1
0
mirror of https://github.com/golang/go synced 2024-09-30 14:28:33 -06:00
Commit Graph

43416 Commits

Author SHA1 Message Date
Gerrit Code Review
cd42fa581a Merge "cmd: merge branch 'dev.link' into master" 2020-04-14 17:35:25 +00:00
Josh Bleecher Snyder
2db4cc38a0 cmd/compile: improve generated code for concrete cases in type switches
Consider

switch x:= x.(type) {
case int:
  // int stmts
case error:
  // error stmts
}

Prior to this change, we lowered this roughly as:

if x, ok := x.(int); ok {
  // int stmts
} else if x, ok := x.(error); ok {
  // error stmts
}

x, ok := x.(error) is implemented with a call to runtime.assertE2I2 or runtime.assertI2I2.

x, ok := x.(int) generates inline code that checks whether x has type int,
and populates x and ok as appropriate. We then immediately branch again on ok.
The shortcircuit pass in the SSA backend is designed to recognize situations
like this, in which we are immediately branching on a bool value
that we just calculated with a branch.

However, the shortcircuit pass has limitations when the intermediate state has phis.
In this case, the phi value is x (the int).
CL 222923 improved the situation, but many cases are still unhandled.
I have further improvements in progress, which is how I found this particular problem,
but they are expensive, and may or may not see the light of day.

In the common case of a lone concrete type in a type switch case,
it is easier and cheaper to simply lower a different way, roughly:

if _, ok := x.(int); ok {
  x := x.(int)
  // int stmts
}

Instead of using a type assertion, though, we extract the value of x
from the interface directly.

This removes the need to track x (the int) across the branch on ok,
which removes the phi, which lets the shortcircuit pass do its job.

Benchmarks for encoding/binary show improvements, as well as some
wild swings on the super fast benchmarks (alignment effects?):

name                      old time/op    new time/op    delta
ReadSlice1000Int32s-8       5.25µs ± 2%    4.87µs ± 3%   -7.11%  (p=0.000 n=44+49)
ReadStruct-8                 451ns ± 2%     417ns ± 2%   -7.39%  (p=0.000 n=45+46)
WriteStruct-8                412ns ± 2%     405ns ± 3%   -1.58%  (p=0.000 n=46+48)
ReadInts-8                   296ns ± 8%     275ns ± 3%   -7.23%  (p=0.000 n=48+50)
WriteInts-8                  324ns ± 1%     318ns ± 2%   -1.67%  (p=0.000 n=44+49)
WriteSlice1000Int32s-8      5.21µs ± 2%    4.92µs ± 1%   -5.67%  (p=0.000 n=46+44)
PutUint16-8                 0.58ns ± 2%    0.59ns ± 2%   +0.63%  (p=0.000 n=49+49)
PutUint32-8                 0.87ns ± 1%    0.58ns ± 1%  -33.10%  (p=0.000 n=46+44)
PutUint64-8                 0.66ns ± 2%    0.87ns ± 2%  +33.07%  (p=0.000 n=47+48)
LittleEndianPutUint16-8     0.86ns ± 2%    0.87ns ± 2%   +0.55%  (p=0.003 n=47+50)
LittleEndianPutUint32-8     0.87ns ± 1%    0.87ns ± 1%     ~     (p=0.547 n=45+47)
LittleEndianPutUint64-8     0.87ns ± 2%    0.87ns ± 1%     ~     (p=0.451 n=46+47)
ReadFloats-8                79.8ns ± 5%    75.9ns ± 2%   -4.83%  (p=0.000 n=50+47)
WriteFloats-8               89.3ns ± 1%    88.9ns ± 1%   -0.48%  (p=0.000 n=46+44)
ReadSlice1000Float32s-8     5.51µs ± 1%    4.87µs ± 2%  -11.74%  (p=0.000 n=47+46)
WriteSlice1000Float32s-8    5.51µs ± 1%    4.93µs ± 1%  -10.60%  (p=0.000 n=48+47)
PutUvarint32-8              25.9ns ± 2%    24.0ns ± 2%   -7.02%  (p=0.000 n=48+50)
PutUvarint64-8              75.1ns ± 1%    61.5ns ± 2%  -18.12%  (p=0.000 n=45+47)
[Geo mean]                  57.3ns         54.3ns        -5.33%

Despite the rarity of type switches, this generates noticeably smaller binaries.

file      before    after     Δ       %
addr2line 4413296   4409200   -4096   -0.093%
api       5982648   5962168   -20480  -0.342%
cgo       4854168   4833688   -20480  -0.422%
compile   19694784  19682560  -12224  -0.062%
cover     5278008   5265720   -12288  -0.233%
doc       4694824   4682536   -12288  -0.262%
fix       3411336   3394952   -16384  -0.480%
link      6721496   6717400   -4096   -0.061%
nm        4371152   4358864   -12288  -0.281%
objdump   4760960   4752768   -8192   -0.172%
pprof     14810820  14790340  -20480  -0.138%
trace     11681076  11668788  -12288  -0.105%
vet       8285464   8244504   -40960  -0.494%
total     115824120 115627576 -196544 -0.170%

Compiler performance is marginally improved (note that go/types has many type switches):

name        old alloc/op      new alloc/op      delta
Template         35.0MB ± 0%       35.0MB ± 0%  +0.09%  (p=0.008 n=5+5)
Unicode          28.5MB ± 0%       28.5MB ± 0%    ~     (p=0.548 n=5+5)
GoTypes           114MB ± 0%        114MB ± 0%  -0.76%  (p=0.008 n=5+5)
Compiler          541MB ± 0%        541MB ± 0%  -0.03%  (p=0.008 n=5+5)
SSA              1.17GB ± 0%       1.17GB ± 0%    ~     (p=0.841 n=5+5)
Flate            21.9MB ± 0%       21.9MB ± 0%    ~     (p=0.421 n=5+5)
GoParser         26.9MB ± 0%       26.9MB ± 0%    ~     (p=0.222 n=5+5)
Reflect          74.6MB ± 0%       74.6MB ± 0%    ~     (p=1.000 n=5+5)
Tar              32.9MB ± 0%       32.8MB ± 0%    ~     (p=0.056 n=5+5)
XML              42.4MB ± 0%       42.1MB ± 0%  -0.77%  (p=0.008 n=5+5)
[Geo mean]       73.2MB            73.1MB       -0.15%

name        old allocs/op     new allocs/op     delta
Template           377k ± 0%         377k ± 0%  +0.06%  (p=0.008 n=5+5)
Unicode            354k ± 0%         354k ± 0%    ~     (p=0.095 n=5+5)
GoTypes           1.31M ± 0%        1.30M ± 0%  -0.73%  (p=0.008 n=5+5)
Compiler          5.44M ± 0%        5.44M ± 0%  -0.04%  (p=0.008 n=5+5)
SSA               11.7M ± 0%        11.7M ± 0%    ~     (p=1.000 n=5+5)
Flate              239k ± 0%         239k ± 0%    ~     (p=1.000 n=5+5)
GoParser           302k ± 0%         302k ± 0%  -0.04%  (p=0.008 n=5+5)
Reflect            977k ± 0%         977k ± 0%    ~     (p=0.690 n=5+5)
Tar                346k ± 0%         346k ± 0%    ~     (p=0.889 n=5+5)
XML                431k ± 0%         430k ± 0%  -0.25%  (p=0.008 n=5+5)
[Geo mean]         806k              806k       -0.10%

For packages with many type switches, this considerably shrinks function text size.
Some examples:

file                                                           before   after    Δ       %
encoding/binary.s                                              30726    29504    -1222   -3.977%
go/printer.s                                                   77597    76005    -1592   -2.052%
cmd/vendor/golang.org/x/tools/go/ast/astutil.s                 65704    63318    -2386   -3.631%
cmd/vendor/golang.org/x/tools/go/analysis/passes/unreachable.s 8047     7714     -333    -4.138%

Text size regressions are rare.

Change-Id: Ic10982bbb04876250eaa5bfee97990141ae5fc28
Reviewed-on: https://go-review.googlesource.com/c/go/+/228106
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2020-04-14 17:34:31 +00:00
Cherry Zhang
ce122624f0 cmd: merge branch 'dev.link' into master
In the dev.link branch we continued developing the new object
file format support and the linker improvements described in
https://golang.org/s/better-linker . Since the last merge, more
progress has been made to improve the new linker.

This is a clean merge, as we already merged master branch to
dev.link first.

Change-Id: I1fef2b1d94bd2410001142da8991544da5ee896d
2020-04-14 13:06:42 -04:00
Cherry Zhang
3216d14f78 [dev.link] cmd/oldlink: update with recent change
Port CL 227864 to cmd/oldlink.

Change-Id: Ib05628e59a6616f422111b564a72c908c44062a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/228227
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-14 16:59:38 +00:00
Cuong Manh Le
54cbb6b0c2 cmd/compile: mark static arrays when initialize map literal as noalg
Same thing as CL 228222 does with static slice.

file      before    after     Δ       %
go        15228932  15228756  -176    -0.001%
addr2line 4429680   4429616   -64     -0.001%
api       5999032   5994904   -4128   -0.069%
asm       5087928   5087864   -64     -0.001%
compile   19727984  19723792  -4192   -0.021%
cover     5290296   5290184   -112    -0.002%
dist      3711816   3711784   -32     -0.001%
doc       4711208   4711176   -32     -0.001%
nm        4379344   4379264   -80     -0.002%
objdump   4773248   4773168   -80     -0.002%
pprof     14856148  14855764  -384    -0.003%
trace     11718212  11718020  -192    -0.002%
vet       8305944   8301768   -4176   -0.050%
total     131377612 131363900 -13712  -0.010%

Change-Id: I5ec00580b1509486c13aca43ad8f5cc7c450b62e
Reviewed-on: https://go-review.googlesource.com/c/go/+/227812
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-14 16:39:49 +00:00
Josh Bleecher Snyder
2222e0601a cmd/compile: mark static slice backing arrays as noalg
file      before    after     Δ       %       
addr2line 4413296   4404160   -9136   -0.207% 
api       5982648   5978232   -4416   -0.074% 
asm       5075640   5057656   -17984  -0.354% 
buildid   2886200   2881304   -4896   -0.170% 
cgo       4854168   4844936   -9232   -0.190% 
compile   19694784  19680752  -14032  -0.071% 
cover     5278008   5269256   -8752   -0.166% 
dist      3699528   3690984   -8544   -0.231% 
doc       4694824   4690408   -4416   -0.094% 
fix       3411336   3411048   -288    -0.008% 
link      6721496   6703320   -18176  -0.270% 
nm        4371152   4357904   -13248  -0.303% 
objdump   4760960   4747680   -13280  -0.279% 
pack      2340824   2336520   -4304   -0.184% 
pprof     14810820  14801188  -9632   -0.065% 
test2json 2861896   2857528   -4368   -0.153% 
trace     11681076  11676228  -4848   -0.042% 
vet       8285464   8276184   -9280   -0.112% 
total     115824120 115665288 -158832 -0.137% 

Change-Id: I66e1985c3a81cd9b2aa72cb4b4a8aa1781e473b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/228222
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2020-04-14 16:09:47 +00:00
Cherry Zhang
54c050e9ca [dev.link] all: merge branch 'master' into dev.link
Change-Id: I31a52b1840ea773d23f5cc60484131ddf898b841
2020-04-14 12:08:07 -04:00
Jeremy Faller
e77c99ce4c [dev.link] cmd/link: remove some globals from symtab.go
Change-Id: Ia2540779c1bf01248591568e1ddef1eef6edc20e
Reviewed-on: https://go-review.googlesource.com/c/go/+/227917
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-14 13:54:31 +00:00
Cuong Manh Le
34e38ac99f cmd/compile: remove "special return in disguise" case
ascompatee does not generate 'x = x' during return, so we don't have to
check for samelist and disguising special return anymore.

While at it, also remove samelist, as this is the only place it's used.

Passes toolstash-check.

Change-Id: I41c7b077d562aadb5916a61e2ab6229bae3cdef4
Reviewed-on: https://go-review.googlesource.com/c/go/+/227807
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-04-14 07:12:17 +00:00
Robert Griesemer
f3424ceff2 go/types: use same local variable consistently (minor cleanup)
Currently this CL has no effect because V == x.typ in the affected
code. But if we should ever manipulate V (e.g., to support some form
of lazy evaluation of the type), not using V consistently would
lead to a subtle bug.

Change-Id: I465e72d18bbd2b6cd8fcbd746e0d28d14f758c03
Reviewed-on: https://go-review.googlesource.com/c/go/+/228105
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-14 05:11:01 +00:00
Obeyda Djeffal
201cb046b7 time: quote original value in errors returned by ParseDuration
Quote original values passed as substring of ParseError.Message.
Improves the user experience of ParseDuration by making it
quote its original argument, for example:

   _, err := time.ParseDuration("for breakfast")
 will now produce an error, which when printed out is:

  time: invalid duration "for breakfast"
 instead of:

  time: invalid duration for breakfast

Adapt test cases for format.Parse and format.ParseDuration.

Fixes #38295

Change-Id: Ife322c8f3c859e1e4e8dd546d4cf0d519b4bfa81
Reviewed-on: https://go-review.googlesource.com/c/go/+/227878
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-14 00:01:14 +00:00
Ian Lance Taylor
5a706d163d Revert "time/tzdata: new package"
This reverts CL 224588.

Reason for revert: Test failing on secondary platforms.

Change-Id: Ic15fdc73a0d2b860e776733abb82c58809e13160
Reviewed-on: https://go-review.googlesource.com/c/go/+/228200
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-13 23:27:02 +00:00
Eric
240eac38e1 io: simplify Examples
- CopyN: 5 creates ambiguity with respect to whitespace and upperbound
- TeeReader less boilerplate and displays a common usage of it
- SectionReader_* all sections unified to 5:17 for clarity
- SectionReader_Seek uses io.Copy to stdout like other examples
- Seeker_Seek remove useless prints
- Pipe print reader like other examples

Updates #36417

Change-Id: Ibd01761d5a5786cdb1ea934f7a98f8302430c8a5
GitHub-Last-Rev: 4c17f9a8e3
GitHub-Pull-Request: golang/go#38379
Reviewed-on: https://go-review.googlesource.com/c/go/+/227868
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-13 22:48:16 +00:00
Cherry Zhang
ca017a6fb9 cmd/link: don't split container symbols when write blocks
We split the output into blocks and write them in parallel. The
block boundary is placed at symbol boundary. In the case of outer
symbols and sub symbols, currently we may split an outer symbol
into two blocks. This will be bad, as the two blocks will have
overlapping address range, since outer symbol and its sub symbols
occupies the same address range.

Make sure we place block boundary only at top-level symbol
boundaries.

Fix boringcrypto build.

Change-Id: I56811d3969c65c6be97672d8e1f1ea36b2447465
Reviewed-on: https://go-review.googlesource.com/c/go/+/227957
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
(cherry picked from commit 636fa3148f)
Reviewed-on: https://go-review.googlesource.com/c/go/+/228138
2020-04-13 22:38:56 +00:00
Cherry Zhang
1b15c7f102 cmd/compile: debug rewrite
If -d=ssa/PASS/debug=N is specified (N >= 2) for a rewrite pass
(e.g. lower), when a Value (or Block) is rewritten, print the
Value (or Block) before and after.

For #31915.
Updates #19013.

Change-Id: I80eadd44302ae736bc7daed0ef68529ab7a16776
Reviewed-on: https://go-review.googlesource.com/c/go/+/176718
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-04-13 21:56:15 +00:00
Ian Lance Taylor
6d63a74f8e time/tzdata: new package
Importing the time/tzdata package will embed a copy of the IANA
timezone database into the program. This will let the program work
correctly when the timezone database is not available on the system.
It will increase the size of the binary by about 800K.

You can also build a program with -tags timetzdata to embed the
timezone database in the program being built.

Fixes #21881
Fixes #38013
Fixes #38017

Change-Id: Iffddee72a8f46c95fee3bcde43c142d6899d9246
Reviewed-on: https://go-review.googlesource.com/c/go/+/224588
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-04-13 21:01:56 +00:00
Katie Hockman
300ed43795 crypto/x509: fix test to prevent Gerrit keycheck errors
Change-Id: I9e6a11c7d8c61d0182467438b35eb6756db7aa89
Reviewed-on: https://go-review.googlesource.com/c/go/+/228198
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2020-04-13 20:38:15 +00:00
Michael Pratt
ce52871948 runtime/pprof: clarify recursive inline heuristic
Following CL 226818, the compiler will allow inlining a single cycle in
an inline chain. Immediately-recursive functions are still disallowed,
which is what this heuristic refers to.

Add a regression test for this case.

Note that in addition to this check, if the compiler were to inline
multiple cycles via a loop (i.e., rather than appending duplicate code),
much more work would be required here to handle a single address
appearing in multiple different inline frames.

Updates #29737

Change-Id: I88de15cfbeabb9c04381e1c12cc36778623132a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/227346
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2020-04-13 20:37:17 +00:00
Michael Pratt
796475ce1f runtime/pprof: try to use real stack in TestTryAdd
TestTryAdd is particularly brittle because it tests some real cases by
constructing fake sample stack frames. If those frames don't correctly
represent what the runtime would generate then they may fail to catch
regressions.

Instead, call runtime.Callers at the bottom of real function calls to
generate real frames as a base for truncation, etc in tests. Several of
these tests still have to fake parts of the frames to test the right
thing, but this is a bit less fragile.

This change is equivalent to the original
0dfb0513ec (golang.org/cl/227484), except
that the test skips if the test functions aren't inline (e.g., noopt
builders).

Change-Id: Ie9e32b5660cfe28a924f9cfcddcd887ea2effd66
Reviewed-on: https://go-review.googlesource.com/c/go/+/227922
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-04-13 20:37:04 +00:00
Katie Hockman
6f3a9515b6 crypto/x509: generate SubjectKeyId for CAs
Fixes #26676

Change-Id: I5bc91d4a8161bc6ff25effcf93f551f735fef115
Reviewed-on: https://go-review.googlesource.com/c/go/+/227098
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2020-04-13 20:22:26 +00:00
Jonathan Amsterdam
7b5303d08a errors: add example for Is
Add ExampleIs to illustrate how errors.Is works.

Updates #31716.
Updates #38369.

Change-Id: I1b9a6667614635aa3a5ed8b2c108d8eb6f35748b
Reviewed-on: https://go-review.googlesource.com/c/go/+/228038
Reviewed-by: Damien Neil <dneil@google.com>
2020-04-13 20:04:56 +00:00
Tobias Klauser
82fcf749bd cmd/cgo: fix parameter name in godoc comment for badPointerTypedef
The parameter name is dt, not t. Also, line-wrap the godoc comment.

Change-Id: Ie012d2a5680525b88e244a3380d72bc4f61da8e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/228058
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-13 18:08:35 +00:00
Cherry Zhang
68305f3fec [dev.link] cmd/link: remove symbol.FuncInfo
It is no longer used. The only remaining use is in generating
Plan 9 debug info, which is already not supported.

Change-Id: Ia023d6f2fa7d57b97ba861ce464e2eec8ac2d1f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/228142
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-13 17:48:49 +00:00
Cherry Zhang
14cf804aa0 [dev.link] cmd/link: stop populating lib/unit.Textp
lib.Textp was used for text address assignment and trampoline
insertion. Now that it has been converted to using the loader,
no need to populate lib.Textp.

Port the logic of canonicalizing dupok symbol's package to the
loader.

unit.Textp was used for DWARF generation, which has also been
converted to using the loader.

Change-Id: I22d4dd30a52a29dd5b1b7b795d43a19f6215e4ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/228140
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-13 17:48:39 +00:00
Katie Hockman
614a713be5 crypto/tls: failed tls.Conn.Write returns a permanent error
Fixes #29971

Change-Id: I2f1653640c88fafe0ec17a75dcf41d5896c4cb8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/227840
Run-TryBot: Katie Hockman <katie@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-13 17:38:02 +00:00
Bryan C. Mills
bd0623b4e7 Revert "cmd/internal/obj/ppc64: add support for pcalign 32 on ppc64x"
This reverts CL 227775.

Reason for revert: broke aix-ppc64 builder (https://build.golang.org/log/cf3b4f9fd09ee81f422a4b58488b9d0a2692c949).

Change-Id: I2095bb2aadb5a4064eb89ad353012503faf15709
Reviewed-on: https://go-review.googlesource.com/c/go/+/228143
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-13 17:35:14 +00:00
Joel Sing
d3d21d0a42 cmd/compile: update TestIntendedInlining for riscv64
Mark nextFreeFast as not inline, as it is too expensive to inline on riscv64.
Also remove riscv64 from non-atomic inline architectures, as we now have
atomic intrisics.

Updates #22239

Change-Id: I6e0e72c1192070e39f065bee486f48df4cc74b35
Reviewed-on: https://go-review.googlesource.com/c/go/+/227808
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-13 17:29:23 +00:00
Hana (Hyang-Ah) Kim
28a55d0123 cmd/trace: use the focustask mode for user task/region trace views
The taskid mode is based on the goroutine-oriented trace view,
which displays each goroutine as a separate row. This is good when
inspecting the interaction and timeline among related goroutines,
and the user region information (associated with each goroutine)
in detail, but when many goroutines are involved, this mode does
not scale.

The focustask mode is based on the default trace view with the
user task hierarchy at the top. Each row is a P and there are only
a handful number of Ps in most cases, so browsers can handle
this mode more gracefully. But, I had difficulty in displaying
the user region information (because a goroutine can start/stop/
migrate across Ps, and visualizing the stack of regions nicely
was complicated). It may be doable, but it's a work.

This CL surfaces the hidden focustask mode. Moreover, use it
as the default user task view mode. The taskid mode can be still
accessible through 'goroutine view' links.

Unlike taskid-based user annotation view that extends goroutine-based
trace view, the focustask view

Change-Id: Ib691a5e1dd14695fa70a0ae67bff62817025e8c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/227921
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-13 17:18:58 +00:00
Cherry Zhang
2820bcede0 [dev.link] cmd/link: stop loading FuncInfo in LoadFull
As we have converted the pclntab generation, FuncInfo is not
needed after. No need to load it.

Change-Id: Idcfe4da44dfc94d8d44509d12179b354a2e295e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/228139
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-13 15:49:20 +00:00
Keith Randall
1e820a3432 cmd/compile: ensure ... rules have compatible aux and auxint types
Otherwise, just copying the aux and auxint fields doesn't make much sense.
(Although there's no bug - it just means it isn't typechecked correctly.)

Change-Id: I4e21ac67f0c7bfd04ed5af1713cd24bca08af092
Reviewed-on: https://go-review.googlesource.com/c/go/+/227962
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-13 15:41:40 +00:00
Keith Randall
dc9879e8fd cmd/compile: convert more AMD64.rules lines to typed aux mode
Change-Id: Idded860128b1a23680520d8c2b9f6d8620dcfcc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/228077
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-13 15:41:13 +00:00
Than McIntosh
6aeaf4a0f4 [dev.link] cmd/link: fix funcfunctab crash with darwin + plugin
Fix a bug in findfunctab when building plugin on Darwin (this is
a regression introduced by CL 227842).

Change-Id: Ic610168e45a750c0a2f2b8611d5d9154e6c2622f
Reviewed-on: https://go-review.googlesource.com/c/go/+/228137
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2020-04-13 13:21:48 +00:00
Tobias Klauser
916ecbc731 internal/cpu: unify HWCap/HWCap2 comments
HWCap and HWCap2 are no longer linknamed into package runtime. Also,
merge two sentences both starting with "These are..." and don't mention
any file name where archauxv is defined, as it become outdated if
support for a new $GOOS/$GOARCH combination is added. This is e.g.
already the case for arm64, where archauxv is also defined for
freebsd/arm64.

Change-Id: I9314a66633736b12e777869a832d8b79d442a6f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/228057
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-13 10:26:24 +00:00
Kevin Burke
2545323c63 cmd/link: fix spelling error
Change-Id: I6e730a99342563a97c3b1556893c8daaf5b6ec90
Reviewed-on: https://go-review.googlesource.com/c/go/+/228097
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-13 04:28:53 +00:00
chainhelen
7242428509 doc/debugging_with_gdb: fix the link of delve
The repository of delve has already switched from the personal
account github.com/derekparker/delve to the organization account
github.com/go-delve/delve. According to go-delve/delve#1456.

Change-Id: Ie64f72c2808a8aca5059a75e2c2f11d8691e66b3
GitHub-Last-Rev: f90120c3b3
GitHub-Pull-Request: golang/go#38387
Reviewed-on: https://go-review.googlesource.com/c/go/+/227999
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-13 04:26:57 +00:00
Joel Sing
c39439c53f cmd/compile: run TestLogOpt for riscv64 on amd64
Run TestLogOpt for riscv64 on amd64, as is done for other architectures.
This would have caught the test failure on riscv64 introduced in
47ade08141.

Change-Id: If29dea2ef383b087154d046728f6d1c96811f5a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/227806
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2020-04-13 04:05:32 +00:00
Than McIntosh
e488ade6dd [dev.link] cmd/link/internal/loader: get rid of the AttrContainer loader method
Remove the loader's AttrContainer method, since it is no longer
needed. All of the code in the linker that used s.Attr.Container() is
now upstream of loadlibfull(), and the code in question now uses local
bitmaps to keep track of container text symbols as opposed to loader
methods.

Change-Id: Iae956d24bef2776e181c3b8208476dcb0b9a2916
Reviewed-on: https://go-review.googlesource.com/c/go/+/227959
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-13 00:37:19 +00:00
Than McIntosh
ad6fcf6993 [dev.link] cmd/link: convert inltree syms to anonymous in pclntab
The pclntab phase generates a series of "inltree.*" symbols with
inlining related pcdata; these symbols previously were given names and
enterered into the symbol lookup table, but there is no real reason to
do this, since they never need to be looked up when pcln generation is
done. Switch them over to anonymous symbols.

So as to insure that the later symtab phase picks them up correctly,
assign them a type of SGOFUNC instead of SRODATA, and change symtab to
look for this when assigning symbols to groups.

Change-Id: I38225dbb130ad7aea5d16f79cef3d8d388c61c2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/227845
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-13 00:37:11 +00:00
Than McIntosh
2f9decbe95 [dev.link] cmd/link: convert findfunctab to loader APIs
Convert the linker's findfunctab phase to use the new loader APIs.

Change-Id: Ia980a85963fe2e7c554c212c0cc89208272264bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/227842
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-13 00:37:01 +00:00
Keith Randall
2f84caebe3 cmd/compile: rewrite some AMD64 rules to use typed aux fields
Surprisingly many rules needed no modification.

Use wrapper functions for aux like we did for auxint.
Simplifies things a bit.

Change-Id: I2e852e77f1585dcb306a976ab9335f1ac5b4a770
Reviewed-on: https://go-review.googlesource.com/c/go/+/227961
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Munday <mike.munday@ibm.com>
2020-04-12 23:46:56 +00:00
Keith Randall
7580937524 cmd/compile: move more generic rewrites to the typed version
Change-Id: I22d0644710d12c7efc509fd2a15789e2e073e6a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/227869
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2020-04-12 19:41:35 +00:00
Joel Sing
fb16f4b82e cmd/compile: log large copies on riscv64
Log large copies in the riscv64 compiler.

This was missed in 47ade08141, resulting in
the new test added to cmd/compile/internal/logopt failing on riscv64.

Change-Id: I6f763e86f42834148e911d16928f9fbabcfa4290
Reviewed-on: https://go-review.googlesource.com/c/go/+/227804
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-12 17:51:29 +00:00
Joel Sing
1eb66be1b9 cmd/compile: enable Sqrt as a compiler intrinsic on riscv64
Change-Id: I829a02ced9aa73b45079e67194186116b39504b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/227805
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-12 16:51:25 +00:00
Keith Randall
3afa74115b runtime/race: rebuild netbsd .syso
Fixes #14481
Fixes #37355

Change-Id: Idfceaf0e64d340b7304ce9562549a82ebfc27e3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/227867
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2020-04-12 15:37:29 +00:00
Cherry Zhang
636fa3148f [dev.link] cmd/link: don't split container symbols when write blocks
We split the output into blocks and write them in parallel. The
block boundary is placed at symbol boundary. In the case of outer
symbols and sub symbols, currently we may split an outer symbol
into two blocks. This will be bad, as the two blocks will have
overlapping address range, since outer symbol and its sub symbols
occupies the same address range.

Make sure we place block boundary only at top-level symbol
boundaries.

Fix boringcrypto build.

Change-Id: I56811d3969c65c6be97672d8e1f1ea36b2447465
Reviewed-on: https://go-review.googlesource.com/c/go/+/227957
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-12 04:28:04 +00:00
Emmanuel T Odeke
83bfe3b1bf doc/go1.15, net/url: document new method URL.Redacted
Adds an entry in the Go1.15 release notes, but also
adds an example test for URL.Redacted.

Follow-up of CL 207082.

Updates #37419

Change-Id: Ibf81989778907511a3a3a3e4a03d1802b5dd9762
Reviewed-on: https://go-review.googlesource.com/c/go/+/227997
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-12 00:19:41 +00:00
Nigel Tao
b10849fbb9 strconv: add comment re extFloat errorscale
Change-Id: I6f006ba72e1711ba2a24cd71552855ad88284eec
Reviewed-on: https://go-review.googlesource.com/c/go/+/227797
Reviewed-by: Rémy Oudompheng <remyoudompheng@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2020-04-11 23:08:34 +00:00
Josh Bleecher Snyder
64dcef3045 cmd/compile: guard against invalid phis in shortcircuit
In the review of CL 222923, Keith expressed concern
that we could end up with invalid phis.

We have some code to handle this, but on further reflection,
I think it might not handle some cases in which phis get moved.

I can't create a failing case, but guard against it nevertheless.

Change-Id: Ib3a07ac1d36a674c72dcb9cc9261ccfcb716b5a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/227697
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-04-11 17:33:35 +00:00
Cuong Manh Le
b78109e80e cmd/compile: correct comment for len check when make slice
CL 226737 optimizes len check when make slice. The comment that cap is
constrainted to [0, 2^31) is not quite true, it's 31 or 63 depends on
whether it's 32/64-bit systems.

Change-Id: I6f54e41827ffe4d0b67a44975da3ce07b2fabbad
Reviewed-on: https://go-review.googlesource.com/c/go/+/227803
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-04-11 16:20:57 +00:00
Keith Randall
a1b802bde7 cmd/compile: move some generic rules to strongly typed
Move a lot of the constant folding rules to use strongly
typed AuxInt fields.

We need more than a cast to convert AuxInt to, e.g., float32.
Make conversion functions for converting back and forth.

Change-Id: Ia3d95ee3583ee2179a10938e20210a7617358c88
Reviewed-on: https://go-review.googlesource.com/c/go/+/227866
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Giovanni Bajo <rasky@develer.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2020-04-11 15:49:38 +00:00