1
0
mirror of https://github.com/golang/go synced 2024-11-12 13:10:33 -07:00
Commit Graph

10621 Commits

Author SHA1 Message Date
Aliaksandr Valialkin
6959087b1c cmd/vet: unexported Stringer and error fields cannot be formatted
According to CL 31817, fmt cannot invoke String or Error methods
on unexported struct fields.

Fixes #17798.

Change-Id: I0d516577298bc36daa9a94313c3874d64dc079e6
Reviewed-on: https://go-review.googlesource.com/44831
Reviewed-by: Rob Pike <r@golang.org>
2017-08-29 11:59:45 +00:00
Alex Brainman
b7397c8100 cmd/link: make it compile again (fixes build)
CL 59375 changed Reloc.Done to bool, but that change
got lost in pe.go while merging. Restore that change.

Change-Id: Ie5a89e85579cdc9282f504fefd56355cfeb49389
Reviewed-on: https://go-review.googlesource.com/59711
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-08-29 02:36:27 +00:00
Manish Goregaokar
29d11ef436 cmd/vet: add test that copylock catches copying a sync.Map
fixes #21635

Change-Id: I78716d47b6a930074e5394f7171d5f545dfba0bc
Reviewed-on: https://go-review.googlesource.com/59690
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-29 02:33:15 +00:00
Alex Brainman
ce54a0c10a cmd/link: introduce and use peFile.writeOptionalHeader
Change-Id: I27b33f2425281bc1790528ae514d99a468ad7fce
Reviewed-on: https://go-review.googlesource.com/59429
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 02:08:51 +00:00
Alex Brainman
cb3fe3aa0d cmd/link: introduce and use peFile.dataDirectory
Change-Id: I61f64287a488ed82e71639540697b6ade5a0426a
Reviewed-on: https://go-review.googlesource.com/59428
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 02:07:54 +00:00
Alex Brainman
ac9be2020b cmd/link: introduce and use peFile.writeFileHeader
Change-Id: I1324b69ab9edb870589197fa601b5764634d42a4
Reviewed-on: https://go-review.googlesource.com/59427
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 02:07:11 +00:00
Alex Brainman
fe1ccc5b88 cmd/link: introduce and use peFile.writeSymbolTableAndStringTable
Change-Id: I506f5e146f3b5bf359d6932a85ac5572d3a3f103
Reviewed-on: https://go-review.googlesource.com/59426
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 02:06:26 +00:00
Alex Brainman
2034297bdb cmd/link: introduce and use peFile.writeSymbols
Change-Id: If629b19cebc6ae8dfbf603dcd7f2dd3d0046a935
Reviewed-on: https://go-review.googlesource.com/59425
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 02:05:23 +00:00
Alex Brainman
84af5ea9b4 cmd/link: simplify writePESymTableRecords
Change-Id: I2da982fdef826aaecb86431f7d80ffc0fb2c4337
Reviewed-on: https://go-review.googlesource.com/59424
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 02:04:06 +00:00
Alex Brainman
6561e4b61c cmd/link: introduce and use peFile.mapToPESection
Change-Id: I598e9da5587908f39faa13c11d2b42054f5a632d
Reviewed-on: https://go-review.googlesource.com/59423
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 02:01:26 +00:00
Alex Brainman
6f299c7f7e cmd/link: introduce and use peFile.writeSymbol
Change-Id: I9fcae7bfd647b52d9b4f36f04710ba7921609c02
Reviewed-on: https://go-review.googlesource.com/59422
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 02:00:21 +00:00
Alex Brainman
72967551e5 cmd/link: move perelocsect into peFile.emitRelocations (no code changed)
Change-Id: I807412bd743d544195aaf9d720f81b128b4636b3
Reviewed-on: https://go-review.googlesource.com/59421
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 01:59:12 +00:00
Alex Brainman
64985505b0 cmd/link: introduce peFile.ctorsSect and use it in peFile.emitRelocations
Change-Id: I65058c150a19aa4e3083fd8754d08ea23721844b
Reviewed-on: https://go-review.googlesource.com/59420
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 01:58:10 +00:00
Alex Brainman
3558c16d48 cmd/link: introduce and use peFile.emitRelocations
Change-Id: I2458d1391af063d99ba1e446bcf12f7c41ae5f6b
Reviewed-on: https://go-review.googlesource.com/59419
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 01:57:05 +00:00
Alex Brainman
04d410d6cd cmd/link: introduce and use peSection.emitRelocations
Change-Id: I2bebee5566ee07786695f147c27661e69337a0f7
Reviewed-on: https://go-review.googlesource.com/59418
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 01:51:26 +00:00
Hiroshi Ioka
88a1e85c70 cmd/link: fix warning for buildmode=plugin on darwin/amd64
Without this CL, the system linker complains about absolute addressing
in type..eqfunc.*.

Updates #18190

Change-Id: I68db37a7f4c96b16a9c13baffc0f043a3048df6d
Reviewed-on: https://go-review.googlesource.com/59373
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-29 00:51:34 +00:00
Hiroshi Ioka
77acf19a59 cmd/cgo: avoid using common names for sniffing
Current code uses names like "x" and "s" which can conflict with user's
code easily. Use cryptographic names.

Fixes #21668

Change-Id: Ib6d3d6327aa5b92d95c71503d42e3a79d96c8e15
Reviewed-on: https://go-review.googlesource.com/59710
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 00:42:34 +00:00
Matthew Dempsky
93471a1390 cmd/compile: merge tempnamel into tempAt
Passes toolstash-check.

Change-Id: I01ed1c04be5a23756742d461f13f1e587ea7ecb8
Reviewed-on: https://go-review.googlesource.com/59610
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2017-08-28 22:46:30 +00:00
Josh Bleecher Snyder
2dd1f87d38 cmd/compile: add Type.NumResults and friends
Passes toolstash-check.

Change-Id: Id62bacff13fbd30de62b925d97a4e7bee1c66120
Reviewed-on: https://go-review.googlesource.com/59331
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-08-28 22:42:57 +00:00
Rob Pike
e3442b4ee8 cmd/doc: search for packages in the two-arg case
When given one argument, as in

	go doc binary.BigEndian

doc would search for the package, but when given two, as in

	go doc binary BigEndian

it would not. Fix the inconsistency.

Fixes #18697
Fixes #18664

Change-Id: Ib59dc483e8d4f91e6061c77a5ec24d0a50e115f0
Reviewed-on: https://go-review.googlesource.com/59413
Reviewed-by: Aliaksandr Valialkin <valyala@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-28 22:15:58 +00:00
Keith Randall
053840dc00 cmd/compile: avoid generating large offsets
The assembler barfs on large offsets. Make sure that all the
instructions that need to have their offsets in an int32
  1) check on any rule that computes offsets for such instructions
  2) change their aux fields so the check builder checks it.

The assembler also silently misassembled offsets between 1<<31
and 1<<32. Add a check in the assembler to barf on those as well.

Fixes #21655

Change-Id: Iebf24bf10f9f37b3ea819ceb7d588251c0f46d7d
Reviewed-on: https://go-review.googlesource.com/59630
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2017-08-28 22:02:59 +00:00
Hana Kim
0b4f4e0153 cmd/trace: add -d that prints parsed traces
This is useful when debugging the tool.

Some tweaks on logging: log the webserver address, log.Print instead
of log.Printf when possible.

Change-Id: Iaf71b6523b40dc13795511784d48eacf0f5a396a
Reviewed-on: https://go-review.googlesource.com/59570
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2017-08-28 20:40:49 +00:00
Keith Randall
2b079c3c04 cmd/compile: use keyed struct for asm tests
Just to make it clearer which regexps are positive and which
regexps are negative.

Change-Id: Ia190e89be28048fcae2491506f552afad90a5f85
Reviewed-on: https://go-review.googlesource.com/59490
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-28 17:34:25 +00:00
Ilya Tocar
7dd279013b cmd/compile/internal/ssa: Mark ADD[Q|L]const as rematerializeable
We can rematerialize only ops that have SP or SB as their only argument.
There are some ADDQconst(SP) that can be rematerialized, but are spilled/filled instead,
so mark addconst as rematerializeable. This shaves ~1kb from go tool.

Change-Id: Ib4cf4fe5f2ec9d3d7e5f0f77f1193eba66ca2f08
Reviewed-on: https://go-review.googlesource.com/54393
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-28 17:30:40 +00:00
David du Colombier
adbfdfe377 cmd/compile: don't use MOVOstore for move on plan9/amd64
The SSA compiler currently generates MOVOstore instructions
to optimize 16 bytes moves on AMD64 architecture.

However, we can't use the MOVOstore instruction on Plan 9,
because floating point operations are not allowed in the
note handler.

We rely on the useSSE flag to disable the use of the
MOVOstore instruction on Plan 9 and replace it by two
MOVQstore instructions.

Fixes #21625

Change-Id: Idfefcceadccafe1752b059b5fe113ce566c0e71c
Reviewed-on: https://go-review.googlesource.com/59171
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
2017-08-28 16:21:28 +00:00
Ben Shi
a2f22a6803 cmd/compile: optimize ARM with more efficient MOVB/MOVBU/MOVH/MOVHU
Like the indexed MOVW (MOVWloadidx/MOVWstoreidx) used in current
ARM backend, the indexed MOVB/MOVBU/MOVH/MOVHU can also be used to
generate further optimized ARM code.

My patch implements this optimization. Here are some contrast test
results against the original go compiler.

1. The total size of all .a files in pkg/ shrinks by 0.03%.

2. The compilecmp benchmark shows a little decline.
name        old time/op       new time/op       delta
Template          2.35s ± 1%        2.37s ± 3%  +0.94%  (p=0.006 n=19+19)
Unicode           1.33s ± 3%        1.33s ± 2%    ~     (p=0.158 n=20+18)
GoTypes           7.86s ± 2%        7.84s ± 1%    ~     (p=0.284 n=19+18)
Compiler          37.5s ± 1%        37.7s ± 2%    ~     (p=0.101 n=20+19)
SSA               83.4s ± 2%        83.6s ± 2%    ~     (p=0.231 n=20+20)
Flate             1.46s ± 2%        1.45s ± 1%    ~     (p=0.097 n=20+17)
GoParser          1.86s ± 2%        1.86s ± 4%    ~     (p=0.738 n=20+20)
Reflect           5.10s ± 1%        5.11s ± 1%    ~     (p=0.290 n=20+18)
Tar               1.78s ± 2%        1.77s ± 2%    ~     (p=0.166 n=19+20)
XML               2.61s ± 2%        2.61s ± 2%    ~     (p=0.665 n=19+19)
[Geo mean]        4.67s             4.68s       +0.16%

name        old user-time/op  new user-time/op  delta
Template          2.79s ± 3%        2.80s ± 2%    ~     (p=0.662 n=20+20)
Unicode           1.62s ± 3%        1.64s ± 4%    ~     (p=0.252 n=20+20)
GoTypes           9.58s ± 2%        9.62s ± 2%    ~     (p=0.250 n=20+20)
Compiler          46.2s ± 1%        46.2s ± 1%    ~     (p=0.602 n=20+19)
SSA                108s ± 1%         108s ± 2%    ~     (p=0.242 n=18+20)
Flate             1.69s ± 3%        1.69s ± 4%    ~     (p=0.470 n=20+20)
GoParser          2.16s ± 3%        2.20s ± 4%  +1.70%  (p=0.005 n=19+20)
Reflect           6.02s ± 2%        6.02s ± 2%    ~     (p=0.700 n=20+17)
Tar               2.11s ± 2%        2.11s ± 3%    ~     (p=0.480 n=18+20)
XML               3.07s ± 2%        3.11s ± 4%  +1.50%  (p=0.043 n=20+20)
[Geo mean]        5.61s             5.64s       +0.55%

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

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

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

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

3. The go1 benchmark shows improvement totally, and even more than 10%
improvement in the test case Revcomp. 
name                     old time/op    new time/op    delta
BinaryTree17-4              42.0s ± 1%     41.5s ± 1%   -1.32%  (p=0.000 n=39+40)
Fannkuch11-4                24.1s ± 1%     23.6s ± 0%   -2.38%  (p=0.000 n=40+40)
FmtFprintfEmpty-4           843ns ± 0%     839ns ± 1%   -0.46%  (p=0.000 n=33+40)
FmtFprintfString-4         1.44µs ± 1%    1.37µs ± 1%   -5.48%  (p=0.000 n=40+35)
FmtFprintfInt-4            1.44µs ± 1%    1.41µs ± 2%   -1.50%  (p=0.000 n=40+40)
FmtFprintfIntInt-4         2.07µs ± 1%    2.06µs ± 0%   -0.78%  (p=0.000 n=40+40)
FmtFprintfPrefixedInt-4    2.50µs ± 1%    2.33µs ± 1%   -6.85%  (p=0.000 n=40+40)
FmtFprintfFloat-4          4.36µs ± 1%    4.34µs ± 0%   -0.39%  (p=0.017 n=40+40)
FmtManyArgs-4              8.11µs ± 0%    8.00µs ± 0%   -1.37%  (p=0.000 n=40+40)
GobDecode-4                 105ms ± 2%     103ms ± 2%   -2.17%  (p=0.000 n=39+39)
GobEncode-4                90.1ms ± 2%    88.6ms ± 1%   -1.67%  (p=0.000 n=40+39)
Gzip-4                      4.18s ± 1%     4.09s ± 1%   -2.03%  (p=0.000 n=40+40)
Gunzip-4                    608ms ± 1%     603ms ± 1%   -0.86%  (p=0.000 n=40+34)
HTTPClientServer-4          674µs ± 3%     661µs ± 2%   -1.82%  (p=0.000 n=40+39)
JSONEncode-4                256ms ± 1%     243ms ± 0%   -5.11%  (p=0.000 n=39+31)
JSONDecode-4                915ms ± 1%     904ms ± 1%   -1.18%  (p=0.000 n=40+36)
Mandelbrot200-4            49.2ms ± 0%    49.3ms ± 0%     ~     (p=0.254 n=34+40)
GoParse-4                  46.9ms ± 2%    46.9ms ± 1%     ~     (p=0.737 n=40+39)
RegexpMatchEasy0_32-4      1.28µs ± 1%    1.27µs ± 1%   -0.71%  (p=0.000 n=40+40)
RegexpMatchEasy0_1K-4      7.86µs ± 4%    7.67µs ± 4%   -2.46%  (p=0.000 n=38+40)
RegexpMatchEasy1_32-4      1.28µs ± 1%    1.28µs ± 1%   -0.54%  (p=0.000 n=40+40)
RegexpMatchEasy1_1K-4      10.4µs ± 2%    10.3µs ± 2%   -0.88%  (p=0.003 n=40+39)
RegexpMatchMedium_32-4     2.05µs ± 0%    2.04µs ± 0%   -0.34%  (p=0.000 n=40+33)
RegexpMatchMedium_1K-4      541µs ± 1%     535µs ± 1%   -1.02%  (p=0.000 n=40+38)
RegexpMatchHard_32-4       29.3µs ± 1%    29.1µs ± 1%   -0.51%  (p=0.000 n=40+40)
RegexpMatchHard_1K-4        881µs ± 1%     871µs ± 1%   -1.15%  (p=0.000 n=40+40)
Revcomp-4                  81.7ms ± 2%    67.5ms ± 2%  -17.37%  (p=0.000 n=39+39)
Template-4                  1.05s ± 1%     1.08s ± 2%   +3.67%  (p=0.000 n=40+40)
TimeParse-4                7.24µs ± 1%    7.09µs ± 1%   -2.13%  (p=0.000 n=40+40)
TimeFormat-4               13.2µs ± 1%    13.1µs ± 0%   -0.31%  (p=0.007 n=40+31)
[Geo mean]                  733µs          718µs        -2.03%

name                     old speed      new speed      delta
GobDecode-4              7.28MB/s ± 2%  7.44MB/s ± 2%   +2.23%  (p=0.000 n=39+39)
GobEncode-4              8.52MB/s ± 2%  8.67MB/s ± 1%   +1.70%  (p=0.000 n=40+39)
Gzip-4                   4.65MB/s ± 1%  4.74MB/s ± 1%   +1.94%  (p=0.000 n=37+40)
Gunzip-4                 31.9MB/s ± 1%  32.2MB/s ± 1%   +0.90%  (p=0.000 n=40+36)
JSONEncode-4             7.57MB/s ± 1%  7.98MB/s ± 0%   +5.41%  (p=0.000 n=40+31)
JSONDecode-4             2.12MB/s ± 1%  2.15MB/s ± 1%   +1.23%  (p=0.000 n=40+40)
GoParse-4                1.23MB/s ± 1%  1.23MB/s ± 1%     ~     (p=0.769 n=39+40)
RegexpMatchEasy0_32-4    25.0MB/s ± 1%  25.2MB/s ± 1%   +0.71%  (p=0.000 n=40+40)
RegexpMatchEasy0_1K-4     130MB/s ± 5%   134MB/s ± 4%   +2.53%  (p=0.000 n=38+40)
RegexpMatchEasy1_32-4    24.9MB/s ± 1%  25.1MB/s ± 1%   +0.55%  (p=0.000 n=40+40)
RegexpMatchEasy1_1K-4    98.5MB/s ± 2%  99.4MB/s ± 2%   +0.88%  (p=0.003 n=40+39)
RegexpMatchMedium_32-4    490kB/s ± 0%   490kB/s ± 0%     ~     (all equal)
RegexpMatchMedium_1K-4   1.89MB/s ± 1%  1.91MB/s ± 1%   +1.02%  (p=0.000 n=40+38)
RegexpMatchHard_32-4     1.10MB/s ± 1%  1.10MB/s ± 0%   +0.41%  (p=0.000 n=40+33)
RegexpMatchHard_1K-4     1.16MB/s ± 1%  1.17MB/s ± 1%   +1.21%  (p=0.000 n=40+40)
Revcomp-4                31.1MB/s ± 2%  37.6MB/s ± 2%  +21.03%  (p=0.000 n=39+39)
Template-4               1.86MB/s ± 1%  1.79MB/s ± 1%   -3.51%  (p=0.000 n=40+38)
[Geo mean]               6.66MB/s       6.80MB/s        +2.13%

fixes #21492

Change-Id: Ia26e7ca393f0a5f31de240e8ff9a220453ca7e0d
Reviewed-on: https://go-review.googlesource.com/58450
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-28 16:10:27 +00:00
Wei Xiao
c195deb48c cmd/internal/objfile: add arm64 disassembler support
Fixes #19157

Change-Id: Ieea286e8dc03929c3645f3113c33df569f8e26f3
Reviewed-on: https://go-review.googlesource.com/58930
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-08-28 14:09:35 +00:00
Daniel Martí
5d39af9d9b all: remove some unused result params
Most of these are return values that were part of a receiving parameter,
so they're still accessible.

A few others are not, but those have never had a use.

Found with github.com/mvdan/unparam, after Kevin Burke's suggestion that
the tool should also warn about unused result parameters.

Change-Id: Id8b5ed89912a99db22027703a88bd94d0b292b8b
Reviewed-on: https://go-review.googlesource.com/55910
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-28 06:52:55 +00:00
Hiroshi Ioka
0c4d035ca8 cmd/link: refactor *reloc
* use bool instead of int if it's adequate.
* remove blank lines.

Change-Id: Ic4a5644a33ed9fc7ce388ef8ba15f1732446fcfc
Reviewed-on: https://go-review.googlesource.com/59375
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-28 05:42:48 +00:00
Josh Bleecher Snyder
53c8be4a8d cmd/compile: use raceX instead of raceXrange for types without subcomponents
Change-Id: I9882488e69565dc9da6814fefbdba3621daf74fe
Reviewed-on: https://go-review.googlesource.com/59332
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Marvin Stenger <marvin.stenger94@gmail.com>
2017-08-28 05:30:40 +00:00
Dmitri Shuralyov
2abef5976a cmd/go/internal/load: fix IsMetaPackage function name in doc
The IsMetaPackage function was made exported when it was moved from
cmd/go to cmd/go/internal/load in CL 36196. Its documentation wasn't
updated accordingly. This change fixes that, resolving a golint issue.

Updates #18653.

Change-Id: Icf89461000754d0f09e6617b11c838e4c050d5a6
Reviewed-on: https://go-review.googlesource.com/59430
Reviewed-by: Dave Cheney <dave@cheney.net>
2017-08-28 03:27:23 +00:00
Hiroshi Ioka
6eef2bb5ee cmd/link: avoid leaking file in ldshlibsyms
Change-Id: If27f7fbf94ede6f9a57f2520aaf75e6506e0b3f8
Reviewed-on: https://go-review.googlesource.com/59374
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2017-08-27 22:27:21 +00:00
Josh Bleecher Snyder
b046878018 cmd/compile: don't generate race calls for zero-sized values
One example of a heavily-used zero-size value is encoding/binary.BigEndian.

Change-Id: I8e873c447e154ab2ca61b7315df774693891270c
Reviewed-on: https://go-review.googlesource.com/59330
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2017-08-26 15:55:04 +00:00
Daniel Martí
99da8730b0 all: remove some double spaces from comments
Went mainly for the ones that make no sense, such as the ones
mid-sentence or after commas.

Change-Id: Ie245d2c19cc7428a06295635cf6a9482ade25ff0
Reviewed-on: https://go-review.googlesource.com/57293
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-26 15:09:09 +00:00
Hiroshi Ioka
37b04c9062 cmd/link: fix debug message
Change-Id: I6cb0ed9b726da34106ba239b57e2da732a8e1b71
Reviewed-on: https://go-review.googlesource.com/50730
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Avelino <t@avelino.xxx>
2017-08-25 22:49:00 +00:00
Daniel Martí
86dde2debb testing: error if -parallel is given N<1
Otherwise, if there are any parallel tests, it will hang and panic with
"all goroutines are asleep - deadlock!".

Do not use flag.Uint to handle the error for us because we also want to
error on N==0, and because it would make setting the default to
GOMAXPROCS(0) more difficult, since it's an int.

Check for it right after flag.Parse, and mimic flag errors by printing
the usage and returning exit code 2.

Fixes #20542.

Change-Id: I0c9d4587f83d406a8f5e42ed74e40be46d639ffb
Reviewed-on: https://go-review.googlesource.com/54150
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-25 22:47:57 +00:00
Meir Fischer
7e455b628c testing: ensure profiles are written upon -timeout panic
This addresses the case of a -timeout panic, but not the more
general case of a signal arriving. See CL 48370 and CL 44352
for recent difficulties in that area.

"-timeout" here means flag usage to distinguish from the
default timeout termination which uses signals.

Fixes #19394

Change-Id: I5452d5422c0c080e940cbcc8c6606049975268c6
Reviewed-on: https://go-review.googlesource.com/48491
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-25 22:45:35 +00:00
fanzha02
aea286b449 cmd/internal/obj/arm64: fix assemble fcsels/fcseld bug
The current code treats the type of SIMD&FP register as C_REG incorrectly.

The fix code converts C_REG type into C_FREG type.

Uncomment fcsels/fcseld test cases.

Fixes #21582
Change-Id: I754c51f72a0418bd352cbc0f7740f14cc599c72d
Reviewed-on: https://go-review.googlesource.com/58350
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-25 20:43:03 +00:00
Heschi Kreinick
38bd725bf1 cmd/compile: bug fixes for DWARF location lists
Fix two small but serious bugs in the DWARF location list code that
should have been caught by the automated tests I didn't write.

After emitting debug information for a user variable, mark it as done
so that it doesn't get emitted again. Otherwise it would be written once
per slot it was decomposed into.

Correct a merge error in CL 44350: the location list abbreviations need
to have DW_AT_decl_line too, otherwise the resulting DWARF is gibberish.

Change-Id: I6ab4b8b32b7870981dac80eadf0ebfc4015ccb01
Reviewed-on: https://go-review.googlesource.com/59070
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2017-08-25 20:37:32 +00:00
Wei Xiao
c02fc1605a cmd/compile: memory clearing optimization for arm64
Use "STP (ZR, ZR), O(R)" instead of "MOVD ZR, O(R)" to implement memory clearing.
Also improve assembler supports to STP/LDP.
Results (A57@2GHzx8):

benchmark                   old ns/op     new ns/op     delta
BenchmarkClearFat8-8        1.00          1.00          +0.00%
BenchmarkClearFat12-8       1.01          1.01          +0.00%
BenchmarkClearFat16-8       1.01          1.01          +0.00%
BenchmarkClearFat24-8       1.52          1.52          +0.00%
BenchmarkClearFat32-8       3.00          2.02          -32.67%
BenchmarkClearFat40-8       3.50          2.52          -28.00%
BenchmarkClearFat48-8       3.50          3.03          -13.43%
BenchmarkClearFat56-8       4.00          3.50          -12.50%
BenchmarkClearFat64-8       4.25          4.00          -5.88%
BenchmarkClearFat128-8      8.01          8.01          +0.00%
BenchmarkClearFat256-8      16.1          16.0          -0.62%
BenchmarkClearFat512-8      32.1          32.0          -0.31%
BenchmarkClearFat1024-8     64.1          64.1          +0.00%

Change-Id: Ie5f5eac271ff685884775005825f206167a5c146
Reviewed-on: https://go-review.googlesource.com/55610
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-08-25 20:09:06 +00:00
Ilya Tocar
9c99512d18 cmd/compile/internal/ssa: combine consecutive loads and stores on amd64
Sometimes (often for calls) we generate code like this:

MOVQ  (addr),AX
MOVQ  8(addr),BX
MOVQ  AX,(otheraddr)
MOVQ  BX,8(otheraddr)

Replace it with

MOVUPS (addr),X0
MOVUPS X0,(otheraddr)

For completeness do the same for 8,16,32-bit loads/stores too.
Shaves 1% from code sections of go tool.

/localdisk/itocar/golang/bin/go 10293917
go_old 10334877 [40960 bytes]

read-only data = 682 bytes (0.040769%)
global text (code) = 38961 bytes (1.036503%)
Total difference 39643 bytes (0.674628%)

Updates #6853

Change-Id: I1f0d2f60273a63a079b58927cd1c4e3429d2e7ae
Reviewed-on: https://go-review.googlesource.com/57130
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-25 20:05:17 +00:00
Josh Bleecher Snyder
a45d6859cb cmd/compile: enforce that MOVXconvert is a no-op on 386 and amd64
Follow-up to CL 58371.

Change-Id: I3d2aaec84ee6db3ef1bd4fcfcaf46cc297c7176b
Reviewed-on: https://go-review.googlesource.com/58610
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-25 19:39:46 +00:00
Keith Randall
fb05948d9e cmd/compile,math: improve code generation for math.Abs
Implement int reg <-> fp reg moves on amd64.
If we see a load to int reg followed by an int->fp move, then we can just
load to the fp reg instead.  Same for stores.

math.Abs is now:

MOVQ	"".x+8(SP), AX
SHLQ	$1, AX
SHRQ	$1, AX
MOVQ	AX, "".~r1+16(SP)

math.Copysign is now:

MOVQ	"".x+8(SP), AX
SHLQ	$1, AX
SHRQ	$1, AX
MOVQ	"".y+16(SP), CX
SHRQ	$63, CX
SHLQ	$63, CX
ORQ	CX, AX
MOVQ	AX, "".~r2+24(SP)

math.Float64bits is now:

MOVSD	"".x+8(SP), X0
MOVSD	X0, "".~r1+16(SP)
(it would be nicer to use a non-SSE reg for this, nothing is perfect)

And due to the fix for #21440, the inlined version of these improve as well.

name      old time/op  new time/op  delta
Abs       1.38ns ± 5%  0.89ns ±10%  -35.54%  (p=0.000 n=10+10)
Copysign  1.56ns ± 7%  1.35ns ± 6%  -13.77%  (p=0.000 n=9+10)

Fixes #13095

Change-Id: Ibd7f2792412a6668608780b0688a77062e1f1499
Reviewed-on: https://go-review.googlesource.com/58732
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
2017-08-25 19:15:01 +00:00
Hana Kim
05ff6bfe33 misc/trace: update trace-viewer
Generated with
 github.com/catapult/tracing/bin/vulcanize_trace_viewer
catapult @ ab4d571fa

Renamed trace_viewer_lean.html to trace_viewer_full.html
to make it clear we are using the full version of trace viewer
(waiting for https://github.com/catapult-project/catapult/issues/2247
to be fixed).

Update #15302

Change-Id: Ice808bb27ab79a1dec9fc863e0c5a761027ebfbe
Reviewed-on: https://go-review.googlesource.com/58750
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2017-08-25 15:50:29 +00:00
Wei Xiao
1708122b48 cmd/vendor/golang.org/x/arch: pull latest updates from x repo (commit edaf650)
Updates #21486

Change-Id: I78ca76490d8e9b52e055c1f0b8d10bdb227e3a80
Reviewed-on: https://go-review.googlesource.com/56331
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-25 14:13:13 +00:00
Matthew Dempsky
180bfc4bd4 cmd/compile: simplify noding for struct embedding
Since golang.org/cl/31670, we've stopped using the 'embedded' function
for handling struct embeddings within package export data. Now the
only remaining use is for Go source files, which allows for some
substantial simplifications:

1. CenterDot never appears within Go source files, so that logic can
simply be removed.

2. The field name will always be declared in the local package.

Passes toolstash-check.

Change-Id: I59505f62824206dd5de0782918f98fbef6e93224
Reviewed-on: https://go-review.googlesource.com/58790
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-08-25 08:18:58 +00:00
Matthew Dempsky
b976859b47 cmd/compile: fix node position for imported constants
Discovered while debugging CL 53644.

No test case because these are purely internal conversions that should
never end up resulting in compiler warnings or even generated code.

Updates #19683.

Change-Id: I0d9333ef2c963fa22eb9b5335bb022bcc9b25708
Reviewed-on: https://go-review.googlesource.com/58190
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-08-25 08:12:20 +00:00
Keith Randall
770d8d8207 cmd/compile: free value earlier in nilcheck
When we remove a nil check, add it back to the free Value pool immediately.

Fixes #18732

Change-Id: I8d644faabbfb52157d3f2d071150ff0342ac28dc
Reviewed-on: https://go-review.googlesource.com/58810
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2017-08-25 06:01:26 +00:00
David du Colombier
14cb41584d cmd/compile: don't use MOVOstore instruction on plan9/amd64
CL 54410 and CL 56250 recently added use of the MOVOstore
instruction to improve performance.

However, we can't use the MOVOstore instruction on Plan 9,
because floating point operations are not allowed in the
note handler.

This change adds a configuration flag useSSE to enable the
use of SSE instructions for non-floating point operations.
This flag is enabled by default and disabled on Plan 9.
When this flag is disabled, the MOVOstore instruction is
not used and the MOVQstoreconst instruction is used instead.

Fixes #21599

Change-Id: Ie609e5d9b82ec0092ae874bab4ce01caa5bc8fb8
Reviewed-on: https://go-review.googlesource.com/58850
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-25 05:56:26 +00:00
Keith Randall
f1517ec6e5 cmd/compile: remove more nil ptr checks after newobject
For code like the following (where x escapes):

   x := []int{1}

We're currently generating a nil check.  The line above is really 3 operations:

	t := new([1]int)
	t[0] = 1
	x := t[:]

We remove the nil check for t[0] = 1, but not for t[:].

Our current nil check removal rule is too strict about the possible
memory arguments of the nil check. Unlike zeroing or storing to the
result of runtime.newobject, the nilness of runtime.newobject is
always false, even after other stores have happened in the meantime.

Change-Id: I95fad4e3a59c27effdb37c43ea215e18f30b1e5f
Reviewed-on: https://go-review.googlesource.com/58711
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-08-25 03:26:58 +00:00