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

29233 Commits

Author SHA1 Message Date
Josh Bleecher Snyder
5c3edc46a6 cmd/compile: add Trunc-of-Ext simplifications
This is a follow-up to the discussion
in CL 27853.

During make.bash, trigger count:

24 rewrite generic.rules:57
22 rewrite generic.rules:69
10 rewrite generic.rules:54
10 rewrite generic.rules:58
10 rewrite generic.rules:67
 7 rewrite generic.rules:66
 4 rewrite generic.rules:59
 3 rewrite generic.rules:50
 3 rewrite generic.rules:51
 3 rewrite generic.rules:52
 1 rewrite generic.rules:64

Change-Id: Id96cb6a707a4a564831f763c2d4d0e180c94bbef
Reviewed-on: https://go-review.googlesource.com/28088
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Martin Möhrmann <martisch@uos.de>
2016-08-30 20:53:36 +00:00
Matthew Dempsky
74a00b249b cmd/compile: get rid of ugly {Recvs,Params,Results}P methods
These were a hack abstraction for before FuncType existed.

The result value from calling FuncType() could be saved, but this
maintains the current idiom of consistently using t.FuncType().foo
everywhere in case we choose to evolve the API further.

Change-Id: I81f19aaeab6fb7caa2d4da8bf0bbbc358ab970d0
Reviewed-on: https://go-review.googlesource.com/28150
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-08-30 20:32:33 +00:00
Hiroshi Ioka
7722d0f903 path/filepath: handle ".." in normalizing a path on Windows
Current code assumes there are not ".." in the Clean(path).
That's not true. Clean doesn't handle leading "..", so we need to stop
normalization if we see "..".

Fixes #16793

Change-Id: I0a7901bedac17f1210b134d593ebd9f5e8483775
Reviewed-on: https://go-review.googlesource.com/27410
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-30 20:01:49 +00:00
Robert Griesemer
1319a0ffc7 cmd/compile: remove unused FmtWidth flag
Change-Id: I6c48683b620b0f119d7f0ae4a88502773202756b
Reviewed-on: https://go-review.googlesource.com/28170
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-08-30 19:54:01 +00:00
Matthew Dempsky
6a982c3901 cmd/compile: remove unused Type.Printed field
Change-Id: Iff2b1507dce08ef7c27085c8e0f45d0e3e88c476
Reviewed-on: https://go-review.googlesource.com/28152
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-30 18:47:47 +00:00
Robert Griesemer
2340f4713d cmd/compile: remove unused FmtBody flag and associated code
For #15323.

Change-Id: I23192a05ce57012aa2f96909d90d6a33b913766b
Reviewed-on: https://go-review.googlesource.com/28151
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-08-30 18:32:12 +00:00
Brad Fitzpatrick
f42f20ad39 net/http: fix ordering & data race in TestTransportEventTrace_h2
Ordering fix: this CL swaps the order of the log write and the channel close
in WroteRequest. I could reproduce the bug by putting a sleep between the two
when the channel close was first. It needs to happen after the log.

Data race: use the log buffer's mutex when reading too. Not really
important once the ordering fix above is fixed (since nobody is
concurrently writing anymore), but for consistency.

Fixes #16414

Change-Id: If6657884e67be90b4455c8f5a6f7bc6981999ee4
Reviewed-on: https://go-review.googlesource.com/28078
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-08-30 18:26:45 +00:00
Martin Möhrmann
0dae9dfb08 cmd/compile: improve string iteration performance
Generate a for loop for ranging over strings that only needs to call
the runtime function charntorune for non ASCII characters.

This provides faster iteration over ASCII characters and slightly
faster iteration for other characters.

The runtime function charntorune is changed to take an index from where
to start decoding and returns the index after the last byte belonging
to the decoded rune.

All call sites of charntorune in the runtime are replaced by a for loop
that will be transformed by the compiler instead of calling the charntorune
function directly.

go binary size decreases by 80 bytes.
godoc binary size increases by around 4 kilobytes.

runtime:

name                           old time/op  new time/op  delta
RuneIterate/range/ASCII-4      43.7ns ± 3%  10.3ns ± 4%  -76.33%  (p=0.000 n=44+45)
RuneIterate/range/Japanese-4   72.5ns ± 2%  62.8ns ± 2%  -13.41%  (p=0.000 n=49+50)
RuneIterate/range1/ASCII-4     43.5ns ± 2%  10.4ns ± 3%  -76.18%  (p=0.000 n=50+50)
RuneIterate/range1/Japanese-4  72.5ns ± 2%  62.9ns ± 2%  -13.26%  (p=0.000 n=50+49)
RuneIterate/range2/ASCII-4     43.5ns ± 3%  10.3ns ± 2%  -76.22%  (p=0.000 n=48+47)
RuneIterate/range2/Japanese-4  72.4ns ± 2%  62.7ns ± 2%  -13.47%  (p=0.000 n=50+50)

strings:

name                 old time/op    new time/op    delta
IndexRune-4            64.7ns ± 5%    22.4ns ± 3%  -65.43%  (p=0.000 n=25+21)
MapNoChanges-4          269ns ± 2%     157ns ± 2%  -41.46%  (p=0.000 n=23+24)
Fields-4               23.0ms ± 2%    19.7ms ± 2%  -14.35%  (p=0.000 n=25+25)
FieldsFunc-4           23.1ms ± 2%    19.6ms ± 2%  -14.94%  (p=0.000 n=25+24)

name                 old speed      new speed      delta
Fields-4             45.6MB/s ± 2%  53.2MB/s ± 2%  +16.87%  (p=0.000 n=24+25)
FieldsFunc-4         45.5MB/s ± 2%  53.5MB/s ± 2%  +17.57%  (p=0.000 n=25+24)

Updates #13162

Change-Id: I79ffaf828d82bf9887592f08e5cad883e9f39701
Reviewed-on: https://go-review.googlesource.com/27853
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Martin Möhrmann <martisch@uos.de>
2016-08-30 18:17:20 +00:00
Keith Randall
0d7a2241cb runtime: update a few comments
noescape is now 0 instructions with the SSA backend.
fast atomics are no longer a TODO (at least for amd64).

Change-Id: Ib6e06f7471bef282a47ba236d8ce95404bb60a42
Reviewed-on: https://go-review.googlesource.com/28087
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-30 18:16:28 +00:00
Robert Griesemer
f7ac5da495 cmd/compile: make internal objects directly print to printer
Internal objects that satisfy the Printable interface can print
directly to a printer w/o going through the conversion to a string
first.

Made printer.f understand and special-case %v so that Printable
objects use the printer directly.

This is work in progress and we may end up doing something else
eventually (perhaps using fmt.Formatter) - or even undo these
changes if this exploration doesn't get us to a significantly
better place.

Allocations numbers relative to commit c85b77c (still up, but
reduced from most recent change):

name       old time/op     new time/op     delta
Template       307ms ± 4%      315ms ± 4%   +2.55%        (p=0.000 n=29+29)
Unicode        164ms ± 4%      165ms ± 4%     ~           (p=0.057 n=30+30)
GoTypes        1.01s ± 3%      1.03s ± 3%   +1.72%        (p=0.000 n=30+30)
Compiler       5.49s ± 1%      5.62s ± 2%   +2.31%        (p=0.000 n=30+28)

name       old user-ns/op  new user-ns/op  delta
Template        397M ± 3%       406M ± 6%   +2.21%        (p=0.000 n=28+30)
Unicode         225M ± 4%       226M ± 3%     ~           (p=0.230 n=29+30)
GoTypes        1.31G ± 3%      1.34G ± 5%   +2.79%        (p=0.000 n=30+30)
Compiler       7.39G ± 2%      7.50G ± 2%   +1.43%        (p=0.000 n=30+29)

name       old alloc/op    new alloc/op    delta
Template      46.8MB ± 0%     47.5MB ± 0%   +1.48%        (p=0.000 n=29+28)
Unicode       37.8MB ± 0%     38.1MB ± 0%   +0.64%        (p=0.000 n=30+28)
GoTypes        143MB ± 0%      145MB ± 0%   +1.72%        (p=0.000 n=30+30)
Compiler       683MB ± 0%      706MB ± 0%   +3.31%        (p=0.000 n=30+29)

name       old allocs/op   new allocs/op   delta
Template        444k ± 0%       481k ± 0%   +8.38%        (p=0.000 n=30+30)
Unicode         369k ± 0%       379k ± 0%   +2.74%        (p=0.000 n=30+30)
GoTypes        1.35M ± 0%      1.50M ± 0%  +10.78%        (p=0.000 n=30+30)
Compiler       5.66M ± 0%      6.25M ± 0%  +10.31%        (p=0.000 n=29+29)

For #16897.

Change-Id: I37f95ab60508018ee6d29a98d238482b60e3e4b5
Reviewed-on: https://go-review.googlesource.com/28072
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-08-30 18:06:52 +00:00
Terrel Shumway
fcb45e7cef doc: clarify FAQ wording for float sizes
I was confused by the current wording. This wording
answers the question more clearly.

Thanks to Robert Griesemer for suggestions.

Fixes #16916

Change-Id: I50187c8df2db661b9581f4b3c5d5c279d2f9af41
Reviewed-on: https://go-review.googlesource.com/28052
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-08-30 17:36:32 +00:00
Keith Randall
d6098e4277 cmd/compile: intrinsify sync/atomic for amd64
Uses the same implementation as runtime/internal/atomic.

Reorganize the intrinsic detector to make it more table-driven.

Also works on amd64p32.

Change-Id: I7a5238951d6018d7d5d1bc01f339f6ee9282b2d0
Reviewed-on: https://go-review.googlesource.com/28076
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-08-30 15:23:23 +00:00
Dave Cheney
adb1e67f02 reflect: avoid zeroing memory that will be overwritten
Avoid new'ing memory that will be overwritten by assignment.

name              old time/op    new time/op    delta
Call-4               160ns ± 4%     155ns ± 2%  -3.19%        (p=0.003 n=10+10)
FieldByName1-4      94.5ns ± 2%    95.2ns ± 1%  +0.65%          (p=0.026 n=9+9)
FieldByName2-4      3.09µs ± 4%    3.13µs ± 2%    ~           (p=0.165 n=10+10)
FieldByName3-4      19.8µs ± 1%    19.9µs ± 1%    ~            (p=0.395 n=10+8)
InterfaceBig-4      11.6ns ± 0%    11.7ns ± 0%  +0.86%          (p=0.000 n=8+9)
InterfaceSmall-4    11.7ns ± 0%    11.7ns ± 0%    ~     (all samples are equal)
New-4               26.6ns ± 0%    26.4ns ± 0%  -0.64%         (p=0.000 n=10+9)

name              old alloc/op   new alloc/op   delta
Call-4              0.00B ±NaN%    0.00B ±NaN%    ~     (all samples are equal)

name              old allocs/op  new allocs/op  delta
Call-4               0.00 ±NaN%     0.00 ±NaN%    ~     (all samples are equal)

Change-Id: I12c85d4e65245598669dd6f66beb0744ec9b9d6d
Reviewed-on: https://go-review.googlesource.com/28011
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-30 08:08:37 +00:00
Brad Fitzpatrick
b6e3a98cf3 cmd/go: make C compiler warnings fatal on builders
Fixes #14698

Change-Id: I82fa781bf136c30e900d8e910ff576ba8b218acb
Reviewed-on: https://go-review.googlesource.com/23005
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-08-30 05:25:59 +00:00
Brad Fitzpatrick
2af00eb63c net/http: stop timeout timer if user cancels a request
Change-Id: I84faeae69f294b9a70e545faac6a070feba67770
Reviewed-on: https://go-review.googlesource.com/28074
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-30 02:06:07 +00:00
Jonathan Boulle
6f43a989b0 os: fix typo in comment (Readir -> Readdir)
Change-Id: I8434925661dc11396380af65c192c9f0dc191287
Reviewed-on: https://go-review.googlesource.com/27973
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-30 01:24:57 +00:00
Brad Fitzpatrick
298791a94a all: use time.Until where applicable
Updates #14595

Change-Id: Idf60b3004c7a0ebb59dd48389ab62c854069e09f
Reviewed-on: https://go-review.googlesource.com/28073
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-30 01:23:46 +00:00
Josh Bleecher Snyder
6c6ad08eb9 go/types: fix bad variable shadowing in offsetsof
Introduced in CL 26995.

Fixes #16902

Change-Id: I8e749f598167e1f8b82cd5e735a7eb5291362e5e
Reviewed-on: https://go-review.googlesource.com/28070
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-08-30 00:17:42 +00:00
Sam Whited
67ea710792 time: Add Until helper function
Adds an Until() function that returns the duration until the given time.
This compliments the existing Since() function and makes writing
expressions that have expiration times more readable; for example:

    <-After(time.Until(connExpires)):

Fixes #14595

Change-Id: I87998a924b11d4dad5512e010b29d2da6b123456
Reviewed-on: https://go-review.googlesource.com/20118
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-08-30 00:10:47 +00:00
Brad Fitzpatrick
9f8335b7e7 os: don't let File.Readdir return an empty slice and nil error
In the case of a file being deleted while Readdir was running, it was
possible for File.Readdir to return an empty slice and a nil error,
counter to its documentation.

Fixes #16919

Change-Id: If0e42882eea52fbf5530317a1895f3829ea8e67b
Reviewed-on: https://go-review.googlesource.com/28056
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-29 23:59:42 +00:00
Matthew Dempsky
11e3955e10 net: restore per-query timeout logic
The handling of "options timeout:n" is supposed to be per individual
DNS server exchange, not per Lookup call.

Fixes #16865.

Change-Id: I2304579b9169c1515292f142cb372af9d37ff7c1
Reviewed-on: https://go-review.googlesource.com/28057
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-29 23:40:48 +00:00
Carlos Eduardo Seo
aaa6b53524 runtime: insufficient padding in the p structure
The current padding in the 'p' struct is hardcoded at 64 bytes. It should be the
cache line size. On ppc64x, the current value is only okay because sys.CacheLineSize
is wrong at 64 bytes. This change fixes that by making the padding equal to the
cache line size. It also fixes the cache line size for ppc64/ppc64le to 128 bytes.

Fixes #16477

Change-Id: Ib7ec5195685116eb11ba312a064f41920373d4a3
Reviewed-on: https://go-review.googlesource.com/25370
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-29 23:22:51 +00:00
Ian Lance Taylor
db1fef7b2a cmd/go: for -msan build runtime/cgo with -fsanitize=memory
The go tool used to avoid passing -fsanitize=memory when building
runtime/cgo. That was originally to avoid an msan error, but that error
was fixed anyhow for issue #13815. And building runtime/cgo with
-fsanitize=memory corrects the handling of the context traceback
function when the traceback function itself is built with
-fsanitize=memory.

Change-Id: I4bf5c3d21de6b2eb540600435ae47f5820d17464
Reviewed-on: https://go-review.googlesource.com/24855
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-29 22:49:16 +00:00
Aliaksandr Valialkin
bd9aa9811d cmd/vet: check for copying of array of locks
Updates #14664

Change-Id: I1f7b1116cfe91466816c760f136ce566da3e80a9
Reviewed-on: https://go-review.googlesource.com/24340
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-08-29 21:56:31 +00:00
Aliaksandr Valialkin
c9fbe0f293 cmd/vet: properly handle indexed arguments in printf
Fixes #15884

Change-Id: I33d98db861d74e3c37a546efaf83ce6f2f76d335
Reviewed-on: https://go-review.googlesource.com/24391
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-08-29 21:56:04 +00:00
Ethan Miller
4955147291 math/big: add assembly implementation of arith for ppc64{le}
The existing implementation used a pure go implementation, leading to slow
cryptographic performance.

Implemented mulWW, subVV, mulAddVWW, addMulVVW, and bitLen for
ppc64{le}.
Implemented divWW for ppc64le only, as the DIVDEU instruction is only
available on Power8 or newer.

benchcmp output:

benchmark                         old ns/op     new ns/op     delta
BenchmarkSignP384                 28934360      10877330      -62.41%
BenchmarkRSA2048Decrypt           41261033      5139930       -87.54%
BenchmarkRSA2048Sign              45231300      7610985       -83.17%
Benchmark3PrimeRSA2048Decrypt     20487300      2481408       -87.89%

Fixes #16621

Change-Id: If8b68963bb49909bde832f2bda08a3791c4f5b7a
Reviewed-on: https://go-review.googlesource.com/26951
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Munday <munday@ca.ibm.com>
2016-08-29 21:03:21 +00:00
Robert Griesemer
0a7c73b5db cmd/compile: use printer in typefmt, Tconv
Change-Id: Ib3ac0177761af1edea6b7951ffbbea042fb836d2
Reviewed-on: https://go-review.googlesource.com/28055
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-08-29 21:01:20 +00:00
Kevin Burke
d3134b6450 cmd/compile: document more Node fields
Change-Id: Ic8d37e5612b68bc73c4b50b59db54d8966b69838
Reviewed-on: https://go-review.googlesource.com/27326
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-29 20:52:56 +00:00
Martin Möhrmann
e6f9f39ce5 cmd/compile: generate makeslice calls with int arguments
Where possible generate calls to runtime makeslice with int arguments
during compile time instead of makeslice with int64 arguments.

This eliminates converting arguments for calls to makeslice with
int64 arguments for platforms where int64 values do not fit into
arguments of type int.

godoc 386 binary shrinks by approximately 12 kilobyte.

amd64:
name         old time/op  new time/op  delta
MakeSlice-2  29.8ns ± 1%  29.8ns ± 1%   ~     (p=1.000 n=24+24)

386:
name         old time/op  new time/op  delta
MakeSlice-2  52.3ns ± 0%  45.9ns ± 0%  -12.17%  (p=0.000 n=25+22)

Fixes  #15357

Change-Id: Icb8701bb63c5a83877d26c8a4b78e782ba76de7c
Reviewed-on: https://go-review.googlesource.com/27851
Run-TryBot: Martin Möhrmann <martisch@uos.de>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-08-29 18:25:33 +00:00
Robert Griesemer
595cebb055 cmd/compile: remove ignored bool from exported ODCL nodes
This shortens the export format by 1 byte for each exported ODCL
node in inlined function bodies.

Maintain backward compatibility by updating format version and
continue to accept older format.

Change-Id: I549bb3ade90bc0f146decf8016d5c9c3f14eb293
Reviewed-on: https://go-review.googlesource.com/27999
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-08-29 18:07:47 +00:00
Jaana Burcu Dogan
428d79bd38 os: add example for OpenFile
New beginners are not familiar with open(2)-style masking of the
flags. Add an example demonstrates the flag or'ing.

Change-Id: Ifa8009c55173ba0dc6642c1d3b3124c766b1ebbb
Reviewed-on: https://go-review.googlesource.com/27996
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-29 17:44:31 +00:00
Carlos C
650c2c173d mime/quotedprintable: add examples
Partially addresses #16360

Change-Id: Ic098d2c465742fb50aee325a3fd0e1d50b7b3c99
Reviewed-on: https://go-review.googlesource.com/25575
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-29 17:39:21 +00:00
Ian Lance Taylor
967fa427fd database/sql: don't hang if the driver Exec method panics
Fixes #13677.
Fixes #15901.

Change-Id: Idffb82cdcba4985954d061bdb021217f47ff4984
Reviewed-on: https://go-review.googlesource.com/23576
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-29 16:51:56 +00:00
Josh Bleecher Snyder
e6a96a6277 doc: add cmd/go pkgdir changes to go1.8.txt
Change-Id: I451ca386781b50ab47b313e07a610867fa14aeaf
Reviewed-on: https://go-review.googlesource.com/27990
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-08-29 15:25:13 +00:00
Josh Bleecher Snyder
26124030a0 androidtest.bash: use go list to get pkg dir
This will be more robust in the faces of
future changes to the pkg dir layout.

Change-Id: Iaf078093f02ef3a10884a19c25e2068cbbf5f36a
Reviewed-on: https://go-review.googlesource.com/27929
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-08-29 15:24:39 +00:00
Josh Bleecher Snyder
6dd0b2d702 androidtest.bash: fix pkg dir
CL 24930 altered the default InstallSuffix
for mobile platforms.
Update androidtest.bash to reflect this.
This reverts CL 16151.

A subsequent CL will make this more robust,
but it will take more discussion and review.
In the meantime, this fixes the build.

Change-Id: Ia19ca2c9bab7b79c9cf24beeca64ecddaa60289c
Reviewed-on: https://go-review.googlesource.com/27927
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Elias Naur <elias.naur@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-08-29 15:24:30 +00:00
Josh Bleecher Snyder
8dd069b52a androidtest.bash: require GOARCH
When finding the pkg dir, androidtest.bash assumes
that GOARCH is set. Require it up front.

Change-Id: I143f7b59ad9d98b9c3cfb53c1d65c2d33a6acc12
Reviewed-on: https://go-review.googlesource.com/27926
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Elias Naur <elias.naur@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-08-29 15:23:08 +00:00
Emmanuel Odeke
7c04633e0c all: fix obsolete inferno-os links
Fixes #16911.

Fix obsolete inferno-os links, since code.google.com shutdown.
This CL points to the right files by replacing
http://code.google.com/p/inferno-os/source/browse
with
https://bitbucket.org/inferno-os/inferno-os/src/default

To implement the change I wrote and ran this script in the root:
$ grep -Rn 'http://code.google.com/p/inferno-os/source/browse' * \
| cut -d":" -f1 | while read F;do perl -pi -e \
's/http:\/\/code.google.com\/p\/inferno-os\/source\/browse/https:\/\/bitbucket.org\/inferno-os\/inferno-os\/src\/default/g'
$F;done

I excluded any cmd/vendor changes from the commit.

Change-Id: Iaaf828ac8f6fc949019fd01832989d00b29b6749
Reviewed-on: https://go-review.googlesource.com/27994
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-29 04:54:42 +00:00
Giovanni Bajo
9ac67f56f7 doc: improve issue template
The previous template used an ordered list, but the formatting always
breaks when users paste quoted snippets of code or command outputs.
It is also harder to visually parse because items in ordered lists
are only indented but not highlighted in any way.

Change-Id: I73c89e9f0465aef41093f5c54d11bb0d12ff8c8d
Reviewed-on: https://go-review.googlesource.com/27252
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-29 03:33:28 +00:00
Cherry Zhang
2f679d74e6 cmd/compile: fix load int32 to FP register on big-endian MIPS64
Fixes #16903.

Change-Id: I1f6fcd57e14b2b62e208b7bb3adccd5fd7f8bdbc
Reviewed-on: https://go-review.googlesource.com/27933
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2016-08-28 21:38:09 +00:00
Radu Berinde
8c15a17251 hash/crc32: fix nil Castagnoli table problem
When SSE is available, we don't need the Table. However, it is
returned as a handle by MakeTable. Fix this to always generate
the table.

Further cleanup is discussed in #16909.

Change-Id: Ic05400d68c6b5d25073ebd962000451746137afc
Reviewed-on: https://go-review.googlesource.com/27934
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-28 19:01:07 +00:00
Keith Randall
0c6c3d1de7 cmd/compile: fix noopt build
Atomic add rules were depending on CSE to combine duplicate atomic ops.
With -N, CSE doesn't run.

Redo the rules for atomic add so there's only one atomic op.
Introduce an add-to-first-part-of-tuple pseudo-ops to make the atomic add result correct.

Change-Id: Ib132247051abe5f80fefad6c197db8df8ee06427
Reviewed-on: https://go-review.googlesource.com/27991
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-08-28 18:54:52 +00:00
Keith Randall
84aac622a4 cmd/compile: intrinsify the rest of runtime/internal/atomic for amd64
Atomic swap, add/and/or, compare and swap.

Also works on amd64p32.

Change-Id: Idf2d8f3e1255f71deba759e6e75e293afe4ab2ba
Reviewed-on: https://go-review.googlesource.com/27813
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-08-28 16:31:08 +00:00
Alex Brainman
e2e2d10b9a time: always use $GOROOT/lib/time/zoneinfo.zip with genzabbrs.go
genzabbrs.go uses whatever zoneinfo database available on the system.
This makes genzabbrs.go output change from system to system. Adjust
go:generate line to always use $GOROOT/lib/time/zoneinfo.zip, so it
does not matter who runs the command.

Also move go:generate line into zoneinfo.go, so it can be run
on Unix (see #16368 for details).

Fixes #15802.

Change-Id: I8ae4818aaf40795364e180d7bb4326ad7c07c370
Reviewed-on: https://go-review.googlesource.com/27832
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-28 02:51:07 +00:00
Radu Berinde
90c3cf4b52 hash/crc32: improve the AMD64 implementation using SSE4.2
The algorithm is explained in the comments. The improvement in
throughput is about 1.4x for buffers between 500b-4Kb and 2.5x-2.6x
for larger buffers.

Additionally, we no longer initialize the software tables if SSE4.2 is
available.

Adding a test for the SSE implementation (restricted to amd64 and
amd64p32).

Benchmarks on a Haswell i5-4670 @ 3.4 GHz:

name                           old time/op    new time/op     delta
CastagnoliCrc15B-4               21.9ns ± 1%     22.9ns ± 0%    +4.45%
CastagnoliCrc15BMisaligned-4     22.6ns ± 0%     23.4ns ± 0%    +3.43%
CastagnoliCrc40B-4               23.3ns ± 0%     23.9ns ± 0%    +2.58%
CastagnoliCrc40BMisaligned-4     25.4ns ± 0%     26.1ns ± 0%    +2.86%
CastagnoliCrc512-4               72.6ns ± 0%     52.8ns ± 0%   -27.33%
CastagnoliCrc512Misaligned-4     76.3ns ± 1%     56.3ns ± 0%   -26.18%
CastagnoliCrc1KB-4                128ns ± 1%       89ns ± 0%   -30.04%
CastagnoliCrc1KBMisaligned-4      130ns ± 0%       88ns ± 0%   -32.65%
CastagnoliCrc4KB-4                461ns ± 0%      187ns ± 0%   -59.40%
CastagnoliCrc4KBMisaligned-4      463ns ± 0%      191ns ± 0%   -58.77%
CastagnoliCrc32KB-4              3.58µs ± 0%     1.35µs ± 0%   -62.22%
CastagnoliCrc32KBMisaligned-4    3.58µs ± 0%     1.36µs ± 0%   -61.84%

name                           old speed      new speed       delta
CastagnoliCrc15B-4              684MB/s ± 1%    655MB/s ± 0%    -4.32%
CastagnoliCrc15BMisaligned-4    663MB/s ± 0%    641MB/s ± 0%    -3.32%
CastagnoliCrc40B-4             1.72GB/s ± 0%   1.67GB/s ± 0%    -2.69%
CastagnoliCrc40BMisaligned-4   1.58GB/s ± 0%   1.53GB/s ± 0%    -2.82%
CastagnoliCrc512-4             7.05GB/s ± 0%   9.70GB/s ± 0%   +37.59%
CastagnoliCrc512Misaligned-4   6.71GB/s ± 1%   9.09GB/s ± 0%   +35.43%
CastagnoliCrc1KB-4             7.98GB/s ± 1%  11.46GB/s ± 0%   +43.55%
CastagnoliCrc1KBMisaligned-4   7.86GB/s ± 0%  11.70GB/s ± 0%   +48.75%
CastagnoliCrc4KB-4             8.87GB/s ± 0%  21.80GB/s ± 0%  +145.69%
CastagnoliCrc4KBMisaligned-4   8.83GB/s ± 0%  21.39GB/s ± 0%  +142.25%
CastagnoliCrc32KB-4            9.15GB/s ± 0%  24.22GB/s ± 0%  +164.62%
CastagnoliCrc32KBMisaligned-4  9.16GB/s ± 0%  24.00GB/s ± 0%  +161.94%

Fixes #16107.

Change-Id: Ibe50ea76574674ce0571ef31c31015e0ed66b907
Reviewed-on: https://go-review.googlesource.com/27931
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-28 01:39:03 +00:00
Joonas Kuorilehto
320bd562cb crypto/tls: add KeyLogWriter for debugging
Add support for writing TLS client random and master secret
in NSS key log format.

https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Key_Log_Format

Normally this is enabled by a developer debugging TLS based
applications, especially HTTP/2, by setting the KeyLogWriter
to an open file. The keys negotiated in handshake are then
logged and can be used to decrypt TLS sessions e.g. in Wireshark.

Applications may choose to add support similar to NSS where this
is enabled by environment variable, but no such mechanism is
built in to Go. Instead each application must explicitly enable.

Fixes #13057.

Change-Id: If6edd2d58999903e8390b1674ba4257ecc747ae1
Reviewed-on: https://go-review.googlesource.com/27434
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-27 17:20:55 +00:00
Keith Randall
3427f16642 Revert "hash/crc32: improve the AMD64 implementation using SSE4.2"
This reverts commit 54d7de7dd6.

It was breaking non-amd64 builds.

Change-Id: I22650e922498eeeba3d4fa08bb4ea40a210c8f97
Reviewed-on: https://go-review.googlesource.com/27925
Reviewed-by: Keith Randall <khr@golang.org>
2016-08-27 16:49:02 +00:00
Radu Berinde
54d7de7dd6 hash/crc32: improve the AMD64 implementation using SSE4.2
The algorithm is explained in the comments. The improvement in
throughput is about 1.4x for buffers between 500b-4Kb and 2.5x-2.6x
for larger buffers.

Additionally, we no longer initialize the software tables if SSE4.2 is
available.

Benchmarks on a Haswell i5-4670 @ 3.4 GHz:

name                           old time/op    new time/op     delta
CastagnoliCrc15B-4               21.9ns ± 1%     22.9ns ± 0%    +4.45%
CastagnoliCrc15BMisaligned-4     22.6ns ± 0%     23.4ns ± 0%    +3.43%
CastagnoliCrc40B-4               23.3ns ± 0%     23.9ns ± 0%    +2.58%
CastagnoliCrc40BMisaligned-4     25.4ns ± 0%     26.1ns ± 0%    +2.86%
CastagnoliCrc512-4               72.6ns ± 0%     52.8ns ± 0%   -27.33%
CastagnoliCrc512Misaligned-4     76.3ns ± 1%     56.3ns ± 0%   -26.18%
CastagnoliCrc1KB-4                128ns ± 1%       89ns ± 0%   -30.04%
CastagnoliCrc1KBMisaligned-4      130ns ± 0%       88ns ± 0%   -32.65%
CastagnoliCrc4KB-4                461ns ± 0%      187ns ± 0%   -59.40%
CastagnoliCrc4KBMisaligned-4      463ns ± 0%      191ns ± 0%   -58.77%
CastagnoliCrc32KB-4              3.58µs ± 0%     1.35µs ± 0%   -62.22%
CastagnoliCrc32KBMisaligned-4    3.58µs ± 0%     1.36µs ± 0%   -61.84%

name                           old speed      new speed       delta
CastagnoliCrc15B-4              684MB/s ± 1%    655MB/s ± 0%    -4.32%
CastagnoliCrc15BMisaligned-4    663MB/s ± 0%    641MB/s ± 0%    -3.32%
CastagnoliCrc40B-4             1.72GB/s ± 0%   1.67GB/s ± 0%    -2.69%
CastagnoliCrc40BMisaligned-4   1.58GB/s ± 0%   1.53GB/s ± 0%    -2.82%
CastagnoliCrc512-4             7.05GB/s ± 0%   9.70GB/s ± 0%   +37.59%
CastagnoliCrc512Misaligned-4   6.71GB/s ± 1%   9.09GB/s ± 0%   +35.43%
CastagnoliCrc1KB-4             7.98GB/s ± 1%  11.46GB/s ± 0%   +43.55%
CastagnoliCrc1KBMisaligned-4   7.86GB/s ± 0%  11.70GB/s ± 0%   +48.75%
CastagnoliCrc4KB-4             8.87GB/s ± 0%  21.80GB/s ± 0%  +145.69%
CastagnoliCrc4KBMisaligned-4   8.83GB/s ± 0%  21.39GB/s ± 0%  +142.25%
CastagnoliCrc32KB-4            9.15GB/s ± 0%  24.22GB/s ± 0%  +164.62%
CastagnoliCrc32KBMisaligned-4  9.16GB/s ± 0%  24.00GB/s ± 0%  +161.94%

Fixes #16107.

Change-Id: I8fa827ec03f708ba27ee71c833f7544ad9dc5bc3
Reviewed-on: https://go-review.googlesource.com/24471
Reviewed-by: Keith Randall <khr@golang.org>
2016-08-27 15:50:28 +00:00
Robert Griesemer
0d23c28526 cmd/compile: make dumpdepth a global again
Fixes indenting in debug output like -W.

Change-Id: Ia16b0bad47428cee71fe036c297731e841ec9ca0
Reviewed-on: https://go-review.googlesource.com/27924
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-27 00:08:36 +00:00
Matthew Dempsky
57331b79da Revert "cmd/compile: use printer in typefmt, Tconv"
This reverts commit 8fb0893307.

Broke go/ast tests.

Change-Id: I5c314cb29731d4bc3a0873af8ebfe376f5faba8a
Reviewed-on: https://go-review.googlesource.com/27923
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-08-26 23:40:33 +00:00