1
0
mirror of https://github.com/golang/go synced 2024-10-02 18:18:33 -06:00
Commit Graph

31267 Commits

Author SHA1 Message Date
Robert Griesemer
9799622f09 cmd/compile/internal/syntax: differentiate between ';' and '\n' in syntax errors
Towards better syntax error messages: With this change, the parser knows whether
a semicolon was an actual ';' in the source, or whether it was an automatically
inserted semicolon as result of a '\n' or EOF. Using this information in error
messages makes them more understandable.

For #17328.

Change-Id: I8cd9accee8681b62569d0ecef922d38682b401eb
Reviewed-on: https://go-review.googlesource.com/36636
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-02-09 01:45:17 +00:00
Daniel Theophanes
4f6d4bb3f4 database/sql: do not exhaust connection pool on conn request timeout
Previously if a context was canceled while it was waiting for a
connection request, that connection request would leak.

To prevent this remove the pending connection request if the
context is canceled and ensure no connection has been sent on the channel.
This requires a change to how the connection requests are represented in the DB.

Fixes #18995

Change-Id: I9a274b48b8f4f7ca46cdee166faa38f56d030852
Reviewed-on: https://go-review.googlesource.com/36563
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-09 01:12:19 +00:00
Kevin Burke
c57d91e34c database/sql: fix typo
Change-Id: I09fdcebb939417f18af09ed57f24460724cab64f
Reviewed-on: https://go-review.googlesource.com/36632
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-02-09 01:08:08 +00:00
Ian Lance Taylor
27520cc4c5 net: merge FreeBSD and DragonFly sendfile support
The two files were identical except for comments.

Change-Id: Ifc300026c8e4584afa50a7b669099eaff146ea5d
Reviewed-on: https://go-review.googlesource.com/36631
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-08 23:15:14 +00:00
David du Colombier
12991a75e0 cmd/gofmt: fix diff on Plan 9
On Plan 9, GNU diff is called ape/diff.

Fixes #18999.

Change-Id: I7cf6c23c97bcc47172bbf838fd9dd72aefa4c18b
Reviewed-on: https://go-review.googlesource.com/36650
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-08 22:29:33 +00:00
Dmitri Shuralyov
af59742d0f net/http: don't modify Request in StripPrefix
As of https://golang.org/cl/21530, rules are updated to state
that Handlers shouldn't modify the provided Request. This change
updates StripPrefix to follow that rule.

Resolves #18952.

Change-Id: I29bbb580722e871131fa75a97e6e038ec64fdfcd
Reviewed-on: https://go-review.googlesource.com/36483
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-08 21:22:27 +00:00
Cherry Zhang
a146dd3a2f cmd/compile: handle DOT STRUCTLIT for zero-valued struct in SSA
CL 35261 makes SSA handle zero-valued STRUCTLIT, but DOT operation
was not handled.

Fixes #18994.

Change-Id: Ic7976036acca1523b0b14afac4d170797e8aee20
Reviewed-on: https://go-review.googlesource.com/36565
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-08 21:01:51 +00:00
David Lazar
e3efdffacd cmd/compile: include linknames in export data
This lets the compiler inline functions that contain a linknamed symbol.
Previously, the net/http tests would fail to build with -l=4 because
the compiler inlined functions that call net.byteIndex (which is
linknamed to strings.IndexByte).

This changes only the compiler-specific export data, so we don't need to
bump the export format version number.

The following benchmark results show how the size of package export data
is impacted by this change. These benchmarks were created by compiling
the go1 benchmark and running `go tool pack x` to extract the export
data from the resulting .a files.

name                                          old bytes   new bytes   delta
bufio                                        3.48k ± 0%  3.58k ± 0%  +2.90%
bytes                                        5.05k ± 0%  5.16k ± 0%  +2.16%
compress/bzip2                               2.61k ± 0%  2.68k ± 0%  +2.68%
compress/flate                               5.07k ± 0%  5.14k ± 0%  +1.40%
compress/gzip                                8.26k ± 0%  8.40k ± 0%  +1.70%
container/list                               1.69k ± 0%  1.76k ± 0%  +4.07%
context                                      3.93k ± 0%  4.01k ± 0%  +1.86%
crypto                                       1.03k ± 0%  1.03k ± 0%  +0.39%
crypto/aes                                     475 ± 0%    475 ± 0%  +0.00%
crypto/cipher                                1.18k ± 0%  1.18k ± 0%  +0.00%
crypto/des                                     502 ± 0%    502 ± 0%  +0.00%
crypto/dsa                                   5.71k ± 0%  5.77k ± 0%  +1.16%
crypto/ecdsa                                 6.67k ± 0%  6.75k ± 0%  +1.08%
crypto/elliptic                              6.28k ± 0%  6.35k ± 0%  +1.07%
crypto/hmac                                    464 ± 0%    464 ± 0%  +0.00%
crypto/internal/cipherhw                       313 ± 0%    313 ± 0%  +0.00%
crypto/md5                                     691 ± 0%    695 ± 0%  +0.58%
crypto/rand                                  5.37k ± 0%  5.43k ± 0%  +1.23%
crypto/rc4                                     512 ± 0%    512 ± 0%  +0.00%
crypto/rsa                                   7.05k ± 0%  7.12k ± 0%  +1.05%
crypto/sha1                                    756 ± 0%    760 ± 0%  +0.53%
crypto/sha256                                  523 ± 0%    523 ± 0%  +0.00%
crypto/sha512                                  662 ± 0%    662 ± 0%  +0.00%
crypto/subtle                                  835 ± 0%    873 ± 0%  +4.55%
crypto/tls                                   28.1k ± 0%  28.5k ± 0%  +1.30%
crypto/x509                                  17.7k ± 0%  17.9k ± 0%  +1.04%
crypto/x509/pkix                             9.75k ± 0%  9.90k ± 0%  +1.50%
encoding                                       473 ± 0%    473 ± 0%  +0.00%
encoding/asn1                                1.41k ± 0%  1.42k ± 0%  +1.00%
encoding/base64                              1.67k ± 0%  1.69k ± 0%  +0.90%
encoding/binary                              2.65k ± 0%  2.76k ± 0%  +4.07%
encoding/gob                                 13.3k ± 0%  13.5k ± 0%  +1.65%
encoding/hex                                   854 ± 0%    857 ± 0%  +0.35%
encoding/json                                11.9k ± 0%  12.1k ± 0%  +1.71%
encoding/pem                                   484 ± 0%    484 ± 0%  +0.00%
errors                                         360 ± 0%    361 ± 0%  +0.28%
flag                                         7.32k ± 0%  7.42k ± 0%  +1.48%
fmt                                          1.42k ± 0%  1.42k ± 0%  +0.00%
go/ast                                       15.7k ± 0%  15.8k ± 0%  +1.07%
go/parser                                    7.48k ± 0%  7.59k ± 0%  +1.55%
go/scanner                                   3.88k ± 0%  3.94k ± 0%  +1.39%
go/token                                     3.51k ± 0%  3.53k ± 0%  +0.60%
hash                                           507 ± 0%    507 ± 0%  +0.00%
hash/crc32                                     685 ± 0%    685 ± 0%  +0.00%
internal/nettrace                              474 ± 0%    474 ± 0%  +0.00%
internal/pprof/profile                       8.29k ± 0%  8.36k ± 0%  +0.89%
internal/race                                  511 ± 0%    511 ± 0%  +0.00%
internal/singleflight                          966 ± 0%    969 ± 0%  +0.31%
internal/syscall/unix                          427 ± 0%    427 ± 0%  +0.00%
io                                           3.48k ± 0%  3.52k ± 0%  +1.15%
io/ioutil                                    5.30k ± 0%  5.38k ± 0%  +1.53%
log                                          4.46k ± 0%  4.53k ± 0%  +1.59%
math                                         3.72k ± 0%  3.75k ± 0%  +0.75%
math/big                                     8.91k ± 0%  9.01k ± 0%  +1.15%
math/rand                                    1.29k ± 0%  1.30k ± 0%  +0.46%
mime                                         2.59k ± 0%  2.63k ± 0%  +1.55%
mime/multipart                               3.61k ± 0%  3.68k ± 0%  +1.80%
mime/quotedprintable                         2.20k ± 0%  2.25k ± 0%  +2.50%
net                                          21.1k ± 0%  21.3k ± 0%  +1.10%
net/http                                     56.6k ± 0%  57.3k ± 0%  +1.28%
net/http/httptest                            33.6k ± 0%  34.1k ± 0%  +1.38%
net/http/httptrace                           14.4k ± 0%  14.5k ± 0%  +1.29%
net/http/internal                            2.70k ± 0%  2.77k ± 0%  +2.59%
net/textproto                                4.51k ± 0%  4.60k ± 0%  +1.82%
net/url                                      1.71k ± 0%  1.73k ± 0%  +1.41%
os                                           11.3k ± 0%  11.4k ± 0%  +1.36%
path                                           587 ± 0%    589 ± 0%  +0.34%
path/filepath                                4.46k ± 0%  4.55k ± 0%  +1.88%
reflect                                      6.39k ± 0%  6.43k ± 0%  +0.72%
regexp                                       5.82k ± 0%  5.88k ± 0%  +1.12%
regexp/syntax                                3.22k ± 0%  3.24k ± 0%  +0.62%
runtime                                      12.9k ± 0%  13.2k ± 0%  +1.94%
runtime/cgo                                    229 ± 0%    229 ± 0%  +0.00%
runtime/debug                                3.66k ± 0%  3.72k ± 0%  +1.86%
runtime/internal/atomic                        905 ± 0%    905 ± 0%  +0.00%
runtime/internal/sys                         2.00k ± 0%  2.05k ± 0%  +2.55%
runtime/pprof                                4.16k ± 0%  4.23k ± 0%  +1.66%
runtime/pprof/internal/protopprof            11.5k ± 0%  11.7k ± 0%  +1.27%
runtime/trace                                  354 ± 0%    354 ± 0%  +0.00%
sort                                         1.63k ± 0%  1.68k ± 0%  +2.94%
strconv                                      1.84k ± 0%  1.85k ± 0%  +0.54%
strings                                      3.87k ± 0%  3.97k ± 0%  +2.48%
sync                                         1.51k ± 0%  1.52k ± 0%  +0.33%
sync/atomic                                  1.58k ± 0%  1.60k ± 0%  +1.27%
syscall                                      53.2k ± 0%  53.3k ± 0%  +0.20%
testing                                      8.14k ± 0%  8.26k ± 0%  +1.49%
testing/internal/testdeps                      597 ± 0%    598 ± 0%  +0.17%
text/tabwriter                               3.09k ± 0%  3.14k ± 0%  +1.85%
text/template                                15.4k ± 0%  15.7k ± 0%  +1.89%
text/template/parse                          8.90k ± 0%  9.12k ± 0%  +2.46%
time                                         5.75k ± 0%  5.86k ± 0%  +1.86%
unicode                                      4.62k ± 0%  4.62k ± 0%  +0.07%
unicode/utf16                                  693 ± 0%    706 ± 0%  +1.88%
unicode/utf8                                 1.05k ± 0%  1.07k ± 0%  +1.14%
vendor/golang_org/x/crypto/chacha20poly1305  1.25k ± 0%  1.26k ± 0%  +0.64%
vendor/golang_org/x/crypto/curve25519          392 ± 0%    392 ± 0%  +0.00%
vendor/golang_org/x/crypto/poly1305            426 ± 0%    426 ± 0%  +0.00%
vendor/golang_org/x/net/http2/hpack          4.19k ± 0%  4.26k ± 0%  +1.69%
vendor/golang_org/x/net/idna                   355 ± 0%    355 ± 0%  +0.00%
vendor/golang_org/x/net/lex/httplex            609 ± 0%    615 ± 0%  +0.99%
vendor/golang_org/x/text/transform           1.31k ± 0%  1.31k ± 0%  +0.08%
vendor/golang_org/x/text/unicode/norm        5.78k ± 0%  5.90k ± 0%  +2.06%
vendor/golang_org/x/text/width               1.24k ± 0%  1.24k ± 0%  +0.16%
[Geo mean]                                    2.49k       2.52k       +1.10%

Fixes #18167.

Change-Id: Ia5b7e70adc9652c7ee9954ca2efc1c59fa79be2b
Reviewed-on: https://go-review.googlesource.com/33911
Run-TryBot: David Lazar <lazard@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2017-02-08 20:59:45 +00:00
Kale Blankenship
39366326cc net/http/pprof: return error when requested profile duration exceeds WriteTimeout
Updates Profile and Trace handlers to reject requests for durations >=
WriteTimeout.

Modifies go tool pprof to print the body of the http response when
status != 200.

Fixes #18755

Change-Id: I6faed21685693caf39f315f003039538114937b0
Reviewed-on: https://go-review.googlesource.com/35564
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-08 20:23:20 +00:00
Максим Федосеев
7bd968fbfd crypto/tls: fix link to more info about channel bindings
Link in the description of TLSUnique field of ConnectionState struct
leads to an article that is no longer available, so this commit
replaces it with link to a copy of the very same article on another
site.

Fixes #18842.

Change-Id: I8f8d298c4774dc0fbbad5042db0684bb3220aee8
Reviewed-on: https://go-review.googlesource.com/36052
Reviewed-by: Filippo Valsorda <hi@filippo.io>
Reviewed-by: Adam Langley <agl@golang.org>
2017-02-08 19:57:15 +00:00
Jaana Burcu Dogan
e2390ec183 doc: remove the confusing use of CL
CL (change list) pops out of nowhere and confuses the
reader. Use "change" instead to be consistent with the
rest of the document.

Fixes #18989.

Change-Id: I525a63a195dc6bb992c8ad0f10c2f2e1b2b952df
Reviewed-on: https://go-review.googlesource.com/36564
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-08 19:43:30 +00:00
Michael Munday
a16e631e74 cmd/compile: remove unnecessary type conversions on s390x
Some rules insert MOVDreg ops to ensure that type changes are kept.
If there is no type change (or the input is constant) then the MOVDreg
can be omitted, allowing further optimization.

Reduces the size of the .text section in the asm tool by ~33KB.

Change-Id: I386883bb35b843c7b99a269cd6840dca77cf4371
Reviewed-on: https://go-review.googlesource.com/36547
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-02-08 19:29:41 +00:00
Robert Griesemer
92cdde016a go/constant: use new math/big.IsInt and isUint predicates
Slightly cleaner and more readable code.

Change-Id: I35263dbf338861b0a1bd62d59417b6a2c6a4e670
Reviewed-on: https://go-review.googlesource.com/36562
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-08 19:13:19 +00:00
haya14busa
ee7fdc2647 cmd/gofmt: use actual filename in gofmt -d output
By using actual filename, diff output of "gofmt -d" can be used with
other commands like "diffstat" and "patch".

Example:
  $ gofmt -d path/to/file.go | diffstat
  $ gofmt -d path/to/file.go > gofmt.patch
  $ patch -u -p0 < gofmt.patch

Fixes #18932

Change-Id: I21ce15eb77870d72f2c14bfd5e7c21e2c77dc9ab
Reviewed-on: https://go-review.googlesource.com/36374
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-08 19:04:35 +00:00
Aliaksandr Valialkin
8946502776 bytes, strings: optimize Split*
The relevant benchmark results on linux/amd64:

bytes:

SplitSingleByteSeparator-4   25.7ms ± 5%   9.1ms ± 4%  -64.40%  (p=0.000 n=10+10)
SplitMultiByteSeparator-4    13.8ms ±20%   4.3ms ± 8%  -69.23%  (p=0.000 n=10+10)
SplitNSingleByteSeparator-4  1.88µs ± 9%  0.88µs ± 4%  -53.25%  (p=0.000 n=10+10)
SplitNMultiByteSeparator-4   4.83µs ±10%  1.32µs ± 9%  -72.65%  (p=0.000 n=10+10)

strings:

name                         old time/op  new time/op  delta
SplitSingleByteSeparator-4   21.4ms ± 8%   8.5ms ± 5%  -60.19%  (p=0.000 n=10+10)
SplitMultiByteSeparator-4    13.2ms ± 9%   3.9ms ± 4%  -70.29%  (p=0.000 n=10+10)
SplitNSingleByteSeparator-4  1.54µs ± 5%  0.75µs ± 7%  -51.21%  (p=0.000 n=10+10)
SplitNMultiByteSeparator-4   3.57µs ± 8%  1.01µs ±11%  -71.76%  (p=0.000 n=10+10)

Fixes #18973

Change-Id: Ie4bc010c6cc389001e72eab530497c81e5b26f34
Reviewed-on: https://go-review.googlesource.com/36510
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-08 18:39:43 +00:00
Daniel Theophanes
c026845bd2 database/sql: record the context error in Rows if canceled
Previously it was intended that Rows.Scan would return
an error and Rows.Err would return nil. This was problematic
because drivers could not differentiate between a normal
Rows.Close or a context cancel close.

The alternative is to require drivers to return a Scan to return
an error if the driver is closed while there are still rows to be read.
This is currently not how several drivers currently work and may be
difficult to detect when there are additional rows.

At the same time guard the the Rows.lasterr and prevent a close
while a Rows operation is active.

For the drivers that do not have Context methods, do not check for
context cancelation after the operation, but before for any operation
that may modify the database state.

Fixes #18961

Change-Id: I49a25318ecd9f97a35d5b50540ecd850c01cfa5e
Reviewed-on: https://go-review.googlesource.com/36485
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-08 18:30:39 +00:00
Adam Langley
0c9325e13d crypto/tls: document that only tickets are supported.
This change clarifies that only ticket-based resumption is supported by
crypto/tls. It's not clear where to document this for a server,
although perhaps it's obvious there because there's nowhere to plug in
the storage that would be needed by SessionID-based resumption.

Fixes #18607

Change-Id: Iaaed53e8d8f2f45c2f24c0683052df4be6340922
Reviewed-on: https://go-review.googlesource.com/36560
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-08 17:54:06 +00:00
Ilya Tocar
438818d9f1 bytes: use Index in Count
Similar to https://go-review.googlesource.com/28586,
but for package bytes instead of strings.
This provides simpler code and some performance gain.
Also update strings.Count to use the same code.

On AMD64 with heavily optimized Index I see:

name             old time/op    new time/op     delta
Count/10-6         47.3ns ± 0%     36.8ns ± 0%    -22.35%  (p=0.000 n=10+10)
Count/32-6          286ns ± 0%       38ns ± 0%    -86.71%  (p=0.000 n=10+10)
Count/4K-6         50.1µs ± 0%      4.4µs ± 0%    -91.18%  (p=0.000 n=10+10)
Count/4M-6         48.1ms ± 1%      4.5ms ± 0%    -90.56%  (p=0.000 n=10+9)
Count/64M-6         784ms ± 0%       73ms ± 0%    -90.73%  (p=0.000 n=10+10)
CountEasy/10-6     28.4ns ± 0%     31.0ns ± 0%     +9.23%  (p=0.000 n=10+10)
CountEasy/32-6     30.6ns ± 0%     37.0ns ± 0%    +20.92%  (p=0.000 n=10+10)
CountEasy/4K-6      186ns ± 0%      198ns ± 0%     +6.45%  (p=0.000 n=9+10)
CountEasy/4M-6      233µs ± 2%      234µs ± 2%       ~     (p=0.912 n=10+10)
CountEasy/64M-6    6.70ms ± 0%     6.68ms ± 1%       ~     (p=0.762 n=8+10)

name             old speed      new speed       delta
Count/10-6        211MB/s ± 0%    272MB/s ± 0%    +28.77%  (p=0.000 n=10+9)
Count/32-6        112MB/s ± 0%    842MB/s ± 0%   +652.84%  (p=0.000 n=10+10)
Count/4K-6       81.8MB/s ± 0%  927.6MB/s ± 0%  +1033.63%  (p=0.000 n=10+9)
Count/4M-6       87.2MB/s ± 1%  924.0MB/s ± 0%   +959.25%  (p=0.000 n=10+9)
Count/64M-6      85.6MB/s ± 0%  922.9MB/s ± 0%   +978.31%  (p=0.000 n=10+10)
CountEasy/10-6    352MB/s ± 0%    322MB/s ± 0%     -8.41%  (p=0.000 n=10+10)
CountEasy/32-6   1.05GB/s ± 0%   0.87GB/s ± 0%    -17.35%  (p=0.000 n=9+10)
CountEasy/4K-6   22.0GB/s ± 0%   20.6GB/s ± 0%     -6.33%  (p=0.000 n=10+10)
CountEasy/4M-6   18.0GB/s ± 2%   18.0GB/s ± 2%       ~     (p=0.912 n=10+10)
CountEasy/64M-6  10.0GB/s ± 0%   10.0GB/s ± 1%       ~     (p=0.762 n=8+10)

On 386, without asm version of Index:

Count/10-6         57.0ns ± 0%     56.9ns ± 0%   -0.11%  (p=0.006 n=10+9)
Count/32-6          340ns ± 0%      274ns ± 0%  -19.48%  (p=0.000 n=10+9)
Count/4K-6         49.5µs ± 0%     37.1µs ± 0%  -24.96%  (p=0.000 n=10+10)
Count/4M-6         51.1ms ± 0%     38.2ms ± 0%  -25.21%  (p=0.000 n=10+10)
Count/64M-6         818ms ± 0%      613ms ± 0%  -25.07%  (p=0.000 n=8+10)
CountEasy/10-6     60.0ns ± 0%     70.4ns ± 0%  +17.34%  (p=0.000 n=10+10)
CountEasy/32-6     81.1ns ± 0%     94.0ns ± 0%  +15.97%  (p=0.000 n=9+10)
CountEasy/4K-6     4.37µs ± 0%     4.39µs ± 0%   +0.30%  (p=0.000 n=10+9)
CountEasy/4M-6     4.43ms ± 0%     4.43ms ± 0%     ~     (p=0.579 n=10+10)
CountEasy/64M-6    70.9ms ± 0%     70.9ms ± 0%     ~     (p=0.912 n=10+10)

name             old speed      new speed       delta
Count/10-6        176MB/s ± 0%    176MB/s ± 0%   +0.10%  (p=0.000 n=10+9)
Count/32-6       93.9MB/s ± 0%  116.5MB/s ± 0%  +24.06%  (p=0.000 n=10+9)
Count/4K-6       82.7MB/s ± 0%  110.3MB/s ± 0%  +33.26%  (p=0.000 n=10+10)
Count/4M-6       82.1MB/s ± 0%  109.7MB/s ± 0%  +33.70%  (p=0.000 n=10+10)
Count/64M-6      82.0MB/s ± 0%  109.5MB/s ± 0%  +33.46%  (p=0.000 n=8+10)
CountEasy/10-6    167MB/s ± 0%    142MB/s ± 0%  -14.75%  (p=0.000 n=9+10)
CountEasy/32-6    395MB/s ± 0%    340MB/s ± 0%  -13.77%  (p=0.000 n=10+10)
CountEasy/4K-6    936MB/s ± 0%    934MB/s ± 0%   -0.29%  (p=0.000 n=10+9)
CountEasy/4M-6    947MB/s ± 0%    946MB/s ± 0%     ~     (p=0.591 n=10+10)
CountEasy/64M-6   947MB/s ± 0%    947MB/s ± 0%     ~     (p=0.867 n=10+10)

Change-Id: Ia76b247372b6f5b5d23a9f10253a86536a5153b3
Reviewed-on: https://go-review.googlesource.com/36489
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-08 17:52:30 +00:00
Russ Cox
04e0a7622c hash/crc32: use sub-benchmarks
Change-Id: Iae68a097a6897f1616f94fdc3548837ef200e66f
Reviewed-on: https://go-review.googlesource.com/36541
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2017-02-08 17:17:08 +00:00
Brad Fitzpatrick
bd5616991b time: bound file reads and validate LoadLocation argument
Fixes #18985

Change-Id: I956117f47d1d2b453b4786c7b78c1c944defeca0
Reviewed-on: https://go-review.googlesource.com/36551
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-02-08 16:20:25 +00:00
Matthew Dempsky
e410d2a81e cmd/gofmt: clear pattern match map at the correct time
We need to clear the pattern match map after the recursive rewrite
applications, otherwise there might be lingering entries that cause
match to fail.

Fixes #18987.

Change-Id: I7913951c455c98932bda790861db6a860ebad032
Reviewed-on: https://go-review.googlesource.com/36546
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-08 04:48:20 +00:00
Ian Lance Taylor
87ad863f35 runtime: use atomic ops for fwdSig, make sigtable immutable
The fwdSig array is accessed by the signal handler, which may run in
parallel with other threads manipulating it via the os/signal package.
Use atomic accesses to ensure that there are no problems.

Move the _SigHandling flag out of the sigtable array. This makes sigtable
immutable and safe to read from the signal handler.

Change-Id: Icfa407518c4ebe1da38580920ced764898dfc9ad
Reviewed-on: https://go-review.googlesource.com/36321
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-08 04:14:41 +00:00
David Crawshaw
14c2849c3e runtime: update android time_now call
This was broken in https://golang.org/cl/36255

Change-Id: Ib23323a745a650ac51b0ead161076f97efe6d7b7
Reviewed-on: https://go-review.googlesource.com/36543
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-08 02:56:25 +00:00
Alberto Donizetti
48d7199072 cmd/go: clarify that tag lists are space-separated
Apparently the current documentation is confusing users that
quickly skim the flags list at the top. Make very clear that
build tags are space-separated.

Updates #18800

Change-Id: I473552c5a2b70ca03d8bbbd2c76805f7f82b49a2
Reviewed-on: https://go-review.googlesource.com/35951
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-02-08 00:59:03 +00:00
Alex Brainman
3b84a3c9ac os: make Stdin.Stat() return ModeCharDevice if Stdin is console
CL 20845 changed Stdin.Stat() so it returns ModeNamedPipe.
But introduced TestStatStdin does not test what Stdin.Stat()
returns when Stdin is console.

This CL adjusts both TestStatStdin and Stdin.Stat
implementations to handle console. Return ModeCharDevice
from Stdin.Stat() when Stdin is console on windows,
just like it does on unix.

Fixes #14853.

Change-Id: I54d73caee2aea45a99618d11600d8e82fe20d0c0
Reviewed-on: https://go-review.googlesource.com/34090
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-07 23:59:31 +00:00
Matt Layher
3f7a35d91c encoding/json: add Valid for checking validity of input bytes
Fixes #18086

Change-Id: Idc501dd37893e04a01c6ed9920147d24c0c1fa18
Reviewed-on: https://go-review.googlesource.com/34202
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-07 23:48:44 +00:00
Robert Griesemer
1f93ba66d6 math/big: add IsInt64/IsUint64 predicates
Change-Id: Ia5ed3919cb492009ac8f66d175b47a69f83ee4f1
Reviewed-on: https://go-review.googlesource.com/36487
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-02-07 23:02:33 +00:00
Matthew Dempsky
7bad00366b cmd/internal/obj: remove ATYPE
In cmd/compile, we can directly construct obj.Auto to represent local
variables and attach them to the function's obj.LSym.

In preparation for being able to emit more precise DWARF info based on
other compiler available information (e.g., lexical scoping).

Change-Id: I9c4225ec59306bec42552838493022e0e9d70228
Reviewed-on: https://go-review.googlesource.com/36420
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2017-02-07 22:38:18 +00:00
Sameer Ajmani
38cb9d28a9 runtime/pprof: document that profile names should not contain spaces.
Change-Id: I967d897e812bee63b32bc2a7dcf453861b89b7e3
Reviewed-on: https://go-review.googlesource.com/36533
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-07 22:00:48 +00:00
Cherry Zhang
a833485828 cmd/compile: do not use statictmp for zeroing
Also fixes #18687.

Change-Id: I7c6d47c71e632adf4c16937a29074621f771844c
Reviewed-on: https://go-review.googlesource.com/35261
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-02-07 21:15:21 +00:00
Matthew Dempsky
8cf1766930 cmd/compile/internal/ssa: use *obj.LSym in ExternSymbol
Change-Id: I713120f90fd1d2df6698c40622ccac6eae907919
Reviewed-on: https://go-review.googlesource.com/36423
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2017-02-07 20:49:44 +00:00
Matthew Dempsky
1a7582f5e9 cmd/internal/dwarf: use []*Var instead of linked lists
Passes toolstash -cmp.

Change-Id: I202b29495ca1aaf3c52879fa99fdc0a4b86703af
Reviewed-on: https://go-review.googlesource.com/36419
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-07 20:17:24 +00:00
Jaana Burcu Dogan
6cf7918e73 runtime/pprof: clarify CPU profile's captured during the lifetime of the prog
Fixes #18504.

Change-Id: I3716fc58fc98472eea15ce3617aee3890670c276
Reviewed-on: https://go-review.googlesource.com/36430
Reviewed-by: Russ Cox <rsc@golang.org>
2017-02-07 19:46:15 +00:00
Sameer Ajmani
67c3d4dab0 time: delete incorrect docs about day-of-month checks.
Documentation was introduced by CL https://golang.org/cl/14123
but that behavior was changed later by CL https://golang.org/cl/17710.
This CL deletes the stale paragraph.

Fixes #18980

Change-Id: Ib434f1eac6fc814fde1be112a8f52afe6e3e0fcc
Reviewed-on: https://go-review.googlesource.com/36532
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-07 19:24:02 +00:00
Russ Cox
57d06fff3e cmd/go, go/build: better defenses against GOPATH=GOROOT
Fixes #18863.

Change-Id: I0723563cd23728b0d43ebcc25979bf8d21e2a72c
Reviewed-on: https://go-review.googlesource.com/36427
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-02-07 18:45:43 +00:00
Austin Clements
4af6b81d41 runtime: fix confusion between _MaxMem and _MaxArena32
Currently both _MaxMem and _MaxArena32 represent the maximum arena
size on 32-bit hosts (except on MIPS32 where _MaxMem is confusingly
smaller than _MaxArena32).

Clean up sysAlloc so that it always uses _MaxMem, which is the maximum
arena size on both 32- and 64-bit architectures and is the arena size
we allocate auxiliary structures for. This lets us simplify and unify
some code paths and eliminate _MaxArena32.

Fixes #18651. mheap.sysAlloc currently assumes that if the arena is
small, we must be on a 32-bit machine and can therefore grow the arena
to _MaxArena32. This breaks down on darwin/arm64, where _MaxMem is
only 2 GB. As a result, on darwin/arm64, we only reserve spans and
bitmap space for a 2 GB heap, and if the application tries to allocate
beyond that, sysAlloc takes the 32-bit path, tries to grow the arena
beyond 2 GB, and panics when it tries to grow the spans array
allocation past its reserved size. This has probably been a problem
for several releases now, but was only noticed recently because
mapSpans didn't check the bounds on the span reservation until
recently. Most likely it corrupted the bitmap before. By using _MaxMem
consistently, we avoid thinking that we can grow the arena larger than
we have auxiliary structures for.

Change-Id: Ifef28cb746a3ead4b31c1d7348495c2242fef520
Reviewed-on: https://go-review.googlesource.com/35253
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Elias Naur <elias.naur@gmail.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-07 18:39:18 +00:00
Austin Clements
1cc24690b8 runtime: simplify and cleanup mallocinit
mallocinit has evolved organically. Make a pass to clean it up in
various ways:

1. Merge the computation of spansSize and bitmapSize. These were
   computed on every loop iteration of two different loops, but always
   have the same value, which can be derived directly from _MaxMem.
   This also avoids over-reserving these on MIPS, were _MaxArena32 is
   larger than _MaxMem.

2. Remove the ulimit -v logic. It's been disabled for many releases
   and the dead code paths to support it are even more wrong now than
   they were when it was first disabled, since now we *must* reserve
   spans and bitmaps for the full address space.

3. Make it clear that we're using a simple linear allocation to lay
   out the spans, bitmap, and arena spaces. Previously there were a
   lot of redundant pointer computations. Now we just bump p1 up as we
   reserve the spaces.

In preparation for #18651.

Updates #5049 (respect ulimit).

Change-Id: Icbe66570d3a7a17bea227dc54fb3c4978b52a3af
Reviewed-on: https://go-review.googlesource.com/35252
Reviewed-by: Russ Cox <rsc@golang.org>
2017-02-07 18:39:15 +00:00
Austin Clements
efb5eae3cf runtime: make _MaxMem an untyped constant
Currently _MaxMem is a uintptr, which is going to complicate some
further changes. Make it untyped so we'll be able to do untyped math
on it before truncating it to a uintptr.

The runtime assembly is identical before and after this change on
{linux,windows}/{amd64,386}.

Updates #18651.

Change-Id: I0f64511faa9e0aa25179a556ab9f185ebf8c9cf8
Reviewed-on: https://go-review.googlesource.com/35251
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-02-07 18:39:12 +00:00
Josh Bleecher Snyder
46085c4b36 cmd/compile: cmd/internal/obj: cull dead code
This code is dead as a result of

* removing the Follow pass
* moving rotation detection from walk to ssa

Change-Id: I14599c85bedb4e3148347b547e724187920182c4
Reviewed-on: https://go-review.googlesource.com/36484
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-07 17:47:19 +00:00
Cherry Zhang
160914e33c cmd/compile: do not use "oaslit" for global
The compiler did not emit write barrier for assigning global with
struct literal, like global = T{} where T contains pointer.

The relevant code path is:
walkexpr OAS var_ OSTRUCTLIT
    oaslit
        anylit OSTRUCTLIT
            walkexpr OAS var_ nil
            return without adding write barrier
    return true
break (without adding write barrier)

This CL makes oaslit not apply to globals. See also CL
https://go-review.googlesource.com/c/36355/ for an alternative
fix.

The downside of this is that it generates static data for zeroing
struct now. Also this only covers global. If there is any lurking
bug with implicit zeroing other than globals, this doesn't fix.

Fixes #18956.

Change-Id: Ibcd27e4fae3aa38390ffa94a32a9dd7a802e4b37
Reviewed-on: https://go-review.googlesource.com/36410
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-07 17:23:23 +00:00
Russ Cox
1ead0bd1dc crypto/x509: check for new tls-ca-bundle.pem last
We added CentOS 7's /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
to the list in response to #17549 - not being able to find any certs otherwise.

Now we have #18813, where CentOS 6 apparently has both that file
and /etc/pki/tls/certs/ca-bundle.crt, and the latter is complete while
the former is not.

Moving the new CentOS 7 file to the bottom of the list should fix both
problems: the CentOS 7 system that didn't have any of the other files
in the list will still find the new one, and existing systems will still
keep using what they were using instead of preferring the new path
that may or may not be complete on some systems.

Fixes #18813.

Change-Id: I5275ab67424b95e7210e14938d3e986c8caee0ba
Reviewed-on: https://go-review.googlesource.com/36429
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2017-02-07 17:19:05 +00:00
Daniel Martí
99df7c9caa cmd/link, crypto/tls: don't use append loops
Change-Id: Ib47e295e8646b769c30fd81e5c7f20f964df163e
Reviewed-on: https://go-review.googlesource.com/36335
Reviewed-by: Filippo Valsorda <hi@filippo.io>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-07 16:42:32 +00:00
Robert Griesemer
e62aab1274 spec: clarify alignment of arrays
Fixes #18950.

Change-Id: I9f94748f36a896bcadc96f0642eb1f3bff387950
Reviewed-on: https://go-review.googlesource.com/36481
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-02-07 16:28:06 +00:00
Daniel Martí
3e366ec6a7 testing: clarify T.Parallel() godoc wording
Fixes #18914.

Change-Id: Iec90d6aaa62595983db28b17794429f3c9a3dc36
Reviewed-on: https://go-review.googlesource.com/36272
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-02-07 15:30:49 +00:00
Russ Cox
14347ee480 Revert "image: fix the overlap check in Rectangle.Intersect."
This reverts commit a855da29db.

Change-Id: I23c0351b0708877e0b3d1b44a2bc2799cee52cd1
Reviewed-on: https://go-review.googlesource.com/36426
Reviewed-by: Russ Cox <rsc@golang.org>
2017-02-07 15:21:56 +00:00
Seth Vargo
50c7783f59 text/template: remove duplicate logic in conditional
It looks like this conditional may have been refactored at some point,
but the logic was still very confusing. The outer conditional checks if
the function is variadic, so there's no need to verify that in the
result. Additionally, since the function isn't variadic, there is no
reason to permit the function call if the number of input arguments is
less than the function signature requires.

Change-Id: Ia957cf83d1c900c08dd66384efcb74f0c368422e
Reviewed-on: https://go-review.googlesource.com/35491
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-02-07 15:10:25 +00:00
Cherry Zhang
bed8129ee6 cmd/internal/obj: remove Follow pass
The Follow pass in the assembler backend reorders and copies
instructions. This even applies to hand-written assembly code,
which in many cases don't want to be reordered. Now that the
SSA compiler does a good job for laying out instructions, the
benefit of this pass is very little:

AMD64: (old = with Follow, new = without Follow)
name                      old time/op    new time/op    delta
BinaryTree17-12              2.78s ± 1%     2.79s ± 1%  +0.44%  (p=0.000 n=20+19)
Fannkuch11-12                3.11s ± 0%     3.31s ± 1%  +6.16%  (p=0.000 n=19+19)
FmtFprintfEmpty-12          50.9ns ± 1%    51.6ns ± 3%  +1.40%  (p=0.000 n=17+20)
FmtFprintfString-12          127ns ± 0%     128ns ± 1%  +0.88%  (p=0.000 n=17+17)
FmtFprintfInt-12             122ns ± 0%     123ns ± 1%  +0.76%  (p=0.000 n=20+19)
FmtFprintfIntInt-12          185ns ± 1%     186ns ± 1%  +0.65%  (p=0.000 n=20+19)
FmtFprintfPrefixedInt-12     192ns ± 1%     202ns ± 1%  +4.99%  (p=0.000 n=20+19)
FmtFprintfFloat-12           284ns ± 0%     288ns ± 0%  +1.33%  (p=0.000 n=15+19)
FmtManyArgs-12               807ns ± 0%     804ns ± 0%  -0.44%  (p=0.000 n=16+18)
GobDecode-12                7.23ms ± 1%    7.21ms ± 1%    ~     (p=0.052 n=20+20)
GobEncode-12                6.09ms ± 1%    6.12ms ± 1%  +0.41%  (p=0.002 n=19+19)
Gzip-12                      253ms ± 1%     255ms ± 1%  +0.95%  (p=0.000 n=18+20)
Gunzip-12                   38.4ms ± 0%    38.5ms ± 0%  +0.34%  (p=0.000 n=17+17)
HTTPClientServer-12         95.4µs ± 2%    96.1µs ± 1%  +0.78%  (p=0.002 n=19+19)
JSONEncode-12               16.5ms ± 1%    16.6ms ± 1%  +1.17%  (p=0.000 n=19+19)
JSONDecode-12               54.6ms ± 1%    55.3ms ± 1%  +1.23%  (p=0.000 n=18+18)
Mandelbrot200-12            4.47ms ± 0%    4.47ms ± 0%  +0.06%  (p=0.000 n=18+18)
GoParse-12                  3.47ms ± 1%    3.47ms ± 1%    ~     (p=0.583 n=20+20)
RegexpMatchEasy0_32-12      84.8ns ± 1%    85.2ns ± 2%  +0.51%  (p=0.022 n=20+20)
RegexpMatchEasy0_1K-12       206ns ± 1%     206ns ± 1%    ~     (p=0.770 n=20+20)
RegexpMatchEasy1_32-12      82.8ns ± 1%    83.4ns ± 1%  +0.64%  (p=0.000 n=20+19)
RegexpMatchEasy1_1K-12       363ns ± 1%     361ns ± 1%  -0.48%  (p=0.007 n=20+20)
RegexpMatchMedium_32-12      126ns ± 1%     126ns ± 0%  +0.72%  (p=0.000 n=20+20)
RegexpMatchMedium_1K-12     39.1µs ± 1%    39.8µs ± 0%  +1.73%  (p=0.000 n=19+19)
RegexpMatchHard_32-12       1.97µs ± 0%    1.98µs ± 1%  +0.29%  (p=0.005 n=18+20)
RegexpMatchHard_1K-12       59.5µs ± 1%    59.8µs ± 1%  +0.36%  (p=0.000 n=18+20)
Revcomp-12                   442ms ± 1%     445ms ± 2%  +0.67%  (p=0.000 n=19+20)
Template-12                 58.0ms ± 1%    57.5ms ± 1%  -0.85%  (p=0.000 n=19+19)
TimeParse-12                 311ns ± 0%     314ns ± 0%  +0.94%  (p=0.000 n=20+18)
TimeFormat-12                350ns ± 3%     346ns ± 0%    ~     (p=0.076 n=20+19)
[Geo mean]                  55.9µs         56.4µs       +0.80%

ARM32:
name                     old time/op    new time/op    delta
BinaryTree17-4              30.4s ± 0%     30.1s ± 0%  -1.14%  (p=0.000 n=10+8)
Fannkuch11-4                13.7s ± 0%     13.6s ± 0%  -0.75%  (p=0.000 n=10+10)
FmtFprintfEmpty-4           664ns ± 1%     651ns ± 1%  -1.96%  (p=0.000 n=7+8)
FmtFprintfString-4         1.83µs ± 2%    1.77µs ± 2%  -3.21%  (p=0.000 n=10+10)
FmtFprintfInt-4            1.57µs ± 2%    1.54µs ± 2%  -2.25%  (p=0.007 n=10+10)
FmtFprintfIntInt-4         2.37µs ± 2%    2.31µs ± 1%  -2.68%  (p=0.000 n=10+10)
FmtFprintfPrefixedInt-4    2.14µs ± 2%    2.10µs ± 1%  -1.83%  (p=0.006 n=10+10)
FmtFprintfFloat-4          3.69µs ± 2%    3.74µs ± 1%  +1.60%  (p=0.000 n=10+10)
FmtManyArgs-4              9.43µs ± 1%    9.17µs ± 1%  -2.70%  (p=0.000 n=10+10)
GobDecode-4                76.3ms ± 1%    75.5ms ± 1%  -1.14%  (p=0.003 n=10+10)
GobEncode-4                70.7ms ± 2%    69.0ms ± 1%  -2.36%  (p=0.000 n=10+10)
Gzip-4                      2.64s ± 1%     2.65s ± 0%  +0.59%  (p=0.002 n=10+10)
Gunzip-4                    402ms ± 0%     398ms ± 0%  -1.11%  (p=0.000 n=10+9)
HTTPClientServer-4          458µs ± 0%     457µs ± 0%    ~     (p=0.247 n=10+10)
JSONEncode-4                171ms ± 0%     172ms ± 0%  +0.56%  (p=0.000 n=10+10)
JSONDecode-4                672ms ± 1%     668ms ± 1%    ~     (p=0.105 n=10+10)
Mandelbrot200-4            33.5ms ± 0%    33.5ms ± 0%    ~     (p=0.156 n=9+10)
GoParse-4                  33.9ms ± 0%    34.0ms ± 0%  +0.36%  (p=0.031 n=9+9)
RegexpMatchEasy0_32-4       823ns ± 1%     835ns ± 1%  +1.49%  (p=0.000 n=8+8)
RegexpMatchEasy0_1K-4      3.99µs ± 0%    4.02µs ± 1%  +0.92%  (p=0.000 n=8+10)
RegexpMatchEasy1_32-4       877ns ± 3%     904ns ± 2%  +3.07%  (p=0.012 n=10+10)
RegexpMatchEasy1_1K-4      5.99µs ± 0%    5.97µs ± 1%  -0.38%  (p=0.023 n=8+8)
RegexpMatchMedium_32-4     1.40µs ± 2%    1.40µs ± 2%    ~     (p=0.590 n=10+9)
RegexpMatchMedium_1K-4      357µs ± 0%     355µs ± 1%  -0.72%  (p=0.000 n=7+8)
RegexpMatchHard_32-4       22.3µs ± 0%    22.1µs ± 0%  -0.49%  (p=0.000 n=8+7)
RegexpMatchHard_1K-4        661µs ± 0%     658µs ± 0%  -0.42%  (p=0.000 n=8+7)
Revcomp-4                  46.3ms ± 0%    46.3ms ± 0%    ~     (p=0.393 n=10+10)
Template-4                  753ms ± 1%     750ms ± 0%    ~     (p=0.211 n=10+9)
TimeParse-4                4.28µs ± 1%    4.22µs ± 1%  -1.34%  (p=0.000 n=8+10)
TimeFormat-4               9.00µs ± 0%    9.05µs ± 0%  +0.59%  (p=0.000 n=10+10)
[Geo mean]                  538µs          535µs       -0.55%

ARM64:
name                     old time/op    new time/op    delta
BinaryTree17-8              8.39s ± 0%     8.39s ± 0%    ~     (p=0.684 n=10+10)
Fannkuch11-8                5.95s ± 0%     5.99s ± 0%  +0.63%  (p=0.000 n=10+10)
FmtFprintfEmpty-8           116ns ± 0%     116ns ± 0%    ~     (all equal)
FmtFprintfString-8          361ns ± 0%     360ns ± 0%  -0.31%  (p=0.003 n=8+6)
FmtFprintfInt-8             290ns ± 0%     290ns ± 0%    ~     (p=0.620 n=9+9)
FmtFprintfIntInt-8          476ns ± 1%     469ns ± 0%  -1.47%  (p=0.000 n=10+6)
FmtFprintfPrefixedInt-8     412ns ± 2%     417ns ± 2%  +1.39%  (p=0.006 n=9+10)
FmtFprintfFloat-8           652ns ± 1%     652ns ± 0%    ~     (p=0.161 n=10+8)
FmtManyArgs-8              1.94µs ± 0%    1.94µs ± 2%    ~     (p=0.781 n=10+10)
GobDecode-8                17.7ms ± 1%    17.7ms ± 0%    ~     (p=0.962 n=10+7)
GobEncode-8                15.6ms ± 0%    15.6ms ± 1%    ~     (p=0.063 n=10+10)
Gzip-8                      786ms ± 0%     787ms ± 0%    ~     (p=0.356 n=10+9)
Gunzip-8                    127ms ± 0%     127ms ± 0%  +0.08%  (p=0.028 n=10+9)
HTTPClientServer-8          198µs ± 6%     198µs ± 7%    ~     (p=0.796 n=10+10)
JSONEncode-8               42.5ms ± 0%    42.2ms ± 0%  -0.73%  (p=0.000 n=9+8)
JSONDecode-8                158ms ± 1%     162ms ± 0%  +2.28%  (p=0.000 n=10+9)
Mandelbrot200-8            10.1ms ± 0%    10.1ms ± 0%  -0.01%  (p=0.000 n=10+9)
GoParse-8                  8.54ms ± 1%    8.63ms ± 1%  +1.06%  (p=0.000 n=10+9)
RegexpMatchEasy0_32-8       231ns ± 1%     225ns ± 0%  -2.52%  (p=0.000 n=9+10)
RegexpMatchEasy0_1K-8      1.63µs ± 0%    1.63µs ± 0%    ~     (p=0.170 n=10+10)
RegexpMatchEasy1_32-8       253ns ± 0%     249ns ± 0%  -1.41%  (p=0.000 n=9+10)
RegexpMatchEasy1_1K-8      2.08µs ± 0%    2.08µs ± 0%  -0.32%  (p=0.000 n=9+10)
RegexpMatchMedium_32-8      355ns ± 1%     351ns ± 0%  -1.04%  (p=0.007 n=10+7)
RegexpMatchMedium_1K-8      104µs ± 0%     104µs ± 0%    ~     (p=0.148 n=10+10)
RegexpMatchHard_32-8       5.79µs ± 0%    5.79µs ± 0%    ~     (p=0.578 n=10+10)
RegexpMatchHard_1K-8        176µs ± 0%     176µs ± 0%    ~     (p=0.137 n=10+10)
Revcomp-8                   1.37s ± 1%     1.36s ± 1%  -0.26%  (p=0.023 n=10+10)
Template-8                  151ms ± 1%     154ms ± 1%  +2.14%  (p=0.000 n=9+10)
TimeParse-8                 723ns ± 2%     721ns ± 1%    ~     (p=0.592 n=10+10)
TimeFormat-8                804ns ± 2%     798ns ± 3%    ~     (p=0.344 n=10+10)
[Geo mean]                  154µs          154µs       -0.02%

Therefore remove this pass. Also reduce text size by 0.5~2%.

Comment out some dead code in runtime/sys_nacl_amd64p32.s
which contains undefined symbols.

Change-Id: I1473986fe5b18b3d2554ce96cdc6f0999b8d955d
Reviewed-on: https://go-review.googlesource.com/36205
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-02-07 15:00:48 +00:00
Mura Li
76d4274491 crypto/des: improve the throughput of DES and 3DES
For detailed explanation of the adopted (Eric Young's) algorithm,
see http://ftp.nluug.nl/security/coast/libs/libdes/ALGORITHM

benchmark                   old ns/op     new ns/op     delta
BenchmarkEncrypt-16         649           164           -74.73%
BenchmarkDecrypt-16         546           156           -71.43%
BenchmarkTDESEncrypt-16     1651          385           -76.68%
BenchmarkTDESDecrypt-16     1645          378           -77.02%

benchmark                   old MB/s     new MB/s     speedup
BenchmarkEncrypt-16         12.31        48.76        3.96x
BenchmarkDecrypt-16         14.64        51.03        3.49x
BenchmarkTDESEncrypt-16     4.84         20.74        4.29x
BenchmarkTDESDecrypt-16     4.86         21.16        4.35x

Change-Id: Ic3e1fe3340419ec5a0e6379434911eb41e0246f6
Reviewed-on: https://go-review.googlesource.com/36490
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-02-07 14:17:05 +00:00
Alan Donovan
08bb7ccb75 go/types: permit f(nil...) for variadic arguments
This code may be pointless, but it is legal.

Fixes golang/go#18268

Change-Id: Ibacae583606e1a6fdf0c0f01abe2e22e9e608393
Reviewed-on: https://go-review.googlesource.com/34194
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-02-07 14:09:32 +00:00
Nigel Tao
a855da29db image: fix the overlap check in Rectangle.Intersect.
The doc comment for Rectangle.Intersect clearly states, "If the two
rectangles do not overlap then the zero rectangle will be returned."
Prior to this fix, calling Intersect on adjacent but non-overlapping
rectangles would return an empty but non-zero rectangle.

The fix essentially changes
if r.Min.X > r.Max.X || r.Min.Y > r.Max.Y { etc }
to
if r.Min.X >= r.Max.X || r.Min.Y >= r.Max.Y { etc }
(note that the > signs have become >= signs), but changing that line to:
if r.Empty() { etc }
seems clearer (and equivalent).

Change-Id: Ia654e4b9dc805978db3e94d7a9718b6366005360
Reviewed-on: https://go-review.googlesource.com/34853
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-02-07 14:07:02 +00:00