]> Cypherpunks repositories - gostls13.git/log
gostls13.git
4 years agocmd/go: test that 'go mod tidy' retains upgraded indirect dependencies
Bryan C. Mills [Fri, 5 Mar 2021 16:30:23 +0000 (11:30 -0500)]
cmd/go: test that 'go mod tidy' retains upgraded indirect dependencies

For #36460

Change-Id: I63596e1c95d0c702073cdb016579598d79cc95ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/300158
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
4 years agocmd/go/internal/modload: in readonly mode, do not read go.mod files missing checksums
Bryan C. Mills [Fri, 12 Mar 2021 16:28:05 +0000 (11:28 -0500)]
cmd/go/internal/modload: in readonly mode, do not read go.mod files missing checksums

This was causing test failures while revising CL 293689: splitting the
roots out from the rest of the module graph may allow 'go list -e' to
proceed even when the rest of the module graph can't be loaded (e.g.
due to missing go.mod checksums). If that occurs, it becomes more
important that the moduleInfo helper function itself avoid fetching
unchecked files.

For #36460

Change-Id: I088509eeb3008cc6e8bfe85a00ec2bf500bf9423
Reviewed-on: https://go-review.googlesource.com/c/go/+/301371
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
4 years agocmd/go/internal/modcmd: in 'go mod tidy', suspend go.mod writes until tidy
Bryan C. Mills [Fri, 12 Mar 2021 16:26:51 +0000 (11:26 -0500)]
cmd/go/internal/modcmd: in 'go mod tidy', suspend go.mod writes until tidy

For #36460

Change-Id: Ia8633f37aec8c7ed532bf7278867251e5e2a4285
Reviewed-on: https://go-review.googlesource.com/c/go/+/301370
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
4 years agocmd/compile: loads from readonly globals into const for mips64x
Meng Zhuo [Tue, 16 Mar 2021 09:04:31 +0000 (17:04 +0800)]
cmd/compile: loads from readonly globals into const for mips64x

Ref: CL 141118
Update #26498

Change-Id: If4ea55c080b9aa10183eefe81fefbd4072deaf3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/280646
Trust: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agocmd/compile: use depth first topological sort algorithm for layout
erifan01 [Thu, 23 Jul 2020 02:24:56 +0000 (10:24 +0800)]
cmd/compile: use depth first topological sort algorithm for layout

The current layout algorithm tries to put consecutive blocks together,
so the priority of the successor block is higher than the priority of
the zero indegree block. This algorithm is beneficial for subsequent
register allocation, but will result in more branch instructions.
The depth-first topological sorting algorithm is a well-known layout
algorithm, which has applications in many languages, and it helps to
reduce branch instructions. This CL applies it to the layout pass.
The test results show that it helps to reduce the code size.

This CL also includes the following changes:
1, Removed the primary predecessor mechanism. The new layout algorithm is
  not very friendly to register allocator in some cases, in order to adapt
  to the new layout algorithm, a new primary predecessor selection strategy
  is introduced.
2, Since the new layout implementation may place non-loop blocks between
  loop blocks, some adaptive modifications have also been made to looprotate
  pass.
3, The layout also affects the results of codegen, so this CL also adjusted
  several codegen tests accordingly.

It is inevitable that this CL will cause the code size or performance of a
few functions to decrease, but the number of cases it improves is much larger
than the number of cases it drops.

Statistical data from compilecmp on linux/amd64 is as follow:
name                      old time/op       new time/op       delta
Template                        382ms ± 4%        382ms ± 4%    ~     (p=0.497 n=49+50)
Unicode                         170ms ± 9%        169ms ± 8%    ~     (p=0.344 n=48+50)
GoTypes                         2.01s ± 4%        2.01s ± 4%    ~     (p=0.628 n=50+48)
Compiler                        190ms ±10%        189ms ± 9%    ~     (p=0.734 n=50+50)
SSA                             11.8s ± 2%        11.8s ± 3%    ~     (p=0.877 n=50+50)
Flate                           241ms ± 9%        241ms ± 8%    ~     (p=0.897 n=50+49)
GoParser                        366ms ± 3%        361ms ± 4%  -1.21%  (p=0.004 n=47+50)
Reflect                         835ms ± 3%        838ms ± 3%    ~     (p=0.275 n=50+49)
Tar                             336ms ± 4%        335ms ± 3%    ~     (p=0.454 n=48+48)
XML                             433ms ± 4%        431ms ± 3%    ~     (p=0.071 n=49+48)
LinkCompiler                    706ms ± 4%        705ms ± 4%    ~     (p=0.608 n=50+49)
ExternalLinkCompiler            1.85s ± 3%        1.83s ± 2%  -1.47%  (p=0.000 n=49+48)
LinkWithoutDebugCompiler        437ms ± 5%        437ms ± 6%    ~     (p=0.953 n=49+50)
[Geo mean]                      615ms             613ms       -0.37%

name                      old alloc/op      new alloc/op      delta
Template                       38.7MB ± 1%       38.7MB ± 1%    ~     (p=0.834 n=50+50)
Unicode                        28.1MB ± 0%       28.1MB ± 0%  -0.22%  (p=0.000 n=49+50)
GoTypes                         168MB ± 1%        168MB ± 1%    ~     (p=0.054 n=47+47)
Compiler                       23.0MB ± 1%       23.0MB ± 1%    ~     (p=0.432 n=50+50)
SSA                            1.54GB ± 0%       1.54GB ± 0%  +0.21%  (p=0.000 n=50+50)
Flate                          23.6MB ± 1%       23.6MB ± 1%    ~     (p=0.153 n=43+46)
GoParser                       35.1MB ± 1%       35.1MB ± 2%    ~     (p=0.202 n=50+50)
Reflect                        84.7MB ± 1%       84.7MB ± 1%    ~     (p=0.333 n=48+49)
Tar                            34.5MB ± 1%       34.5MB ± 1%    ~     (p=0.406 n=46+49)
XML                            44.3MB ± 2%       44.2MB ± 3%    ~     (p=0.981 n=50+50)
LinkCompiler                    131MB ± 0%        128MB ± 0%  -2.74%  (p=0.000 n=50+50)
ExternalLinkCompiler            120MB ± 0%        120MB ± 0%  +0.01%  (p=0.007 n=50+50)
LinkWithoutDebugCompiler       77.3MB ± 0%       77.3MB ± 0%  -0.02%  (p=0.000 n=50+50)
[Geo mean]                     69.3MB            69.1MB       -0.22%

file      before    after     Δ        %
addr2line 4104220   4043684   -60536   -1.475%
api       5342502   5249678   -92824   -1.737%
asm       4973785   4858257   -115528  -2.323%
buildid   2667844   2625660   -42184   -1.581%
cgo       4686849   4616313   -70536   -1.505%
compile   23667431  23268406  -399025  -1.686%
cover     4959676   4874108   -85568   -1.725%
dist      3515934   3450422   -65512   -1.863%
doc       3995581   3925469   -70112   -1.755%
fix       3379202   3318522   -60680   -1.796%
link      6743249   6629913   -113336  -1.681%
nm        4047529   3991777   -55752   -1.377%
objdump   4456151   4388151   -68000   -1.526%
pack      2435040   2398072   -36968   -1.518%
pprof     13804080  13565808  -238272  -1.726%
test2json 2690043   2645987   -44056   -1.638%
trace     10418492  10232716  -185776  -1.783%
vet       7258259   7121259   -137000  -1.888%
total     113145867 111204202 -1941665 -1.716%

The situation on linux/arm64 is as follow:
name                      old time/op       new time/op       delta
Template                        280ms ± 1%        282ms ± 1%  +0.75%  (p=0.000 n=46+48)
Unicode                         124ms ± 2%        124ms ± 2%  +0.37%  (p=0.045 n=50+50)
GoTypes                         1.69s ± 1%        1.70s ± 1%  +0.56%  (p=0.000 n=49+50)
Compiler                        122ms ± 1%        123ms ± 1%  +0.93%  (p=0.000 n=50+50)
SSA                             12.6s ± 1%        12.7s ± 0%  +0.72%  (p=0.000 n=50+50)
Flate                           170ms ± 1%        172ms ± 1%  +0.97%  (p=0.000 n=49+49)
GoParser                        262ms ± 1%        263ms ± 1%  +0.39%  (p=0.000 n=49+48)
Reflect                         639ms ± 1%        650ms ± 1%  +1.63%  (p=0.000 n=49+49)
Tar                             243ms ± 1%        245ms ± 1%  +0.82%  (p=0.000 n=50+50)
XML                             324ms ± 1%        327ms ± 1%  +0.72%  (p=0.000 n=50+49)
LinkCompiler                    597ms ± 1%        596ms ± 1%  -0.27%  (p=0.001 n=48+47)
ExternalLinkCompiler            1.90s ± 1%        1.88s ± 1%  -1.00%  (p=0.000 n=50+50)
LinkWithoutDebugCompiler        364ms ± 1%        363ms ± 1%    ~     (p=0.220 n=49+50)
[Geo mean]                      485ms             488ms       +0.49%

name                      old alloc/op      new alloc/op      delta
Template                       38.7MB ± 0%       38.8MB ± 1%    ~     (p=0.093 n=43+49)
Unicode                        28.4MB ± 0%       28.4MB ± 0%  +0.03%  (p=0.000 n=49+45)
GoTypes                         169MB ± 1%        169MB ± 1%  +0.23%  (p=0.010 n=50+50)
Compiler                       23.2MB ± 1%       23.2MB ± 1%  +0.11%  (p=0.000 n=40+44)
SSA                            1.54GB ± 0%       1.55GB ± 0%  +0.45%  (p=0.000 n=47+49)
Flate                          23.8MB ± 2%       23.8MB ± 1%    ~     (p=0.543 n=50+50)
GoParser                       35.3MB ± 1%       35.4MB ± 1%    ~     (p=0.792 n=50+50)
Reflect                        85.2MB ± 1%       85.2MB ± 0%    ~     (p=0.055 n=50+47)
Tar                            34.5MB ± 1%       34.5MB ± 1%  +0.06%  (p=0.015 n=50+50)
XML                            43.8MB ± 2%       43.9MB ± 2%  +0.19%  (p=0.000 n=48+48)
LinkCompiler                    137MB ± 0%        136MB ± 0%  -0.92%  (p=0.000 n=50+50)
ExternalLinkCompiler            127MB ± 0%        127MB ± 0%    ~     (p=0.516 n=50+50)
LinkWithoutDebugCompiler       84.0MB ± 0%       84.0MB ± 0%    ~     (p=0.057 n=50+50)
[Geo mean]                     70.4MB            70.4MB       +0.01%

file      before    after     Δ        %
addr2line 4021557   4002933   -18624   -0.463%
api       5127847   5028503   -99344   -1.937%
asm       5034716   4936836   -97880   -1.944%
buildid   2608118   2594094   -14024   -0.538%
cgo       4488592   4398320   -90272   -2.011%
compile   22501129  22213592  -287537  -1.278%
cover     4742301   4713573   -28728   -0.606%
dist      3388071   3365311   -22760   -0.672%
doc       3802250   3776082   -26168   -0.688%
fix       3306147   3216939   -89208   -2.698%
link      6404483   6363699   -40784   -0.637%
nm        3941026   3921930   -19096   -0.485%
objdump   4383330   4295122   -88208   -2.012%
pack      2404547   2389515   -15032   -0.625%
pprof     12996234  12856818  -139416  -1.073%
test2json 2668500   2586788   -81712   -3.062%
trace     9816276   9609580   -206696  -2.106%
vet       6900682   6787338   -113344  -1.643%
total     108535806 107056973 -1478833 -1.363%

Change-Id: Iaec1cdcaacca8025e9babb0fb8a532fddb70c87d
Reviewed-on: https://go-review.googlesource.com/c/go/+/255239
Reviewed-by: eric fang <eric.fang@arm.com>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: eric fang <eric.fang@arm.com>

4 years agocmd/compile/internal/ssa: handle more cases in fuse pass
eric fang [Thu, 11 Jun 2020 09:35:24 +0000 (09:35 +0000)]
cmd/compile/internal/ssa: handle more cases in fuse pass

Currently fuseBlockIf handls four cases where s0 and s1 have only one predecessor
node. In fact, even if s0 and s1 have multiple predecessor nodes, it can be optimized
as well. This patch handles these cases.

This CL does not bring significant performance changes, it is more like an optimization
of dead code elimination. So it detects a lot of benchmarks whose functions are
completely optimized, such as BenchmarkNeIfaceConcrete, BenchmarkEqIfaceConcrete,
BenchmarkFullJapaneseRune, BenchmarkClearFat{8, 12, 16,...1024}, Benchmark{En|De}codeRune,
and BenchmarkCopyFat{8, 12, 16,...1024} and many others that I didn't check.

Test result of compilecmp on linux amd64, the data on linux arm64 is similar.
name                      old time/op                 new time/op                 delta
Template                    466131893.640000ns +-16%    455546571.480000ns +-12%    ~     (p=0.066 n=50+50)
Unicode                     195858206.980000ns +- 9%    197387526.224490ns +- 9%    ~     (p=0.231 n=50+49)
GoTypes                    1581961264.260000ns +- 7%   1581828319.640000ns +- 5%    ~     (p=0.964 n=50+50)
Compiler                   7425890449.259998ns +- 2%   7424138343.632654ns +- 2%    ~     (p=0.815 n=50+49)
SSA                       17392652203.380009ns +- 1%  17248314507.854172ns +- 1%  -0.83%  (p=0.000 n=50+48)
Flate                       298061504.940000ns +-12%    292773080.632653ns +-12%    ~     (p=0.165 n=50+49)
GoParser                    376046929.420000ns +- 9%    370746254.693878ns +- 9%    ~     (p=0.231 n=50+49)
Reflect                     995721330.160000ns +- 7%    985916024.620000ns +- 7%    ~     (p=0.103 n=50+50)
Tar                         398878287.040000ns +-10%    399186737.000000ns +-11%    ~     (p=0.883 n=50+50)
XML                         555898064.200000ns +- 8%    554877077.100000ns +-10%    ~     (p=0.926 n=50+50)
LinkCompiler                757995424.632653ns +- 7%    758301900.420000ns +- 7%    ~     (p=0.437 n=49+50)
ExternalLinkCompiler       2399985741.270834ns +- 4%   2396112274.630435ns +- 4%    ~     (p=0.766 n=48+46)
LinkWithoutDebugCompiler    450472710.700000ns +- 9%    448935188.720000ns +- 7%    ~     (p=0.668 n=50+50)
[Geo mean]                   927951041.671984ns          922858781.007286ns       -0.55%

name                      old user-time/op            new user-time/op            delta
Template                    639484500.000000ns +-16%    630857140.000000ns +-13%    ~     (p=0.363 n=50+50)
Unicode                     370072081.632653ns +-11%    375108300.000000ns +-10%    ~     (p=0.248 n=49+50)
GoTypes                    2205838860.000000ns +- 5%   2206640900.000000ns +- 3%    ~     (p=0.915 n=50+50)
Compiler                  10337224272.727268ns +- 2%  10366187152.173916ns +- 2%    ~     (p=0.324 n=44+46)
SSA                       23843616104.166660ns +- 3%  23678281387.755112ns +- 3%  -0.69%  (p=0.002 n=48+49)
Flate                       396446760.000000ns +-15%    391245333.333333ns +-10%    ~     (p=0.313 n=50+48)
GoParser                    509121660.000000ns +-10%    505938620.000000ns +- 9%    ~     (p=0.436 n=50+50)
Reflect                    1328136212.765958ns +- 6%   1312627440.000000ns +- 8%    ~     (p=0.068 n=47+50)
Tar                         563039480.000000ns +-10%    563064360.000000ns +-10%    ~     (p=0.953 n=50+50)
XML                         775596380.000000ns +- 9%    774736920.000000ns +-11%    ~     (p=0.899 n=50+50)
LinkCompiler               1315155260.000000ns +- 9%   1312946860.000001ns +- 6%    ~     (p=0.861 n=50+50)
ExternalLinkCompiler       2739635480.000000ns +- 6%   2732580380.000000ns +- 6%    ~     (p=0.943 n=50+50)
LinkWithoutDebugCompiler    537418600.000000ns +-10%    535914620.000000ns +- 9%    ~     (p=0.734 n=50+50)
[Geo mean]                  1296231259.389525ns         1291929605.124197ns       -0.33%

name                      old alloc/op                new alloc/op                delta
Template                                35.0MB +- 0%                35.0MB +- 0%    ~     (p=0.586 n=50+50)
Unicode                                 29.3MB +- 0%                29.3MB +- 0%  +0.01%  (p=0.004 n=50+50)
GoTypes                                  116MB +- 0%                 116MB +- 0%    ~     (p=0.102 n=50+50)
Compiler                                 555MB +- 0%                 555MB +- 0%    ~     (p=0.285 n=50+50)
SSA                                     1.37GB +- 0%                1.36GB +- 0%  -0.98%  (p=0.000 n=49+49)
Flate                                   21.8MB +- 0%                21.8MB +- 0%    ~     (p=0.475 n=50+49)
GoParser                                26.7MB +- 0%                26.7MB +- 0%    ~     (p=0.385 n=50+50)
Reflect                                 74.2MB +- 0%                74.3MB +- 0%  +0.01%  (p=0.006 n=49+50)
Tar                                     32.7MB +- 0%                32.7MB +- 0%    ~     (p=0.125 n=50+50)
XML                                     41.8MB +- 0%                41.8MB +- 0%    ~     (p=0.649 n=49+50)
LinkCompiler                             105MB +- 0%                 105MB +- 0%  -0.05%  (p=0.000 n=50+48)
ExternalLinkCompiler                    92.6MB +- 0%                92.6MB +- 0%  -0.02%  (p=0.000 n=50+50)
LinkWithoutDebugCompiler                63.9MB +- 0%                63.9MB +- 0%  -0.05%  (p=0.000 n=50+50)
[Geo mean]                               77.0MB                      76.9MB       -0.08%

name                      old allocs/op               new allocs/op               delta
Template                                  344k +- 0%                  344k +- 0%    ~     (p=0.091 n=50+50)
Unicode                                   340k +- 0%                  340k +- 0%    ~     (p=0.084 n=50+50)
GoTypes                                  1.19M +- 0%                 1.19M +- 0%    ~     (p=0.634 n=50+50)
Compiler                                 5.05M +- 0%                 5.05M +- 0%    ~     (p=0.428 n=50+48)
SSA                                      12.9M +- 0%                 12.8M +- 0%  -0.94%  (p=0.000 n=48+50)
Flate                                     216k +- 0%                  216k +- 0%    ~     (p=0.959 n=50+50)
GoParser                                  275k +- 0%                  275k +- 0%    ~     (p=0.705 n=50+50)
Reflect                                   887k +- 0%                  887k +- 0%    ~     (p=0.136 n=50+50)
Tar                                       318k +- 0%                  318k +- 0%  +0.01%  (p=0.007 n=50+48)
XML                                       396k +- 0%                  396k +- 0%    ~     (p=0.577 n=48+50)
LinkCompiler                              457k +- 0%                  457k +- 0%  -0.02%  (p=0.000 n=50+48)
ExternalLinkCompiler                      459k +- 0%                  459k +- 0%  -0.02%  (p=0.000 n=50+49)
LinkWithoutDebugCompiler                  111k +- 0%                  111k +- 0%  -0.09%  (p=0.000 n=50+50)
[Geo mean]                                 603k                        603k       -0.08%

name                      old maxRSS/op               new maxRSS/op               delta
Template                                 33.7M +- 5%                 33.7M +- 3%    ~     (p=0.798 n=50+48)
Unicode                                  35.2M +- 5%                 35.3M +- 5%    ~     (p=0.586 n=50+50)
GoTypes                                  73.5M +- 5%                 73.2M +- 5%    ~     (p=0.436 n=50+50)
Compiler                                  315M +- 3%                  315M +- 3%    ~     (p=0.726 n=49+48)
SSA                                       705M +- 5%                  691M +- 5%  -2.01%  (p=0.000 n=50+50)
Flate                                    25.2M +- 3%                 25.0M +- 3%    ~     (p=0.122 n=49+49)
GoParser                                 27.7M +- 5%                 27.7M +- 3%    ~     (p=0.967 n=50+50)
Reflect                                  54.6M +- 4%                 54.8M +- 4%    ~     (p=0.418 n=50+50)
Tar                                      32.2M +- 4%                 32.1M +- 3%    ~     (p=0.644 n=50+49)
XML                                      38.7M +- 5%                 38.9M +- 5%    ~     (p=0.612 n=50+50)
LinkCompiler                              159M +- 1%                  159M +- 1%    ~     (p=0.302 n=49+50)
ExternalLinkCompiler                      171M +- 1%                  170M +- 1%  -0.33%  (p=0.000 n=50+50)
LinkWithoutDebugCompiler                  133M +- 1%                  132M +- 1%  -0.44%  (p=0.000 n=48+50)
[Geo mean]                                76.9M                       76.8M       -0.25%

name                      old text-bytes              new text-bytes              delta
HelloSize                                804kB +- 0%                 804kB +- 0%    ~     (all equal)

name                      old data-bytes              new data-bytes              delta
HelloSize                               13.2kB +- 0%                13.2kB +- 0%    ~     (all equal)

name                      old bss-bytes               new bss-bytes               delta
HelloSize                                206kB +- 0%                 206kB +- 0%    ~     (all equal)

name                      old exe-bytes               new exe-bytes               delta
HelloSize                               1.20MB +- 0%                1.20MB +- 0%    ~     (all equal)

file    before    after     Δ       %
api     4904729   4904881   +152    +0.003%
asm     4849768   4849696   -72     -0.001%
buildid 2604760   2604768   +8      +0.000%
cgo     4505984   4506000   +16     +0.000%
compile 18936732  18864939  -71793  -0.379%
cover   4787385   4787377   -8      -0.000%
dist    3451964   3451988   +24     +0.001%
doc     3794929   3794913   -16     -0.000%
fix     3201863   3201847   -16     -0.000%
link    6467231   6467327   +96     +0.001%
objdump 4400076   4400132   +56     +0.001%
pprof   13354395  13354507  +112    +0.001%
trace   10186673  10187273  +600    +0.006%
vet     6727213   6727277   +64     +0.001%
total   105284348 105213571 -70777  -0.067%

Change-Id: I5020d112021f165a4ae18aa56402d8690330d8fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/239457
Reviewed-by: eric fang <eric.fang@arm.com>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: eric fang <eric.fang@arm.com>
Run-TryBot: eric fang <eric.fang@arm.com>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agointernal/poll: eliminate the redundant type conversions of FD.Sysfd
Andy Pan [Sun, 14 Mar 2021 05:19:12 +0000 (13:19 +0800)]
internal/poll: eliminate the redundant type conversions of FD.Sysfd

Change-Id: Ib75662f717320510319c696520e645f54eec97f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/301569
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agoruntime: using wyhash for memhashFallback on 32bit platform
Meng Zhuo [Mon, 15 Mar 2021 11:48:39 +0000 (19:48 +0800)]
runtime: using wyhash for memhashFallback on 32bit platform

wyhash is a general hash function that:

1. Default hash function of Zig, Nim
2. Passed Smhasher, BigCrush and PractRand
3. Less code
4. 3~26% faster than internal hashmap

name                  old time/op    new time/op    delta
Hash5                   67.8ns ± 0%    65.4ns ± 0%   -3.45%  (p=0.000 n=7+10)
Hash16                  82.5ns ± 0%    74.2ns ± 0%  -10.12%  (p=0.000 n=6+8)
Hash64                   121ns ± 0%     102ns ± 0%  -15.82%  (p=0.000 n=7+10)
Hash1024                1.13µs ± 0%    0.89µs ± 0%  -20.58%  (p=0.000 n=10+9)
Hash65536               68.9µs ± 0%    54.4µs ± 0%  -21.04%  (p=0.000 n=10+7)
HashStringSpeed          103ns ± 2%      93ns ± 3%  -10.24%  (p=0.000 n=9+10)
HashBytesSpeed           191ns ± 2%     180ns ± 1%   -5.40%  (p=0.000 n=10+8)
HashInt32Speed          59.0ns ± 2%    59.1ns ± 1%     ~     (p=0.655 n=9+8)
HashInt64Speed          72.7ns ± 3%    66.1ns ± 5%   -9.04%  (p=0.000 n=10+10)
HashStringArraySpeed     270ns ± 1%     222ns ± 2%  -17.91%  (p=0.000 n=10+10)
FastrandHashiter         108ns ± 0%     109ns ± 1%   +0.96%  (p=0.002 n=10+10)

name                  old speed      new speed      delta
Hash5                 73.8MB/s ± 0%  76.4MB/s ± 0%   +3.58%  (p=0.000 n=7+10)
Hash16                 194MB/s ± 0%   216MB/s ± 0%  +11.25%  (p=0.000 n=10+8)
Hash64                 530MB/s ± 0%   630MB/s ± 0%  +18.74%  (p=0.000 n=8+10)
Hash1024               910MB/s ± 0%  1145MB/s ± 0%  +25.88%  (p=0.000 n=10+9)
Hash65536              951MB/s ± 0%  1204MB/s ± 0%  +26.64%  (p=0.000 n=10+7)

Update #43130

Change-Id: Id00c54b116a2411fcf675e95896fffb85f0e25b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/280372
Trust: Meng Zhuo <mzh@golangcn.org>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
4 years agotime: support "," as separator for fractional seconds
Emmanuel T Odeke [Fri, 12 Mar 2021 01:34:09 +0000 (17:34 -0800)]
time: support "," as separator for fractional seconds

Accepts comma "," as a separator for fractional seconds
hence we now accept:
* 2006-01-02 15:04:05,999999999 -0700 MST
* Mon Jan _2 15:04:05,120007 2006
* Mon Jan 2 15:04:05,120007 2006

This change follows the recommendations of ISO 8601 per

   https://en.wikipedia.org/wiki/ISO_8601#cite_note-26

which states

   ISO 8601:2004(E), ISO, 2004-12-01, "4.2.2.4 ...
   the decimal fraction shall be divided from the integer
   part by the decimal sign specified in ISO 31-0, i.e.
   the comma [,] or full stop [.]. Of these, the comma
   is the preferred sign."

Unfortunately, I couldn't directly access the ISO 8601 document
because suddenly it is behind a paywall on the ISO website,
charging CHF 158 (USD 179) for 38 pages :-(

However, this follows publicly available cited literature, as well
as the recommendations from the proposal approval.

Fixes #6189
Updates #27746
Updates #26002
Updates #36145
Updates #43813
Fixes #43823

Change-Id: Ibe96064e8ee27c239be78c880fa561a1a41e190c
Reviewed-on: https://go-review.googlesource.com/c/go/+/300996
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agotime: add Time.IsDST() to check if its Location is in Daylight Savings Time
Joel Courtney [Mon, 15 Mar 2021 22:28:31 +0000 (22:28 +0000)]
time: add Time.IsDST() to check if its Location is in Daylight Savings Time

Fixes #42102

Change-Id: I2cd2fdf67c794c3e99ed1c24786f7f779da73962
GitHub-Last-Rev: bbfa92135734cbd55895012fa492e51686a7b58b
GitHub-Pull-Request: golang/go#42103
Reviewed-on: https://go-review.googlesource.com/c/go/+/264077
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Rob Pike <r@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>

4 years agoreflect: panic if ArrayOf is called with negative length
Paschalis Tsilias [Fri, 15 Jan 2021 15:40:20 +0000 (17:40 +0200)]
reflect: panic if ArrayOf is called with negative length

Since we cannot change the signature of reflect.ArrayOf to return an
error, we panic instead of producing a wrong result.

Fixes #43603

Change-Id: I23915df8d190f35af4d00ab86768868cd621e839
Reviewed-on: https://go-review.googlesource.com/c/go/+/284136
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agonet: fix BenchmarkWriteToReadFromUDP on Windows
Filippo Valsorda [Mon, 15 Mar 2021 22:10:21 +0000 (23:10 +0100)]
net: fix BenchmarkWriteToReadFromUDP on Windows

Using 0.0.0.0 for ListenUDP listens on all addresses. Calling LocalAddr
on that Conn returns 0.0.0.0. Sending to 0.0.0.0 doesn't seem to work on
Windows. See #22827.

Change-Id: I4a48fbabe65a63e07600a65309977cec08a9c1e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/301850
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Trust: Filippo Valsorda <filippo@golang.org>

4 years agoall: run gofmt
Prajwal Koirala [Mon, 15 Mar 2021 06:13:23 +0000 (06:13 +0000)]
all: run gofmt

Fixes #44980

Change-Id: Icef35319d1582d8367c8911e15d11b0224957327
GitHub-Last-Rev: 2113e97e837c1ef5de9ba6a7bd62db92e644c500
GitHub-Pull-Request: golang/go#45005
Reviewed-on: https://go-review.googlesource.com/c/go/+/301632
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>

4 years agoRevert "cmd/compile: spill output parameters passed in registers as autos"
David Chase [Mon, 15 Mar 2021 21:12:08 +0000 (21:12 +0000)]
Revert "cmd/compile: spill output parameters passed in registers as autos"

This reverts commit 8ed438c077d82c4b4662c327dbbdb3c64e7547ca, CL 300749.

Reason for revert: Looks like it crashes on link-register architectures

Change-Id: I0c261df58900008cada3359889d2a87508158447
Reviewed-on: https://go-review.googlesource.com/c/go/+/302053
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agocmd/compile: spill output parameters passed in registers as autos
David Chase [Thu, 11 Mar 2021 01:54:11 +0000 (20:54 -0500)]
cmd/compile: spill output parameters passed in registers as autos

ALSO:
found evidence that stack maps for bodyless methods are wrong.
gofmt in test/abi
removed never-executed code in types/size.go

Updates #44816.

Change-Id: I658c33f049337fb6f1e625f0c55430d25bfa877e
Reviewed-on: https://go-review.googlesource.com/c/go/+/300749
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agocmd/compile: fix case where func-valued field of a generic type is called
Dan Scales [Sun, 14 Mar 2021 20:46:23 +0000 (13:46 -0700)]
cmd/compile: fix case where func-valued field of a generic type is called

Added test example orderedmap.go (binary search tree) that requires this
fix (calling function compare in _Map).

Also added new tests slices.go and metrics.go that just work.

Change-Id: Ifa5f42ab6eee9aa54c40f0eca19e00a87f8f608a
Reviewed-on: https://go-review.googlesource.com/c/go/+/301829
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
4 years agocmd/compile: add support for generic maps
Dan Scales [Mon, 15 Mar 2021 03:13:05 +0000 (20:13 -0700)]
cmd/compile: add support for generic maps

Add support for maps in subster.typ(). Add new test cases maps.go and set.go.

Change substitution of a TFUNC in subster.typ() to always create new
param and result structs if any of the receiver, param, or result
structs get substituted. All these func structs must be copied, because
they have offset fields that are dependent, and so must have an
independent copy for each new signature (else there will be an error
later when frame offsets are calculated).

Change-Id: I576942a62f06b46b6f005abc98f65533008de8dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/301670
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
4 years agocmd/compile: add support for generic channels and type conversion during calls
Dan Scales [Sun, 14 Mar 2021 06:41:51 +0000 (22:41 -0800)]
cmd/compile:  add support for generic channels and type conversion during calls

Add support for channels in subster.typ(). Add new test file chans.go.

To support assignability of bidirectional channel args to directional
channel params, I needed to type check generic calls after they are
instantiated. (Eventually, we will create separate functions to just do
the assignability logic, so we don't need to call the old typechecker in
this case.) So, for generic calls, we now leave the call as OCALL (as a
signal that the call still needs typechecking), and do typecheck.Call()
during stenciling.

Smaller changes:
 - Set the type of an instantiated OCLOSURE node (and not just the associated
   OFUNC node)

 - In instTypeName2, filter out the space that types2.TypeString inserts
   after a common in a typelist. Our standard naming requires no space
   after the comma.

 - With the assignability fix above, I no longer need the explicit
   conversions in cons.go.

Change-Id: I148858bfc6708c0aa3f50bad7debce2b8c8c091f
Reviewed-on: https://go-review.googlesource.com/c/go/+/301669
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
4 years agoruntime: prepare arenas for use incrementally
Michael Anthony Knyszek [Mon, 16 Nov 2020 21:57:32 +0000 (21:57 +0000)]
runtime: prepare arenas for use incrementally

This change moves the call of sysMap from (*mheap).sysAlloc into
(*mheap).grow, so we only sysMap what we're going to use in the near
future (thanks to the curArena mechanism). The purpose of this change is
to better support systems with strict overcommit rules which generally
accept reserved memory but not prepared memory (see malloc.go for exact
descriptions of these states).

This move requires changing linearAlloc to only optionally map memory.
In one case, with mheap.heapArenaAlloc, we do want it to map memory. But
now in the other case, with mheap.arena, we don't, because we want grow
to take care of it.

The risk with this change is we may make more syscalls than before on
systems with 64 MiB arenas, but because heap growth is relatively rare
this is unlikely to be a noticable issue. We also bound the amount of
syscalls made by only extending curArena (and thus mapping) by
pallocChunkPages*pageSize which is 4 MiB.

Fixes #42612.

Change-Id: I736df696afe78ddb1a747a896caa0db8726027e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/270537
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
4 years agoencoding/xml: replace comments inside directives with a space
Filippo Valsorda [Mon, 26 Oct 2020 23:21:30 +0000 (00:21 +0100)]
encoding/xml: replace comments inside directives with a space

A Directive (like <!ENTITY xxx []>) can't have other nodes nested inside
it (in our data structure representation), so there is no way to
preserve comments. The previous behavior was to just elide them, which
however might change the semantic meaning of the surrounding markup.
Instead, replace them with a space which hopefully has the same semantic
effect of the comment.

Directives are not actually a node type in the XML spec, which instead
specifies each of them separately (<!ENTITY, <!DOCTYPE, etc.), each with
its own grammar. The rules for where and when the comments are allowed
are not straightforward, and can't be implemented without implementing
custom logic for each of the directives.

Simply preserving the comments in the body of the directive would be
problematic, as there can be unmatched quotes inside the comment.
Whether those quotes are considered meaningful semantically or not,
other parsers might disagree and interpret the output differently.

This issue was reported by Juho Nurminen of Mattermost as it leads to
round-trip mismatches. See #43168. It's not being fixed in a security
release because round-trip stability is not a currently supported
security property of encoding/xml, and we don't believe these fixes
would be sufficient to reliably guarantee it in the future.

Fixes CVE-2020-29510
Updates #43168

Change-Id: Icd86c75beff3e1e0689543efebdad10ed5178ce3
Reviewed-on: https://go-review.googlesource.com/c/go/+/277893
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
4 years agoencoding/xml: handle leading, trailing, or double colons in names
Filippo Valsorda [Mon, 26 Oct 2020 23:17:15 +0000 (00:17 +0100)]
encoding/xml: handle leading, trailing, or double colons in names

Before this change, <:name> would parse as <name>, which could cause
issues in applications that rely on the parse-encode cycle to
round-trip. Similarly, <x name:=""> would parse as expected but then
have the attribute dropped when serializing because its name was empty.
Finally, <a:b:c> would parse and get serialized incorrectly. All these
values are invalid XML, but to minimize the impact of this change, we
parse them whole into Name.Local.

This issue was reported by Juho Nurminen of Mattermost as it leads to
round-trip mismatches. See #43168. It's not being fixed in a security
release because round-trip stability is not a currently supported
security property of encoding/xml, and we don't believe these fixes
would be sufficient to reliably guarantee it in the future.

Fixes CVE-2020-29509
Fixes CVE-2020-29511
Updates #43168

Change-Id: I68321c4d867305046f664347192948a889af3c7f
Reviewed-on: https://go-review.googlesource.com/c/go/+/277892
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
4 years agonet: use mid-stack inlining with ReadFromUDP to avoid an allocation
Josh Bleecher Snyder [Thu, 11 Feb 2021 18:49:55 +0000 (10:49 -0800)]
net: use mid-stack inlining with ReadFromUDP to avoid an allocation

This commit rewrites ReadFromUDP to be mid-stack inlined
and pass a UDPAddr for lower layers to fill in.

This lets performance-sensitive clients avoid an allocation.
It requires some care on their part to prevent the UDPAddr
from escaping, but it is now possible.
The UDPAddr trivially does not escape in the benchmark,
as it is immediately discarded.

name                  old time/op    new time/op    delta
WriteToReadFromUDP-8    17.2µs ± 6%    17.1µs ± 5%     ~     (p=0.387 n=9+9)

name                  old alloc/op   new alloc/op   delta
WriteToReadFromUDP-8      112B ± 0%       64B ± 0%  -42.86%  (p=0.000 n=10+10)

name                  old allocs/op  new allocs/op  delta
WriteToReadFromUDP-8      3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=10+10)

Updates #43451

Co-authored-by: Filippo Valsorda <filippo@golang.org>
Change-Id: I1f9d2ab66bd7e4eff07fe39000cfa0b45717bd13
Reviewed-on: https://go-review.googlesource.com/c/go/+/291509
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Filippo Valsorda <filippo@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>

4 years agoall: update golang.org/x/* dependencies
Emmanuel T Odeke [Fri, 26 Feb 2021 10:27:24 +0000 (02:27 -0800)]
all: update golang.org/x/* dependencies

Updates src/ and src/cmd/* dependencies, using

    go mod vendor

as well as

    updatestd -branch=master -goroot=$GOROOT

This change was ran in anticipation of bringing in x/net/http2 CL 237957.

For #32112.
For #36905.

Change-Id: If8cefc348463b6d82d85020b57db411213720ef8
Reviewed-on: https://go-review.googlesource.com/c/go/+/296789
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
4 years agocmd/internal/moddeps: fix typo in TestAllDependencies log messages
Tobias Klauser [Mon, 15 Mar 2021 16:54:35 +0000 (17:54 +0100)]
cmd/internal/moddeps: fix typo in TestAllDependencies log messages

s/dependecies/dependencies/

Change-Id: I454668a36192e345965173d76be12cbd5917ea34
Reviewed-on: https://go-review.googlesource.com/c/go/+/301849
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
4 years agocmd/compile: remove ARMv5 special case in register allocator
Cherry Zhang [Fri, 12 Mar 2021 23:45:52 +0000 (18:45 -0500)]
cmd/compile: remove ARMv5 special case in register allocator

The register allocator has a special case that doesn't allocate
LR on ARMv5. This was necessary when softfloat expansion was done
by the assembler. Now softfloat calls are inserted by SSA, so it
works as normal. Remove this special case.

Change-Id: I5502f07597f4d4b675dc16b6b0d7cb47e1e8974b
Reviewed-on: https://go-review.googlesource.com/c/go/+/301792
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
4 years agobytes: correct tense in comment
Ian Lance Taylor [Mon, 15 Mar 2021 17:03:30 +0000 (10:03 -0700)]
bytes: correct tense in comment

Undo incorrect change accidentally made in CL 299109.

Change-Id: Iba29827d0fbd3637c311cebc50c2f4ea437fc582
Reviewed-on: https://go-review.googlesource.com/c/go/+/301830
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
4 years agocmd/compile: fix outdated comment
Ethan Hur [Sun, 14 Mar 2021 13:43:26 +0000 (13:43 +0000)]
cmd/compile: fix outdated comment

variable xtop has removed and refactored after go 1.16, but there are comments referring xtop.

It may mislead new contributors to be confused.

Change-Id: Id79c747d8daef14049b29e70a4ecd34054a28a5e
GitHub-Last-Rev: 94b55208862fdc9fa0de39aacf2c9ef9987cef56
GitHub-Pull-Request: golang/go#44995
Reviewed-on: https://go-review.googlesource.com/c/go/+/301629
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Keith Randall <khr@golang.org>

4 years agocmd/internal/obj: reorder ppc64 MOV* optab entries
Paul E. Murphy [Tue, 9 Mar 2021 22:54:59 +0000 (16:54 -0600)]
cmd/internal/obj: reorder ppc64 MOV* optab entries

These are always sorted and grouped during initialization of the
actual opcode -> optab map generation. Thus, their initial location
in optab is mostly aimed at readability. This cleanup is intends to
ease reviewing of future patches which simplify, combine, or remove
MOV* optab entries.

Change-Id: I87583ed34fab79e0f625880f419d499939e2a9e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/300612
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>

4 years agocrypto/md5: improve ppc64x performance
Paul E. Murphy [Wed, 10 Mar 2021 23:06:54 +0000 (17:06 -0600)]
crypto/md5: improve ppc64x performance

This is mostly cleanup and simplification.  This removes
many unneeded register moves, loads, and bit twiddlings
which were holdovers from porting this from the amd64
version.

The updated code loads each block once per iteration
instead of once per round. Similarly, the logical
operations now match the original md5 specification.

Likewise, add extra sizes to the benchtest to give more
data points on how the implementation scales with input
size.

All in all, this is roughly a 20% improvement on ppc64le
code running on POWER9 (POWER8 is similar, but around
16%):

name                 old time/op    new time/op    delta
Hash8Bytes              297ns ± 0%     255ns ± 0%  -14.14%
Hash64                  527ns ± 0%     444ns ± 0%  -15.76%
Hash128                 771ns ± 0%     645ns ± 0%  -16.35%
Hash256                1.26µs ± 0%    1.05µs ± 0%  -16.68%
Hash512                2.23µs ± 0%    1.85µs ± 0%  -16.82%
Hash1K                 4.16µs ± 0%    3.46µs ± 0%  -16.83%
Hash8K                 31.2µs ± 0%    26.0µs ± 0%  -16.74%
Hash1M                 3.58ms ± 0%    2.98ms ± 0%  -16.74%
Hash8M                 26.1ms ± 0%    21.7ms ± 0%  -16.81%
Hash8BytesUnaligned     297ns ± 0%     255ns ± 0%  -14.08%
Hash1KUnaligned        4.16µs ± 0%    3.46µs ± 0%  -16.79%
Hash8KUnaligned        31.2µs ± 0%    26.0µs ± 0%  -16.78%

name                 old speed      new speed      delta
Hash8Bytes           26.9MB/s ± 0%  31.4MB/s ± 0%  +16.45%
Hash64                122MB/s ± 0%   144MB/s ± 0%  +18.69%
Hash128               166MB/s ± 0%   199MB/s ± 0%  +19.54%
Hash256               203MB/s ± 0%   244MB/s ± 0%  +20.01%
Hash512               230MB/s ± 0%   276MB/s ± 0%  +20.18%
Hash1K                246MB/s ± 0%   296MB/s ± 0%  +20.26%
Hash8K                263MB/s ± 0%   315MB/s ± 0%  +20.11%
Hash1M                293MB/s ± 0%   352MB/s ± 0%  +20.10%
Hash8M                321MB/s ± 0%   386MB/s ± 0%  +20.21%
Hash8BytesUnaligned  26.9MB/s ± 0%  31.4MB/s ± 0%  +16.41%
Hash1KUnaligned       246MB/s ± 0%   296MB/s ± 0%  +20.19%
Hash8KUnaligned       263MB/s ± 0%   315MB/s ± 0%  +20.15%

Change-Id: I269bfa6878966bb4f6a64dc349100f5dc453ab7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/300613
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>

4 years agocmd/link/internal/ld: fix typo in a comment
Tao Qingyun [Sun, 14 Mar 2021 00:09:05 +0000 (00:09 +0000)]
cmd/link/internal/ld: fix typo in a comment

Change-Id: I9ae39aa2da2bfa6bb5d3f279bca764128d9cc401
GitHub-Last-Rev: 7a5945ae120b911793a1510f371945ac17611440
GitHub-Pull-Request: golang/go#44990
Reviewed-on: https://go-review.googlesource.com/c/go/+/301529
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Tobias Klauser <tobias.klauser@gmail.com>

4 years agocmd/compile: fix whitespace in comment
Josh Bleecher Snyder [Sun, 14 Mar 2021 21:27:06 +0000 (14:27 -0700)]
cmd/compile: fix whitespace in comment

The whitespace was there to align with the following comment,
but the extra whitespace was unnecessary; it wasn't gofmt'd.
Then the file got gofmt'd, but the whitespace didn't get fixed.

Change-Id: I45aad9605b99d83545e4e611ae3ea1b2ff9e6bf6
Reviewed-on: https://go-review.googlesource.com/c/go/+/301649
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
4 years agocmd/link: regression test for issue #42484
Alessandro Arzilli [Thu, 12 Nov 2020 15:02:55 +0000 (16:02 +0100)]
cmd/link: regression test for issue #42484

Adds test to check that the compiler does not emit duplicate debug_line
entries for the end of sequence address.

Updates #42484

Change-Id: I3c5d1d606fcfd758aa1fd83ecc51d8edc054398b
Reviewed-on: https://go-review.googlesource.com/c/go/+/270197
TryBot-Result: Go Bot <gobot@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Than McIntosh <thanm@google.com>
4 years agoencoding/json: fix package shadowing in MarshalIndent example
Ariel Mashraki [Sun, 14 Mar 2021 16:12:59 +0000 (18:12 +0200)]
encoding/json: fix package shadowing in MarshalIndent example

Prior to this CL, pasting the example from the website causes a
compilation error for some programs because it was shadowing the
"json" package.

Change-Id: I39b68a66ca99468547f2027a7655cf1387b61e95
Reviewed-on: https://go-review.googlesource.com/c/go/+/301492
Reviewed-by: Joe Tsai <joetsai@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Joe Tsai <joetsai@google.com>
Run-TryBot: Joe Tsai <joetsai@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agoall: add internal/itoa package
Josh Bleecher Snyder [Sun, 14 Mar 2021 00:52:16 +0000 (16:52 -0800)]
all: add internal/itoa package

This replaces five implementations scattered across low level packages.
(And I plan to use it in a sixth soon.)
Three of the five were byte-for-byte identical.

Change-Id: I3bbbeeac63723a487986c912b604e10ad1e042f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/301549
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
4 years agocmd/cover: replace code using optimized golang.org/x/tools/cover
Koichi Shiraishi [Fri, 21 Aug 2020 12:23:18 +0000 (21:23 +0900)]
cmd/cover: replace code using optimized golang.org/x/tools/cover

After CL 179377, this change deletes all the prior cmd/cover code
and instead vendors and type aliases code using the significantly
optimized  golang.org/x/tools/cover, which sped up ParseProfiles by
manually parsing profiles instead of a regex. The speed up was:

name         old time/op   new time/op   delta
ParseLine-12 2.43µs ± 2%   0.05µs ± 8%   -97.98% (p=0.000 n=10+9)

name         old speed     new speed       delta
ParseLine-12 42.5MB/s ± 2% 2103.2MB/s ± 7% +4853.14% (p=0.000 n=10+9)

Fixes #32211.

Change-Id: Ie4e8be7502f25eb95fae7a9d8334fc97b045d53f
Reviewed-on: https://go-review.googlesource.com/c/go/+/249759
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agonet/http: revert change from CL 299109 breaking TestAllDependencies
Tobias Klauser [Sat, 13 Mar 2021 18:43:12 +0000 (19:43 +0100)]
net/http: revert change from CL 299109 breaking TestAllDependencies

This code is generated from golang.org/x/net/http2 and thus any changes
first have to occur there. Otherwise TestAllDependencies fails on the
longtest builders.

Change-Id: I918afdd9388dd28bb3c8e55438be764c4f32c7c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/301491
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agoio/fs: use testing.T.TempDir in TestWalkDir
Tobias Klauser [Sat, 13 Mar 2021 17:00:17 +0000 (18:00 +0100)]
io/fs: use testing.T.TempDir in TestWalkDir

Change-Id: I805ad51332e4efe27d47f6c6e3b0af945e0d4aa0
Reviewed-on: https://go-review.googlesource.com/c/go/+/301489
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
4 years agocmd/compile/internal/ssa: prealloc slice
cui [Mon, 11 Jan 2021 08:44:45 +0000 (08:44 +0000)]
cmd/compile/internal/ssa: prealloc slice

Change-Id: I9943a4f931c251a69bc8244c0d7723a0a3552073
GitHub-Last-Rev: d9dd94ae4444cb0106756cdb98c1c5fa12fa5f79
GitHub-Pull-Request: golang/go#43622
Reviewed-on: https://go-review.googlesource.com/c/go/+/282992
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>

4 years agoio: add error check to WriteString Example test
JulianChu [Sat, 13 Mar 2021 17:44:10 +0000 (17:44 +0000)]
io: add error check to WriteString Example test

Change-Id: I9ce1c79e5799f205aec3a4dc02645ed26bdc3581
GitHub-Last-Rev: 59b637db0154e55ddfdd55e54b9596dc3a0ad32d
GitHub-Pull-Request: golang/go#44533
Reviewed-on: https://go-review.googlesource.com/c/go/+/295389
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agofmt: use “truncateString” not “truncate” in method doc
zfCode [Sat, 13 Mar 2021 18:00:30 +0000 (18:00 +0000)]
fmt: use “truncateString” not “truncate” in method doc

Change-Id: If1acb6a8533a782f80c7d1f0ad5155e98e1134dd
GitHub-Last-Rev: 03384a3d99dd89d802635f7ef48ce4456ec338b0
GitHub-Pull-Request: golang/go#44375
Reviewed-on: https://go-review.googlesource.com/c/go/+/293629
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Rob Pike <r@golang.org>
Trust: Rob Pike <r@golang.org>

4 years agoerrors/wrap: do not call Elem() twice
Vitaly Zdanevich [Mon, 8 Mar 2021 03:15:25 +0000 (03:15 +0000)]
errors/wrap: do not call Elem() twice

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

4 years agoall: remove duplicate words
John Bampton [Sat, 13 Mar 2021 11:25:15 +0000 (11:25 +0000)]
all: remove duplicate words

Change-Id: Ib0469232a2b69a869e58d5d24990ad74ac96ea56
GitHub-Last-Rev: eb38e049ee1e773392ff3747e1eb2af20dd50dcd
GitHub-Pull-Request: golang/go#44805
Reviewed-on: https://go-review.googlesource.com/c/go/+/299109
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
4 years agoencoding/gob: ensure "duplicate type received" decoder errors surface up
Aman Karmani [Tue, 2 Mar 2021 19:52:34 +0000 (11:52 -0800)]
encoding/gob: ensure "duplicate type received" decoder errors surface up

Previously re-using a decoder with a new stream resulted in a confusing
"extra data in buffer" error message.

Change-Id: Ia4c4c3a2d4b63c59e37e53faa61a500d5ff6e5f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/297949
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>

4 years agocrypto/ecdsa: fix dead reference link
Mostyn Bramley-Moore [Tue, 16 Feb 2021 16:01:39 +0000 (16:01 +0000)]
crypto/ecdsa: fix dead reference link

The previous link broke, but it's available on the internet archive.

Fixes #39808

Change-Id: Ic2be74a1f0591600ca1acbe08e1bab8ba1e21abe
GitHub-Last-Rev: 6d6de5d2f451c6d53a1e55b62fb5a1fab0d49f10
GitHub-Pull-Request: golang/go#40165
Reviewed-on: https://go-review.googlesource.com/c/go/+/242103
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
4 years agonet/http: note that "HTTP/2" is invalid for ParseHTTPVersion
Josh Deprez [Tue, 10 Nov 2020 21:27:04 +0000 (21:27 +0000)]
net/http: note that "HTTP/2" is invalid for ParseHTTPVersion

Change-Id: Ieba05dea892ec9855a63b80e456bcf9188eef855
GitHub-Last-Rev: 5f7663ac4aaecb01a27a04309277240fd15759c9
GitHub-Pull-Request: golang/go#41806
Reviewed-on: https://go-review.googlesource.com/c/go/+/259758
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Damien Neil <dneil@google.com>

4 years agoruntime: fix documented alignment of 32KiB and 64KiB size classes
Matthew Dempsky [Sat, 13 Mar 2021 00:58:10 +0000 (16:58 -0800)]
runtime: fix documented alignment of 32KiB and 64KiB size classes

As Cherry pointed out on golang.org/cl/299909, the page allocator
doesn't guarantee any alignment for multi-page allocations, so object
alignments are thus implicitly capped at page alignment.

Change-Id: I6f5df27f269b095cde54056f876fe4240f69c5c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/301292
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>

4 years agoall: use HTML5 br tags
John Bampton [Fri, 5 Mar 2021 01:53:00 +0000 (01:53 +0000)]
all: use HTML5 br tags

In HTML5 br tags don't need a closing slash

Change-Id: Ic53c43faee08c5b1267daa9a02cc186b1c255ca1
GitHub-Last-Rev: 652208116944d01b23b8af8f1af485da5e916d32
GitHub-Pull-Request: golang/go#44283
Reviewed-on: https://go-review.googlesource.com/c/go/+/292370
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>

4 years agomisc/cgo/testcarchive: don't use == for string equality in C code
Ian Lance Taylor [Thu, 11 Mar 2021 23:09:47 +0000 (15:09 -0800)]
misc/cgo/testcarchive: don't use == for string equality in C code

For https://gcc.gnu.org/PR99553

Change-Id: I29a7fbfd89963d4139bc19af99330d70567938ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/300993
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
4 years agocmd/compile/internal/types2: use self_test.go from go/types
Robert Griesemer [Fri, 12 Mar 2021 02:10:08 +0000 (18:10 -0800)]
cmd/compile/internal/types2: use self_test.go from go/types

This CL replaces self_test.go with the (improved) version
from go/types, modified for types2.

To see the differences between go/types/self_test.go and
this version, compare against patch set 1.

Change-Id: I7ae830a17f7a0de40cc1f5063166a7247f78ec27
Reviewed-on: https://go-review.googlesource.com/c/go/+/300997
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
4 years agocmd/compile/internal/types2: simplify error reporting API (cleanup)
Robert Griesemer [Fri, 12 Mar 2021 00:34:01 +0000 (16:34 -0800)]
cmd/compile/internal/types2: simplify error reporting API (cleanup)

- Remove specialized errorf functions for invalid AST/argument/operation.
  Instead use prefix constants with the error message.

- Replace several calls to Checker.errorf with calls to Checker.error
  if there are no arguments to format.

- Replace a handful of %s format verbs with %v to satisfy vet check.

- Add a basic test that checks that we're not using Checker.errorf when
  we should be using Checker.error.

Change-Id: I7bc7c14f3cf774689ec8cd5782ea31b6e30dbcd6
Reviewed-on: https://go-review.googlesource.com/c/go/+/300995
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
4 years agocmd/compile: mention that -m can be increased or given multiple times
Michael Schaller [Fri, 12 Mar 2021 12:12:48 +0000 (12:12 +0000)]
cmd/compile: mention that -m can be increased or given multiple times

-m can be increased or it can be given up to 4 times to increase the verbosity of the printed optimization decisions: https://github.com/golang/go/search?q=LowerM

Change-Id: I0cc304385be052664fad455ff075846a3a63f298
GitHub-Last-Rev: 140f08529024dd17c5ca1cbad52dd1d17c6126c0
GitHub-Pull-Request: golang/go#44857
Reviewed-on: https://go-review.googlesource.com/c/go/+/299709
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
4 years agodelete favicon.ico and robots.txt
Dmitri Shuralyov [Wed, 10 Mar 2021 04:27:11 +0000 (23:27 -0500)]
delete favicon.ico and robots.txt

The favicon.ico and robots.txt files have been with us in the root
directory since 2009 and 2011 respectively. Back then, the Go repo
had content for the golang.org website, which could be run locally.
Since these files were at the root of the website, they were added
to the corresponding location in the GOROOT tree—at the root.

In 2018, work started on factoring out golang.org website content
and code into a new golang.org/x/website repository (issue 29206).

The favicon.ico and robots.txt files were copied to x/website repo,
but some more work needed to be done before they would be picked up
and served when golangorg was executed in module mode. That work is
done by now (CL 293413 and CL 293414).

The scope of the godoc tool has also been reduced to just serving
Go package documentation and not the website (issue 32011), so it
can provide its own favicon.ico as needed (CL 300394).

This means these two files have no more use and can be deleted.
So long and goodbye!

Change-Id: Id71bdab6317c1dc481c9d85beaaac4b4eb92d379
Reviewed-on: https://go-review.googlesource.com/c/go/+/300549
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
4 years agocmd/go: fix godoc formatting for text from 'go help install'
Jay Conrod [Fri, 12 Mar 2021 18:48:32 +0000 (13:48 -0500)]
cmd/go: fix godoc formatting for text from 'go help install'

Fixes #44846

Change-Id: I5a12c6437a91ce59307483ffcc70e084edc32197
Reviewed-on: https://go-review.googlesource.com/c/go/+/301329
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agocmd/compile: minor cleanup -- remove dead code conditional on test
David Chase [Fri, 12 Mar 2021 15:56:08 +0000 (10:56 -0500)]
cmd/compile: minor cleanup -- remove dead code conditional on test

It would fail now if it were turned on.

Updsates #44816.

Change-Id: I19d94f0cb2dd84271f5304c796d7c81e1e64af25
Reviewed-on: https://go-review.googlesource.com/c/go/+/301270
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agocmd/compile: test register ABI for method, interface, closure calls
David Chase [Fri, 5 Mar 2021 19:24:41 +0000 (14:24 -0500)]
cmd/compile: test register ABI for method, interface, closure calls

This is enabled with a ridiculous magic name for method,
or for last input type passed, that needs to be changed
to something inutterable before actual release.

Ridiculous method name: MagicMethodNameForTestingRegisterABI
Ridiculous last (input) type name: MagicLastTypeNameForTestingRegisterABI

RLTN is tested with strings.Contains, so you can have
MagicLastTypeNameForTestingRegisterABI1
and
MagicLastTypeNameForTestingRegisterABI2
if that is helpful

Includes test test/abi/fibish2.go

Updates #44816.

Change-Id: I592a6edc71ca9bebdd1d00e24edee1ceebb3e43f
Reviewed-on: https://go-review.googlesource.com/c/go/+/299410
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agocmd/go/internal/load: always set IsImportCycle when in a cycle
Roland Shoemaker [Fri, 12 Mar 2021 17:51:50 +0000 (09:51 -0800)]
cmd/go/internal/load: always set IsImportCycle when in a cycle

When hitting an import cycle in reusePackage, and there is already
an error set, make sure IsImportCycle is set so that we don't
end up stuck in a loop.

Fixes #25830

Change-Id: Iba966aea4a637dfc34ee22782a477209ac48c9bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/301289
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agoruntime: simplify divmagic for span calculations
Matthew Dempsky [Thu, 11 Mar 2021 23:45:52 +0000 (15:45 -0800)]
runtime: simplify divmagic for span calculations

It's both simpler and faster to just unconditionally do two 32-bit
multiplies rather than a bunch of branching to try to avoid them.
This is safe thanks to the tight bounds derived in [1] and verified
during mksizeclasses.go.

Benchstat results below for compilebench benchmarks on my P920. See
also [2] for micro benchmarks comparing the new functions against the
originals (as well as several basic attempts at optimizing them).

name                      old time/op       new time/op       delta
Template                        295ms ± 3%        290ms ± 1%  -1.95%  (p=0.000 n=20+20)
Unicode                         113ms ± 3%        110ms ± 2%  -2.32%  (p=0.000 n=21+17)
GoTypes                         1.78s ± 1%        1.76s ± 1%  -1.23%  (p=0.000 n=21+20)
Compiler                        119ms ± 2%        117ms ± 4%  -1.53%  (p=0.007 n=20+20)
SSA                             14.3s ± 1%        13.8s ± 1%  -3.12%  (p=0.000 n=17+20)
Flate                           173ms ± 2%        170ms ± 1%  -1.64%  (p=0.000 n=20+19)
GoParser                        278ms ± 2%        273ms ± 2%  -1.92%  (p=0.000 n=20+19)
Reflect                         686ms ± 3%        671ms ± 3%  -2.18%  (p=0.000 n=19+20)
Tar                             255ms ± 2%        248ms ± 2%  -2.90%  (p=0.000 n=20+20)
XML                             335ms ± 3%        327ms ± 2%  -2.34%  (p=0.000 n=20+20)
LinkCompiler                    799ms ± 1%        799ms ± 1%    ~     (p=0.925 n=20+20)
ExternalLinkCompiler            1.90s ± 1%        1.90s ± 0%    ~     (p=0.327 n=20+20)
LinkWithoutDebugCompiler        385ms ± 1%        386ms ± 1%    ~     (p=0.251 n=18+20)
[Geo mean]                      512ms             504ms       -1.61%

name                      old user-time/op  new user-time/op  delta
Template                        286ms ± 4%        282ms ± 4%  -1.42%  (p=0.025 n=21+20)
Unicode                         104ms ± 9%        102ms ±14%    ~     (p=0.294 n=21+20)
GoTypes                         1.75s ± 3%        1.72s ± 2%  -1.36%  (p=0.000 n=21+20)
Compiler                        109ms ±11%        108ms ± 8%    ~     (p=0.187 n=21+19)
SSA                             14.0s ± 1%        13.5s ± 2%  -3.25%  (p=0.000 n=16+20)
Flate                           166ms ± 4%        164ms ± 4%  -1.34%  (p=0.032 n=19+19)
GoParser                        268ms ± 4%        263ms ± 4%  -1.71%  (p=0.011 n=18+20)
Reflect                         666ms ± 3%        654ms ± 4%  -1.77%  (p=0.002 n=18+20)
Tar                             245ms ± 5%        236ms ± 6%  -3.34%  (p=0.000 n=20+20)
XML                             320ms ± 4%        314ms ± 3%  -2.01%  (p=0.001 n=19+18)
LinkCompiler                    744ms ± 4%        747ms ± 3%    ~     (p=0.627 n=20+19)
ExternalLinkCompiler            1.71s ± 3%        1.72s ± 2%    ~     (p=0.149 n=20+20)
LinkWithoutDebugCompiler        345ms ± 6%        342ms ± 8%    ~     (p=0.355 n=20+20)
[Geo mean]                      484ms             477ms       -1.50%

[1] Daniel Lemire, Owen Kaser, Nathan Kurz. 2019. "Faster Remainder by
Direct Computation: Applications to Compilers and Software Libraries."
https://arxiv.org/abs/1902.01961

[2] https://github.com/mdempsky/benchdivmagic

Change-Id: Ie4d214e7a908b0d979c878f2d404bd56bdf374f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/300994
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 years agoruntime: add alignment info to sizeclasses.go comments
Matthew Dempsky [Mon, 8 Mar 2021 23:36:28 +0000 (15:36 -0800)]
runtime: add alignment info to sizeclasses.go comments

I was curious about the minimum possible alignment for each size class
and the minimum size to guarantee any particular alignment (e.g., to
know at what class size you can start assuming heap bits are byte- or
word-aligned).

Change-Id: I205b750286e8914986533c4f60712c420c3e63e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/299909
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>

4 years agocmd/go: include default GOEXPERIMENT in build config
Cherry Zhang [Fri, 12 Mar 2021 16:21:38 +0000 (11:21 -0500)]
cmd/go: include default GOEXPERIMENT in build config

Currently, the build config includes GOEXPERIMENT environment
variable if it is not empty, but that doesn't take the default
value (set at make.bash/bat/rc time) into consideration. This
may cause standard library packages appearing stale, as the
build config appears changed.

This CL changes it to use cfg.GOEXPERIMENT variable, which
includes the default value (if it is not overwritten).

May fix regabi and staticlockranking builders.

Change-Id: I242f887167f8e99192010be5c1a046eb88ab0c2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/301269
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agoRevert "testing/fstest: test that ReadDirFile on a non-dir fails"
Josh Bleecher Snyder [Fri, 12 Mar 2021 15:45:18 +0000 (15:45 +0000)]
Revert "testing/fstest: test that ReadDirFile on a non-dir fails"

This reverts commit 1853411d8376570295711f9084d494d458822578.

Reason for revert: broke plan 9 builder. fixes #44967

Change-Id: Ib89448d37f7ab8bb05dbd89ce744431d807eb4da
Reviewed-on: https://go-review.googlesource.com/c/go/+/301190
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>

4 years agoA+C: add new e-mail addresses for Andy Pan
Andy Pan [Thu, 11 Mar 2021 06:22:16 +0000 (14:22 +0800)]
A+C: add new e-mail addresses for Andy Pan

Change-Id: I2be9cba124b407f27823b3a3778331b6118112cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/300470
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
4 years agocmd/compile: fix noder.Addr() to not call typechecker
Dan Scales [Thu, 11 Mar 2021 01:27:30 +0000 (17:27 -0800)]
cmd/compile:  fix noder.Addr() to not call typechecker

Simple change to avoid calling the old typechecker in noder.Addr(). This
fixes cases where generic code calls a pointer method with a non-pointer
receiver.

Added test typeparam/lockable.go that now works with this change.

For lockable.go to work, also fix incorrect check to decide whether to
translate an OXDOT now or later. We should delay translating an OXDOT
until instantiation (because we don't know how embedding, etc. will
work) if the receiver has any typeparam, not just if the receiver type
is a simple typeparam. We also have to handle OXDOT for now in
IsAddressable(), until we can remove calls to the old typechecker in
(*irgen).funcBody().

Change-Id: I77ee5efcef9a8f6c7133564106a32437e36ba4bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/300990
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
4 years agointernal/poll: fix some grammar errors
Andy Pan [Thu, 11 Mar 2021 14:34:45 +0000 (22:34 +0800)]
internal/poll: fix some grammar errors

Change-Id: I25a6424bce9d372fa46e8bdd856095845d3397bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/300889
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agocmd/internal/obj/arm64: add support for op(extended register) with RSP arguments
fanzha02 [Wed, 20 Jan 2021 09:58:21 +0000 (17:58 +0800)]
cmd/internal/obj/arm64: add support for op(extended register) with RSP arguments

Refer to ARM reference manual, like add(extended register) instructions,
the extension is encoded in the "option" field. If "Rd" or "Rn" is
RSP and "option" is "010" then LSL is preferred. Therefore, the instrution
"add Rm<<imm, RSP, RSP" or "add Rm<<imm RSP" is valid and can be encoded
as add(extended register) instruction.

But the current assembler can not handle like "op R1<<1, RSP, RSP"
instructions, this patch adds the support.

Because MVN(extended register) does not exist, remove it.

Add test cases.

Change-Id: I968749d75c6b93a4f297b39c73cc292e6b1035ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/284900
Trust: fannie zhang <Fannie.Zhang@arm.com>
Run-TryBot: fannie zhang <Fannie.Zhang@arm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agocmd/compile: call types.CheckSize() in g.typ()
Dan Scales [Thu, 11 Mar 2021 03:28:28 +0000 (19:28 -0800)]
cmd/compile:  call types.CheckSize() in g.typ()

Restore code to call types.CheckSize() in g.typ(). There are certain
cases (involving maps) where we need to do CheckSize here. In general,
the old typechecker calls CheckSize() a lot, and we want to eliminate
calling it eventually, so should get do types.CheckSize() when we create
a new concrete type.

However, the test typeparams/cons.go does not work with just calling
types.CheckSize() in g.typ() (which is why I disabled the calls
originally). The reason is that g.typ() is called recursively within
types.go, so it can be called on a partially-created recursive type,
which leads to an error in CheckSize(). So, we need to call CheckSize()
only on fully-created top-level types. So, I divided typ() into typ()
and typ1(), where typ() is now the external entry point, and typ1() is
called within types.go. Now, typ() can call CheckSize() safely.

I also added in an extra condition - we do not currently need to call
CheckSize() on non-fully-instantiated types, since they will not make it
to the backend.  That could change a bit with dictionaries.

Fixes #44895

Change-Id: I783aa7d2999dd882ddbd99a7c19a6ff6ee420102
Reviewed-on: https://go-review.googlesource.com/c/go/+/300989
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
4 years agocmd: move GOEXPERIMENT knob from make.bash to cmd/go
Matthew Dempsky [Thu, 24 Dec 2020 03:49:39 +0000 (19:49 -0800)]
cmd: move GOEXPERIMENT knob from make.bash to cmd/go

This CL changes GOEXPERIMENT to act like other GO[CONFIG] environment
variables. Namely, that it can be set at make.bash time to provide a
default value used by the toolchain, but then can be manually set when
running either cmd/go or the individual tools (compiler, assembler,
linker).

For example, it's now possible to test rsc.io/tmp/fieldtrack by simply
running:

GOEXPERIMENT=fieldtrack go test -gcflags=-l rsc.io/tmp/fieldtrack \
  -ldflags=-k=rsc.io/tmp/fieldtrack.tracked

without needing to re-run make.bash. (-gcflags=-l is needed because
the compiler's inlining abilities have improved, so calling a function
with a for loop is no longer sufficient to suppress inlining.)

Fixes #42681.

Change-Id: I2cf8995d5d0d05f6785a2ee1d3b54b2cfb3331ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/300991
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
4 years agonet/http: revert change to generated file from CL 296152
Bryan C. Mills [Thu, 11 Mar 2021 20:04:16 +0000 (15:04 -0500)]
net/http: revert change to generated file from CL 296152

This file is generated, so the fix needs to happen upstream.
The file can then be regenerated using 'go generate net/http'.

Updates #44143

Change-Id: I13a1e7677470ba84a06976e5bbe24f4ce1e7cfb2
Reviewed-on: https://go-review.googlesource.com/c/go/+/301069
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agocmd/go: remove some fsyncs when writing files
Michael Matloob [Fri, 11 Dec 2020 22:03:17 +0000 (17:03 -0500)]
cmd/go: remove some fsyncs when writing files

cache.Trim, dowloadZip, rewriteVersionList, writeDiskCache all use
renameio.WriteFile to write their respective files to disk. For the
uses in cache.Trim and downloadZip, instead do of renameio.WriteFile,
do a truncate to the length of the file, then write the relevant bytes
so that a corrupt file (which would contain null bytes because of
the truncate) could be detected. For rewriteVersionList, use
lockedfile.Transform to do the write (which does a truncate as part of
the write too. writeDiskCache stays the same in this CL.

Also desete renameio methods that aren't used and remove the
renameio.WriteFile wrapper and just use renameio.WriteToFile which it
wraps.

There is a possibility of corrupt files in the cache (which was true
even before this CL) so later CLs will add facilities to clear corrupt
files in the cache.

Change-Id: I0d0bda40095e4cb898314315bf313e71650d8d25
Reviewed-on: https://go-review.googlesource.com/c/go/+/277412
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
4 years agocmd/compile: optimize multi-register shifts on amd64
Josh Bleecher Snyder [Fri, 8 Jan 2021 03:25:05 +0000 (19:25 -0800)]
cmd/compile: optimize multi-register shifts on amd64

amd64 can shift in bits from another register instead of filling with 0/1.
This pattern is helpful when implementing 128 bit shifts or arbitrary length shifts.
In the standard library, it shows up in pure Go math/big.

Benchmarks results on amd64 with -tags=math_big_pure_go.

name                          old time/op  new time/op  delta
NonZeroShifts/1/shrVU-8       4.45ns ± 3%  4.39ns ± 1%   -1.28%  (p=0.000 n=30+27)
NonZeroShifts/1/shlVU-8       4.13ns ± 4%  4.10ns ± 2%     ~     (p=0.254 n=29+28)
NonZeroShifts/2/shrVU-8       5.55ns ± 1%  5.63ns ± 2%   +1.42%  (p=0.000 n=28+29)
NonZeroShifts/2/shlVU-8       5.70ns ± 2%  5.14ns ± 1%   -9.82%  (p=0.000 n=29+28)
NonZeroShifts/3/shrVU-8       6.79ns ± 2%  6.35ns ± 2%   -6.46%  (p=0.000 n=28+29)
NonZeroShifts/3/shlVU-8       6.69ns ± 1%  6.25ns ± 1%   -6.60%  (p=0.000 n=28+27)
NonZeroShifts/4/shrVU-8       7.79ns ± 2%  7.06ns ± 2%   -9.48%  (p=0.000 n=30+30)
NonZeroShifts/4/shlVU-8       7.82ns ± 1%  7.24ns ± 1%   -7.37%  (p=0.000 n=28+29)
NonZeroShifts/5/shrVU-8       8.90ns ± 3%  7.93ns ± 1%  -10.84%  (p=0.000 n=29+26)
NonZeroShifts/5/shlVU-8       8.68ns ± 1%  7.92ns ± 1%   -8.76%  (p=0.000 n=29+29)
NonZeroShifts/10/shrVU-8      14.4ns ± 1%  12.3ns ± 2%  -14.79%  (p=0.000 n=28+29)
NonZeroShifts/10/shlVU-8      14.1ns ± 1%  11.9ns ± 2%  -15.55%  (p=0.000 n=28+27)
NonZeroShifts/100/shrVU-8      118ns ± 1%    96ns ± 3%  -18.82%  (p=0.000 n=30+29)
NonZeroShifts/100/shlVU-8      120ns ± 2%    98ns ± 2%  -18.46%  (p=0.000 n=29+28)
NonZeroShifts/1000/shrVU-8    1.10µs ± 1%  0.88µs ± 2%  -19.63%  (p=0.000 n=29+30)
NonZeroShifts/1000/shlVU-8    1.10µs ± 2%  0.88µs ± 2%  -20.28%  (p=0.000 n=29+28)
NonZeroShifts/10000/shrVU-8   10.9µs ± 1%   8.7µs ± 1%  -19.78%  (p=0.000 n=28+27)
NonZeroShifts/10000/shlVU-8   10.9µs ± 2%   8.7µs ± 1%  -19.64%  (p=0.000 n=29+27)
NonZeroShifts/100000/shrVU-8   111µs ± 2%    90µs ± 2%  -19.39%  (p=0.000 n=28+29)
NonZeroShifts/100000/shlVU-8   113µs ± 2%    90µs ± 2%  -20.43%  (p=0.000 n=30+27)

The assembly version is still faster, unfortunately, but the gap is narrowing.
Speedup from pure Go to assembly:

name                          old time/op  new time/op  delta
NonZeroShifts/1/shrVU-8       4.39ns ± 1%  3.45ns ± 2%  -21.36%  (p=0.000 n=27+29)
NonZeroShifts/1/shlVU-8       4.10ns ± 2%  3.47ns ± 3%  -15.42%  (p=0.000 n=28+30)
NonZeroShifts/2/shrVU-8       5.63ns ± 2%  3.97ns ± 0%  -29.40%  (p=0.000 n=29+25)
NonZeroShifts/2/shlVU-8       5.14ns ± 1%  3.77ns ± 2%  -26.65%  (p=0.000 n=28+26)
NonZeroShifts/3/shrVU-8       6.35ns ± 2%  4.79ns ± 2%  -24.52%  (p=0.000 n=29+29)
NonZeroShifts/3/shlVU-8       6.25ns ± 1%  4.42ns ± 1%  -29.29%  (p=0.000 n=27+26)
NonZeroShifts/4/shrVU-8       7.06ns ± 2%  5.64ns ± 1%  -20.05%  (p=0.000 n=30+29)
NonZeroShifts/4/shlVU-8       7.24ns ± 1%  5.34ns ± 2%  -26.23%  (p=0.000 n=29+29)
NonZeroShifts/5/shrVU-8       7.93ns ± 1%  6.56ns ± 2%  -17.26%  (p=0.000 n=26+30)
NonZeroShifts/5/shlVU-8       7.92ns ± 1%  6.27ns ± 1%  -20.79%  (p=0.000 n=29+25)
NonZeroShifts/10/shrVU-8      12.3ns ± 2%  10.2ns ± 2%  -17.21%  (p=0.000 n=29+29)
NonZeroShifts/10/shlVU-8      11.9ns ± 2%  10.5ns ± 2%  -12.45%  (p=0.000 n=27+29)
NonZeroShifts/100/shrVU-8     95.9ns ± 3%  77.7ns ± 1%  -19.00%  (p=0.000 n=29+30)
NonZeroShifts/100/shlVU-8     97.5ns ± 2%  66.8ns ± 2%  -31.47%  (p=0.000 n=28+30)
NonZeroShifts/1000/shrVU-8     884ns ± 2%   705ns ± 1%  -20.17%  (p=0.000 n=30+28)
NonZeroShifts/1000/shlVU-8     880ns ± 2%   590ns ± 1%  -32.96%  (p=0.000 n=28+25)
NonZeroShifts/10000/shrVU-8   8.74µs ± 1%  7.34µs ± 3%  -15.94%  (p=0.000 n=27+30)
NonZeroShifts/10000/shlVU-8   8.73µs ± 1%  6.00µs ± 1%  -31.25%  (p=0.000 n=27+28)
NonZeroShifts/100000/shrVU-8  89.6µs ± 2%  75.5µs ± 2%  -15.80%  (p=0.000 n=29+29)
NonZeroShifts/100000/shlVU-8  89.6µs ± 2%  68.0µs ± 3%  -24.09%  (p=0.000 n=27+30)

Change-Id: I18f58d8f5513d737d9cdf09b8f9d14011ffe3958
Reviewed-on: https://go-review.googlesource.com/c/go/+/297050
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
4 years agohash/maphash: increase the buffer size
Josh Bleecher Snyder [Thu, 17 Dec 2020 04:28:43 +0000 (20:28 -0800)]
hash/maphash: increase the buffer size

This helps a lot for larger writes.

name            old time/op    new time/op    delta
Hash8Bytes-8      16.5ns ± 4%    16.8ns ± 2%   +1.76%  (p=0.000 n=29+30)
Hash320Bytes-8    55.0ns ± 2%    41.4ns ± 2%  -24.64%  (p=0.000 n=28+28)
Hash1K-8           190ns ± 2%     130ns ± 3%  -31.65%  (p=0.000 n=30+30)
Hash8K-8          1.57µs ± 2%    1.05µs ± 3%  -33.01%  (p=0.000 n=30+29)

name            old speed      new speed      delta
Hash8Bytes-8     485MB/s ± 4%   476MB/s ± 2%   -1.73%  (p=0.000 n=29+30)
Hash320Bytes-8  5.82GB/s ± 2%  7.72GB/s ± 3%  +32.55%  (p=0.000 n=28+29)
Hash1K-8        5.39GB/s ± 2%  7.88GB/s ± 3%  +46.32%  (p=0.000 n=30+30)
Hash8K-8        5.21GB/s ± 2%  7.77GB/s ± 3%  +49.28%  (p=0.000 n=30+29)

Updates #42710

Change-Id: Idaf4b2a8a41fc62fc16b54c9358cf2cc7009cf29
Reviewed-on: https://go-review.googlesource.com/c/go/+/278760
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
4 years agohash/maphash: optimize Write and WriteString
Josh Bleecher Snyder [Thu, 17 Dec 2020 03:38:39 +0000 (19:38 -0800)]
hash/maphash: optimize Write and WriteString

The existing code makes copies of every byte it hashes.
When passed a large chunk of memory, Write and WriteString
can skip the copying and initSeed for most of it.

To ensure that Write, WriteByte, and WriteString continue to
generate output that depends only on the sequence of bytes,
expand the grouping test to include WriteString and interleaved calls.
Also, make the test process a lot more data, to ensure that
Write* handled full buffers correctly.

name            old time/op    new time/op    delta
Hash8Bytes-8      17.1ns ± 3%    16.5ns ± 2%   -3.26%  (p=0.000 n=29+27)
Hash320Bytes-8    74.9ns ± 2%    58.5ns ± 2%  -21.86%  (p=0.000 n=30+29)
Hash1K-8           246ns ± 3%     195ns ± 1%  -20.82%  (p=0.000 n=29+30)
Hash8K-8          1.87µs ± 2%    1.59µs ± 2%  -15.04%  (p=0.000 n=26+30)

name            old speed      new speed      delta
Hash8Bytes-8     468MB/s ± 3%   484MB/s ± 2%   +3.36%  (p=0.000 n=29+27)
Hash320Bytes-8  4.28GB/s ± 2%  5.47GB/s ± 2%  +27.97%  (p=0.000 n=30+29)
Hash1K-8        4.17GB/s ± 3%  5.26GB/s ± 1%  +26.28%  (p=0.000 n=29+30)
Hash8K-8        4.38GB/s ± 2%  5.16GB/s ± 2%  +17.70%  (p=0.000 n=26+30)

Updates #42710

Change-Id: If3cdec1580ffb3e36fab9865e5a9d089c0a34bec
Reviewed-on: https://go-review.googlesource.com/c/go/+/278758
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
4 years agohash/maphash: manually inline setSeed
Josh Bleecher Snyder [Thu, 17 Dec 2020 04:22:58 +0000 (20:22 -0800)]
hash/maphash: manually inline setSeed

Provides a minor performance win.

name            old time/op    new time/op    delta
Hash8Bytes-8      16.5ns ± 2%    16.5ns ± 4%    ~     (p=0.407 n=27+29)
Hash320Bytes-8    58.5ns ± 2%    55.0ns ± 2%  -6.01%  (p=0.000 n=29+28)
Hash1K-8           195ns ± 1%     190ns ± 2%  -2.23%  (p=0.000 n=30+30)
Hash8K-8          1.59µs ± 2%    1.57µs ± 2%  -0.88%  (p=0.002 n=30+30)

name            old speed      new speed      delta
Hash8Bytes-8     484MB/s ± 2%   485MB/s ± 4%    ~     (p=0.417 n=27+29)
Hash320Bytes-8  5.47GB/s ± 2%  5.82GB/s ± 2%  +6.39%  (p=0.000 n=29+28)
Hash1K-8        5.26GB/s ± 1%  5.39GB/s ± 2%  +2.29%  (p=0.000 n=30+30)
Hash8K-8        5.16GB/s ± 2%  5.21GB/s ± 2%  +0.89%  (p=0.002 n=30+30)

Updates #42710

Change-Id: Ia0d7264b648f96099202de21c6b69a9c1776f6c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/278759
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agotesting/fstest: clarify TestFS docs
Josh Bleecher Snyder [Thu, 25 Feb 2021 19:10:57 +0000 (11:10 -0800)]
testing/fstest: clarify TestFS docs

The sentence starts "fsys must only contain",
which leads the reader to believe that fsys must not contain others.
The rapid reversal leads to confusion.
I had to read it several times to be sure I'd parsed it correctly.

Remove "only"; rely on the rest of the sentence to clarify.

Change-Id: I9fb7935aed4f9839344d3a00b761d20981fba864
Reviewed-on: https://go-review.googlesource.com/c/go/+/296529
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agotesting/fstest: test that ReadDirFile on a non-dir fails
Josh Bleecher Snyder [Thu, 25 Feb 2021 17:44:35 +0000 (09:44 -0800)]
testing/fstest: test that ReadDirFile on a non-dir fails

ReadDirFile implementations should return an error for non-directories.

Change-Id: I99888562cb6cf829017904ae8c1e8887a416c4cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/296391
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agoio/fs: clarify additional File interface docs
Josh Bleecher Snyder [Thu, 25 Feb 2021 17:32:38 +0000 (09:32 -0800)]
io/fs: clarify additional File interface docs

Emphasize ReadDirFile. It isn't really optional,
and all filesystems have at least one directory (".").

The remaining two additional interfaces are optimizations.
Call them that.

Fully qualify package package io identifiers.

Change-Id: Ibc425a5dfd27e08c2c10c353f780e4a6304cfd87
Reviewed-on: https://go-review.googlesource.com/c/go/+/296390
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agocmd/link: fix glink resolver generation on ppc64le
Paul E. Murphy [Wed, 10 Mar 2021 20:32:27 +0000 (14:32 -0600)]
cmd/link: fix glink resolver generation on ppc64le

AddSymRef grows the section to fit the relocation. This was not
being accounted for. Instead, add a relocation and explicitly
populate it so we patch the desired instructions.

Change-Id: I583147e2545aea34c854f9d35ca920c57be60b90
Reviewed-on: https://go-review.googlesource.com/c/go/+/300949
Run-TryBot: Paul Murphy <murp@ibm.com>
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>

4 years agoruntime: support register ABI for finalizers
Michael Anthony Knyszek [Thu, 22 Oct 2020 16:55:55 +0000 (16:55 +0000)]
runtime: support register ABI for finalizers

This change modifies runfinq to properly pass arguments to finalizers in
registers via reflectcall.

For #40724.

Change-Id: I414c0eff466ef315a0eb10507994e598dd29ccb2
Reviewed-on: https://go-review.googlesource.com/c/go/+/300112
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agotest: add test that caused a gofrontend internal error
Ian Lance Taylor [Thu, 11 Mar 2021 03:35:22 +0000 (19:35 -0800)]
test: add test that caused a gofrontend internal error

For #44383

Change-Id: I3610105dad3574e210e226d3ba80a4ba5a7eeaa6
Reviewed-on: https://go-review.googlesource.com/c/go/+/300789
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agodocs: clarify when APIs use context.Background.
Matt T. Proud [Thu, 25 Feb 2021 00:03:35 +0000 (01:03 +0100)]
docs: clarify when APIs use context.Background.

The Go standard library retrofitted context support onto existing APIs
using context.Background and later offered variants that directly
supported user-defined context value specification. This commit makes
that behavior clear in documentation and suggests context-aware
alternatives if the user is looking for one.

An example motivation is supporting code for use in systems that expect
APIs to be cancelable for lifecycle correctness or load
shedding/management reasons, as alluded to in
https://blog.golang.org/context-and-structs.

Updates #44143

Change-Id: I2d7f954ddf9b48264d5ebc8d0007058ff9bddf14
Reviewed-on: https://go-review.googlesource.com/c/go/+/296152
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Jean de Klerk <deklerk@google.com>
Trust: Jean de Klerk <deklerk@google.com>
Run-TryBot: Jean de Klerk <deklerk@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agosyscall: use runtime.KeepAlive for ProcThreadAttributeList arguments
Jason A. Donenfeld [Wed, 10 Mar 2021 14:21:56 +0000 (07:21 -0700)]
syscall: use runtime.KeepAlive for ProcThreadAttributeList arguments

It turns out that if you write Go pointers to Go memory, the Go compiler
must be involved so that it generates various calls to the GC in the
process. Letting Windows write Go pointers to Go memory violated this.
So, we replace that with just a boring call to runtime.KeepAlive. That's
not a great API, but this is all internal code anyway. We fix it up
more elegantly for external consumption in x/sys/windows with CL 300369.

Fixes #44900.

Change-Id: Id6599a793af9c4815f6c9387b00796923f32cb97
Reviewed-on: https://go-review.googlesource.com/c/go/+/300349
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years agocrypto/rand, internal/syscall/unix: add support for getrandom syscall on solaris
Tobias Klauser [Wed, 10 Mar 2021 09:26:20 +0000 (10:26 +0100)]
crypto/rand, internal/syscall/unix: add support for getrandom syscall on solaris

The getrandom syscall is available on Solaris and Illumos, see
https://docs.oracle.com/cd/E88353_01/html/E37841/getrandom-2.html and
https://illumos.org/man/2/getrandom

Change-Id: Id1c65d6a5b2fbc80d20b43d8b32dab137ca950ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/299134
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agointernal/syscall/unix: unify GetRandom implementation
Tobias Klauser [Wed, 10 Mar 2021 09:06:11 +0000 (10:06 +0100)]
internal/syscall/unix: unify GetRandom implementation

The implementation of GetRandom for Linux, FreeBSD and DragonflyBSD can
be shared.

Also remove GRND_INSECURE on DragonflyBSD as pointed out by Ian in the
review of CL 269999.

Change-Id: I5bf4c1bd51ddb2ad600652a57e0bc1bafa1cf40d
Reviewed-on: https://go-review.googlesource.com/c/go/+/299133
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agocmd/dist: refactor test constraints for misc/cgo/testsantizers
fanzha02 [Mon, 1 Mar 2021 02:34:08 +0000 (10:34 +0800)]
cmd/dist: refactor test constraints for misc/cgo/testsantizers

Currently, the cmd/dist runs test cases in misc/cgo/testsantizers only
when memeory sanitizer is supported, but the tsan tests in
misc/cgo/testsanitizers do not require support for -msan option, which
makes tsan tests can not be run on some unsupported -msan option platforms.

Therefore, this patch moves the test constraints from cmd/dist to
msan_test.go, so that the tsan tests in misc/cgo/testsanitizers
can be run on any system where the C compiler supports -fsanitize=thread
option.

Change-Id: I779c92eedd0270050f1a0b1a69ecce50c3712bc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/297774
Trust: fannie zhang <Fannie.Zhang@arm.com>
Run-TryBot: fannie zhang <Fannie.Zhang@arm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agocmd/compile: remove 8-byte alignment requirement of stack slot on ppc64
eric fang [Tue, 2 Mar 2021 06:05:00 +0000 (06:05 +0000)]
cmd/compile: remove 8-byte alignment requirement of stack slot on ppc64

This CL applies CL 267999 to ppc64.

Fixes #42385

Change-Id: I6462d647d1abdf7cec99607c40ef4d1fed1941e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/297770
Reviewed-by: eric fang <eric.fang@arm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: eric fang <eric.fang@arm.com>

4 years agocmd/compile: fix handling of partially inferred type arguments
Dan Scales [Wed, 10 Mar 2021 02:24:51 +0000 (18:24 -0800)]
cmd/compile: fix handling of partially inferred type arguments

In the case of partially inferred type arguments, we need to use the
IndexExpr as the key in g.info.Inferred[] rather than the CallExpr.

Added an extra fromStrings1 call in the settable.go test that tests
partially inferred type arguments. This new call uses a new concrete
type SettableString as well.

I also added another implementation fromStrings3 (derived from a go2go
tests) that typechecks but intentionally causes a panic.

Change-Id: I74d35c5a741f72f37160a96fbec939451157f392
Reviewed-on: https://go-review.googlesource.com/c/go/+/300309
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
4 years agocmd/internal/obj: remove param element from ppc64 optab
Paul E. Murphy [Tue, 9 Mar 2021 22:54:56 +0000 (16:54 -0600)]
cmd/internal/obj: remove param element from ppc64 optab

This is rarely used, and is implied based on the
memory type of the operand.  This is a step towards
simplifying the MOV* pseudo opcodes on ppc64.

Similarly, remove the bogus param value from AVMULESB.

Change-Id: Ibad4d045ec6d8c5163a468b2db1dfb762ef674ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/300177
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Trust: Ian Lance Taylor <iant@golang.org>

4 years agoruntime, time: disable preemption in addtimer
Michael Pratt [Wed, 10 Mar 2021 21:06:47 +0000 (16:06 -0500)]
runtime, time: disable preemption in addtimer

The timerpMask optimization updates a mask of Ps (potentially)
containing timers in pidleget / pidleput. For correctness, it depends on
the assumption that new timers can only be added to a P's own heap.

addtimer violates this assumption if it is preempted after computing pp.
That G may then run on a different P, but adding a timer to the original
P's heap.

Avoid this by disabling preemption while pp is in use.

Other uses of doaddtimer should be OK:

* moveTimers: always moves to the current P's heap
* modtimer, cleantimers, addAdjustedTimers, runtimer: does not add net
  new timers to the heap while locked

Fixes #44868

Change-Id: I4a5d080865e854931d0a3a09a51ca36879101d72
Reviewed-on: https://go-review.googlesource.com/c/go/+/300610
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

4 years agocmd/go/internal/mvs: factor out an incremental implementation
Bryan C. Mills [Thu, 29 Oct 2020 01:47:32 +0000 (21:47 -0400)]
cmd/go/internal/mvs: factor out an incremental implementation

The new Graph type implements an incremental version of the MVS
algorithm, with requirements pushed in by the caller instead of pulled
by an internal MVS traversal.

To avoid redundancy going forward (and to ensure adequate test
coverage of the incremental implementation), the existing buildList
function is reimplemented in terms of Graph.

For #36460

Change-Id: Idd0b6ab8f17cc41d83a2a4c25a95f82e9ce1eab0
Reviewed-on: https://go-review.googlesource.com/c/go/+/244760
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
4 years agocmd/go/internal/modload: make EditBuildList report whether the build list was changed
Bryan C. Mills [Mon, 22 Feb 2021 22:05:32 +0000 (17:05 -0500)]
cmd/go/internal/modload: make EditBuildList report whether the build list was changed

For #36460

Change-Id: I8dd6e6f998a217a4287212815ce61209df6f007f
Reviewed-on: https://go-review.googlesource.com/c/go/+/296609
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
4 years agocmd/go/internal/modload: fuse upgrading with downgrading in EditBuildList
Bryan C. Mills [Sat, 6 Feb 2021 05:50:55 +0000 (00:50 -0500)]
cmd/go/internal/modload: fuse upgrading with downgrading in EditBuildList

Previosly, EditBuildList performed an mvs.Upgrade followed by an
mvs.Downgrade, with the Downgrade building on the result of the
Upgrade. Unfortunately, that approach potentially folds in irrelevant
dependencies from the first Upgrade, which are then preserved
unnecessarily by the Downgrade (see mod_get_downup_artifact.txt).

Now, we use the initial Upgrade only to compute the maximum allowed
versions of transitive dependencies, and apply the module upgrades and
downgrades together in a single operation.

For #36460

Change-Id: I7590c137111fed4a3b06531c88d90efd49e6943a
Reviewed-on: https://go-review.googlesource.com/c/go/+/290770
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
4 years agocmd/go: test remote lookup of packages with leading dots in path elements
Jay Conrod [Mon, 1 Mar 2021 20:18:12 +0000 (15:18 -0500)]
cmd/go: test remote lookup of packages with leading dots in path elements

Follow-up to CL 297530.

For #43985
For #34992

Change-Id: I2cfa6c41c013e627c3464c383ca42f5c9ebe521a
Reviewed-on: https://go-review.googlesource.com/c/go/+/297634
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
4 years agocmd/compile/internal: improve handling of DS form offsets on ppc64x
Lynn Boger [Mon, 8 Mar 2021 16:07:17 +0000 (10:07 -0600)]
cmd/compile/internal: improve handling of DS form offsets on ppc64x

In the ppc64 ISA DS form loads and stores are restricted to offset
fields that are a multiple of 4. This is currently handled with checks
in the rules that generate MOVDload, MOVWload, MOVDstore and
MOVDstorezero to prevent invalid instructions from getting to the
assembler.

An unhandled case was discovered which led to the search for a better
solution to this problem. Now, instead of checking the offset in the
rules, this will be detected when processing these Ops in
ssaGenValues in ppc64/ssa.go. If the offset is not valid, the address
of the symbol to be loaded or stored will be computed using the base
register + offset, and that value used in the new base register.
With the full address in the base register, the offset field can be
zero in the instruction.

Updates #44739

Change-Id: I4f3c0c469ae70a63e3add295c9b55ea0e30ef9b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/299789
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agoruntime: check partial lock ranking order
Michael Pratt [Tue, 9 Mar 2021 21:13:23 +0000 (16:13 -0500)]
runtime: check partial lock ranking order

To ease readability we typically keep the partial order lists sorted by
rank. This isn't required for correctness, it just makes it (slightly)
easier to read the lists.

Currently we must notice out-of-order entries during code review, which
is an error-prone process.

Add a test to enforce ordering, and fix the errors that have crept in.
Most of the existing errors were misordered lockRankHchan or
lockRankPollDesc.

While we're here, I've moved the correctness check that the partial
ordering satisfies the total ordering from init to a test case. This
will allow us to catch these errors without even running
staticlockranking.

Change-Id: I9c11abe49ea26c556439822bb6a3183129600c3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/300171
Trust: Michael Pratt <mpratt@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
4 years agoflag: panic if flag name begins with - or contains =
KimMachineGun [Wed, 10 Mar 2021 12:55:56 +0000 (12:55 +0000)]
flag: panic if flag name begins with - or contains =

Fixes #41792

Change-Id: I9b4aae8a899e3c3ac9532d27932d275cfb1fab48
GitHub-Last-Rev: f06b1e17674bf77bdc2d3e798df4c4379748c8d2
GitHub-Pull-Request: golang/go#42737
Reviewed-on: https://go-review.googlesource.com/c/go/+/271788
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Rob Pike <r@golang.org>

4 years agoencoding/xml: prevent infinite loop while decoding
Katie Hockman [Mon, 1 Mar 2021 14:54:00 +0000 (09:54 -0500)]
encoding/xml: prevent infinite loop while decoding

This change properly handles a TokenReader which
returns an EOF in the middle of an open XML
element.

Thanks to Sam Whited for reporting this.

Fixes CVE-2021-27918
Fixes #44913

Change-Id: Id02a3f3def4a1b415fa2d9a8e3b373eb6cb0f433
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1004594
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Filippo Valsorda <valsorda@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/300391
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
4 years agoarchive/zip: fix panic in Reader.Open
Roland Shoemaker [Tue, 2 Mar 2021 18:00:53 +0000 (10:00 -0800)]
archive/zip: fix panic in Reader.Open

When operating on a Zip file that contains a file prefixed with "../",
Open(...) would cause a panic in toValidName when attempting to strip
the prefixed path components.

Fixes CVE-2021-27919
Fixes #44916

Change-Id: Ic755d8126cb0897e2cbbdacf572439c38dde7b35
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1004761
Reviewed-by: Filippo Valsorda <valsorda@google.com>
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-by: Katie Hockman <katiehockman@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/300489
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
4 years agocmd/compile: deal with helper generic types that add methods to T
Dan Scales [Sat, 6 Mar 2021 06:07:56 +0000 (22:07 -0800)]
cmd/compile:  deal with helper generic types that add methods to T

Deal with cases like: 'type P[T any] T' (used to add methods to an
arbitrary type T), In this case, P[T] has kind types.TTYPEPARAM (as does
T itself), but requires more code to substitute than a simple TTYPEPARAM
T. See the comment near the beginning of subster.typ() in stencil.go.

Add new test absdiff.go. This test has a case for complex types (which
I've commented out) that will only work when we deal better with Go
builtins in generic functions (like real and imag).

Remove change in fmt.go for TTYPEPARAMS that is no longer needed (since
all TTYPEPARAMS have a sym) and was sometimes causing an extra prefix
when formatting method names.

Separate out the setting of a TTYPEPARAM bound, since it can reference
the TTYPEPARAM being defined, so must be done separately. Also, we don't
currently (and may not ever) need bounds after types2 typechecking.

Change-Id: Id173057e0c4563b309b95e665e9c1151ead4ba77
Reviewed-on: https://go-review.googlesource.com/c/go/+/300049
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
4 years agocmd/gofmt: fix const association to avoid inaccurate comment
Rob Findley [Wed, 10 Mar 2021 16:33:23 +0000 (11:33 -0500)]
cmd/gofmt: fix const association to avoid inaccurate comment

The const parseTypeParams was grouped with printer-related consts in
gofmt.go, implicitly suggesting that it must be kept in sync with
go/format/format.go.

Change-Id: Ia65dc15c27fef2c389f963071252adee32ec6bd6
Reviewed-on: https://go-review.googlesource.com/c/go/+/300451
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
4 years agogo/types: add missing build tag to api_go1.18_test.go
Rob Findley [Wed, 10 Mar 2021 16:30:24 +0000 (11:30 -0500)]
go/types: add missing build tag to api_go1.18_test.go

This file has a go:build comment without a corresponding +build comment.

Change-Id: Id01604242a14d8ead16ffb9aa1b45eef7706956a
Reviewed-on: https://go-review.googlesource.com/c/go/+/300450
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
4 years agoruntime/race: update dead link
Michael Pratt [Wed, 10 Mar 2021 16:41:04 +0000 (11:41 -0500)]
runtime/race: update dead link

LLVM changed their main branch name, so this link didn't work anymore.

Change-Id: I4c3a67b26e2bda012071281e29ea3c932c185130
Reviewed-on: https://go-review.googlesource.com/c/go/+/300469
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Go Bot <gobot@golang.org>