1
0
mirror of https://github.com/golang/go synced 2024-11-07 08:36:28 -07:00
Commit Graph

37745 Commits

Author SHA1 Message Date
Iskander Sharipov
0fbaf6ca8b math,net: omit explicit true tag expr in switch
Performed `switch true {}` => `switch {}` replacement.

Found using https://go-critic.github.io/overview.html#switchTrue-ref

Change-Id: Ib39ea98531651966a5a56b7bd729b46e4eeb7f7c
Reviewed-on: https://go-review.googlesource.com/123378
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 22:15:59 +00:00
isharipo
328adf9d62 cmd/link: fewer allocs in ld.Arch.Archreloc
Archreloc had this signature:

	func(*Link, *sym.Reloc, *sym.Symbol, *int64) bool

The last *int64 argument is used as out parameter.
Passed valus could be allocated on stack, but escape analysis
fails here, leading to high number of unwanted allocs.

If instead 4th arg is passed by value, and modified values is returned,
no problems with allocations arise:

	func(*Link, *sym.Reloc, *sym.Symbol, int64) (int64, bool)

There are 2 benefits:
1. code becomes more readable.
2. less allocations.

For linking "hello world" example from net/http:

	name      old time/op  new time/op  delta
	Linker-4   530ms ± 2%   520ms ± 2%  -1.83%  (p=0.001 n=17+16)

It's top 1 in alloc_objects from memprofile:

	flat   flat%  sum%       cum    cum%
	229379 33.05% 33.05%     229379 33.05%  cmd/link/internal/ld.relocsym
	...

list relocsym:

	229379     229379 (flat, cum) 33.05% of Total
	229379     229379    183:    var o int64

After the patch, ~230k of int64 allocs (~ 1.75mb) removed.

Passes toolshash-check (toolstash cmp).

Change-Id: I25504fe27967bcff70c4b7338790f3921d15473d
Reviewed-on: https://go-review.googlesource.com/113637
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 22:10:31 +00:00
Ilya Tocar
4201c2077e cmd/compile: omit racefuncentry/exit when they are not needed
When compiling with -race, we insert calls to racefuncentry,
into every function. Add a rule that removes them in leaf functions,
without instrumented loads/stores.
Shaves ~30kb from "-race" version of go tool:

file difference:
go_old 15626192
go_new 15597520 [-28672 bytes]

section differences:
global text (code) = -24513 bytes (-0.358598%)
read-only data = -5849 bytes (-0.167064%)
Total difference -30362 bytes (-0.097928%)

Fixes #24662

Change-Id: Ia63bf1827f4cf2c25e3e28dcd097c150994ade0a
Reviewed-on: https://go-review.googlesource.com/121235
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-08-20 22:07:22 +00:00
David Symonds
f76eaeb2c8 cmd/go/internal/get: more efficient path prefix checking code
Splitting the string is unnecessary.

Change-Id: I02796cb91602c1b9bf22721b985cd41b18cc92f2
Reviewed-on: https://go-review.googlesource.com/119936
Run-TryBot: David Symonds <dsymonds@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2018-08-20 21:54:45 +00:00
nogoegst
a1addf15df bufio: make Reader naming consistent
All the readers are denoted as `b` while for `Reader.Size()` it is `r`.

Change-Id: Ib6f97306c11b3abb2ff30edbc9f9362cad36d080
GitHub-Last-Rev: 992f88b374
GitHub-Pull-Request: golang/go#26205
Reviewed-on: https://go-review.googlesource.com/122156
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 21:51:48 +00:00
Ian Lance Taylor
c9b018918d testing: exit with error if testing.Short is called before flag.Parse
Change-Id: I2fa547d1074ef0931196066678fadd7250a1148d
Reviewed-on: https://go-review.googlesource.com/121936
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 21:51:11 +00:00
Shivansh Rai
d05f31a3c5 internal/poll: Avoid evaluating condition for an unreachable branch
Change-Id: I868dcaf84767d631bc8f1b6ef6bcb3ec18047259
Reviewed-on: https://go-review.googlesource.com/116135
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-08-20 21:50:00 +00:00
Ilya Tocar
a3593685cf cmd/compile/internal/ssa: remove useless zero extension
We generate MOVBLZX for byte-sized LoadReg, so
(MOVBQZX (LoadReg (Arg))) is the same as
(LoadReg (Arg)). Remove those zero extension where possible.
Triggers several times during all.bash.

Fixes #25378
Updates #15300

Change-Id: If50656e66f217832a13ee8f49c47997f4fcc093a
Reviewed-on: https://go-review.googlesource.com/115617
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-08-20 21:38:20 +00:00
Ilya Tocar
c292b32f33 cmd/compile: enable disjoint memmove inlining on amd64
Memmove can use AVX/prefetches/other optional instructions, so
only do it for small sizes, when call overhead dominates.

Change-Id: Ice5e93deb11462217f7fb5fc350b703109bb4090
Reviewed-on: https://go-review.googlesource.com/112517
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Munday <mike.munday@ibm.com>
2018-08-20 21:10:12 +00:00
Jordan Rhee
3000795c83 cmd/dist: support windows/arm
Updates #26148

Change-Id: I4744ebcc77fda3acc1301a1d8857754c0ee797fa
Reviewed-on: https://go-review.googlesource.com/130056
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 20:41:54 +00:00
Jordan Rhee
c589b9ec4e cmd/vet: exclude windows/arm from cmd/vet
Updates #27103

Change-Id: I1f7d198879e5912661e4156a86e13de2698a5473
Reviewed-on: https://go-review.googlesource.com/130055
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-08-20 20:41:46 +00:00
Fazlul Shahriar
e8f49aa80e cmd/go/internal/modload: ignore directories when looking for go.mod file in Plan 9
This fixes builds in Plan 9 under /n. Since directories in /n are
automatically created, /n/go.mod always exists.

Fixes #27074

Change-Id: Ie9a1155b7c316bdc27655f5b99172550b413838d
Reviewed-on: https://go-review.googlesource.com/129804
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-08-20 19:14:25 +00:00
Shulhan
1ba74448f2 runtime: document all possible values for GOOS and GOARCH
The updated list is taken from "src/go/build/syslist.go".

Reason: one should not do web search to know the possible values of GOOS
and GOARCH.  The search result point to stackoverflow page which
reference the above source and documentation on installation page [1].
It should available offline (as in local godoc), as part of package
documentation.

[1] https://golang.org/doc/install/source#environment

Change-Id: I736804b8ef4dc11e0260fa862999212ab3f7b3fd
Reviewed-on: https://go-review.googlesource.com/129935
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 19:14:00 +00:00
Brad Fitzpatrick
09ec523049 Revert "cmd/dist: support windows/arm"
This reverts commit def3280eb4.

Reason for revert: broke the vetall builder and I (Brad) forgot to run the trybots first. :(

Change-Id: I255bedeb28d13e265f357060e57561e593145275
Reviewed-on: https://go-review.googlesource.com/130015
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 19:12:24 +00:00
Austin Clements
a034f310b0 runtime: use gList in closechan
Change-Id: I8148eb17fe9f2cbb659c35d84cdd212b46dc23bf
Reviewed-on: https://go-review.googlesource.com/129401
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2018-08-20 18:19:29 +00:00
Austin Clements
083938df14 runtime: use gList for injectglist
Change-Id: Id5af75eaaf41f43bc6baa6d3fe2b852a2f93bb6f
Reviewed-on: https://go-review.googlesource.com/129400
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2018-08-20 18:19:28 +00:00
Austin Clements
d02169d380 runtime: use gList for work.sweepWaiters
Change-Id: Ibae474a5c9a3528a042ddf19ddb4a88913a87606
Reviewed-on: https://go-review.googlesource.com/129399
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2018-08-20 18:19:27 +00:00
Austin Clements
8e8cc9db0f runtime: use gList for gfree lists
Change-Id: I3d21587e02264fe5da1cc38d98779facfa09b927
Reviewed-on: https://go-review.googlesource.com/129398
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2018-08-20 18:19:26 +00:00
Austin Clements
de990545c3 runtime: use gList in netpoll
netpoll is perhaps one of the most confusing uses of G lists currently
since it passes around many lists as bare *g values right now.
Switching to gList makes it much clearer what's an individual g and
what's a list.

Change-Id: I8d8993c4967c5bae049c7a094aad3a657928ba6c
Reviewed-on: https://go-review.googlesource.com/129397
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2018-08-20 18:19:25 +00:00
Austin Clements
3578918b66 runtime: replace manually managed G dequeues with a type
There are two manually managed G dequeues. Abstract these both into a
shared gQueue type. This also introduces a gList type, which we'll use
to replace several manually-managed G lists in follow-up CLs.

This makes the code more readable and maintainable. gcFlushBgCredit in
particular becomes much easier to follow. It also makes it easier to
introduce more G queues in the future. Finally, the gList type clearly
distinguishes between lists of Gs and individual Gs; currently both
are represented by a *g, which can easily lead to confusion and bugs.

Change-Id: Ic7798841b405d311fc8b6aa5a958ffa4c7993c6c
Reviewed-on: https://go-review.googlesource.com/129396
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2018-08-20 18:19:22 +00:00
Giovanni Bajo
723479bc30 cmd/go: add graphviz output to graph command
This allows to quickly visual inspect dependencies.

Change-Id: Ice326ec69d7d57720f608b04cdf3ece153b8c5f1
Reviewed-on: https://go-review.googlesource.com/127599
Run-TryBot: Giovanni Bajo <rasky@develer.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-08-20 18:14:55 +00:00
Jordan Rhee
18034e6b9f debug/pe: support windows/arm
Enable 'go tool objdump' to disassemble windows/arm images.

Updates #26148

Change-Id: I7d11226f01d92288061f8e25980334b9bd82c41f
Reviewed-on: https://go-review.googlesource.com/125649
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 18:12:47 +00:00
Jordan Rhee
def3280eb4 cmd/dist: support windows/arm
Updates #26148

Change-Id: I407481f9c0f8e3565dcfcbbc53e5aa7427d74680
Reviewed-on: https://go-review.googlesource.com/125646
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 18:08:37 +00:00
Qais Patankar
6570ea3c60 container/heap: clarify that Remove returns the removed element
Change-Id: I63b59c1ca8265e9af7eb3f9210ee1d17925de891
Reviewed-on: https://go-review.googlesource.com/129779
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 18:05:11 +00:00
Michael Munday
edae0ff8c1 math: use s390x mnemonics rather than binary encodings
TMLL, LGDR and LDGR have all been added to the Go assembler
previously, so we don't need to encode them using WORD and BYTE
directives anymore. This is purely a cosmetic change, it does not
change the contents of any object files.

Change-Id: I93f815b91be310858297d8a0dc9e6d8e3f09dd65
Reviewed-on: https://go-review.googlesource.com/129895
Run-TryBot: Michael Munday <mike.munday@ibm.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-08-20 17:42:08 +00:00
Ben Hoyt
6c7e199e50 text/scanner: don't allow Float exponents with no mantissa
Previously Scanner would allow float literals like "1.5e" and "1e+"
that weren't actually valid Go float literals, and also not valid
when passed to ParseFloat. This commit fixes that behaviour to match
the documentation ("recognizes all literals as defined by the Go
language specification"), and Scanner emits an error in these cases.

Fixes #26374

Change-Id: I6855402ea43febb448c6dff105b9578e31803c01
Reviewed-on: https://go-review.googlesource.com/129095
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-08-20 17:01:34 +00:00
Martin Möhrmann
7b9c2c1950 internal/cpu: add and use cpu.CacheLinePad for padding structs
Add a CacheLinePad struct type to internal/cpu that has a size of CacheLineSize.
This can be used for padding structs in order to avoid false sharing.

Updates #25203

Change-Id: Icb95ae68d3c711f5f8217140811cad1a1d5be79a
Reviewed-on: https://go-review.googlesource.com/116276
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 15:41:37 +00:00
Ben Shi
84feb4bbb7 cmd/internal/obj/arm64: add register indexed FMOVS/FMOVD
This CL adds register indexed FMOVS/FMOVD.
FMOVS Fx, (Rn)(Rm)
FMOVS Fx, (Rn)(Rm<<2)
FMOVD Fx, (Rn)(Rm)
FMOVD Fx, (Rn)(Rm<<3)
FMOVS (Rn)(Rm), Fx
FMOVS (Rn)(Rm<<2), Fx
FMOVD (Rn)(Rm), Fx
FMOVD (Rn)(Rm<<3), Fx

Change-Id: Id76de6a4be96b64cf79d7e9a1962d9d49cb462f2
Reviewed-on: https://go-review.googlesource.com/123995
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-08-20 15:15:16 +00:00
Martin Möhrmann
21ac811924 internal/cpu: make all constants for s390x feature detection typed
Only the first constant in the function and facility
constant declaration blocks were typed constants.
Make all other constants used for function codes and
named facilities also typed.

Change-Id: I1814121de3733094da699c78b7311f99ba4772e1
Reviewed-on: https://go-review.googlesource.com/126776
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 15:13:39 +00:00
Ben Shi
0a382e0b7f cmd/compile: optimize ARMv7 code
"AND $0xffff0000, Rx" will be encoded to 12 bytes.
1. MOVWload from the constant pool to Rtmp
2. AND Rtmp, Rx
3. a 4-byte item in the constant pool

It can be simplified to 8 bytes on ARMv7, since ARMv7 has
"MOVW $imm-16, Rx".
1. MOVW $0xffff, Rtmp
2. BIC Rtmp, Rx

The above optimization also applies to BICconst, ADDconst and
SUBconst.

1. The total size of pkg/android_arm (excluding cmd/compile)
   decreases about 2KB.

2. The go1 benchmark shows no regression, exlcuding noise.
name                     old time/op    new time/op    delta
BinaryTree17-4              25.5s ± 1%     25.2s ± 1%  -0.85%  (p=0.000 n=30+30)
Fannkuch11-4                13.3s ± 0%     13.3s ± 0%  +0.16%  (p=0.000 n=24+25)
FmtFprintfEmpty-4           397ns ± 0%     394ns ± 0%  -0.64%  (p=0.000 n=30+30)
FmtFprintfString-4          679ns ± 0%     678ns ± 0%    ~     (p=0.093 n=30+29)
FmtFprintfInt-4             708ns ± 0%     707ns ± 0%  -0.19%  (p=0.000 n=27+28)
FmtFprintfIntInt-4         1.05µs ± 0%    1.05µs ± 0%  -0.07%  (p=0.001 n=18+30)
FmtFprintfPrefixedInt-4    1.16µs ± 0%    1.15µs ± 0%  -0.41%  (p=0.000 n=29+30)
FmtFprintfFloat-4          2.26µs ± 0%    2.23µs ± 1%  -1.40%  (p=0.000 n=30+30)
FmtManyArgs-4              3.96µs ± 0%    3.95µs ± 0%  -0.29%  (p=0.000 n=29+30)
GobDecode-4                52.9ms ± 2%    53.4ms ± 2%  +0.92%  (p=0.004 n=28+30)
GobEncode-4                49.7ms ± 2%    49.8ms ± 2%    ~     (p=0.890 n=30+26)
Gzip-4                      2.61s ± 0%     2.60s ± 0%  -0.36%  (p=0.000 n=29+29)
Gunzip-4                    312ms ± 0%     311ms ± 0%  -0.13%  (p=0.000 n=30+28)
HTTPClientServer-4         1.02ms ± 8%    1.00ms ± 7%    ~     (p=0.224 n=29+26)
JSONEncode-4                125ms ± 1%     124ms ± 3%  -1.05%  (p=0.000 n=25+30)
JSONDecode-4                432ms ± 1%     436ms ± 2%    ~     (p=0.277 n=26+30)
Mandelbrot200-4            18.4ms ± 0%    18.4ms ± 0%  +0.02%  (p=0.001 n=28+25)
GoParse-4                  22.4ms ± 1%    22.3ms ± 1%  -0.41%  (p=0.000 n=28+28)
RegexpMatchEasy0_32-4       697ns ± 0%     706ns ± 0%  +1.23%  (p=0.000 n=19+30)
RegexpMatchEasy0_1K-4      4.27µs ± 0%    4.26µs ± 0%  -0.06%  (p=0.000 n=30+30)
RegexpMatchEasy1_32-4       741ns ± 0%     735ns ± 0%  -0.86%  (p=0.000 n=26+30)
RegexpMatchEasy1_1K-4      5.49µs ± 0%    5.49µs ± 0%  -0.03%  (p=0.023 n=25+30)
RegexpMatchMedium_32-4     1.05µs ± 2%    1.04µs ± 2%    ~     (p=0.893 n=30+30)
RegexpMatchMedium_1K-4      261µs ± 0%     261µs ± 0%  -0.11%  (p=0.000 n=29+30)
RegexpMatchHard_32-4       14.9µs ± 0%    14.9µs ± 0%  -0.36%  (p=0.000 n=23+29)
RegexpMatchHard_1K-4        446µs ± 0%     445µs ± 0%  -0.17%  (p=0.000 n=30+29)
Revcomp-4                  41.6ms ± 1%    41.7ms ± 1%  +0.27%  (p=0.040 n=28+30)
Template-4                  531ms ± 0%     532ms ± 1%    ~     (p=0.059 n=30+30)
TimeParse-4                3.40µs ± 0%    3.33µs ± 0%  -2.02%  (p=0.000 n=30+30)
TimeFormat-4               6.14µs ± 0%    6.11µs ± 0%  -0.45%  (p=0.000 n=27+29)
[Geo mean]                  384µs          383µs       -0.27%

name                     old speed      new speed      delta
GobDecode-4              14.5MB/s ± 2%  14.4MB/s ± 2%  -0.90%  (p=0.005 n=28+30)
GobEncode-4              15.4MB/s ± 2%  15.4MB/s ± 2%    ~     (p=0.741 n=30+25)
Gzip-4                   7.44MB/s ± 0%  7.47MB/s ± 1%  +0.37%  (p=0.000 n=25+30)
Gunzip-4                 62.3MB/s ± 0%  62.4MB/s ± 0%  +0.13%  (p=0.000 n=30+28)
JSONEncode-4             15.5MB/s ± 1%  15.6MB/s ± 3%  +1.07%  (p=0.000 n=25+30)
JSONDecode-4             4.48MB/s ± 0%  4.46MB/s ± 2%    ~     (p=0.655 n=23+30)
GoParse-4                2.58MB/s ± 1%  2.59MB/s ± 1%  +0.42%  (p=0.000 n=28+29)
RegexpMatchEasy0_32-4    45.9MB/s ± 0%  45.3MB/s ± 0%  -1.23%  (p=0.000 n=28+30)
RegexpMatchEasy0_1K-4     240MB/s ± 0%   240MB/s ± 0%  +0.07%  (p=0.000 n=30+30)
RegexpMatchEasy1_32-4    43.2MB/s ± 0%  43.5MB/s ± 0%  +0.85%  (p=0.000 n=30+28)
RegexpMatchEasy1_1K-4     186MB/s ± 0%   186MB/s ± 0%  +0.03%  (p=0.026 n=25+30)
RegexpMatchMedium_32-4    955kB/s ± 2%   960kB/s ± 2%    ~     (p=0.084 n=30+30)
RegexpMatchMedium_1K-4   3.92MB/s ± 0%  3.93MB/s ± 0%  +0.14%  (p=0.000 n=29+30)
RegexpMatchHard_32-4     2.14MB/s ± 0%  2.15MB/s ± 0%  +0.31%  (p=0.000 n=30+26)
RegexpMatchHard_1K-4     2.30MB/s ± 0%  2.30MB/s ± 0%    ~     (all equal)
Revcomp-4                61.1MB/s ± 1%  60.9MB/s ± 1%  -0.27%  (p=0.039 n=28+30)
Template-4               3.66MB/s ± 0%  3.65MB/s ± 1%  -0.14%  (p=0.045 n=30+30)
[Geo mean]               12.8MB/s       12.8MB/s       +0.04%

Change-Id: I02370e2584b4c041fddd324c97628fd6f0c12183
Reviewed-on: https://go-review.googlesource.com/123179
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-08-20 15:13:23 +00:00
Martin Möhrmann
cd0e79d9f1 all: use internal/cpu feature variables directly
Avoid using package specific variables when there is a one to one
correspondance to cpu feature support exported by internal/cpu.

This makes it clearer which cpu feature is referenced.
Another advantage is that internal/cpu variables are padded to avoid
false sharing and memory and cache usage is shared by multiple packages.

Change-Id: If18fb448a95207cfa6a3376f3b2ddc4b230dd138
Reviewed-on: https://go-review.googlesource.com/126596
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 14:47:07 +00:00
Alberto Donizetti
099498db0e time: always run ZoneAbbr test
CL 52430 added logic to skip the testZoneAbbr test in locales where
the timezone does not have a three-letter name, because the following
line

  Parse(RFC1123, t1.Format(RFC1123))

failed for timezones with only numeric names (like -07).

Since Go 1.11, Parse supports the parsing of timezones with numeric
names (this was implemented in CL 98157), so we can now run the test
unconditionally.

Change-Id: I8ed40e1ba325c0c0dc79c4184a9e71209e2e9a02
Reviewed-on: https://go-review.googlesource.com/127757
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 14:39:59 +00:00
Martin Möhrmann
2556df0ac0 internal/cpu: remove parentheses from arm64 feature constants
The parentheses are not required for the definitions and it brings
the declaration style in line with other architectures feature bits
defined in internal/cpu.

Change-Id: I86cc3812c1488216779e0d1f0e7481687502e592
Reviewed-on: https://go-review.googlesource.com/126775
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-08-20 14:33:26 +00:00
Ben Shi
556971316f cmd/compile: optimize 386's comparison
CMPL/CMPW/CMPB can take a memory operand on 386, and this CL
implements that optimization.

1. The total size of pkg/linux_386 decreases about 45KB, excluding
cmd/compile.

2. The go1 benchmark shows a little improvement.
name                     old time/op    new time/op    delta
BinaryTree17-4              3.36s ± 2%     3.37s ± 3%    ~     (p=0.537 n=40+40)
Fannkuch11-4                3.59s ± 1%     3.53s ± 2%  -1.58%  (p=0.000 n=40+40)
FmtFprintfEmpty-4          46.0ns ± 3%    45.8ns ± 3%    ~     (p=0.249 n=40+40)
FmtFprintfString-4         80.0ns ± 4%    78.8ns ± 3%  -1.49%  (p=0.001 n=40+40)
FmtFprintfInt-4            89.7ns ± 2%    90.3ns ± 2%  +0.74%  (p=0.003 n=40+40)
FmtFprintfIntInt-4          144ns ± 3%     143ns ± 3%  -0.95%  (p=0.003 n=40+40)
FmtFprintfPrefixedInt-4     181ns ± 4%     180ns ± 2%    ~     (p=0.103 n=40+40)
FmtFprintfFloat-4           412ns ± 3%     408ns ± 4%  -0.97%  (p=0.018 n=40+40)
FmtManyArgs-4               607ns ± 4%     605ns ± 4%    ~     (p=0.148 n=40+40)
GobDecode-4                7.19ms ± 4%    7.24ms ± 5%    ~     (p=0.340 n=40+40)
GobEncode-4                7.04ms ± 9%    6.99ms ± 9%    ~     (p=0.289 n=40+40)
Gzip-4                      400ms ± 6%     398ms ± 5%    ~     (p=0.168 n=40+40)
Gunzip-4                   41.2ms ± 3%    41.7ms ± 3%  +1.40%  (p=0.001 n=40+40)
HTTPClientServer-4         62.5µs ± 1%    62.1µs ± 2%  -0.61%  (p=0.000 n=37+37)
JSONEncode-4               20.7ms ± 4%    20.4ms ± 3%  -1.60%  (p=0.000 n=40+40)
JSONDecode-4               69.4ms ± 4%    69.2ms ± 6%    ~     (p=0.177 n=40+40)
Mandelbrot200-4            5.22ms ± 6%    5.21ms ± 3%    ~     (p=0.531 n=40+40)
GoParse-4                  3.29ms ± 3%    3.28ms ± 3%    ~     (p=0.321 n=40+39)
RegexpMatchEasy0_32-4       104ns ± 4%     103ns ± 7%  -0.89%  (p=0.040 n=40+40)
RegexpMatchEasy0_1K-4       852ns ± 3%     853ns ± 2%    ~     (p=0.357 n=40+40)
RegexpMatchEasy1_32-4       113ns ± 8%     113ns ± 3%    ~     (p=0.906 n=40+40)
RegexpMatchEasy1_1K-4      1.03µs ± 4%    1.03µs ± 5%    ~     (p=0.326 n=40+40)
RegexpMatchMedium_32-4      136ns ± 3%     133ns ± 3%  -2.31%  (p=0.000 n=40+40)
RegexpMatchMedium_1K-4     44.0µs ± 3%    43.7µs ± 3%    ~     (p=0.053 n=40+40)
RegexpMatchHard_32-4       2.27µs ± 3%    2.26µs ± 4%    ~     (p=0.391 n=40+40)
RegexpMatchHard_1K-4       68.0µs ± 3%    68.9µs ± 3%  +1.28%  (p=0.000 n=40+40)
Revcomp-4                   1.86s ± 5%     1.86s ± 2%    ~     (p=0.950 n=40+40)
Template-4                 73.4ms ± 4%    69.9ms ± 7%  -4.78%  (p=0.000 n=40+40)
TimeParse-4                 449ns ± 4%     441ns ± 5%  -1.76%  (p=0.000 n=40+40)
TimeFormat-4                416ns ± 3%     417ns ± 4%    ~     (p=0.304 n=40+40)
[Geo mean]                 67.7µs         67.3µs       -0.55%

name                     old speed      new speed      delta
GobDecode-4               107MB/s ± 4%   106MB/s ± 5%    ~     (p=0.336 n=40+40)
GobEncode-4               109MB/s ± 5%   110MB/s ± 9%    ~     (p=0.142 n=38+40)
Gzip-4                   48.5MB/s ± 5%  48.8MB/s ± 5%    ~     (p=0.172 n=40+40)
Gunzip-4                  472MB/s ± 3%   465MB/s ± 3%  -1.39%  (p=0.001 n=40+40)
JSONEncode-4             93.6MB/s ± 4%  95.1MB/s ± 3%  +1.61%  (p=0.000 n=40+40)
JSONDecode-4             28.0MB/s ± 3%  28.1MB/s ± 6%    ~     (p=0.181 n=40+40)
GoParse-4                17.6MB/s ± 3%  17.7MB/s ± 3%    ~     (p=0.350 n=40+39)
RegexpMatchEasy0_32-4     308MB/s ± 4%   311MB/s ± 6%  +0.96%  (p=0.025 n=40+40)
RegexpMatchEasy0_1K-4    1.20GB/s ± 3%  1.20GB/s ± 2%    ~     (p=0.317 n=40+40)
RegexpMatchEasy1_32-4     282MB/s ± 7%   282MB/s ± 3%    ~     (p=0.516 n=40+40)
RegexpMatchEasy1_1K-4     994MB/s ± 4%   991MB/s ± 5%    ~     (p=0.319 n=40+40)
RegexpMatchMedium_32-4   7.31MB/s ± 3%  7.49MB/s ± 3%  +2.46%  (p=0.000 n=40+40)
RegexpMatchMedium_1K-4   23.3MB/s ± 3%  23.4MB/s ± 3%    ~     (p=0.052 n=40+40)
RegexpMatchHard_32-4     14.1MB/s ± 3%  14.1MB/s ± 4%    ~     (p=0.391 n=40+40)
RegexpMatchHard_1K-4     15.1MB/s ± 3%  14.9MB/s ± 3%  -1.27%  (p=0.000 n=40+40)
Revcomp-4                 137MB/s ± 5%   137MB/s ± 2%    ~     (p=0.942 n=40+40)
Template-4               26.5MB/s ± 4%  27.8MB/s ± 7%  +5.03%  (p=0.000 n=40+40)
[Geo mean]               78.6MB/s       79.0MB/s       +0.57%

Change-Id: Idcacc6881ef57cd7dc33aa87b711282842b72a53
Reviewed-on: https://go-review.googlesource.com/126618
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-08-20 14:23:22 +00:00
Ben Shi
b75c5c5992 cmd/compile: optimize AMD64 with more read-modify-write operations
6 more operations which do read-modify-write with a constant
source operand are added.

1. The total size of pkg/linux_amd64 decreases about 3KB, excluding
cmd/compile.

2. The go1 benckmark shows a slight improvement.
name                     old time/op    new time/op    delta
BinaryTree17-4              2.61s ± 4%     2.67s ± 2%  +2.26%  (p=0.000 n=30+29)
Fannkuch11-4                2.39s ± 2%     2.32s ± 2%  -2.67%  (p=0.000 n=30+30)
FmtFprintfEmpty-4          44.0ns ± 4%    41.7ns ± 4%  -5.15%  (p=0.000 n=30+30)
FmtFprintfString-4         74.2ns ± 4%    72.3ns ± 4%  -2.59%  (p=0.000 n=30+30)
FmtFprintfInt-4            81.7ns ± 3%    78.8ns ± 4%  -3.54%  (p=0.000 n=27+30)
FmtFprintfIntInt-4          130ns ± 4%     124ns ± 5%  -4.60%  (p=0.000 n=30+30)
FmtFprintfPrefixedInt-4     154ns ± 3%     152ns ± 3%  -1.13%  (p=0.012 n=30+30)
FmtFprintfFloat-4           215ns ± 4%     212ns ± 5%  -1.56%  (p=0.002 n=30+30)
FmtManyArgs-4               522ns ± 3%     512ns ± 3%  -1.84%  (p=0.001 n=30+30)
GobDecode-4                6.42ms ± 5%    6.49ms ± 7%    ~     (p=0.070 n=30+30)
GobEncode-4                6.07ms ± 8%    5.98ms ± 8%    ~     (p=0.150 n=30+30)
Gzip-4                      236ms ± 4%     223ms ± 4%  -5.57%  (p=0.000 n=30+30)
Gunzip-4                   37.4ms ± 3%    36.7ms ± 4%  -2.03%  (p=0.000 n=30+30)
HTTPClientServer-4         58.7µs ± 1%    58.5µs ± 2%  -0.37%  (p=0.018 n=30+29)
JSONEncode-4               12.0ms ± 4%    12.1ms ± 3%    ~     (p=0.112 n=30+30)
JSONDecode-4               54.5ms ± 3%    55.5ms ± 4%  +1.80%  (p=0.006 n=30+30)
Mandelbrot200-4            3.78ms ± 4%    3.78ms ± 4%    ~     (p=0.173 n=30+30)
GoParse-4                  3.16ms ± 5%    3.22ms ± 5%  +1.75%  (p=0.010 n=30+30)
RegexpMatchEasy0_32-4      76.6ns ± 1%    75.9ns ± 3%    ~     (p=0.672 n=25+30)
RegexpMatchEasy0_1K-4       252ns ± 3%     253ns ± 3%  +0.57%  (p=0.027 n=30+30)
RegexpMatchEasy1_32-4      69.8ns ± 4%    70.2ns ± 6%    ~     (p=0.539 n=30+30)
RegexpMatchEasy1_1K-4       374ns ± 3%     373ns ± 5%    ~     (p=0.263 n=30+30)
RegexpMatchMedium_32-4      107ns ± 4%     109ns ± 3%    ~     (p=0.067 n=30+30)
RegexpMatchMedium_1K-4     33.9µs ± 5%    34.1µs ± 4%    ~     (p=0.297 n=30+30)
RegexpMatchHard_32-4       1.54µs ± 3%    1.56µs ± 4%  +1.43%  (p=0.002 n=30+30)
RegexpMatchHard_1K-4       46.6µs ± 3%    47.0µs ± 3%    ~     (p=0.055 n=30+30)
Revcomp-4                   411ms ± 6%     407ms ± 6%    ~     (p=0.219 n=30+30)
Template-4                 66.8ms ± 3%    64.8ms ± 5%  -3.01%  (p=0.000 n=30+30)
TimeParse-4                 312ns ± 2%     319ns ± 3%  +2.50%  (p=0.000 n=30+30)
TimeFormat-4                296ns ± 5%     299ns ± 3%  +0.93%  (p=0.005 n=30+30)
[Geo mean]                 47.5µs         47.1µs       -0.75%

name                     old speed      new speed      delta
GobDecode-4               120MB/s ± 5%   118MB/s ± 6%    ~     (p=0.072 n=30+30)
GobEncode-4               127MB/s ± 8%   129MB/s ± 8%    ~     (p=0.150 n=30+30)
Gzip-4                   82.1MB/s ± 4%  87.0MB/s ± 4%  +5.90%  (p=0.000 n=30+30)
Gunzip-4                  519MB/s ± 4%   529MB/s ± 4%  +2.07%  (p=0.001 n=30+30)
JSONEncode-4              162MB/s ± 4%   161MB/s ± 3%    ~     (p=0.110 n=30+30)
JSONDecode-4             35.6MB/s ± 3%  35.0MB/s ± 4%  -1.77%  (p=0.007 n=30+30)
GoParse-4                18.3MB/s ± 4%  18.0MB/s ± 4%  -1.72%  (p=0.009 n=30+30)
RegexpMatchEasy0_32-4     418MB/s ± 1%   422MB/s ± 3%    ~     (p=0.645 n=25+30)
RegexpMatchEasy0_1K-4    4.06GB/s ± 3%  4.04GB/s ± 3%  -0.57%  (p=0.033 n=30+30)
RegexpMatchEasy1_32-4     459MB/s ± 4%   456MB/s ± 6%    ~     (p=0.530 n=30+30)
RegexpMatchEasy1_1K-4    2.73GB/s ± 3%  2.75GB/s ± 5%    ~     (p=0.279 n=30+30)
RegexpMatchMedium_32-4   9.28MB/s ± 5%  9.18MB/s ± 4%    ~     (p=0.086 n=30+30)
RegexpMatchMedium_1K-4   30.2MB/s ± 4%  30.0MB/s ± 4%    ~     (p=0.300 n=30+30)
RegexpMatchHard_32-4     20.8MB/s ± 3%  20.5MB/s ± 4%  -1.41%  (p=0.002 n=30+30)
RegexpMatchHard_1K-4     22.0MB/s ± 3%  21.8MB/s ± 3%    ~     (p=0.051 n=30+30)
Revcomp-4                 619MB/s ± 7%   625MB/s ± 7%    ~     (p=0.219 n=30+30)
Template-4               29.0MB/s ± 3%  29.9MB/s ± 4%  +3.11%  (p=0.000 n=30+30)
[Geo mean]                123MB/s        123MB/s       +0.28%

Change-Id: I850652cfd53329c1af804b7f57f4393d8097bb0d
Reviewed-on: https://go-review.googlesource.com/121135
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
2018-08-20 14:18:39 +00:00
Martin Möhrmann
b40db51438 cmd/compile: split slow 3 operand LEA instructions into two LEAs
go tool objdump ../bin/go | grep "\.go\:" | grep -c "LEA.*0x.*[(].*[(].*"
Before: 1012
After: 20

Updates #21735

Benchmarks thanks to drchase@google.com
Intel(R) Xeon(R) CPU E5-1650 v3 @ 3.50GHz
benchstat -geomean *.stdout | grep -v pkg:
name                                       old time/op    new time/op    delta
FastTest2KB-12                              131.0ns ± 0%   131.0ns ± 0%    ~     (all equal)
BaseTest2KB-12                              601.3ns ± 0%   601.3ns ± 0%    ~     (p=0.942 n=45+41)
Encoding4KBVerySparse-12                    15.38µs ± 1%   15.41µs ± 0%  +0.24%  (p=0.000 n=44+43)
Join_8-12                                    2.117s ± 2%    2.128s ± 2%  +0.51%  (p=0.007 n=48+48)
HashimotoLight-12                           1.663ms ± 1%   1.668ms ± 1%  +0.35%  (p=0.006 n=49+49)
Sha3_224_MTU-12                             4.843µs ± 0%   4.836µs ± 0%  -0.14%  (p=0.000 n=45+42)
GenSharedKeyP256-12                         73.74µs ± 0%   70.92µs ± 0%  -3.82%  (p=0.000 n=48+47)
Run/10k/1-12                                 24.81s ± 0%    24.88s ± 0%  +0.30%  (p=0.000 n=48+47)
Run/10k/16-12                                4.621s ± 2%    4.625s ± 3%    ~     (p=0.776 n=50+50)
Dnrm2MediumPosInc-12                        4.018µs ± 0%   4.019µs ± 0%    ~     (p=0.060 n=50+48)
DasumMediumUnitaryInc-12                    855.3ns ± 0%   855.0ns ± 0%  -0.03%  (p=0.000 n=47+42)
Dgeev/Circulant10-12                        40.45µs ± 1%   41.11µs ± 1%  +1.62%  (p=0.000 n=45+49)
Dgeev/Circulant100-12                       10.42ms ± 2%   10.61ms ± 1%  +1.83%  (p=0.000 n=49+48)
MulWorkspaceDense1000Hundredth-12           64.69ms ± 1%   64.63ms ± 1%    ~     (p=0.718 n=48+48)
ScaleVec10000Inc20-12                       22.31µs ± 1%   22.29µs ± 1%    ~     (p=0.424 n=50+50)
ValidateVersionTildeFail-12                 737.6ns ± 1%   736.0ns ± 1%  -0.22%  (p=0.000 n=49+49)
StripHTML-12                                2.846µs ± 0%   2.806µs ± 1%  -1.40%  (p=0.000 n=43+50)
ReaderContains-12                           6.073µs ± 0%   5.999µs ± 0%  -1.22%  (p=0.000 n=48+48)
EncodeCodecFromInternalProtobuf-12          5.817µs ± 2%   5.555µs ± 2%  -4.51%  (p=0.000 n=47+47)
TarjanSCCGnp_10_tenth-12                    7.091µs ± 5%   7.132µs ± 7%    ~     (p=0.361 n=50+50)
TarjanSCCGnp_1000_half-12                   82.25ms ± 3%   81.29ms ± 2%  -1.16%  (p=0.000 n=50+43)
AStarUndirectedmallWorld_10_2_2_2_Heur-12   15.18µs ± 8%   15.11µs ± 7%    ~     (p=0.511 n=50+49)
LouvainDirectedMultiplex-12                 20.92ms ± 1%   21.00ms ± 1%  +0.36%  (p=0.000 n=48+49)
WalkAllBreadthFirstGnp_10_tenth-12          2.974µs ± 4%   2.964µs ± 5%    ~     (p=0.504 n=50+50)
WalkAllBreadthFirstGnp_1000_tenth-12        9.733ms ± 4%   9.741ms ± 4%    ~     (p=0.774 n=48+50)
TextMovementBetweenSegments-12              432.8µs ± 0%   433.2µs ± 1%    ~     (p=0.128 n=50+50)
Growth_MultiSegment-12                      13.11ms ± 0%   13.19ms ± 1%  +0.58%  (p=0.000 n=44+46)
AddingFields/Zap.Sugar-12                   1.296µs ± 1%   1.310µs ± 2%  +1.09%  (p=0.000 n=43+43)
AddingFields/apex/log-12                    34.19µs ± 1%   34.31µs ± 1%  +0.35%  (p=0.000 n=45+45)
AddingFields/inconshreveable/log15-12       30.08µs ± 2%   30.07µs ± 2%    ~     (p=0.803 n=48+47)
AddingFields/sirupsen/logrus-12             6.683µs ± 3%   6.735µs ± 3%  +0.78%  (p=0.000 n=43+42)

[Geo mean]                                  143.5µs        143.3µs       -0.16%

Change-Id: I637203c75c837737f1febced75d5985703e51044
Reviewed-on: https://go-review.googlesource.com/114655
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
2018-08-20 14:17:20 +00:00
Yury Smolsky
c3533d7a26 cmd/cover: remove unused global var and the unquote function
Change-Id: I52a39f2d8f1a296f23624e3ec577d9ad1b8302f1
Reviewed-on: https://go-review.googlesource.com/126555
Run-TryBot: Yury Smolsky <yury@smolsky.by>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-08-20 14:10:05 +00:00
Ben Shi
26d62b4ca9 cmd/internal/obj/arm64: add SWPALD/SWPALW/SWPALH/SWPALB
Those new instructions have acquire/release semantics, besides
normal atomic SWPD/SWPW/SWPH/SWPB.

Change-Id: I24821a4d21aebc342897ae52903aef612c8d8a4a
Reviewed-on: https://go-review.googlesource.com/128476
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-08-20 14:09:51 +00:00
Ben Shi
285747b900 cmd/compile: optimize ARM's comparision
Since MULA&MULS cost more CPU cycles than MUL, so
	MUL Rx, Ry, Rd
	CMP Ra, Rd
cost less cycles than
	MULA Rx, Ry, Ra, Rd
	CMP $0, Rd

This CL implement that optimization, and the GobEncode-4 of the go1 benchmark
got a little improvement, while other cases got little impact (noise excluded).

name                     old time/op    new time/op    delta
BinaryTree17-4              25.2s ± 1%     25.2s ± 0%    ~     (p=0.420 n=30+29)
Fannkuch11-4                13.3s ± 0%     13.3s ± 0%  +0.03%  (p=0.003 n=27+30)
FmtFprintfEmpty-4           406ns ± 0%     405ns ± 0%    ~     (p=0.309 n=30+30)
FmtFprintfString-4          672ns ± 0%     670ns ± 0%  -0.32%  (p=0.000 n=29+29)
FmtFprintfInt-4             717ns ± 0%     714ns ± 0%  -0.42%  (p=0.000 n=27+22)
FmtFprintfIntInt-4         1.07µs ± 0%    1.07µs ± 0%  +0.11%  (p=0.000 n=19+30)
FmtFprintfPrefixedInt-4    1.12µs ± 0%    1.12µs ± 0%  -0.43%  (p=0.000 n=23+30)
FmtFprintfFloat-4          2.25µs ± 0%    2.25µs ± 0%    ~     (p=0.509 n=29+29)
FmtManyArgs-4              4.01µs ± 1%    4.00µs ± 0%  -0.35%  (p=0.000 n=30+30)
GobDecode-4                53.6ms ± 4%    51.9ms ± 2%  -3.17%  (p=0.000 n=30+30)
GobEncode-4                51.1ms ± 2%    50.6ms ± 2%  -0.98%  (p=0.000 n=30+30)
Gzip-4                      2.61s ± 0%     2.61s ± 0%    ~     (p=0.504 n=30+30)
Gunzip-4                    312ms ± 0%     312ms ± 0%    ~     (p=0.866 n=30+30)
HTTPClientServer-4          977µs ± 7%     974µs ± 8%    ~     (p=0.804 n=30+29)
JSONEncode-4                127ms ± 1%     125ms ± 2%  -1.88%  (p=0.000 n=29+29)
JSONDecode-4                435ms ± 3%     431ms ± 2%  -0.80%  (p=0.005 n=30+30)
Mandelbrot200-4            18.4ms ± 0%    18.4ms ± 0%  -0.02%  (p=0.006 n=29+25)
GoParse-4                  22.4ms ± 0%    22.4ms ± 0%    ~     (p=0.105 n=27+29)
RegexpMatchEasy0_32-4       753ns ± 0%     753ns ± 0%    ~     (all equal)
RegexpMatchEasy0_1K-4      4.32µs ± 0%    4.32µs ± 0%    ~     (p=0.554 n=29+28)
RegexpMatchEasy1_32-4       788ns ± 0%     788ns ± 0%    ~     (all equal)
RegexpMatchEasy1_1K-4      5.54µs ± 0%    5.55µs ± 0%  +0.03%  (p=0.013 n=29+30)
RegexpMatchMedium_32-4     1.08µs ± 0%    1.08µs ± 0%    ~     (p=0.443 n=28+28)
RegexpMatchMedium_1K-4      258µs ± 0%     258µs ± 0%    ~     (p=0.932 n=30+28)
RegexpMatchHard_32-4       14.8µs ± 0%    14.8µs ± 0%  -0.06%  (p=0.021 n=30+30)
RegexpMatchHard_1K-4        442µs ± 0%     442µs ± 0%    ~     (p=0.554 n=29+30)
Revcomp-4                  41.7ms ± 1%    41.7ms ± 1%    ~     (p=0.763 n=28+30)
Template-4                  528ms ± 1%     528ms ± 0%    ~     (p=0.072 n=30+29)
TimeParse-4                3.31µs ± 0%    3.31µs ± 0%    ~     (p=0.215 n=30+30)
TimeFormat-4               6.07µs ± 0%    6.07µs ± 0%    ~     (p=0.733 n=30+30)
[Geo mean]                  386µs          385µs       -0.29%

name                     old speed      new speed      delta
GobDecode-4              14.3MB/s ± 4%  14.8MB/s ± 2%  +3.23%  (p=0.000 n=30+30)
GobEncode-4              15.0MB/s ± 2%  15.2MB/s ± 2%  +0.99%  (p=0.000 n=30+30)
Gzip-4                   7.44MB/s ± 0%  7.44MB/s ± 0%    ~     (p=0.328 n=29+30)
Gunzip-4                 62.2MB/s ± 0%  62.2MB/s ± 0%    ~     (p=0.905 n=30+30)
JSONEncode-4             15.2MB/s ± 1%  15.5MB/s ± 2%  +1.93%  (p=0.000 n=29+29)
JSONDecode-4             4.46MB/s ± 3%  4.50MB/s ± 2%  +0.79%  (p=0.007 n=30+30)
GoParse-4                2.58MB/s ± 1%  2.58MB/s ± 1%    ~     (p=0.223 n=29+30)
RegexpMatchEasy0_32-4    42.5MB/s ± 0%  42.5MB/s ± 0%    ~     (p=0.964 n=30+30)
RegexpMatchEasy0_1K-4     237MB/s ± 0%   237MB/s ± 0%    ~     (p=0.392 n=29+28)
RegexpMatchEasy1_32-4    40.6MB/s ± 0%  40.6MB/s ± 0%    ~     (p=0.974 n=30+29)
RegexpMatchEasy1_1K-4     185MB/s ± 0%   185MB/s ± 0%  -0.03%  (p=0.012 n=29+30)
RegexpMatchMedium_32-4    920kB/s ± 0%   920kB/s ± 0%    ~     (all equal)
RegexpMatchMedium_1K-4   3.97MB/s ± 0%  3.97MB/s ± 0%    ~     (all equal)
RegexpMatchHard_32-4     2.17MB/s ± 0%  2.17MB/s ± 0%  +0.18%  (p=0.000 n=30+28)
RegexpMatchHard_1K-4     2.32MB/s ± 0%  2.32MB/s ± 0%    ~     (all equal)
Revcomp-4                61.0MB/s ± 1%  61.0MB/s ± 1%    ~     (p=0.744 n=28+30)
Template-4               3.68MB/s ± 1%  3.67MB/s ± 0%    ~     (p=0.147 n=30+29)
[Geo mean]               12.7MB/s       12.7MB/s       +0.41%

Change-Id: Ic6053c350c94e9bf57db16542e1370b848155342
Reviewed-on: https://go-review.googlesource.com/129535
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-08-20 14:08:53 +00:00
Ben Shi
bd483592a2 cmd/compile/internal/x86: simplify 387 with FLDZ and FLZ1
FLD1 pushes +1.0 to the 387 register stack, and FLDZ pushes +0.0
to the 387 regiser stack.

They can be used to simplify MOVSSconst/MOVSDconst when the
constant is +0.0, -0.0, +1.0, -1.0.

The size of the go executable reduces about 62KB and the total size
of pkg/linux_386 reduces about 7KB with this optimization.

Change-Id: Icc8213b58262e0024a277cf1103812a17dd4b05e
Reviewed-on: https://go-review.googlesource.com/119635
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-08-20 14:05:37 +00:00
Yury Smolsky
5403b8eceb cmd/compile: remove empty branches
Change-Id: Id87d9f55d1714fc553f5b1a9cba0f2fe348dad3e
Reviewed-on: https://go-review.googlesource.com/126396
Run-TryBot: Yury Smolsky <yury@smolsky.by>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 13:42:37 +00:00
Daniel Martí
3b7b9dce43 cmd/compile/internal/gc: various minor cleanups
Two funcs and a field were unused. Remove them.

A few statements could be made simpler.

importsym's pos parameter was unused, so remove it.

Finally, don't use printf-like funcs with constant strings that have no
formatting directives.

Change-Id: I415452249bf2168aa353ac4f3643dfc03017ee53
Reviewed-on: https://go-review.googlesource.com/117699
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2018-08-20 13:27:53 +00:00
Daniel Martí
9e4d87d115 all: update stale test skips
Issues #10043, #15405, and #22660 appear to have been fixed, and
whatever tests I could run locally do succeed, so remove the skips.

Issue #7237 was closed in favor of #17906, so update its skip line.

Issue #7634 was closed as it had not appeared for over three years.
Re-enable it for now. An issue should be open if the test starts being
skipped again.

Change-Id: I67daade906744ed49223291035baddaad9f56dca
Reviewed-on: https://go-review.googlesource.com/121735
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 13:10:24 +00:00
Daniel Martí
0566ab3383 strings: add Builder.Cap
To report the capacity of the underlying buffer. The method mirrors
bytes.Buffer.Cap.

The method can be useful to know whether or not calling write or grow
methods will result in an allocation, or to know how much memory has
been allocated so far.

Fixes #26269.

Change-Id: I391db45ae825011566b594836991e28135369a78
Reviewed-on: https://go-review.googlesource.com/122835
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 13:04:52 +00:00
Daniel Martí
b2e66f1aec cmd/vet: rewrite structtag using go/types
This lets us simplify the code considerably. For example, unquoting the
tag is no longer necessary, and we can get the field name with a single
method call.

While at it, fix a typechecking error in testdata/structtag.go, which
hadn't been caught since vet still skips past go/types errors in most
cases.

Using go/types will also let us expand the structtag check more easily
if we want to, for example to allow it to check for duplicates in
embedded fields.

Finally, update one of the test cases to check for regressions when we
output invalid tag strings. We also checked that these two changes to
testdata/structtag.go didn't fail with the old structtag check.

For #25593.

Change-Id: Iea4906d0f30a67f36b28c21d8aa96251aae653f5
Reviewed-on: https://go-review.googlesource.com/115676
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Rob Pike <r@golang.org>
2018-08-20 12:54:31 +00:00
Tobias Klauser
88aa208024 syscall: use private copy of ustat_t on Linux
Port CL 120295 from golang.org/x/sys/unix to the syscall package.

The ustat syscall has been deprecated on Linux for a long time and the
upcoming glibc 2.28 will remove ustat.h and it can no longer be used to
to generate the Ustat_t wrapper type. Since Linux still provides the
syscall, let's not break this functionality and add a private copy of
struct ustat so Ustat_t can still be generated.

Fixes golang/go#25990

Change-Id: I0dab2ba1cc76fbd21553b499f9256fd9d59ca409
Reviewed-on: https://go-review.googlesource.com/120563
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-08-20 08:01:43 +00:00
Iskander Sharipov
dc79206aec net: combine append calls in reverseaddr
Combined appends lead to fewer machine code and faster performance.
Some may even say that it makes code more readable.

Running revAddrTests over reverseaddr gives measurable improvements:

	name              old time/op  new time/op  delta
	ReverseAddress-8  4.10µs ± 3%  3.94µs ± 1%  -3.81%  (p=0.000 n=10+9)

Change-Id: I9bda7a20f802bcdffc6e948789765d04c6da04e7
Reviewed-on: https://go-review.googlesource.com/117615
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 05:23:29 +00:00
Daniel Martí
e0faedbb53 cmd/go: add missing newlines in printf formats
These are all errors given by module-aware cmd/go, so they must end with
a newline. It looks like they were omitted by mistake.

Fixes #27081.

Change-Id: I19b5803bb48a6d5dd52e857f483278fe20fe246b
Reviewed-on: https://go-review.googlesource.com/129780
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-08-20 03:32:43 +00:00
Austin Clements
edf81050a8 doc/go1.11: Delve 1.1.0 added support for method calls
Change-Id: I5f887f9831378cf76f5a9f447f481ea24c63f390
Reviewed-on: https://go-review.googlesource.com/129803
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-20 02:42:36 +00:00
Russ Cox
bf80e3b564 cmd/go: fix module get -insecure
Need to actually use the flag for it to take effect.

Fixes #27049.

Change-Id: I57227b45f46f9dd67ecbf87c11bb2d08124bcfa0
Reviewed-on: https://go-review.googlesource.com/129801
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-18 18:23:06 +00:00