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

10662 Commits

Author SHA1 Message Date
isharipo
50f1f639a4 cmd/asm: add most SSE4 missing instructions
Instructions added:
  INSERTPS immb, r/m, xmm
  MPSADBW immb, r/m, xmm
  BLENDPD immb, r/m, xmm
  BLENDPS immb, r/m, xmm
  DPPD immb, r/m, xmm
  DPPS immb, r/m, xmm
  MOVNTDQA r/m, xmm
  PACKUSDW r/m, xmm
  PBLENDW immb, r/m, xmm
  PCMPEQQ r/m, xmm
  PCMPGTQ r/m, xmm
  PCMPISTRI immb, r/m, xmm
  PCMPISTRM immb, r/m, xmm
  PMAXSB r/m, xmm
  PMAXSD r/m, xmm
  PMAXUD r/m, xmm
  PMAXUW r/m, xmm
  PMINSB r/m, xmm
  PMINSD r/m, xmm
  PMINUD r/m, xmm
  PMINUW r/m, xmm
  PTEST r/m, xmm
  PCMPESTRM immb, r/m, xmm

Note: only 'optab' table is extended.

`EXTRACTPS immb, xmm, r/m` is not included in this
change due to new ytab set 'yextractps'. This should simplify
code review.

4-operand instructions are a subject of upcoming changes that
make 4-th (and so on) operands explicit.
Related TODO note in asm6.go:
"dont't hide 4op, some version have xmm version".

Part of the mission to add missing amd64 SSE4 instructions to Go asm.

Change-Id: I71716df14a8a5332e866dd0f0d52d43d7714872f
Reviewed-on: https://go-review.googlesource.com/57470
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
2017-09-06 16:00:54 +00:00
isharipo
b15e8babc8 cmd/asm: add amd64 PALIGNR instruction
3rd change out of 3 to cover AMD64 SSSE3 instruction set in Go asm.
This commit adds instruction that do require new ytab variable.

Change-Id: I0bc7d9401c9176eb3760c3d59494ef082e97af84
Reviewed-on: https://go-review.googlesource.com/56870
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-09-06 15:37:20 +00:00
isharipo
4074e4e5be cmd/asm: add amd64 CLFLUSH instruction
This is the last instruction I found missing in SSE2 set.

It does not reuse 'yprefetch' ytabs due to differences in
operands SRC/DST roles:
- PREFETCHx: ModRM:r/m(r) -> FROM
- CLFLUSH:   ModRM:r/m(w) -> TO

unaryDst map is extended accordingly.

Change-Id: I89e34ebb81cc0ee5f9ebbb1301bad417f7ee437f
Reviewed-on: https://go-review.googlesource.com/56833
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-09-06 15:37:00 +00:00
isharipo
26dadbe32c cmd/asm: add amd64 PAB{SB,SD,SW}, PMADDUBSW, PMULHRSW, PSIG{NB,ND,NW}
instructions

1st change out of 3 to cover AMD64 SSSE3 instruction set in Go asm.
This commit adds instructions that do not require new named ytab sets.

Change-Id: I0c3dfd8d39c3daa8b7683ab163c63145626d042e
Reviewed-on: https://go-review.googlesource.com/56834
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-09-06 15:35:25 +00:00
Martin Möhrmann
6c102e141c cmd/compile: avoid stack allocation of a map bucket for large constant hints
runtime.makemap will allocate map buckets on the heap for hints larger
than the number of elements a single map bucket can hold.

Do not allocate any map bucket on the stack if it is known at compile time
that hint is larger than the number of elements one map bucket can hold.
This avoids zeroing and reserving memory on the stack that will not be used.

Change-Id: I1a5ab853fb16f6a18d67674a77701bf0cf29b550
Reviewed-on: https://go-review.googlesource.com/60450
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-09-06 04:38:12 +00:00
Martin Möhrmann
9c3f268558 cmd/compile: set hiter type for map iterator in order pass
Previously the type was first set to uint8 and then corrected
later in walkrange.

Change-Id: I9e4b597710e8a5fad39dde035df85676bc8d2874
Reviewed-on: https://go-review.googlesource.com/61032
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-09-05 21:00:59 +00:00
Martin Möhrmann
bb31217579 runtime: move map ismapkey check to the compiler
Remove the runtime ismapkey check from makemap and
add a check that the map key type supports comparison
to the hmap construction in the compiler.

Move the ismapkey check for the reflect code path
into reflect_makemap.

Change-Id: I718f79b0670c05b63ef31721e72408f59ec4ae86
Reviewed-on: https://go-review.googlesource.com/61035
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-09-05 20:39:52 +00:00
Matthew Dempsky
0fb82fbcce cmd/compile: remove global bout variable
Change-Id: I7054bbec080708c3a11ed62d7f6594e82aa33747
Reviewed-on: https://go-review.googlesource.com/61691
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2017-09-05 19:59:21 +00:00
Matthew Dempsky
34db5f0c4d cmd/compile: fix evaluation order for OASOP
Currently, we handle "x op= y" by rewriting as "x = x op y", while
ensuring that any calls or receive operations in 'x' are only
evaluated once. Notably, pointer indirection, indexing operations,
etc. are left alone as it's typically safe to re-evaluate those.

However, those operations were interleaved with evaluating 'y', which
could include function calls that might cause re-evaluation to yield
different memory addresses.

As a fix, simply ensure that we order side-effecting operations in 'y'
before either evaluation of 'x'.

Fixes #21687.

Change-Id: Ib14e77760fda9c828e394e8e362dc9e5319a84b2
Reviewed-on: https://go-review.googlesource.com/60091
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2017-09-05 18:10:17 +00:00
Matthew Dempsky
d349fa25df cmd/compile: fix and improve struct field reflect information
The previous logic was overly complicated, generated suboptimally
encoded struct type descriptors, and mishandled embeddings of
predeclared universal types.

Fixes #21122.
Fixes #21353.
Fixes #21696.
Fixes #21702.
Updates #21357.

Change-Id: If34761fa6dbe4af2af59dee501e7f30845320376
Reviewed-on: https://go-review.googlesource.com/60410
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-09-05 18:09:41 +00:00
Mark Pulford
812b34efae cmd/compile: ignore non-code nodes when inlining
Avoid counting nodes that don't generate code (eg, constants) against the
inlining budget.

Fixes #21749

Change-Id: I10fca073e64be7d304709ef33e125eb8c78d5e4d
Reviewed-on: https://go-review.googlesource.com/61250
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-04 00:07:33 +00:00
Matthew Dempsky
b2e8630f2f cmd/compile: simplify "missing function body" error message
Fixes #21747.

Change-Id: I6a68370be3b7510ce364ddd1e41a1d767ce3a67f
Reviewed-on: https://go-review.googlesource.com/61311
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-09-03 23:45:15 +00:00
Keith Randall
aed1c119fd cmd/compile: fix assembly test
Bad merge, missed changing to keyed literal structs.

Bug introduced in CL 56252

Change-Id: I55cccff4990bd25e6387f6c90919ee5866900d7f
Reviewed-on: https://go-review.googlesource.com/61290
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-03 16:24:24 +00:00
Cholerae Hu
fb165eaffd cmd/compile: combine x*n - y*n into (x-y)*n
Do the similar thing to CL 55143 to reduce IMUL.

Change-Id: I1bd38f618058e3cd74fac181f003610ea13f2294
Reviewed-on: https://go-review.googlesource.com/56252
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-09-03 14:29:38 +00:00
Ilya Tocar
a4e1a72f0a cmd/compile/internal/amd64: add MOVLloadidx8 and MOVLstoreidx8
Currently we only use 1 and 4 as a scale for indexed 4-byte load.
In code generated in #20711 we can use indexed load with scale=8,
to improve performance:

name  old time/op  new time/op  delta
GM-6   108µs ± 0%    95µs ± 0%  -12.06%  (p=0.000 n=10+10)

So add new ops and combine loadidx1(shift 3..).. into loadidx8,
same for stores.

Change-Id: I5ed1c250ac40960e20606580cf9de221e75b72f1
Reviewed-on: https://go-review.googlesource.com/46134
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-09-01 21:25:25 +00:00
David Crawshaw
605331f43e cmd/go: pass plugin package name to compile -p
When compiling a plugin, package main gets a new name so as not to
conflict with the main package in the host binary, or any other
plugins. It is already defined by cmd/go, and used by cmd/link when
filling out the "" package placeholder in symbols.

With this CL, the plugin-specific name for main is also passed to
cmd/compile's -p flag. This is used to fill out the pkgpath field
of types, and ensures that two types defined in two different plugin
mains with the same name will not be mistaken for one another at
runtime.

Fixes #21386

Change-Id: I8a646d8d7451caff533fe0007343ea8b8e1704ed
Reviewed-on: https://go-review.googlesource.com/60910
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-01 18:27:59 +00:00
Rob Pike
e3f3adedcd cmd/go: document the build flags properly for vet
The "build flags" mentioned in the documentation are only those
that apply to analyzing packages and executing the tool.

Fixes #21711.

Change-Id: Ie7b2a354f1e30c928b40888c51fc68e599a5444a
Reviewed-on: https://go-review.googlesource.com/60830
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-01 04:51:50 +00:00
Hiroshi Ioka
f74b52cf50 cmd/cgo: support large unsigned macro again
The approach of https://golang.org/cl/43476 turned out incorrect.
The problem is that the sniff introduced by the CL only work for simple
expression. And when it fails it fallback to uint64, not int64, which
breaks backward compatibility.
In this CL, we use DWARF for guessing kind instead. That should be more
reliable than previous approach. And importanly, it fallbacks to int64 even
if it fails to guess kind.

Fixes #21708

Change-Id: I39a18cb2efbe4faa9becdcf53d5ac68dba180d46
Reviewed-on: https://go-review.googlesource.com/60510
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-01 00:42:21 +00:00
Joel Sing
51e92d7261 cmd/go: fix clang option handling
On OpenBSD -current, clang is available/installed as 'cc'. This means that
the existing clang check fails and the clang related flags are not enabled.
Fix this by enabling the clang flags if the compiler claims to support them.

Change-Id: I84d124d2409a10f87002c6cbfdb69b4c9a55981a
Reviewed-on: https://go-review.googlesource.com/60750
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-01 00:31:15 +00:00
Heschi Kreinick
37dbfc51b0 cmd/link: emit DW_AT_data_member_location as a constant
Simplify the DWARF representation of structs by emitting field offsets
as constants rather than location descriptions.

This was not explicitly mentioned as an option in DWARF2. It is
mentioned in DWARF4, but isn't listed in the changes, so it's not clear
if this was always intended to work or is an undocumented change. Either
way, it should be valid DWARF4.

Change-Id: Idf7fdd397a21c8f8745673ecc77ef65afa3ffe1c
Reviewed-on: https://go-review.googlesource.com/51611
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2017-08-31 19:42:23 +00:00
Sam Whited
bf90da97c1 cmd/fix: rewrite x/net/context by default
Since these are type aliases in Go 1.9 make rewriting
golang.org/x/net/context imports to context the default.

Change-Id: Ib7ee58b59ea5463b92e1590c8b8f5c0ef87d310b
Reviewed-on: https://go-review.googlesource.com/58590
Reviewed-by: Sameer Ajmani <sameer@golang.org>
Run-TryBot: Sam Whited <sam@samwhited.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-31 19:04:54 +00:00
Ben Shi
074547a5ce cmd/internal/obj/arm: support more ARM VFP instructions
Add support of more ARM VFP instructions in the assembler.
They were introduced in ARM VFPv2.

"NMULF/NMULD   Fm, Fn, Fd": Fd = -Fn*Fm
"MULAF/MULAD   Fm, Fn, Fd": Fd = Fd + Fn*Fm
"NMULAF/NMULAD Fm, Fn, Fd": Fd = -(Fd + Fn*Fm)
"MULSF/MULSD   Fm, Fn, Fd": Fd = Fd - Fn*Fm
"NMULSF/NMULSD Fm, Fn, Fd": Fd = -(Fd - Fn*Fm)

Change-Id: Icd302676ca44a9f5f153fce734225299403c4163
Reviewed-on: https://go-review.googlesource.com/60170
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-31 13:42:17 +00:00
Cherry Zhang
7846500a5a cmd/compile: remove redundant constant shift rules
Normal shift rules plus constant folding are enough to generate
efficient shift-by-constant instructions.

Add test to make sure we don't generate comparisons for constant
shifts.

TODO: there are still constant shift rules on PPC64. If they
are removed, the constant folding rules are not enough to remove
all the test and mask stuff for constant shifts. Leave them in
for now.

Fixes #20663.

Change-Id: I724cc324aa8607762d0c8aacf9bfa641bda5c2a1
Reviewed-on: https://go-review.googlesource.com/60330
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-31 02:08:48 +00:00
Hiroshi Ioka
03876af91c cmd/cgo: support niladic function-like macros
Currently, cgo supports only macros which can be reduced to constants
or variables. The CL addresses remaining parts, macros which can be
represented as niladic functions.

The basic idea is simple:
  1. make a thin wrapper function per macros.
  2. replace macro expansions with function calls.

Fixes #10715
Fixes #18720

Change-Id: I150b4fb48e9dc4cc34466ef6417c04ac93d4bc1a
Reviewed-on: https://go-review.googlesource.com/43970
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-30 18:28:58 +00:00
Ilya Tocar
782ee23884 cmd/compile/internal/ssa: remove redundant zeroextensions on amd64
Some instructions operating on <= 32 bits also zero out upper 32bits.
Remove zeroextensions of such values. Triggers a few times during
all.bash. Also removes ugly code like:
MOVL CX,CX

Change-Id: I66a46c190dd6929b7e3c52f3fe6b967768d00638
Reviewed-on: https://go-review.googlesource.com/58090
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-30 16:22:18 +00:00
Ben Shi
64607dbd26 cmd/compile: optimize ARM with MULS
MULS was introduced in ARMv7 and corresponding to MULA. This patch
duplicated all MULA related SSA rules with MULS.

Here was the contrast test result against the original go compiler.
There was no improvement in total, but big improvement in special cases.

1. A specific test case accelerated 18.62%.
(https://github.com/benshi001/ugo1/blob/master/mulsub_test.go)
name                     old time/op    new time/op    delta
MulSub-4                    270µs ± 0%     219µs ± 0%  -18.62%  (p=0.000 n=35+40)

2. Total size of all .a files in pkg/ shrank by 0.002%.

3. The compilecmp benchmark showed no decline.
name        old time/op       new time/op       delta
Template          2.37s ± 3%        2.36s ± 1%    ~     (p=0.233 n=19+18)
Unicode           1.32s ± 2%        1.34s ± 5%  +1.32%  (p=0.011 n=20+18)
GoTypes           7.88s ± 1%        7.87s ± 1%    ~     (p=0.758 n=20+20)
Compiler          37.5s ± 1%        37.6s ± 1%    ~     (p=0.194 n=20+19)
SSA               83.7s ± 2%        83.5s ± 2%    ~     (p=0.569 n=20+19)
Flate             1.46s ± 3%        1.45s ± 1%    ~     (p=0.619 n=20+17)
GoParser          1.87s ± 2%        1.85s ± 1%  -0.58%  (p=0.048 n=20+18)
Reflect           5.10s ± 2%        5.11s ± 2%    ~     (p=0.365 n=19+20)
Tar               1.78s ± 2%        1.78s ± 2%    ~     (p=0.531 n=19+20)
XML               2.62s ± 1%        2.61s ± 2%    ~     (p=0.057 n=17+19)
[Geo mean]        4.68s             4.67s       -0.07%

name        old user-time/op  new user-time/op  delta
Template          2.80s ± 1%        2.79s ± 2%    ~     (p=0.686 n=17+20)
Unicode           1.61s ± 4%        1.63s ± 6%    ~     (p=0.222 n=20+20)
GoTypes           9.59s ± 1%        9.60s ± 1%    ~     (p=0.482 n=17+20)
Compiler          46.1s ± 1%        46.2s ± 1%    ~     (p=0.373 n=20+18)
SSA                108s ± 1%         108s ± 2%    ~     (p=0.784 n=20+20)
Flate             1.68s ± 3%        1.69s ± 3%    ~     (p=0.335 n=20+19)
GoParser          2.20s ± 4%        2.19s ± 2%    ~     (p=0.844 n=20+18)
Reflect           5.97s ± 3%        6.01s ± 2%    ~     (p=0.184 n=20+20)
Tar               2.11s ± 2%        2.11s ± 4%    ~     (p=0.961 n=19+20)
XML               3.07s ± 1%        3.07s ± 3%    ~     (p=0.786 n=16+19)
[Geo mean]        5.61s             5.62s       +0.19%

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)

4. The go1 benchmark showed no decline in total.
name                     old time/op    new time/op    delta
BinaryTree17-4              41.7s ± 1%     41.7s ± 1%    ~     (p=0.966 n=40+40)
Fannkuch11-4                23.6s ± 0%     23.6s ± 1%  -0.23%  (p=0.000 n=40+40)
FmtFprintfEmpty-4           844ns ± 1%     834ns ± 1%  -1.23%  (p=0.000 n=40+40)
FmtFprintfString-4         1.39µs ± 1%    1.40µs ± 1%  +0.71%  (p=0.000 n=40+40)
FmtFprintfInt-4            1.44µs ± 1%    1.45µs ± 1%  +0.70%  (p=0.000 n=40+40)
FmtFprintfIntInt-4         2.10µs ± 1%    2.10µs ± 1%  +0.30%  (p=0.000 n=40+40)
FmtFprintfPrefixedInt-4    2.49µs ± 0%    2.50µs ± 1%  +0.66%  (p=0.000 n=32+40)
FmtFprintfFloat-4          4.42µs ± 1%    4.46µs ± 2%  +0.94%  (p=0.000 n=40+40)
FmtManyArgs-4              8.31µs ± 1%    8.22µs ± 1%  -1.09%  (p=0.000 n=40+40)
GobDecode-4                 105ms ± 1%     102ms ± 1%  -2.30%  (p=0.000 n=39+39)
GobEncode-4                90.2ms ± 1%    88.7ms ± 1%  -1.66%  (p=0.000 n=40+39)
Gzip-4                      4.17s ± 1%     4.16s ± 1%    ~     (p=0.785 n=40+40)
Gunzip-4                    608ms ± 1%     608ms ± 1%    ~     (p=0.481 n=40+40)
HTTPClientServer-4          697µs ± 2%     684µs ± 3%  -1.89%  (p=0.000 n=37+40)
JSONEncode-4                255ms ± 1%     256ms ± 1%  +0.35%  (p=0.000 n=40+40)
JSONDecode-4                920ms ± 1%     926ms ± 1%  +0.64%  (p=0.000 n=40+39)
Mandelbrot200-4            49.3ms ± 1%    49.3ms ± 0%  +0.07%  (p=0.005 n=40+40)
GoParse-4                  46.8ms ± 2%    46.7ms ± 1%    ~     (p=1.000 n=40+40)
RegexpMatchEasy0_32-4      1.27µs ± 0%    1.27µs ± 1%    ~     (p=0.057 n=40+40)
RegexpMatchEasy0_1K-4      7.97µs ± 7%    7.92µs ± 5%    ~     (p=0.094 n=40+40)
RegexpMatchEasy1_32-4      1.28µs ± 1%    1.28µs ± 1%    ~     (p=0.406 n=40+40)
RegexpMatchEasy1_1K-4      10.5µs ± 4%    10.5µs ± 3%    ~     (p=0.855 n=40+40)
RegexpMatchMedium_32-4     2.04µs ± 0%    2.04µs ± 1%  -0.22%  (p=0.000 n=39+40)
RegexpMatchMedium_1K-4      541µs ± 0%     540µs ± 1%  -0.25%  (p=0.000 n=40+38)
RegexpMatchHard_32-4       29.3µs ± 1%    29.3µs ± 0%    ~     (p=0.149 n=40+40)
RegexpMatchHard_1K-4        878µs ± 1%     880µs ± 0%  +0.14%  (p=0.005 n=36+35)
Revcomp-4                  81.8ms ± 2%    81.4ms ± 2%  -0.43%  (p=0.015 n=38+39)
Template-4                  1.05s ± 1%     1.05s ± 1%    ~     (p=0.302 n=40+35)
TimeParse-4                7.18µs ± 1%    7.26µs ± 1%  +1.05%  (p=0.000 n=40+36)
TimeFormat-4               13.1µs ± 1%    13.1µs ± 1%    ~     (p=0.698 n=37+40)
[Geo mean]                  733µs          732µs       -0.16%

name                     old speed      new speed      delta
GobDecode-4              7.34MB/s ± 1%  7.51MB/s ± 1%  +2.36%  (p=0.000 n=39+39)
GobEncode-4              8.51MB/s ± 1%  8.65MB/s ± 1%  +1.69%  (p=0.000 n=40+39)
Gzip-4                   4.66MB/s ± 1%  4.66MB/s ± 1%    ~     (p=0.783 n=40+40)
Gunzip-4                 31.9MB/s ± 1%  31.9MB/s ± 1%    ~     (p=0.466 n=40+40)
JSONEncode-4             7.61MB/s ± 1%  7.58MB/s ± 1%  -0.35%  (p=0.001 n=40+40)
JSONDecode-4             2.11MB/s ± 1%  2.10MB/s ± 1%  -0.52%  (p=0.000 n=38+39)
GoParse-4                1.24MB/s ± 2%  1.24MB/s ± 1%    ~     (p=0.556 n=40+39)
RegexpMatchEasy0_32-4    25.1MB/s ± 0%  25.1MB/s ± 1%    ~     (p=0.064 n=40+40)
RegexpMatchEasy0_1K-4     129MB/s ± 8%   129MB/s ± 5%    ~     (p=0.094 n=40+40)
RegexpMatchEasy1_32-4    25.0MB/s ± 1%  25.1MB/s ± 1%    ~     (p=0.331 n=40+40)
RegexpMatchEasy1_1K-4    97.7MB/s ± 4%  97.8MB/s ± 3%    ~     (p=0.851 n=40+40)
RegexpMatchMedium_32-4    490kB/s ± 0%   490kB/s ± 0%    ~     (all equal)
RegexpMatchMedium_1K-4   1.89MB/s ± 0%  1.90MB/s ± 1%  +0.12%  (p=0.031 n=40+40)
RegexpMatchHard_32-4     1.09MB/s ± 1%  1.09MB/s ± 1%    ~     (p=0.597 n=40+40)
RegexpMatchHard_1K-4     1.16MB/s ± 1%  1.16MB/s ± 1%    ~     (p=0.565 n=40+35)
Revcomp-4                31.1MB/s ± 2%  31.2MB/s ± 2%  +0.44%  (p=0.018 n=38+39)
Template-4               1.85MB/s ± 1%  1.85MB/s ± 1%    ~     (p=0.873 n=40+40)
[Geo mean]               6.66MB/s       6.67MB/s       +0.26%

Change-Id: Icc972d8a78ea06c32c3aa15733ff0537c82c2dc7
Reviewed-on: https://go-review.googlesource.com/58950
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
2017-08-30 13:45:08 +00:00
Martin Möhrmann
dcef97e088 cmd/compile: rename mapbucket to bmap
This makes the name of the function to construct the map bucket type
consistent with runtimes naming and the existing hmap function.

Change-Id: If4d8b4a54c92ab914d4adcb96022b48d8b5db631
Reviewed-on: https://go-review.googlesource.com/59915
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-30 09:44:34 +00:00
Martin Möhrmann
4c9989a360 cmd/compile: avoid padding for indirect map key or value on amd64p32
Padding needed for map buckets is dependent on the types used to
construct the map bucket. In case of indirect keys or values pointers
are used in the map bucket to the keys or values.

Change the map bucket padding calculation to take the alignment of
the key and value types used to construct the map bucket into account
instead of the original key and value type.

Since pointers are always 32bit aligned on amd64p32 this prevents
adding unneeded padding in case the key or value would have needed
64bit alignment without indirect referencing.

Change-Id: I7943448e882d269b5cff7e921a2a6f3430c50878
Reviewed-on: https://go-review.googlesource.com/60030
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-30 09:02:47 +00:00
Martin Möhrmann
2548d36c86 cmd/compile: simplify check for pointers in map bucket
Change-Id: Ie5e977c54f50274421962a7ca268ae71a6f19cef
Reviewed-on: https://go-review.googlesource.com/60050
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-30 07:42:54 +00:00
Martin Möhrmann
54125d191d runtime: move dynamic makemap checks into cmd/compile
Check map invariants, type size and alignments during compile time.

Keep runtime checks for reflect by adding them to reflect_makemap.

Change-Id: Ia28610626591bf7fafb7d5a1ca318da272e54879
Reviewed-on: https://go-review.googlesource.com/59914
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-08-30 07:07:55 +00:00
Alex Brainman
d77d4f509c cmd/link: unexport all peSection fields
Change-Id: I83e168f0d1dd1897a0c02c0f1233e1054e93fb0f
Reviewed-on: https://go-review.googlesource.com/59791
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-30 01:36:22 +00:00
Alex Brainman
3bd79713b7 cmd/link: introduce and use peFile.addDWARF
Change-Id: I2c217e03779772605aa0b5a33ef80459333eeebc
Reviewed-on: https://go-review.googlesource.com/59790
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-30 01:35:29 +00:00
Hiroshi Ioka
0e2cde7c69 cmd/link: refactor container()
* rename to emitPcln because I'd like to skip not only container types,
  but also something like "go.buildid" in the future.
* return bool instead of int.

Change-Id: I029adb81292f7dd2fe98e69f3877c5c27f32ec30
Reviewed-on: https://go-review.googlesource.com/59415
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2017-08-30 01:07:31 +00:00
Ian Lance Taylor
5a7283f146 cmd/link: remove unused SFILE and FileSym
Change-Id: Iec610753052abcf6941a1cd16a9256ee9d689732
Reviewed-on: https://go-review.googlesource.com/59750
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hiroshi Ioka <hirochachacha@gmail.com>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2017-08-29 23:29:45 +00:00
Hiroshi Ioka
1e093043e7 cmd/link: remove dead code
Change-Id: I8a54235c8b7bf1010f19d0d358cd4f76fc911d28
Reviewed-on: https://go-review.googlesource.com/59416
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 23:29:24 +00:00
Hiroshi Ioka
bce795fb1f cmd/link: unexport Elfadddynsym
Change-Id: Ifc66bd8c32e788f35da3bd105bcdcfd04bd3dabc
Reviewed-on: https://go-review.googlesource.com/59414
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2017-08-29 23:29:00 +00:00
Hiroshi Ioka
4eca0898ec cmd/link: refactor addlib
* extract pkgname() and findlib() from the function for #18190.
* rename const pkgname to const pkgdef to avoid confliction.

Change-Id: Ie62509bfbddcf19cf92b5b12b598679a069e6e74
Reviewed-on: https://go-review.googlesource.com/59417
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 23:28:32 +00:00
Austin Clements
b0392159f6 runtime,cmd/trace: trace GC STW events
Right now we only kind of sort of trace GC STW events. We emit events
around mark termination, but those start well after stopping the world
and end before starting it again, and we don't emit any events for
sweep termination.

Fix this by generalizing EvGCScanStart/EvGCScanDone. These were
already re-purposed to indicate mark termination (despite the names).
This commit renames them to EvGCSTWStart/EvGCSTWDone, adds an argument
to indicate the STW reason, and shuffles the runtime to generate them
right before stopping the world and right after starting the world,
respectively.

These events will make it possible to generate precise minimum mutator
utilization (MMU) graphs and could be useful in detecting
non-preemptible goroutines (e.g., #20792).

Change-Id: If95783f370781d8ef66addd94886028103a7c26f
Reviewed-on: https://go-review.googlesource.com/55411
Reviewed-by: Rick Hudson <rlh@golang.org>
2017-08-29 21:54:55 +00:00
Hiroshi Ioka
ec04f107ad cmd/cgo: update documentation on implementation details
Change-Id: Iec771d5bbdf510b6c5ec17a614da90e7974a6348
Reviewed-on: https://go-review.googlesource.com/59870
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-08-29 17:25:23 +00:00
Matthew Dempsky
3124439b3a cmd/compile: make more use of exported position information
Updates #19683.

Change-Id: I64b3b93a3ab14518a5376e1270bdd2a94bdd67ef
Reviewed-on: https://go-review.googlesource.com/59611
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-08-29 15:50:53 +00:00
Carlos Eduardo Seo
526f3420c2 cmd/asm, cmd/internal/obj/ppc64: add ISA 3.0 instructions
This change adds new ppc64 instructions from the POWER9 ISA. This includes
compares, loads, maths, register moves and the new random number generator and
copy/paste facilities.

Change-Id: Ife3720b90f5af184ff115bbcdcbce5c1302d39b6
Reviewed-on: https://go-review.googlesource.com/53930
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
2017-08-29 12:28:38 +00:00
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