1
0
mirror of https://github.com/golang/go synced 2024-11-23 06:50:05 -07:00
Commit Graph

41292 Commits

Author SHA1 Message Date
David Chase
91b55b4fa3 cmd/compile: attempt to preserve statement marks when empty blocks are trimmed.
This was a cause of some statements being lost.

Change-Id: Ia4805c2dafd7a880d485a678a48427de8930d57e
Reviewed-on: https://go-review.googlesource.com/c/go/+/198482
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-04 17:31:51 +00:00
Jordi Martin
3ce29b44bb cmd/go: set expected filename when building a local package with -o is pointing to a folder
In the local package build process, when -o is pointing to an existing folder, the object
the filename is generated from files listed on the command line like when the -o is
not pointing to a folder instead of using the `importPath` that is going to be `command-line-arguments`

Fixes #34535

Change-Id: I09a7609c17a2ccdd83da32f01247c0ef473dea1e
GitHub-Last-Rev: b3224226a3
GitHub-Pull-Request: golang/go#34562
Reviewed-on: https://go-review.googlesource.com/c/go/+/197544
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-04 17:30:40 +00:00
Cuong Manh Le
43a4c61e12 cmd/compile: update comment in order.go to refer new methods/functions
Change-Id: I2d6b73ae7447e4bdeffcdac90f7422a9280666e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/198678
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-10-04 17:26:05 +00:00
David Chase
c8e7c53b40 cmd/compile: preserve statement mark in rematerialized values
Statement markers on rematerializable values were getting lost in
register allocation.  This checks for that case (rematerializable
input and using value share line number, but mark is on the input)
and preserves the mark.

When combined with other CLs in this series, this CL reduces the
"nostmt" count (a line appears in the assembly, but no statement
marker) for cmd/go from 413 to 277.  The rematerialized input is
usually a LEAQ (on AMD64).

The cause is "complicated"; for example, a NilCheck originally has the
statement mark (a good thing, if the NilCheck  remains) but the
NilCheck is removed and the mark floats to a Block end, then to a
SliceMake.  The SliceMake decomposes and goes dead without preserving
its marker (its component values are elided in other rewrites and may
target inputs with different line numbers), but before deadcode
removes it from the graph it moves the mark to an input, which at that
time happens to be a LocalAddr. This eventually transforms to a LEAQ.

Change-Id: Iff91fc2a934357fb59ec46ac87b4a9b1057d9160
Reviewed-on: https://go-review.googlesource.com/c/go/+/198480
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-04 17:09:10 +00:00
David Chase
33ab6ccba0 cmd/compile: don't attach statement marks to OpPhi
OpPhi nodes tend to disappear or get rearranged,
and cause statement marks to vanish.

Change-Id: I2f5a222903b7fcd0d1a72e8f6d7e156036b23f30
Reviewed-on: https://go-review.googlesource.com/c/go/+/198481
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-04 16:54:10 +00:00
Vojtech Bocek
72dc3a0919 crypto/x509: truncate signed hash before DSA signature verification
According to spec, the hash must be truncated, but crypto/dsa
does not do it. We can't fix it in crypto/dsa, because it would break
verification of previously generated signatures.
In crypto/x509 however, go can't generate DSA certs, only verify them,
so the fix here should be safe.

Fixes #22017

Change-Id: Iee7e20a5d76f45da8901a7ca686063639092949f
GitHub-Last-Rev: 8041cde8d2
GitHub-Pull-Request: golang/go#34630
Reviewed-on: https://go-review.googlesource.com/c/go/+/198138
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2019-10-04 16:27:55 +00:00
Bryan C. Mills
6145a80608 cmd/go: remove the -mod flag from 'go get'
'GOFLAGS=-mod=vendor' currently causes 'go get' to always fail unless
the '-mod' flag is explicitly overwritten. Moreover, as of CL 198319
we plan to set -mod=vendor by default if a vendor directory is
present, so all users with vendor directories will be affected — not
just those who set 'GOFLAGS' explicitly.

Similarly, an explicit '-mod=readonly' argument to 'go get' is
currently ignored as a special case, but the fact that it is ignored
(rather than rejected) can be very surprising.

Rather than adding more special cases, we should remove the '-mod'
flag from 'go get' entirely.

Fixes #30345
Fixes #32502
Updates #33848

Change-Id: Iecd3233ca3ef580ca3a66bd5e6ee8d86d4cbd8a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/198438
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-04 15:47:46 +00:00
Alberto Donizetti
c1e46af62f test: add testcase for Issue 34520
CL 188317 introduced a compiler crash during dwarf generation which
was reported as Issue #34520. After CL 188217, the issue appears to be
fixed. Add a testcase to avoid future regressions.

Fixes #34520

Change-Id: I73544a9e9baf8dbfb85c19eb6d202beea05affb6
Reviewed-on: https://go-review.googlesource.com/c/go/+/198546
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2019-10-04 15:04:57 +00:00
Duco van Amstel
8c74bfb491 cmd/go: fix listing of ambiguous paths
Passing ambiguous patterns, ending in `.go`, to `go list` results in them
being interpreted as Go files despite potentially being package references.
This can then result in errors on other package references.

The parsing logic is modified to check for a locally present file
corresponding to any pattern ending in `.go`. If no such file is present
the pattern is considered to be a package reference.

We're also adding a variety of non-regression tests that fail with the
original parsing code but passes after applying the fix.

Fixes #32483
Fixes #34653

Change-Id: I073871da0dfc5641a359643f95ac14608fdca09b
GitHub-Last-Rev: 5abc200103
GitHub-Pull-Request: golang/go#34663
Reviewed-on: https://go-review.googlesource.com/c/go/+/198459
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-04 13:47:53 +00:00
Josh Bleecher Snyder
a7042249ab os/exec: simplify doc wording for cmd.StdoutPipe and cmd.StderrPipe
The existing text was hard to parse.
Shorten the sentences and simplify the text.

Change-Id: Ic16f486925090ea303c04e70969e5a4b27a60896
Reviewed-on: https://go-review.googlesource.com/c/go/+/198758
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-04 00:22:44 +00:00
David Chase
adc4d2cc2d cmd/compile: run deadcode before nilcheck for better statement relocation
Nilcheck would move statements from NilCheck values to others that
turned out were already dead, which leads to lost statements.  Better
to eliminate the dead code first.

One "error" is removed from test/prove.go because the code is
actually dead, and the additional deadcode pass removes it before
prove can run.

Change-Id: If75926ca1acbb59c7ab9c8ef14d60a02a0a94f8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/198479
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-03 21:12:13 +00:00
David Chase
08a87938bb cmd/compile: make nilcheck more careful about statement relocations
The earlier code was picking nodes that were "poor choices" and
thus sometimes losing statements altogether.

Change-Id: Ibe5ed800ffbd3c926c0ab1bc10c77d72d3042e45
Reviewed-on: https://go-review.googlesource.com/c/go/+/198478
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-03 21:10:26 +00:00
David Chase
53bd915109 cmd/compile: classify more nodes as "poor choices" for statements
Aggregate-making nodes that are later decomposed
are poor choices for statements, because the decomposition
phase turns them into multiple sub-values, some of which may be
dead.  Better to look elsewhere for a statement mark.

Change-Id: Ibd9584138ab3d1384548686896a28580a2e43f54
Reviewed-on: https://go-review.googlesource.com/c/go/+/198477
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-03 21:08:27 +00:00
David Chase
6139019efa cmd/compile: pick position of implicit break statements more carefully
The previous version used the position of the switch statement,
which makes for potentially jumpy stepping and introduces a large
number of statements repeating the line (tricky for inserting
breaks).  It also shared a single OBREAK node and this was not
really a syntax "tree".

This improves both the nostmt test (by 6 lines) and
reduces the total badness score from dwarf-goodness (by about 200).

Change-Id: I1f71b231a26f152bdb6ce9bc8f95828bb222f665
Reviewed-on: https://go-review.googlesource.com/c/go/+/188218
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-03 21:07:45 +00:00
David Chase
f7f85bdc2c cmd/compile: refine statement marking in numberlines
1) An empty block is treated as not-a-statement unless its line differs
from at least one of its predecessors (it might make sense to
rearrange branches in predecessors, but that is a different issue).

2) When iterating forward to choose a "good" place for a statement,
actually check that the chosen place is in fact good.

3) Refactor same line and same file into methods on XPos and Pos.

This reduces the failure rate of ssa/stmtlines_test by 7-ish lines.
(And interacts favorably with later debugging CLs.)

Change-Id: Idb7cca7068f6fc9fbfdbe25bc0da15bcfc7b9d4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/188217
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2019-10-03 21:06:11 +00:00
Matthew Dempsky
3ad350820d cmd/compile: change size diagnostic to use benchmark format
Makes it easier to run

    go build -a -gcflags=-d=export std |& grep ^BenchmarkExportSize

and get useful output for feeding into benchstat.

Change-Id: I2b52e8f5ff33b7ccb6c25b18e464513344bd9ad9
Reviewed-on: https://go-review.googlesource.com/c/go/+/198698
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-10-03 20:43:01 +00:00
Meng Zhuo
a1b1ba7daf internal/bytealg: (re)adding mips64x compare implementation
The original CL of mips64x compare function has been reverted due to wrong
implement for little endian.
Original CL: https://go-review.googlesource.com/c/go/+/196837

name                         old time/op    new time/op    delta
BytesCompare/1                 28.9ns ± 4%    22.1ns ± 0%    -23.60%  (p=0.000 n=9+8)
BytesCompare/2                 34.6ns ± 0%    23.1ns ± 0%    -33.25%  (p=0.000 n=8+10)
BytesCompare/4                 54.6ns ± 0%    40.8ns ± 0%    -25.27%  (p=0.000 n=8+8)
BytesCompare/8                 73.9ns ± 0%    49.1ns ± 0%    -33.56%  (p=0.000 n=8+8)
BytesCompare/16                 113ns ± 0%      24ns ± 0%    -79.20%  (p=0.000 n=9+9)
BytesCompare/32                 190ns ± 0%      26ns ± 0%    -86.53%  (p=0.000 n=10+10)
BytesCompare/64                 345ns ± 0%      44ns ± 0%    -87.19%  (p=0.000 n=10+8)
BytesCompare/128                654ns ± 0%      52ns ± 0%    -91.97%  (p=0.000 n=9+8)
BytesCompare/256               1.27µs ± 0%    0.07µs ± 0%    -94.14%  (p=0.001 n=8+9)
BytesCompare/512               2.51µs ± 0%    0.12µs ± 0%    -95.26%  (p=0.000 n=9+10)
BytesCompare/1024              4.99µs ± 0%    0.21µs ± 0%    -95.85%  (p=0.000 n=8+10)
BytesCompare/2048              9.94µs ± 0%    0.38µs ± 0%    -96.14%  (p=0.000 n=8+8)
CompareBytesEqual               105ns ± 0%      64ns ± 0%    -39.43%  (p=0.000 n=10+9)
CompareBytesToNil              34.8ns ± 1%    38.6ns ± 3%    +11.01%  (p=0.000 n=10+10)
CompareBytesEmpty              33.6ns ± 3%    36.6ns ± 0%     +8.77%  (p=0.000 n=10+8)
CompareBytesIdentical          29.7ns ± 0%    40.5ns ± 1%    +36.45%  (p=0.000 n=10+8)
CompareBytesSameLength         69.1ns ± 0%    51.8ns ± 0%    -25.04%  (p=0.000 n=10+9)
CompareBytesDifferentLength    69.8ns ± 0%    52.5ns ± 0%    -24.79%  (p=0.000 n=10+8)
CompareBytesBigUnaligned       5.15ms ± 0%    2.19ms ± 0%    -57.59%  (p=0.000 n=9+9)
CompareBytesBig                5.28ms ± 0%    0.28ms ± 0%    -94.64%  (p=0.000 n=8+8)
CompareBytesBigIdentical       29.7ns ± 0%    36.9ns ± 2%    +24.11%  (p=0.000 n=8+10)

name                         old speed      new speed      delta
CompareBytesBigUnaligned      204MB/s ± 0%   480MB/s ± 0%   +135.77%  (p=0.000 n=9+9)
CompareBytesBig               198MB/s ± 0%  3704MB/s ± 0%  +1765.97%  (p=0.000 n=8+8)
CompareBytesBigIdentical     35.3TB/s ± 0%  28.4TB/s ± 2%    -19.44%  (p=0.000 n=8+10)

Fixes #34549

Change-Id: I2ef29f13cdd4229745ac2d018bb53c76f2ff1209
Reviewed-on: https://go-review.googlesource.com/c/go/+/197557
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-03 20:32:21 +00:00
Meng Zhuo
2bf7a92571 cmd/asm: add VLD[1-4]R vector instructions on arm64
This change adds VLD1R, VLD2R, VLD3R, VLD4R

Change-Id: Ie19e9ae02fdfc94b9344acde8c9938849efb0bf0
Reviewed-on: https://go-review.googlesource.com/c/go/+/181697
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-03 20:31:11 +00:00
Bryan C. Mills
5fe3b49a05 Revert "cmd/compile: walk the progs to generate debug_lines"
This reverts CL 196661.

Reason for revert: broke TestGdb* tests on mips64le, ppc64le, and s390x builders.

Change-Id: I3b5c97c840819a0d407b943f7cf7e2d97f06042d
Reviewed-on: https://go-review.googlesource.com/c/go/+/198697
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-03 18:18:14 +00:00
Matthew Dempsky
c33d45a898 cmd/compile: don't statically copy string-typed variables
During package initialization, the compiler tries to optimize:

    var A = "foo"
    var B = A

into

    var A = "foo"
    var B = "foo"

so that we can statically initialize both A and B and skip emitting
dynamic initialization code to assign "B = A".

However, this isn't safe in the presence of cmd/link's -X flag, which
might overwrite an initialized string-typed variable at link time. In
particular, if cmd/link changes A's static initialization, it won't
know it also needs to change B's static initialization.

To address this, this CL disables this optimization for string-typed
variables.

Fixes #34675.

Change-Id: I1c18f3b855f6d7114aeb39f96aaaf1b452b88236
Reviewed-on: https://go-review.googlesource.com/c/go/+/198657
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-03 18:08:32 +00:00
Jason A. Donenfeld
6b85fa8051 runtime: iterate ms via allm linked list to avoid race
It's pointless to reach all ms via allgs, and doing so introduces a
race, since the m member of a g can change underneath it. Instead
iterate directly through the allm linked list.

Updates: #31528
Updates: #34130

Change-Id: I34b88402b44339b0a5b4cd76eafd0ce6e43e2be1
Reviewed-on: https://go-review.googlesource.com/c/go/+/198417
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-03 15:55:39 +00:00
Jeremy Faller
9e6a84f2b1 cmd/compile: walk the progs to generate debug_lines
Rather than use the pcln tables, walk progs while generating
debug_lines.  This code slightly increases the number of is_stmt toggles
in the debug information due to a previous bug in how the pcline walking
worked. (Previous versions of the line walking code wouldn't return the
old_value, instead returning 0. This behavior might lose is_stmt toggles
in the line table.)

We suspected there would be a speedup with this change, but benchmarking
hasn't shown this to be true (but has been noisy enough to not really
show any large differences either way). These benchmarks are comparing
non-prog walking code with this prog-walking code:

name                      old time/op       new time/op       delta
Template                        321ms ± 4%        316ms ± 3%     ~     (p=0.165 n=10+10)
Unicode                         146ms ± 5%        142ms ± 4%     ~     (p=0.063 n=10+10)
GoTypes                         1.06s ± 2%        1.07s ± 2%     ~     (p=0.280 n=10+10)
Compiler                        4.07s ± 1%        4.06s ± 1%     ~     (p=0.549 n=10+9)
SSA                             12.6s ± 2%        12.7s ± 2%   +1.27%  (p=0.019 n=10+10)
Flate                           201ms ± 7%        202ms ± 4%     ~     (p=0.436 n=10+10)
GoParser                        248ms ± 4%        250ms ± 2%     ~     (p=0.356 n=9+10)
Reflect                         679ms ± 5%        678ms ± 4%     ~     (p=0.971 n=10+10)
Tar                             281ms ± 2%        283ms ± 3%     ~     (p=0.222 n=9+9)
XML                             381ms ± 3%        384ms ± 5%     ~     (p=0.393 n=10+10)
LinkCompiler                    1.08s ± 2%        1.10s ± 2%   +1.89%  (p=0.009 n=10+10)
ExternalLinkCompiler            2.23s ± 4%        2.23s ± 1%     ~     (p=1.000 n=10+8)
LinkWithoutDebugCompiler        654ms ± 4%        673ms ± 4%   +2.94%  (p=0.019 n=10+10)
StdCmd                          13.6s ± 2%        13.9s ± 1%   +2.00%  (p=0.000 n=10+10)

name                      old user-time/op  new user-time/op  delta
Template                        582ms ±11%        575ms ±14%     ~     (p=0.631 n=10+10)
Unicode                         431ms ±24%        390ms ±38%     ~     (p=0.315 n=10+10)
GoTypes                         2.47s ±11%        2.51s ± 4%     ~     (p=0.280 n=10+10)
Compiler                        9.09s ± 3%        9.04s ± 5%     ~     (p=0.684 n=10+10)
SSA                             25.8s ± 4%        26.0s ± 3%     ~     (p=0.529 n=10+10)
Flate                           318ms ±14%        322ms ±13%     ~     (p=0.912 n=10+10)
GoParser                        386ms ± 6%        386ms ± 5%     ~     (p=0.888 n=9+8)
Reflect                         1.42s ±20%        1.32s ±24%     ~     (p=0.393 n=10+10)
Tar                             476ms ±19%        471ms ±25%     ~     (p=1.000 n=10+10)
XML                             681ms ±25%        745ms ±21%     ~     (p=0.143 n=10+10)
LinkCompiler                    1.75s ±13%        1.86s ±12%     ~     (p=0.075 n=10+10)
ExternalLinkCompiler            2.98s ±18%        3.41s ±13%  +14.48%  (p=0.003 n=10+10)
LinkWithoutDebugCompiler        1.05s ±12%        1.08s ±16%     ~     (p=0.739 n=10+10)

name                      old alloc/op      new alloc/op      delta
Template                       36.4MB ± 0%       36.4MB ± 0%   -0.11%  (p=0.000 n=10+10)
Unicode                        28.6MB ± 0%       28.5MB ± 0%   -0.06%  (p=0.029 n=10+10)
GoTypes                         121MB ± 0%        121MB ± 0%   -0.09%  (p=0.000 n=9+9)
Compiler                        548MB ± 0%        547MB ± 0%   -0.10%  (p=0.000 n=10+10)
SSA                            1.87GB ± 0%       1.87GB ± 0%   -0.13%  (p=0.000 n=10+10)
Flate                          23.0MB ± 0%       22.9MB ± 0%   -0.09%  (p=0.000 n=9+10)
GoParser                       27.9MB ± 0%       27.8MB ± 0%   -0.12%  (p=0.000 n=10+10)
Reflect                        77.7MB ± 0%       77.6MB ± 0%   -0.12%  (p=0.000 n=8+10)
Tar                            34.5MB ± 0%       34.5MB ± 0%   -0.07%  (p=0.003 n=10+10)
XML                            44.4MB ± 0%       44.4MB ± 0%   -0.07%  (p=0.000 n=10+10)
LinkCompiler                    236MB ± 0%        240MB ± 0%   +1.72%  (p=0.000 n=10+10)
ExternalLinkCompiler            246MB ± 0%        254MB ± 0%   +3.02%  (p=0.000 n=10+10)
LinkWithoutDebugCompiler        159MB ± 0%        164MB ± 0%   +3.35%  (p=0.000 n=10+10)

name                      old allocs/op     new allocs/op     delta
Template                         372k ± 0%         371k ± 0%   -0.23%  (p=0.000 n=10+10)
Unicode                          340k ± 0%         340k ± 0%   -0.05%  (p=0.000 n=10+10)
GoTypes                         1.33M ± 0%        1.32M ± 0%   -0.20%  (p=0.000 n=9+10)
Compiler                        5.37M ± 0%        5.36M ± 0%   -0.17%  (p=0.000 n=10+10)
SSA                             17.9M ± 0%        17.9M ± 0%   -0.15%  (p=0.000 n=10+10)
Flate                            234k ± 0%         233k ± 0%   -0.24%  (p=0.000 n=9+10)
GoParser                         309k ± 0%         309k ± 0%   -0.21%  (p=0.000 n=10+10)
Reflect                          969k ± 0%         966k ± 0%   -0.30%  (p=0.000 n=9+10)
Tar                              348k ± 0%         347k ± 0%   -0.22%  (p=0.000 n=10+9)
XML                              426k ± 0%         425k ± 0%   -0.15%  (p=0.000 n=9+10)
LinkCompiler                     638k ± 0%         637k ± 0%   -0.07%  (p=0.000 n=10+10)
ExternalLinkCompiler            1.69M ± 0%        1.69M ± 0%   -0.05%  (p=0.000 n=10+10)
LinkWithoutDebugCompiler         222k ± 0%         221k ± 0%   -0.03%  (p=0.007 n=10+9)

name                      old object-bytes  new object-bytes  delta
Template                        559kB ± 0%        560kB ± 0%   +0.23%  (p=0.000 n=10+10)
Unicode                         216kB ± 0%        216kB ± 0%   +0.01%  (p=0.000 n=10+10)
GoTypes                        2.03MB ± 0%       2.04MB ± 0%   +0.31%  (p=0.000 n=10+10)
Compiler                       8.07MB ± 0%       8.10MB ± 0%   +0.35%  (p=0.000 n=10+10)
SSA                            27.1MB ± 0%       27.3MB ± 0%   +0.72%  (p=0.000 n=10+10)
Flate                           343kB ± 0%        344kB ± 0%   +0.22%  (p=0.000 n=10+10)
GoParser                        441kB ± 0%        442kB ± 0%   +0.34%  (p=0.000 n=10+10)
Reflect                        1.36MB ± 0%       1.36MB ± 0%   +0.23%  (p=0.000 n=10+10)
Tar                             487kB ± 0%        488kB ± 0%   +0.21%  (p=0.000 n=10+10)
XML                             632kB ± 0%        634kB ± 0%   +0.35%  (p=0.000 n=10+10)

name                      old export-bytes  new export-bytes  delta
Template                       18.5kB ± 0%       18.5kB ± 0%     ~     (all equal)
Unicode                        7.92kB ± 0%       7.92kB ± 0%     ~     (all equal)
GoTypes                        35.0kB ± 0%       35.0kB ± 0%     ~     (all equal)
Compiler                        109kB ± 0%        109kB ± 0%   +0.00%  (p=0.000 n=10+10)
SSA                             137kB ± 0%        137kB ± 0%   +0.00%  (p=0.000 n=10+10)
Flate                          4.89kB ± 0%       4.89kB ± 0%     ~     (all equal)
GoParser                       8.49kB ± 0%       8.49kB ± 0%     ~     (all equal)
Reflect                        11.4kB ± 0%       11.4kB ± 0%     ~     (all equal)
Tar                            10.5kB ± 0%       10.5kB ± 0%     ~     (all equal)
XML                            16.7kB ± 0%       16.7kB ± 0%     ~     (all equal)

name                      old text-bytes    new text-bytes    delta
HelloSize                       760kB ± 0%        760kB ± 0%     ~     (all equal)
CmdGoSize                      10.8MB ± 0%       10.8MB ± 0%     ~     (all equal)

name                      old data-bytes    new data-bytes    delta
HelloSize                      10.7kB ± 0%       10.7kB ± 0%     ~     (all equal)
CmdGoSize                       312kB ± 0%        312kB ± 0%     ~     (all equal)

name                      old bss-bytes     new bss-bytes     delta
HelloSize                       122kB ± 0%        122kB ± 0%     ~     (all equal)
CmdGoSize                       146kB ± 0%        146kB ± 0%     ~     (all equal)

name                      old exe-bytes     new exe-bytes     delta
HelloSize                      1.13MB ± 0%       1.13MB ± 0%     ~     (all equal)
CmdGoSize                      15.0MB ± 0%       15.1MB ± 0%   +0.22%  (p=0.000 n=10+10)

Change-Id: If6e0982cd1398062a88e6c0c7513e141f9503531
Reviewed-on: https://go-review.googlesource.com/c/go/+/196661
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2019-10-03 14:09:40 +00:00
Tobias Klauser
64785bf96c cmd/go/internal/modfetch: update TestCodeRepo for gopkg.in/yaml.v2 again
Update the expected data to fix the longtest builder.

Updates #28856

Change-Id: I7fb6ee72e8469d974561b4b4057f40142f5b3654
Reviewed-on: https://go-review.googlesource.com/c/go/+/198557
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-10-03 12:52:41 +00:00
Utkarsh Dixit
3d437ac6bc C: update email address for utkarsh-extc
Change-Id: If657dab2df19d3b0c2ff9869a64e3a97446646ac
GitHub-Last-Rev: b921b01cf4
GitHub-Pull-Request: golang/go#34637
Reviewed-on: https://go-review.googlesource.com/c/go/+/198041
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-10-03 12:39:06 +00:00
Robert Griesemer
27fc32ff01 cmd/compile: better error message for language version errors
Fixes #33753.
Updates #31747.

Change-Id: Icc42b23405ead4f7f17b0ffa3611405454b6b271
Reviewed-on: https://go-review.googlesource.com/c/go/+/198491
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-03 04:48:44 +00:00
Matthew Dempsky
64e598f783 runtime: use efaceOf where applicable
Prepared with gofmt -r.

Change-Id: Ifea325c209d800b5692d318955930b10debb548b
Reviewed-on: https://go-review.googlesource.com/c/go/+/198494
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-03 02:09:41 +00:00
Ariel Mashraki
debbb1e78d text/template/parse: speed up nodes printing
This CL is a follow up for 198080.
Added a private writeTo method to the Node interface,
in order to use the same builder for printing all nodes
in the tree. Benchmark output against master:

benchmark                     old ns/op     new ns/op     delta
BenchmarkParseLarge-8         24594994      25292054      +2.83%
BenchmarkVariableString-8     117           118           +0.85%
BenchmarkListString-8         10475         3353          -67.99%

benchmark                     old allocs     new allocs     delta
BenchmarkVariableString-8     3              3              +0.00%
BenchmarkListString-8         149            31             -79.19%

benchmark                     old bytes     new bytes     delta
BenchmarkVariableString-8     72            72            +0.00%
BenchmarkListString-8         5698          1608          -71.78%

Change-Id: I2b1cf07cda65c1b80083fb99671289423700feba
Reviewed-on: https://go-review.googlesource.com/c/go/+/198278
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-03 00:16:28 +00:00
Michael Hendricks
f0e940ebc9 net: avoid an infinite loop in LookupAddr
If a request for a PTR record returned a response with a non-PTR
answer, goLookupPTR would loop forever.  Skipping non-PTR answers
guarantees progress through the DNS response.

Fixes #34660

Change-Id: I56f9d21e5342d07e7d843d253267e93a29707904
Reviewed-on: https://go-review.googlesource.com/c/go/+/198460
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-02 20:54:54 +00:00
Egon Elbre
e85ffec784 cmd/cgo: optimize cgoCheckPointer call
Currently cgoCheckPointer is only used with one optional argument.
Using a slice for the optional arguments is quite expensive, hence
replace it with a single interface{}. This results in ~30% improvement.

When checking struct fields, they quite often end up being without
pointers. Check this before calling cgoCheckPointer, which results in
additional ~20% improvement.

Inline some p == nil checks from cgoIsGoPointer which gives
additional ~15% improvement.

All of this translates to:

name                             old time/op  new time/op  delta
CgoCall/add-int-32               46.9ns ± 1%  46.6ns ± 1%   -0.75%  (p=0.000 n=18+20)
CgoCall/one-pointer-32            143ns ± 1%    87ns ± 1%  -38.96%  (p=0.000 n=20+20)
CgoCall/eight-pointers-32         767ns ± 0%   327ns ± 1%  -57.30%  (p=0.000 n=18+16)
CgoCall/eight-pointers-nil-32     110ns ± 1%    89ns ± 2%  -19.10%  (p=0.000 n=19+19)
CgoCall/eight-pointers-array-32  5.09µs ± 1%  3.56µs ± 2%  -30.09%  (p=0.000 n=19+19)
CgoCall/eight-pointers-slice-32  3.92µs ± 0%  2.57µs ± 2%  -34.48%  (p=0.000 n=20+20)

Change-Id: I2aa9f5ae8962a9a41a7fb1db0c300893109d0d75
Reviewed-on: https://go-review.googlesource.com/c/go/+/198081
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-02 20:51:29 +00:00
W. Trevor King
30d7b64008 crypto/x509: add Detail to Expired errors
Because errors like:

    certificate has expired or is not yet valid

make it difficult to distinguish between "certificate has expired" and
"my local clock is skewed".  Including our idea of the local time
makes it easier to identify the clock-skew case, and including the
violated certificate constraint saves folks the trouble of looking it
up in the target certificate.

Change-Id: I52e0e71705ee36f6afde1bb5a47b9b42ed5ead5b
GitHub-Last-Rev: db2ca4029c
GitHub-Pull-Request: golang/go#34646
Reviewed-on: https://go-review.googlesource.com/c/go/+/198046
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-02 19:23:07 +00:00
Dan Scales
0000f0be0a cmd/compile: add an explicit test for compile of arch.ZeroRange
Add a test that causes generation of arch.ZeroRange calls of various sizes 8-136
bytes in the compiler. This is to test that ZeroRanges of various sizes actually
compile on different architectures, but is not testing runtime correctness (which
is hard to do).

Updates #34604

Change-Id: I4131eb86669bdfe8d4e36f4ae5c2a7b069abd6c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/198045
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-02 17:24:11 +00:00
Brad Fitzpatrick
0ba0ea172d net/http: document that Request.Host includes HTTP/2 :authority
Fixes #34640

Change-Id: I4a6c9414fe369cd5e9915472331c4bd8a21d8b0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/198457
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2019-10-02 16:47:29 +00:00
Ruixin(Peter) Bao
ac2ceba01a cmd/compile/internal/gc: intrinsify mulWW on s390x
SSA rule have already been added previously to intrisinfy Mul/Mul64 on s390x. In this CL,
we want to let mulWW use that SSA rule as well. Also removed an extra line for formatting.

Benchmarks:
QuoRem-18                            3.59µs ±15%    2.94µs ± 3%  -18.06%  (p=0.000 n=8+8)
ModSqrt225_Tonelli-18                 806µs ± 0%     800µs ± 0%   -0.85%  (p=0.000 n=7+8)
ModSqrt225_3Mod4-18                   245µs ± 1%     243µs ± 0%   -0.81%  (p=0.001 n=8+8)
ModSqrt231_Tonelli-18                 837µs ± 0%     834µs ± 1%   -0.36%  (p=0.028 n=8+8)
ModSqrt231_5Mod8-18                   282µs ± 0%     280µs ± 0%   -0.76%  (p=0.000 n=8+8)
Sqrt-18                              45.8µs ± 2%    38.6µs ± 0%  -15.63%  (p=0.000 n=8+8)
IntSqr/1-18                          19.1ns ± 0%    13.1ns ± 0%  -31.41%  (p=0.000 n=8+8)
IntSqr/2-18                          48.3ns ± 2%    48.2ns ± 0%     ~     (p=0.094 n=8+8)
IntSqr/3-18                          70.5ns ± 1%    70.7ns ± 0%     ~     (p=0.428 n=8+8)
IntSqr/5-18                           119ns ± 1%     118ns ± 0%   -1.02%  (p=0.000 n=7+8)
IntSqr/8-18                           215ns ± 1%     215ns ± 0%     ~     (p=0.320 n=8+7)
IntSqr/10-18                          302ns ± 1%     301ns ± 0%     ~     (p=0.148 n=8+7)
IntSqr/20-18                          952ns ± 1%     807ns ± 0%  -15.28%  (p=0.000 n=8+8)
IntSqr/30-18                         1.74µs ± 0%    1.53µs ± 0%  -11.93%  (p=0.000 n=8+8)
IntSqr/50-18                         3.91µs ± 0%    3.57µs ± 0%   -8.64%  (p=0.000 n=7+8)
IntSqr/80-18                         8.66µs ± 1%    8.11µs ± 0%   -6.39%  (p=0.000 n=8+8)
IntSqr/100-18                        12.8µs ± 0%    12.2µs ± 0%   -5.19%  (p=0.000 n=8+8)
IntSqr/200-18                        46.0µs ± 0%    44.5µs ± 0%   -3.06%  (p=0.000 n=8+8)
IntSqr/300-18                        81.4µs ± 0%    78.4µs ± 0%   -3.71%  (p=0.000 n=7+8)
IntSqr/500-18                         212µs ± 1%     206µs ± 0%   -2.66%  (p=0.000 n=8+8)
IntSqr/800-18                         419µs ± 1%     406µs ± 0%   -3.07%  (p=0.000 n=8+8)
IntSqr/1000-18                        635µs ± 0%     621µs ± 0%   -2.13%  (p=0.000 n=8+8)

Change-Id: Ib097857186932b902601ab087cbeff3fc9555c3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/197639
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-02 11:08:43 +00:00
Michael Munday
9c2e7e8bed cmd/compile: allow multiple SSA block control values
Control values are used to choose which successor of a block is
jumped to. Typically a control value takes the form of a 'flags'
value that represents the result of a comparison. Some
architectures however use a variable in a register as a control
value.

Up until now we have managed with a single control value per block.
However some architectures (e.g. s390x and riscv64) have combined
compare-and-branch instructions that take two variables in registers
as parameters. To generate these instructions we need to support 2
control values per block.

This CL allows up to 2 control values to be used in a block in
order to support the addition of compare-and-branch instructions.
I have implemented s390x compare-and-branch instructions in a
different CL.

Passes toolstash-check -all.

Results of compilebench:

name                      old time/op       new time/op       delta
Template                        208ms ± 1%        209ms ± 1%    ~     (p=0.289 n=20+20)
Unicode                        83.7ms ± 1%       83.3ms ± 3%  -0.49%  (p=0.017 n=18+18)
GoTypes                         748ms ± 1%        748ms ± 0%    ~     (p=0.460 n=20+18)
Compiler                        3.47s ± 1%        3.48s ± 1%    ~     (p=0.070 n=19+18)
SSA                             11.5s ± 1%        11.7s ± 1%  +1.64%  (p=0.000 n=19+18)
Flate                           130ms ± 1%        130ms ± 1%    ~     (p=0.588 n=19+20)
GoParser                        160ms ± 1%        161ms ± 1%    ~     (p=0.211 n=20+20)
Reflect                         465ms ± 1%        467ms ± 1%  +0.42%  (p=0.007 n=20+20)
Tar                             184ms ± 1%        185ms ± 2%    ~     (p=0.087 n=18+20)
XML                             253ms ± 1%        253ms ± 1%    ~     (p=0.377 n=20+18)
LinkCompiler                    769ms ± 2%        774ms ± 2%    ~     (p=0.070 n=19+19)
ExternalLinkCompiler            3.59s ±11%        3.68s ± 6%    ~     (p=0.072 n=20+20)
LinkWithoutDebugCompiler        446ms ± 5%        454ms ± 3%  +1.79%  (p=0.002 n=19+20)
StdCmd                          26.0s ± 2%        26.0s ± 2%    ~     (p=0.799 n=20+20)

name                      old user-time/op  new user-time/op  delta
Template                        238ms ± 5%        240ms ± 5%    ~     (p=0.142 n=20+20)
Unicode                         105ms ±11%        106ms ±10%    ~     (p=0.512 n=20+20)
GoTypes                         876ms ± 2%        873ms ± 4%    ~     (p=0.647 n=20+19)
Compiler                        4.17s ± 2%        4.19s ± 1%    ~     (p=0.093 n=20+18)
SSA                             13.9s ± 1%        14.1s ± 1%  +1.45%  (p=0.000 n=18+18)
Flate                           145ms ±13%        146ms ± 5%    ~     (p=0.851 n=20+18)
GoParser                        185ms ± 5%        188ms ± 7%    ~     (p=0.174 n=20+20)
Reflect                         534ms ± 3%        538ms ± 2%    ~     (p=0.105 n=20+18)
Tar                             215ms ± 4%        211ms ± 9%    ~     (p=0.079 n=19+20)
XML                             295ms ± 6%        295ms ± 5%    ~     (p=0.968 n=20+20)
LinkCompiler                    832ms ± 4%        837ms ± 7%    ~     (p=0.707 n=17+20)
ExternalLinkCompiler            1.58s ± 8%        1.60s ± 4%    ~     (p=0.296 n=20+19)
LinkWithoutDebugCompiler        478ms ±12%        489ms ±10%    ~     (p=0.429 n=20+20)

name                      old object-bytes  new object-bytes  delta
Template                        559kB ± 0%        559kB ± 0%    ~     (all equal)
Unicode                         216kB ± 0%        216kB ± 0%    ~     (all equal)
GoTypes                        2.03MB ± 0%       2.03MB ± 0%    ~     (all equal)
Compiler                       8.07MB ± 0%       8.07MB ± 0%  -0.06%  (p=0.000 n=20+20)
SSA                            27.1MB ± 0%       27.3MB ± 0%  +0.89%  (p=0.000 n=20+20)
Flate                           343kB ± 0%        343kB ± 0%    ~     (all equal)
GoParser                        441kB ± 0%        441kB ± 0%    ~     (all equal)
Reflect                        1.36MB ± 0%       1.36MB ± 0%    ~     (all equal)
Tar                             487kB ± 0%        487kB ± 0%    ~     (all equal)
XML                             632kB ± 0%        632kB ± 0%    ~     (all equal)

name                      old export-bytes  new export-bytes  delta
Template                       18.5kB ± 0%       18.5kB ± 0%    ~     (all equal)
Unicode                        7.92kB ± 0%       7.92kB ± 0%    ~     (all equal)
GoTypes                        35.0kB ± 0%       35.0kB ± 0%    ~     (all equal)
Compiler                        109kB ± 0%        110kB ± 0%  +0.72%  (p=0.000 n=20+20)
SSA                             137kB ± 0%        138kB ± 0%  +0.58%  (p=0.000 n=20+20)
Flate                          4.89kB ± 0%       4.89kB ± 0%    ~     (all equal)
GoParser                       8.49kB ± 0%       8.49kB ± 0%    ~     (all equal)
Reflect                        11.4kB ± 0%       11.4kB ± 0%    ~     (all equal)
Tar                            10.5kB ± 0%       10.5kB ± 0%    ~     (all equal)
XML                            16.7kB ± 0%       16.7kB ± 0%    ~     (all equal)

name                      old text-bytes    new text-bytes    delta
HelloSize                       761kB ± 0%        761kB ± 0%    ~     (all equal)
CmdGoSize                      10.8MB ± 0%       10.8MB ± 0%    ~     (all equal)

name                      old data-bytes    new data-bytes    delta
HelloSize                      10.7kB ± 0%       10.7kB ± 0%    ~     (all equal)
CmdGoSize                       312kB ± 0%        312kB ± 0%    ~     (all equal)

name                      old bss-bytes     new bss-bytes     delta
HelloSize                       122kB ± 0%        122kB ± 0%    ~     (all equal)
CmdGoSize                       146kB ± 0%        146kB ± 0%    ~     (all equal)

name                      old exe-bytes     new exe-bytes     delta
HelloSize                      1.13MB ± 0%       1.13MB ± 0%    ~     (all equal)
CmdGoSize                      15.1MB ± 0%       15.1MB ± 0%    ~     (all equal)

Change-Id: I3cc2f9829a109543d9a68be4a21775d2d3e9801f
Reviewed-on: https://go-review.googlesource.com/c/go/+/196557
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-02 09:56:36 +00:00
Jason A. Donenfeld
274f4cef93 cmd/link: implement Msync for Windows using FlushViewOfFile
CL 196846 implemented memory mapped output files but forgot to provide
an implementation for Msync. This rectifies that with a simple call to
FlushViewOfFile.

Change-Id: I5aebef9baf3a2a6ad54ceda096952a5d7d660bfe
Reviewed-on: https://go-review.googlesource.com/c/go/+/198418
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-02 09:45:12 +00:00
Kyohei Kadota
148ec3e3bc net/http/cgi: skip tests if not functional perl
TestEnvOverride sets PATH to /wibble before executing a CGI.
So customized Perl that is starting with '#!/usr/bin/env bash' will fail
because /usr/bin/env can't lookup bash.

Fixes #27790

Change-Id: I25e433061a7ff9da8c86429e934418fc15f12f90
Reviewed-on: https://go-review.googlesource.com/c/go/+/196845
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-02 05:52:16 +00:00
Emmanuel T Odeke
e79b57d6c4 os/signal: lazily start signal watch loop only on Notify
By lazily starting the signal watch loop only on Notify,
we are able to have deadlock detection even when
"os/signal" is imported.

Thanks to Ian Lance Taylor for the solution and discussion.

With this change in, fix a runtime gorountine count test that
assumed that os/signal.init would unconditionally start the
signal watching goroutine, but alas no more.

Fixes #21576.

Change-Id: I6eecf82a887f59f2ec8897f1bcd67ca311ca42ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/101036
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-02 03:52:59 +00:00
Bryan C. Mills
a1b0af9904 internal/goversion: update to 1.14
In #33848, we propose to use 'go 1.14' in the go.mod file to enable
new default behavior. That means that 'go mod init' needs to start
generating that directive by default, which requires the presence of
the updated version tag in the build environment.

Updates #33848

Change-Id: I9f3b8845fdfd843fd76de32f4b55d8f765d691de
Reviewed-on: https://go-review.googlesource.com/c/go/+/198318
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-01 22:07:45 +00:00
Ariel Mashraki
93a79bbcc0 text/template/parse: remove duplication in peekNonSpace
nextNonSpace has an identical code except the call to
backup at the end.

Change-Id: Iefa5b13950007da38323a800fb6b0ce3d436254b
Reviewed-on: https://go-review.googlesource.com/c/go/+/198277
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2019-10-01 20:30:37 +00:00
Ariel Mashraki
86cd6c2ee5 text/template/parse: use strings.Builder in Chain and List nodes
This CL is a continuation of 198078. Benchmark output:

benchmark                     old ns/op     new ns/op     delta
BenchmarkParseLarge-8         24759165      24516563      -0.98%
BenchmarkVariableString-8     115           115           +0.00%
BenchmarkListString-8         924           680           -26.41%

benchmark                     old allocs     new allocs     delta
BenchmarkVariableString-8     3              3              +0.00%
BenchmarkListString-8         14             13             -7.14%

benchmark                     old bytes     new bytes     delta
BenchmarkVariableString-8     72            72            +0.00%
BenchmarkListString-8         512           424           -17.19%

Change-Id: I9ec48fe4832437c556a5fa94d4cbf6e29e28d944
Reviewed-on: https://go-review.googlesource.com/c/go/+/198080
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-01 19:03:51 +00:00
Clément Chigot
09c9bced82 cmd/internal/obj/ppc64: Fix ADUFFxxxx generation on aix/ppc64
ADUFFCOPY and ADUFFZERO instructions weren't handled by rewriteToUseTOC.
These instructions are considered as a simple branch except with -dynlink
where they become an indirect call.

Fixes #34604

Change-Id: I16ca6a152164966fb9cbf792219a8a39aad2b53b
Reviewed-on: https://go-review.googlesource.com/c/go/+/197842
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-01 18:30:25 +00:00
Nuno Cruces
a49067aab6 net/http: avoid sending unspecified time for directories
Change applies to sendFile.
This is already done for sendContent.

Change-Id: If43d9ab99e6e66a1363b08e0bdcceb57df1f855c
GitHub-Last-Rev: 1c47620a09
GitHub-Pull-Request: golang/go#34631
Reviewed-on: https://go-review.googlesource.com/c/go/+/198139
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-01 15:27:28 +00:00
Andrew Bonventre
1820cca7d7 Revert "cmd/link: load symbols from .syso in external link mode"
This reverts CL 186417.

Reason for revert: Broke darwin (10_14), linux (ppc), aix (ppc)

Updates #33139

Change-Id: I8bf3c817a96a0e57e45754a097cea7062b2fcdfd
Reviewed-on: https://go-review.googlesource.com/c/go/+/198177
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-01 13:20:16 +00:00
Alex Brainman
af880809d8 cmd/link: MapViewOfFile output file
CL 170738 used mmap for writing most of the output file content.

This change implements similar functionality for Windows.

The output of

compilebench -count=5

command before and after this change

name                      old time/op       new time/op       delta
Template                        254ms ±14%        239ms ±10%    ~     (p=0.222 n=5+5)
Unicode                         119ms ±14%        113ms ±12%    ~     (p=0.421 n=5+5)
GoTypes                         892ms ±23%        850ms ± 1%    ~     (p=0.841 n=5+5)
Compiler                        3.86s ± 2%        3.82s ± 1%    ~     (p=0.222 n=5+5)
SSA                             12.6s ± 1%        12.6s ± 1%    ~     (p=0.095 n=5+5)
Flate                           162ms ±18%        149ms ± 1%  -7.91%  (p=0.016 n=5+5)
GoParser                        199ms ±12%        184ms ± 1%    ~     (p=0.056 n=5+5)
Reflect                         524ms ±13%        507ms ± 3%    ~     (p=0.421 n=5+5)
Tar                             207ms ± 7%        198ms ± 0%  -4.58%  (p=0.016 n=5+4)
XML                             305ms ± 6%        299ms ± 5%    ~     (p=0.690 n=5+5)
LinkCompiler                    1.14s ±11%        1.14s ± 3%    ~     (p=0.222 n=5+5)
ExternalLinkCompiler            2.80s ± 5%        2.92s ±13%    ~     (p=0.222 n=5+5)
LinkWithoutDebugCompiler        727ms ± 2%        750ms ± 7%    ~     (p=0.151 n=5+5)
StdCmd                          44.0s ± 8%        43.3s ± 2%    ~     (p=1.000 n=5+5)

name                      old user-time/op  new user-time/op  delta
Template                        300ms ±27%        259ms ±34%    ~     (p=0.341 n=5+5)
Unicode                         134ms ±51%        144ms ±67%    ~     (p=0.548 n=5+5)
GoTypes                         1.05s ±10%        1.03s ± 6%    ~     (p=0.968 n=5+5)
Compiler                        5.01s ± 3%        4.88s ± 3%    ~     (p=0.286 n=5+5)
SSA                             16.8s ± 1%        16.7s ± 1%  -0.95%  (p=0.008 n=5+5)
Flate                           178ms ±67%        181ms ±38%    ~     (p=0.849 n=5+5)
GoParser                        231ms ±32%        219ms ±21%    ~     (p=0.810 n=5+5)
Reflect                         634ms ±33%        650ms ± 6%    ~     (p=0.135 n=5+5)
Tar                             219ms ±36%        231ms ±19%    ~     (p=0.905 n=5+5)
XML                             378ms ±20%        366ms ±23%    ~     (p=0.913 n=5+5)
LinkCompiler                    1.34s ±15%        1.32s ±10%    ~     (p=0.730 n=5+5)
ExternalLinkCompiler            1.22s ±13%        1.18s ±15%    ~     (p=0.873 n=5+5)
LinkWithoutDebugCompiler        847ms ±13%        841ms ±21%    ~     (p=0.667 n=5+5)

name                      old text-bytes    new text-bytes    delta
HelloSize                       767kB ± 0%        767kB ± 0%    ~     (all equal)
CmdGoSize                      10.6MB ± 0%       10.6MB ± 0%    ~     (all equal)

name                      old data-bytes    new data-bytes    delta
HelloSize                      10.1kB ± 0%       10.1kB ± 0%    ~     (all equal)
CmdGoSize                       310kB ± 0%        310kB ± 0%    ~     (all equal)

name                      old bss-bytes     new bss-bytes     delta
HelloSize                       0.00B             0.00B         ~     (all equal)
CmdGoSize                       0.00B             0.00B         ~     (all equal)

name                      old exe-bytes     new exe-bytes     delta
HelloSize                      1.10MB ± 0%       1.10MB ± 0%    ~     (all equal)
CmdGoSize                      14.7MB ± 0%       14.7MB ± 0%    ~     (all equal)

Change-Id: I653f63213b9cc8a4b05f71938e34b5d53b05e3f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/196846
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2019-10-01 08:19:15 +00:00
Ariel Mashraki
4f13a9c5b1 text/template/parse: use strings.Builder in String methods
As mentioned in godoc, strings.Builder is more efficient for
concatenating and building strings.
Running a simple bench test on VariableNode.String() gives:

benchmark                     old ns/op     new ns/op     delta
BenchmarkParseLarge-8         25676831      24453285      -4.77%
BenchmarkVariableString-8     296           115           -61.15%

benchmark                     old allocs     new allocs     delta
BenchmarkVariableString-8     8              3              -62.50%

benchmark                     old bytes     new bytes     delta
BenchmarkVariableString-8     112           72            -35.71%

Change-Id: I13c9340080738fcad1edeed859d33ba608e4b05a
Reviewed-on: https://go-review.googlesource.com/c/go/+/198078
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-01 07:16:47 +00:00
Shenghou Ma
c1635ad8f0 runtime: fix darwin syscall performance regression
While understanding why syscall.Read is 2x slower on darwin/amd64, I found
out that, contrary to popular belief, the slowdown is not due to the migration
to use libSystem.dylib instead of direct SYSCALLs, i.e., CL 141639 (and #17490),
but due to a subtle change introduced in CL 141639.

Previously, syscall.Read used syscall.Syscall(SYS_READ), whose preamble called
runtime.entersyscall, but after CL 141639, syscall.Read changes to call
runtime.syscall_syscall instead, which in turn calls runtime.entersyscallblock
instead of runtime.entersyscall. And the entire 2x slow down can be attributed
to this change.

I think this is unnecessary as even though syscalls like Read might block, it
does not always block, so there is no need to handoff P proactively for each
Read. Additionally, we have been fine with not handing off P for each Read
prior to Go 1.12, so we probably don't need to change it. This changes restores
the pre-Go 1.12 behavior, where syscall preamble uses runtime.entersyscall,
and we rely on sysmon to take P back from g blocked in syscalls.

Change-Id: If76e97b5a7040cf1c10380a567c4f5baec3121ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/197938
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-01 04:04:40 +00:00
Andrew Bonventre
e617141b0b cmd/go/internal/modfetch: update TestCodeRepo for gopkg.in/yaml.v2
The new yaml.v2 release broke the longtest builder. Update the expected
data.

Updates #28856

Change-Id: I98ec9e32e55bdb6b26b67e46dc16f34f77c2d40f
Reviewed-on: https://go-review.googlesource.com/c/go/+/198117
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-10-01 02:07:28 +00:00
John Papandriopoulos
5e514b76e2 cmd/link: load symbols from .syso in external link mode
Fix linking with a package having a .syso file in external link mode,
that would otherwise cause an error before executing the external
linker because it can't find symbols that are exported in the said
.syso file.

Fixes #33139

Change-Id: Id3ee737fba1c6f1e37910593dfedf9c84486d398
Reviewed-on: https://go-review.googlesource.com/c/go/+/186417
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-01 00:02:11 +00:00
Rob Pike
27cf81e1b4 text/template: further simplify building the vars list
Followup to https://golang.org/cl/197997

If you know the number of elements, you don't need append at all.
Either use append to grow, or allocate and index. Here we choose
number 2.

Change-Id: Ic58637231789640ff7b293ece04a95a8de7ccf8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/198097
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-01 00:00:02 +00:00
Matthew Dempsky
e76b9e8908 cmd/compile: remove pointer temporaries in walkcompare
When comparing two T-typed values t1 and t2 using the T_eq function,
we used to generate:

    pl := &t1
    pr := &t2
    return T_eq(pl, pr, unsafe.Sizeof(T{}))

This CL changes it to simply generate:

    return T_eq(&t1, &t2, unsafe.Sizeof(T{}))

Surprisingly, this does not pass toolstash. For some reason, it seems
like SSA wasn't able to SSA-ify the pl and pr variables in all cases.

Change-Id: I111fbb068a1741fa169c9922cb8cdb6e21579aa4
Reviewed-on: https://go-review.googlesource.com/c/go/+/197601
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-09-30 23:44:36 +00:00