]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agocmd/compile/internal/gc: simplify typecheck's Efoo consts
Matthew Dempsky [Tue, 19 Apr 2016 21:15:37 +0000 (14:15 -0700)]
cmd/compile/internal/gc: simplify typecheck's Efoo consts

There's no need for Eiota, Eindir, Eaddr, or Eproc; the values are
threaded through to denote various typechecking contexts, but they
don't actually influence typechecking behavior at all.

Also, while here, switch the Efoo const declarations to use iota.

Passes toolstash -cmp.

Change-Id: I5cea869ccd0755c481cf071978f863474bc9c1ed
Reviewed-on: https://go-review.googlesource.com/22271
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: updated SIGSYS to cause a panic + stacktrace
Julia Hansbrough [Mon, 18 Apr 2016 22:53:29 +0000 (15:53 -0700)]
runtime: updated SIGSYS to cause a panic + stacktrace

On GNU/Linux, SIGSYS is specified to cause the process to terminate
without a core dump. In https://codereview.appspot.com/3749041 , it
appears that Golang accidentally introduced incorrect behavior for
this signal, which caused Golang processes to keep running after
receiving SIGSYS. This change reverts it to the old/correct behavior.

Updates #15204

Change-Id: I3aa48a9499c1bc36fa5d3f40c088fdd7599e0db5
Reviewed-on: https://go-review.googlesource.com/22202
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agostrconv: fix ParseFloat for special forms of zero values
Robert Griesemer [Tue, 19 Apr 2016 21:42:15 +0000 (14:42 -0700)]
strconv: fix ParseFloat for special forms of zero values

Fixes #15364.

Change-Id: Id2a349896064c7c9e00e36c55162068bf18162b2
Reviewed-on: https://go-review.googlesource.com/22272
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocrypto/x509: fix copy/paste-o in error message
Brad Fitzpatrick [Tue, 19 Apr 2016 18:31:17 +0000 (18:31 +0000)]
crypto/x509: fix copy/paste-o in error message

Fixes #15371

Change-Id: Iff8d36e1bd9b5641f6b577a30ac6e967f973c939
Reviewed-on: https://go-review.googlesource.com/22240
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/compile: convT2{I,E} don't handle direct interfaces
Keith Randall [Tue, 19 Apr 2016 19:48:09 +0000 (12:48 -0700)]
cmd/compile: convT2{I,E} don't handle direct interfaces

We now inline type to interface conversions when the type
is pointer-shaped.  No need to keep code to handle that in
convT2{I,E}.

Change-Id: I3a6668259556077cbb2986a9e8fe42a625d506c9
Reviewed-on: https://go-review.googlesource.com/22249
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michel Lespinasse <walken@google.com>
9 years agocmd/compile: transform some Phis into Or8.
Alexandru Moșoi [Tue, 12 Apr 2016 16:24:34 +0000 (18:24 +0200)]
cmd/compile: transform some Phis into Or8.

func f(a, b bool) bool {
          return a || b
}

is now a single instructions (excluding loading and unloading the arguments):
      v10 = ORB <bool> v11 v12 : AX

Change-Id: Iff63399410cb46909f4318ea1c3f45a029f4aa5e
Reviewed-on: https://go-review.googlesource.com/21872
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agogo/types: trailing semis are ok after valid fallthrough
Robert Griesemer [Tue, 19 Apr 2016 21:18:59 +0000 (14:18 -0700)]
go/types: trailing semis are ok after valid fallthrough

Fixes #15376.

Change-Id: I9ece80f26b83be129671c961120c157da2ac0079
Reviewed-on: https://go-review.googlesource.com/22270
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agoruntime: add maxSliceCap
Josh Bleecher Snyder [Tue, 19 Apr 2016 16:18:59 +0000 (09:18 -0700)]
runtime: add maxSliceCap

This avoids expensive division calculations
for many common slice element sizes.

name                      old time/op  new time/op  delta
MakeSlice-8               51.9ns ± 3%  35.1ns ± 2%  -32.41%  (p=0.000 n=10+10)
GrowSliceBytes-8          44.1ns ± 2%  44.1ns ± 1%     ~     (p=0.984 n=10+10)
GrowSliceInts-8           60.9ns ± 3%  60.9ns ± 3%     ~     (p=0.698 n=10+10)
GrowSlicePtr-8             131ns ± 1%   120ns ± 2%   -8.41%   (p=0.000 n=8+10)
GrowSliceStruct24Bytes-8   111ns ± 2%   103ns ± 3%   -7.23%    (p=0.000 n=8+8)

Change-Id: I2630eb3d73c814db030cad16e620ea7fecbbd312
Reviewed-on: https://go-review.googlesource.com/22223
Reviewed-by: Keith Randall <khr@golang.org>
9 years agocmd/compile: static composite literals are side-effect free
Josh Bleecher Snyder [Tue, 19 Apr 2016 19:26:28 +0000 (12:26 -0700)]
cmd/compile: static composite literals are side-effect free

This extends CL 22192.

This removes the remaining performance disparity
between non-SSA and SSA on the AppendInPlace benchmarks.

Going from non-SSA to SSA:

AppendInPlace/NoGrow/2Ptr-8  1.60µs ± 5%  1.53µs ± 5%  -4.04%  (p=0.000 n=15+14)
AppendInPlace/NoGrow/3Ptr-8  2.04µs ± 3%  1.96µs ± 2%  -3.90%  (p=0.000 n=13+14)
AppendInPlace/NoGrow/4Ptr-8  2.83µs ± 8%  2.62µs ± 4%  -7.39%  (p=0.000 n=13+15)

Previously these were 20% regressions.

Change-Id: Ie87810bffd598730658e07585f5e2ef979a12b8f
Reviewed-on: https://go-review.googlesource.com/22248
Reviewed-by: Keith Randall <khr@golang.org>
9 years agocmd/compile: fix isStaticCompositeLiteral
Josh Bleecher Snyder [Tue, 19 Apr 2016 19:08:33 +0000 (12:08 -0700)]
cmd/compile: fix isStaticCompositeLiteral

Previously, isStaticCompositeLiteral would
return the wrong value for literals like:

[1]struct{ b []byte }{b: []byte{1}}

Note that the outermost component is an array,
but once we recurse into isStaticCompositeLiteral,
we never check again that arrays are actually arrays.

Instead of adding more logic to the guts of
isStaticCompositeLiteral, allow it to accept
any Node and return the correct answer.

Change-Id: I6af7814a9037bbc7043da9a96137fbee067bbe0e
Reviewed-on: https://go-review.googlesource.com/22247
Reviewed-by: Keith Randall <khr@golang.org>
9 years agogo/types: accept trailing empty stmts in terminating stmt lists
Robert Griesemer [Tue, 19 Apr 2016 18:27:52 +0000 (11:27 -0700)]
go/types: accept trailing empty stmts in terminating stmt lists

Per the latest spec refinement (https://golang.org/cl/19981).

Fixes #14537.

Change-Id: I2dedee942c4da21dc94bdeda466f133827ab5bb9
Reviewed-on: https://go-review.googlesource.com/22241
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocrypto/aes: de-couple asm and go implementations
Michael Munday [Fri, 15 Apr 2016 20:56:37 +0000 (16:56 -0400)]
crypto/aes: de-couple asm and go implementations

There is currently only one assembly implementation of AES
(amd64). While it is possible to fit other implementations to the
same pattern it complicates the code. For example s390x does not
use expanded keys, so having enc and dec in the aesCipher struct
is confusing.

By separating out the asm implementations we can more closely
match the data structures to the underlying implementation. This
also opens the door for AES implementations that support block
cipher modes other than GCM (e.g. CTR and CBC).

This commit changes BenchmarkExpandKey to test the go
implementation of key expansion. It might be better to have some
sort of 'initialisation' benchmark instead to cover the startup
costs of the assembly implementations (which might be doing
key expansion in a different way, or not at all).

Change-Id: I094a7176b5bbe2177df73163a9c0b711a61c12d6
Reviewed-on: https://go-review.googlesource.com/22193
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: re-enable in-place append optimization
Josh Bleecher Snyder [Mon, 18 Apr 2016 16:40:30 +0000 (09:40 -0700)]
cmd/compile: re-enable in-place append optimization

CL 21891 was too clever in its attempts to avoid spills.
Storing newlen too early caused uses of append in the runtime
itself to receive an inconsistent view of a slice,
leading to corruption.

This CL makes the generate code much more similar to
the old backend. It spills more than before,
but those spills have been contained to the grow path.
It recalculates newlen unnecessarily on the fast path,
but that's measurably cheaper than spilling it.

CL 21891 caused runtime failures in 6 of 2000 runs
of net/http and crypto/x509 in my test setup.
This CL has gone 6000 runs without a failure.

Benchmarks going from master to this CL:

name                         old time/op  new time/op  delta
AppendInPlace/NoGrow/Byte-8   439ns ± 2%   436ns ± 2%  -0.72%  (p=0.001 n=28+27)
AppendInPlace/NoGrow/1Ptr-8   901ns ± 0%   856ns ± 0%  -4.95%  (p=0.000 n=26+29)
AppendInPlace/NoGrow/2Ptr-8  2.15µs ± 1%  1.95µs ± 0%  -9.07%  (p=0.000 n=28+30)
AppendInPlace/NoGrow/3Ptr-8  2.66µs ± 0%  2.45µs ± 0%  -7.93%  (p=0.000 n=29+26)
AppendInPlace/NoGrow/4Ptr-8  3.24µs ± 1%  3.02µs ± 1%  -6.75%  (p=0.000 n=28+30)
AppendInPlace/Grow/Byte-8     269ns ± 1%   271ns ± 1%  +0.84%  (p=0.000 n=30+29)
AppendInPlace/Grow/1Ptr-8     275ns ± 1%   280ns ± 1%  +1.75%  (p=0.000 n=30+30)
AppendInPlace/Grow/2Ptr-8     384ns ± 0%   391ns ± 0%  +1.94%  (p=0.000 n=27+30)
AppendInPlace/Grow/3Ptr-8     455ns ± 0%   462ns ± 0%  +1.43%  (p=0.000 n=29+29)
AppendInPlace/Grow/4Ptr-8     478ns ± 0%   479ns ± 0%  +0.23%  (p=0.000 n=30+27)

However, for the large no-grow cases, there is still more work to be done.
Going from this CL to the non-SSA backend:

name                         old time/op  new time/op  delta
AppendInPlace/NoGrow/Byte-8   436ns ± 2%   436ns ± 2%     ~     (p=0.967 n=27+29)
AppendInPlace/NoGrow/1Ptr-8   856ns ± 0%   884ns ± 0%   +3.28%  (p=0.000 n=29+26)
AppendInPlace/NoGrow/2Ptr-8  1.95µs ± 0%  1.56µs ± 0%  -20.28%  (p=0.000 n=30+29)
AppendInPlace/NoGrow/3Ptr-8  2.45µs ± 0%  1.89µs ± 0%  -22.88%  (p=0.000 n=26+28)
AppendInPlace/NoGrow/4Ptr-8  3.02µs ± 1%  2.56µs ± 1%  -15.35%  (p=0.000 n=30+28)
AppendInPlace/Grow/Byte-8     271ns ± 1%   283ns ± 1%   +4.56%  (p=0.000 n=29+29)
AppendInPlace/Grow/1Ptr-8     280ns ± 1%   288ns ± 1%   +2.99%  (p=0.000 n=30+30)
AppendInPlace/Grow/2Ptr-8     391ns ± 0%   409ns ± 0%   +4.66%  (p=0.000 n=30+29)
AppendInPlace/Grow/3Ptr-8     462ns ± 0%   481ns ± 0%   +4.13%  (p=0.000 n=29+30)
AppendInPlace/Grow/4Ptr-8     479ns ± 0%   502ns ± 0%   +4.81%  (p=0.000 n=27+26)

New generated code:

var x []byte

func a() {
x = append(x, 1)
}

"".a t=1 size=208 args=0x0 locals=0x48
0x0000 00000 (a.go:5) TEXT "".a(SB), $72-0
0x0000 00000 (a.go:5) MOVQ (TLS), CX
0x0009 00009 (a.go:5) CMPQ SP, 16(CX)
0x000d 00013 (a.go:5) JLS 190
0x0013 00019 (a.go:5) SUBQ $72, SP
0x0017 00023 (a.go:5) FUNCDATA $0, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
0x0017 00023 (a.go:5) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
0x0017 00023 (a.go:6) MOVQ "".x+16(SB), CX
0x001e 00030 (a.go:6) MOVQ "".x+8(SB), DX
0x0025 00037 (a.go:6) MOVQ "".x(SB), BX
0x002c 00044 (a.go:6) LEAQ 1(DX), BP
0x0030 00048 (a.go:6) CMPQ BP, CX
0x0033 00051 (a.go:6) JGT $0, 73
0x0035 00053 (a.go:6) LEAQ 1(DX), AX
0x0039 00057 (a.go:6) MOVQ AX, "".x+8(SB)
0x0040 00064 (a.go:6) MOVB $1, (BX)(DX*1)
0x0044 00068 (a.go:7) ADDQ $72, SP
0x0048 00072 (a.go:7) RET
0x0049 00073 (a.go:6) LEAQ type.[]uint8(SB), AX
0x0050 00080 (a.go:6) MOVQ AX, (SP)
0x0054 00084 (a.go:6) MOVQ BX, 8(SP)
0x0059 00089 (a.go:6) MOVQ DX, 16(SP)
0x005e 00094 (a.go:6) MOVQ CX, 24(SP)
0x0063 00099 (a.go:6) MOVQ BP, 32(SP)
0x0068 00104 (a.go:6) PCDATA $0, $0
0x0068 00104 (a.go:6) CALL runtime.growslice(SB)
0x006d 00109 (a.go:6) MOVQ 40(SP), CX
0x0072 00114 (a.go:6) MOVQ 48(SP), DX
0x0077 00119 (a.go:6) MOVQ DX, "".autotmp_0+64(SP)
0x007c 00124 (a.go:6) MOVQ 56(SP), BX
0x0081 00129 (a.go:6) MOVQ BX, "".x+16(SB)
0x0088 00136 (a.go:6) MOVL runtime.writeBarrier(SB), AX
0x008e 00142 (a.go:6) TESTB AL, AL
0x0090 00144 (a.go:6) JNE $0, 162
0x0092 00146 (a.go:6) MOVQ CX, "".x(SB)
0x0099 00153 (a.go:6) MOVQ "".x(SB), BX
0x00a0 00160 (a.go:6) JMP 53
0x00a2 00162 (a.go:6) LEAQ "".x(SB), BX
0x00a9 00169 (a.go:6) MOVQ BX, (SP)
0x00ad 00173 (a.go:6) MOVQ CX, 8(SP)
0x00b2 00178 (a.go:6) PCDATA $0, $0
0x00b2 00178 (a.go:6) CALL runtime.writebarrierptr(SB)
0x00b7 00183 (a.go:6) MOVQ "".autotmp_0+64(SP), DX
0x00bc 00188 (a.go:6) JMP 153
0x00be 00190 (a.go:6) NOP
0x00be 00190 (a.go:5) CALL runtime.morestack_noctxt(SB)
0x00c3 00195 (a.go:5) JMP 0

Fixes #14969 again

Change-Id: Ia50463b1f506011aad0718a4fef1d4738e43c32d
Reviewed-on: https://go-review.googlesource.com/22197
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
9 years agospec: refine rules about terminating statements
Robert Griesemer [Fri, 26 Feb 2016 23:52:13 +0000 (15:52 -0800)]
spec: refine rules about terminating statements

Per a suggestion from mdempsky.

Both gc and gccgo consider a statement list as terminating if the
last _non_empty_ statement is terminating; i.e., trailing semis are
ok. Only gotype followed the current stricter rule in the spec.

This change adjusts the spec to match gc and gccgo behavior. In
support of this change, the spec has a matching rule for fallthrough,
which in valid positions may be followed by trailing semis as well.

For details and examples, see the issue below.

Fixes #14422.

Change-Id: Ie17c282e216fc40ecb54623445c17be111e17ade
Reviewed-on: https://go-review.googlesource.com/19981
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocrypto/aes: delete TestEncryptBlock and TestDecryptBlock
Michael Munday [Fri, 15 Apr 2016 19:20:24 +0000 (15:20 -0400)]
crypto/aes: delete TestEncryptBlock and TestDecryptBlock

The encryptBlock and decryptBlock functions are already tested
(via the public API) by TestCipherEncrypt and TestCipherDecrypt
respectively. Both sets of tests check the output of the two
functions against the same set of FIPS 197 examples. I therefore
think it is safe to delete these two tests without losing any
coverage.

Deleting these two tests will make it easier to modify the
internal API, which I am hoping to do in future CLs.

Change-Id: I0dd568bc19f47b70ab09699b507833e527d39ba7
Reviewed-on: https://go-review.googlesource.com/22115
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet: add support for Zone of IPNet
Mikio Hara [Sun, 28 Feb 2016 00:37:36 +0000 (09:37 +0900)]
net: add support for Zone of IPNet

This change adds Zone field to IPNet structure for making it possible to
determine which network interface is associated with IPv6 link-local
address. Also makes ParseCIDR and IPNet.String capable handling literal
IPv6 address prefixes with zone identifier.

Fixes #14518.

Change-Id: I8f8a40d3b4f500ffef25728d4995651379d8408a
Reviewed-on: https://go-review.googlesource.com/19946
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: stop using GetHostByName and GetServByName
Alex Brainman [Tue, 19 Apr 2016 04:31:41 +0000 (14:31 +1000)]
net: stop using GetHostByName and GetServByName

Go 1.6 requires Windows XP or later. I have:

C:\>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name:                   Microsoft Windows XP Professional
OS Version:                5.1.2600 Service Pack 3 Build 2600

Running "go test" PASSes on my system after this CL is applied.

Change-Id: Id59d169138c4a4183322c89ee7e766fb74d381fa
Reviewed-on: https://go-review.googlesource.com/22209
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet: enable DualStack mode on Plan 9
David du Colombier [Tue, 19 Apr 2016 01:24:21 +0000 (03:24 +0200)]
net: enable DualStack mode on Plan 9

DualStack mode requires dialTCP to support cancellation,
which has been implemented for Plan 9 in CL 22144.

Updates #11225.
Updates #11932.

Change-Id: I6e468363dc147326b097b604c122d5af80362787
Reviewed-on: https://go-review.googlesource.com/22204
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet: enable TestDialParallel, TestDialerFallbackDelay and TestDialCancel on Plan 9
David du Colombier [Tue, 19 Apr 2016 01:19:12 +0000 (03:19 +0200)]
net: enable TestDialParallel, TestDialerFallbackDelay and TestDialCancel on Plan 9

TestDialParallel, TestDialerFallbackDelay and TestDialCancel
require dialTCP to support cancellation, which has been
implemented for Plan 9 in CL 22144.

Updates #11225.
Updates #11932.

Change-Id: I3b30a645ef79227dfa519cde8d46c67b72f2485c
Reviewed-on: https://go-review.googlesource.com/22203
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: fix internal consistency check with binary exporter
Robert Griesemer [Mon, 18 Apr 2016 20:55:40 +0000 (13:55 -0700)]
cmd/compile: fix internal consistency check with binary exporter

Per feedback from mdempsky from https://go-review.googlesource.com/22096.

Also fix emitted position info.

Change-Id: I7ff1967430867d922be8784832042c75d81df28b
Reviewed-on: https://go-review.googlesource.com/22198
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet: handle hangup in read on Plan 9
David du Colombier [Mon, 18 Apr 2016 20:37:33 +0000 (22:37 +0200)]
net: handle hangup in read on Plan 9

On Plan 9, when closing a TCP connection, we
write the "hangup" string to the TCP ctl file.

The next read on the TCP data file will return
an error like "/net/tcp/18/data: Hangup", while
in Go, we expect to return io.EOF.

This change makes Read to return io.EOF when
an error string containing "Hangup" is returned.

Change-Id: I3f71ed543704190b441cac4787488a77f46d88a1
Reviewed-on: https://go-review.googlesource.com/22149
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/link: shorter type symbol names
David Crawshaw [Wed, 6 Apr 2016 17:09:06 +0000 (13:09 -0400)]
cmd/link: shorter type symbol names

Use (part of) a SHA-1 checksum to replace type symbol names.

In typical programs this has no effect because types are not included
in the symbol table. But when dynamically linking, types are in the
table to make sure there is only one *rtype per Go type.

Eventually we may be able to get rid of all pointers to rtype values in
the binary, but probably not by 1.7. And this has a nice effect on
binary size today:

libstd.so:
before 27.4MB
after  26.2MB

For #6853.

Change-Id: I603d7f3e5baad84f59f2fd37eeb1e4ae5acfe44a
Reviewed-on: https://go-review.googlesource.com/21583
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: logical operation identities
Keith Randall [Mon, 18 Apr 2016 16:28:50 +0000 (09:28 -0700)]
cmd/compile: logical operation identities

Some rewrites to simplify logical operations.

Fixes #14363

Change-Id: I45a1e8f227267cbcca0778101125f7bab776a5dd
Reviewed-on: https://go-review.googlesource.com/22188
Reviewed-by: Alexandru Moșoi <alexandru@mosoi.ro>
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/link, cmd/compile: typelink sorting in linker
David Crawshaw [Mon, 4 Apr 2016 17:07:24 +0000 (13:07 -0400)]
cmd/link, cmd/compile: typelink sorting in linker

Instead of writing out the type almost twice in the symbol name,
teach the linker how to sort typelink symbols by their contents.

This ~halves the size of typelink symbol names, which helps very
large (6KB) names like those mentioned in #15104.

This does not increase the total sorting work done by the linker,
and makes it possible to use shorter symbol names for types. See
the follow-on CL 21583.

Change-Id: Ie5807565ed07d31bc477d20f60e4c0b47144f337
Reviewed-on: https://go-review.googlesource.com/21457
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoreflect: test that method name offset is valid
David Crawshaw [Mon, 18 Apr 2016 08:50:19 +0000 (04:50 -0400)]
reflect: test that method name offset is valid

Bug fix went in CL 21396, this is a matching test.

Fixes #15343

Change-Id: I3670145c7cac45cb4fb3121ffc039cfb7fa7c87a
Reviewed-on: https://go-review.googlesource.com/22171
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: add benchmarks for in-place append
Josh Bleecher Snyder [Mon, 18 Apr 2016 02:53:39 +0000 (19:53 -0700)]
runtime: add benchmarks for in-place append

Change-Id: I2b43cc976d2efbf8b41170be536fdd10364b65e5
Reviewed-on: https://go-review.googlesource.com/22190
Reviewed-by: Keith Randall <khr@golang.org>
9 years agocmd/compile: eliminate copy for static literals
Keith Randall [Mon, 18 Apr 2016 18:17:55 +0000 (11:17 -0700)]
cmd/compile: eliminate copy for static literals

*p = [5]byte{1,2,3,4,5}

First we allocate a global containing the RHS.  Then we copy
that global to a local stack variable, and then copy that local
stack variable to *p.  The intermediate copy is unnecessary.

Note that this only works if the RHS is completely constant.
If the code was:
*p = [5]byte{1,2,x,4,5}
this optimization doesn't apply as we have to construct the
RHS on the stack before copying it to *p.

Fixes #12841

Change-Id: I7cd0404ecc7a2d1750cbd8fe1222dba0fa44611f
Reviewed-on: https://go-review.googlesource.com/22192
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agonet: fix plan9 after context change, propagate contexts more
Brad Fitzpatrick [Sat, 16 Apr 2016 21:17:40 +0000 (14:17 -0700)]
net: fix plan9 after context change, propagate contexts more

My previous https://golang.org/cl/22101 to add context throughout the
net package broke Plan 9, which isn't currently tested (#15251).

It also broke some old unsupported version of Windows (Windows 2000?)
which doesn't have the ConnectEx function, but that was only found
visually, since our minimum supported Windows version has ConnectEx.
This change simplifies the Windows and deletes the non-ConnectEx code
path.  Windows 2000 will work even less now, if it even worked
before. Windows XP remains our minimum supported version.

Specifically, the previous CL stopped using the "dial" function, which
0intro noted:
https://github.com/golang/go/issues/15333#issuecomment-210842761

This CL removes the dial function instead and makes plan9's net
implementation respect contexts, which likely fixes a number of
t.Skipped tests. I'm leaving that to 0intro to investigate.

In the process of propagating and respecting contexts for plan9, I had
to change some signatures to add contexts to more places and ended up
pushing contexts down into the Go-based DNS resolution as well,
replacing the pure-Go DNS implementation's use of "timeout
time.Duration" with a context instead.

Updates #11932
Updates #15328

Fixes #15333

Change-Id: I6ad1e62f38271cdd86b3f40921f2d0f23374936a
Reviewed-on: https://go-review.googlesource.com/22144
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/link: use gold when dynamic linking on arm64
David Crawshaw [Mon, 18 Apr 2016 11:24:48 +0000 (07:24 -0400)]
cmd/link: use gold when dynamic linking on arm64

The GNU linker follows the letter of -znocopyreloc by refusing to
generate COPY relocations on arm64. Unfortunately it generates an
error instead of finding another way. The gold linker works, so
switch to it.

Fixes linux/arm64 build.

Change-Id: I1f7119d999c8f9f1f2d0c1e06b6462cea9c02a71
Reviewed-on: https://go-review.googlesource.com/22185
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: document Hijacker and Flusher more
Brad Fitzpatrick [Fri, 15 Apr 2016 21:56:30 +0000 (21:56 +0000)]
net/http: document Hijacker and Flusher more

Fixes #15312

Change-Id: I4fabef3f21081bc4b020069851b5c2504bc6b4d8
Reviewed-on: https://go-review.googlesource.com/22122
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/compile: a dot expression can not be a struct literal key
Ian Lance Taylor [Sun, 17 Apr 2016 22:33:07 +0000 (15:33 -0700)]
cmd/compile: a dot expression can not be a struct literal key

Passes toolstash -cmp.

Fixes #15311.

Change-Id: I1d67f5c9de38e899ab2d6c8986fabd6f197df23a
Reviewed-on: https://go-review.googlesource.com/22162
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/compile, etc: use name offset in method tables
David Crawshaw [Tue, 29 Mar 2016 01:51:10 +0000 (21:51 -0400)]
cmd/compile, etc: use name offset in method tables

Introduce and start using nameOff for two encoded names. This pair
of changes is best done together because the linker's method decoder
expects the method layouts to match.

Precursor to converting all existing name and *string fields to
nameOff.

linux/amd64:
cmd/go:  -45KB (0.5%)
jujud:  -389KB (0.6%)

linux/amd64 PIE:
cmd/go: -170KB (1.4%)
jujud:  -1.5MB (1.8%)

For #6853.

Change-Id: Ia044423f010fb987ce070b94c46a16fc78666ff6
Reviewed-on: https://go-review.googlesource.com/21396
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/link: use -znocopyreloc when dynamic linking
David Crawshaw [Sat, 16 Apr 2016 15:08:41 +0000 (11:08 -0400)]
cmd/link: use -znocopyreloc when dynamic linking

On ARM, use the gold linker to avoid copy relocations.
https://sourceware.org/bugzilla/show_bug.cgi?id=19962

Change-Id: Icf82a38d39495d4518812713b957a03a6652c728
Reviewed-on: https://go-review.googlesource.com/22141
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: mention that _test.go files are ignored when building
Andrew Gerrand [Mon, 18 Apr 2016 03:31:50 +0000 (13:31 +1000)]
cmd/go: mention that _test.go files are ignored when building

Fixes #15315

Change-Id: I8fea31507a5f83df8a86fb067f1b11d90133dc09
Reviewed-on: https://go-review.googlesource.com/22180
Reviewed-by: Chris Broadfoot <cbro@golang.org>
9 years agocompress/flate: use uncompressed if dynamic encoding is larger
Klaus Post [Sun, 10 Apr 2016 10:00:13 +0000 (12:00 +0200)]
compress/flate: use uncompressed if dynamic encoding is larger

This adds size calculation to "dynamic" writes.
This ensures that if dynamic Huffman encoding is bigger,
or only slightly smaller than raw data, the block is written
uncompressed.

To minimize the code duplication of this function, the
size calculation has been moved to separate functions.

Since I was modifying these calculations, I changed "int64"
size calculations to "int". Blocks are of very limited size,
so there is not any risk of overflows.
This should mainly improve 32 bit performance, but amd64 also
gets a slight boost:

name                       old time/op    new time/op    delta
EncodeDigitsHuffman1e4-8     49.9µs ± 1%    49.3µs ± 1%  -1.21%  (p=0.000 n=10+10)
EncodeDigitsHuffman1e5-8      476µs ± 1%     471µs ± 3%    ~     (p=0.218 n=10+10)
EncodeDigitsHuffman1e6-8     4.80ms ± 2%    4.75ms ± 2%    ~      (p=0.243 n=10+9)
EncodeDigitsSpeed1e4-8        305µs ± 3%     300µs ± 1%  -1.86%  (p=0.005 n=10+10)
EncodeDigitsSpeed1e5-8       3.67ms ± 2%    3.58ms ± 1%  -2.29%    (p=0.000 n=9+8)
EncodeDigitsSpeed1e6-8       38.3ms ± 2%    37.0ms ± 1%  -3.45%    (p=0.000 n=9+9)
EncodeDigitsDefault1e4-8      361µs ± 2%     353µs ± 1%  -2.21%  (p=0.000 n=10+10)
EncodeDigitsDefault1e5-8     5.24ms ± 2%    5.19ms ± 2%    ~     (p=0.105 n=10+10)
EncodeDigitsDefault1e6-8     56.5ms ± 3%    55.1ms ± 1%  -2.42%  (p=0.001 n=10+10)
EncodeDigitsCompress1e4-8     362µs ± 2%     358µs ± 2%    ~     (p=0.123 n=10+10)
EncodeDigitsCompress1e5-8    5.26ms ± 3%    5.20ms ± 1%    ~     (p=0.089 n=10+10)
EncodeDigitsCompress1e6-8    56.0ms ± 4%    55.0ms ± 1%    ~      (p=0.065 n=10+9)
EncodeTwainHuffman1e4-8      70.9µs ± 3%    67.6µs ± 2%  -4.59%  (p=0.000 n=10+10)
EncodeTwainHuffman1e5-8       556µs ± 2%     533µs ± 1%  -4.20%  (p=0.000 n=10+10)
EncodeTwainHuffman1e6-8      5.54ms ± 3%    5.29ms ± 1%  -4.37%   (p=0.000 n=10+9)
EncodeTwainSpeed1e4-8         294µs ± 3%     293µs ± 1%    ~      (p=0.965 n=10+8)
EncodeTwainSpeed1e5-8        2.59ms ± 2%    2.56ms ± 1%    ~     (p=0.353 n=10+10)
EncodeTwainSpeed1e6-8        25.6ms ± 1%    24.9ms ± 1%  -2.62%   (p=0.000 n=9+10)
EncodeTwainDefault1e4-8       419µs ± 2%     417µs ± 1%    ~      (p=0.780 n=10+9)
EncodeTwainDefault1e5-8      6.23ms ± 4%    6.16ms ± 1%    ~     (p=0.218 n=10+10)
EncodeTwainDefault1e6-8      66.2ms ± 2%    65.7ms ± 1%    ~     (p=0.529 n=10+10)
EncodeTwainCompress1e4-8      426µs ± 1%     428µs ± 2%    ~      (p=0.549 n=9+10)
EncodeTwainCompress1e5-8     6.80ms ± 1%    6.85ms ± 3%    ~      (p=0.156 n=9+10)
EncodeTwainCompress1e6-8     74.6ms ± 3%    73.8ms ± 2%    ~     (p=0.280 n=10+10)

name                       old speed      new speed      delta
EncodeDigitsHuffman1e4-8    200MB/s ± 1%   203MB/s ± 1%  +1.23%  (p=0.000 n=10+10)
EncodeDigitsHuffman1e5-8    210MB/s ± 1%   212MB/s ± 3%    ~      (p=0.356 n=10+9)
EncodeDigitsHuffman1e6-8    208MB/s ± 2%   210MB/s ± 2%    ~      (p=0.243 n=10+9)
EncodeDigitsSpeed1e4-8     32.8MB/s ± 3%  33.4MB/s ± 1%  +1.88%  (p=0.005 n=10+10)
EncodeDigitsSpeed1e5-8     27.2MB/s ± 2%  27.9MB/s ± 1%  +2.60%   (p=0.000 n=10+8)
EncodeDigitsSpeed1e6-8     26.1MB/s ± 2%  27.0MB/s ± 1%  +3.56%    (p=0.000 n=9+9)
EncodeDigitsDefault1e4-8   27.7MB/s ± 2%  28.4MB/s ± 1%  +2.24%  (p=0.000 n=10+10)
EncodeDigitsDefault1e5-8   19.1MB/s ± 2%  19.3MB/s ± 2%    ~     (p=0.101 n=10+10)
EncodeDigitsDefault1e6-8   17.7MB/s ± 3%  18.1MB/s ± 1%  +2.46%  (p=0.001 n=10+10)
EncodeDigitsCompress1e4-8  27.6MB/s ± 2%  27.9MB/s ± 2%    ~     (p=0.119 n=10+10)
EncodeDigitsCompress1e5-8  19.0MB/s ± 3%  19.2MB/s ± 1%    ~     (p=0.085 n=10+10)
EncodeDigitsCompress1e6-8  17.9MB/s ± 4%  18.1MB/s ± 3%    ~     (p=0.110 n=10+10)
EncodeTwainHuffman1e4-8     141MB/s ± 3%   148MB/s ± 2%  +4.79%  (p=0.000 n=10+10)
EncodeTwainHuffman1e5-8     180MB/s ± 2%   188MB/s ± 1%  +4.38%  (p=0.000 n=10+10)
EncodeTwainHuffman1e6-8     181MB/s ± 3%   189MB/s ± 1%  +4.54%   (p=0.000 n=10+9)
EncodeTwainSpeed1e4-8      34.0MB/s ± 3%  34.1MB/s ± 1%    ~      (p=0.948 n=10+8)
EncodeTwainSpeed1e5-8      38.7MB/s ± 2%  39.0MB/s ± 1%    ~     (p=0.353 n=10+10)
EncodeTwainSpeed1e6-8      39.1MB/s ± 1%  40.1MB/s ± 1%  +2.68%   (p=0.000 n=9+10)
EncodeTwainDefault1e4-8    23.9MB/s ± 2%  24.0MB/s ± 1%    ~      (p=0.734 n=10+9)
EncodeTwainDefault1e5-8    16.0MB/s ± 4%  16.2MB/s ± 1%    ~     (p=0.210 n=10+10)
EncodeTwainDefault1e6-8    15.1MB/s ± 2%  15.2MB/s ± 1%    ~     (p=0.515 n=10+10)
EncodeTwainCompress1e4-8   23.5MB/s ± 1%  23.4MB/s ± 2%    ~      (p=0.536 n=9+10)
EncodeTwainCompress1e5-8   14.7MB/s ± 1%  14.6MB/s ± 3%    ~      (p=0.138 n=9+10)
EncodeTwainCompress1e6-8   13.4MB/s ± 3%  13.5MB/s ± 2%    ~     (p=0.239 n=10+10)

This improves "random input" to the dynamic writer, which is why the test data is
updated. The output size goes from 1051 to 1005 bytes.

Change-Id: I3ee11d2d2511b277d2dd16734aeea07c98bca450
Reviewed-on: https://go-review.googlesource.com/21757
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
9 years agodoc: link to iant's generics proposal from the FAQ.
David Symonds [Sun, 17 Apr 2016 23:20:58 +0000 (09:20 +1000)]
doc: link to iant's generics proposal from the FAQ.

Updates #15292.

Change-Id: I229f66c2a41ae0738225f2ba7a574478f5d6d620
Reviewed-on: https://go-review.googlesource.com/22163
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years ago.gitignore: don't ignore y.output
Ian Lance Taylor [Sun, 17 Apr 2016 22:13:46 +0000 (15:13 -0700)]
.gitignore: don't ignore y.output

We no longer use yacc, and we shouldn't have any y.output files.

Change-Id: I045671b6aef3f53c3cfe068b0c14a4871689c13e
Reviewed-on: https://go-review.googlesource.com/22161
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agofmt: remove extra space in doc for compound objects
Emmanuel Odeke [Sun, 17 Apr 2016 18:24:57 +0000 (11:24 -0700)]
fmt: remove extra space in doc for compound objects

Fixes #15339

Change-Id: I0b006deefb58ccfc47beae4e1b8da3d77fafda6b
Reviewed-on: https://go-review.googlesource.com/22148
Reviewed-by: Rob Pike <r@golang.org>
9 years agofmt: fix padding when precision is set for integer formatting
Martin Möhrmann [Sat, 16 Apr 2016 07:24:43 +0000 (09:24 +0200)]
fmt: fix padding when precision is set for integer formatting

Ignore the f.zero flag and use spaces for padding instead
when precision is set.

Fixes #15331

Change-Id: I3ac485df24b7bdf4fddf69e3cc17c213c737b5ff
Reviewed-on: https://go-review.googlesource.com/22131
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agocrypto/x509: gofmt
Josh Bleecher Snyder [Sun, 17 Apr 2016 04:42:07 +0000 (21:42 -0700)]
crypto/x509: gofmt

Change-Id: I05659a836612f958083fea9a27805eb9f0ac0836
Reviewed-on: https://go-review.googlesource.com/22145
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoimage/draw: remove some bounds checks from DrawYCbCr
Josh Bleecher Snyder [Sun, 17 Apr 2016 01:36:07 +0000 (18:36 -0700)]
image/draw: remove some bounds checks from DrawYCbCr

It’d be nicer to write just

_ = dpix[x+3]

but the compiler isn’t able to reason about offsets
from symbols (yet).

image/draw benchmark:

YCbCr-8   722µs ± 3%   682µs ± 3%  -5.54%  (p=0.000 n=50+50)

Change-Id: Ia1e399496ed87c282bf0f9ca56c0b2d4948a0df9
Reviewed-on: https://go-review.googlesource.com/22146
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile/internal/ssa: use Compare instead of Equal
Josh Bleecher Snyder [Sun, 3 Apr 2016 21:44:29 +0000 (14:44 -0700)]
cmd/compile/internal/ssa: use Compare instead of Equal

They have different semantics.

Equal is stricter and is designed for the front-end.
Compare is looser and cheaper and is designed for the back-end.
To avoid possible regression, remove Equal from ssa.Type.

Updates #15043

Change-Id: Ie23ce75ff6b4d01b7982e0a89e6f81b5d099d8d6
Reviewed-on: https://go-review.googlesource.com/21483
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>

9 years agoencoding/json: update docs to not use misuse the term "object"
Brad Fitzpatrick [Wed, 13 Apr 2016 18:14:52 +0000 (18:14 +0000)]
encoding/json: update docs to not use misuse the term "object"

In JSON terminology, "object" is a collect of key/value pairs. But a
JSON object is only one type of JSON value (others are string, number,
array, true, false, null).

This updates the Go docs (at least the public godoc) to not use
"object" when we mean any JSON value.

Change-Id: Ieb1c456c703693714d63d9d09d306f4d9e8f4597
Reviewed-on: https://go-review.googlesource.com/22003
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoruntime: scavenge memory on physical page-aligned boundaries
Austin Clements [Thu, 14 Apr 2016 17:41:36 +0000 (13:41 -0400)]
runtime: scavenge memory on physical page-aligned boundaries

Currently the scavenger marks memory unused in multiples of the
allocator page size (8K). This is safe as long as the true physical
page size is 4K (or 8K), as it is on many platforms. However, on
ARM64, PPC64x, and MIPS64, the physical page size is larger than 8K,
so if we attempt to mark memory unused, the kernel will round the
boundaries of the region *out* to all pages covered by the requested
region, and we'll release a larger region of memory than intended. As
a result, the scavenger is currently disabled on these platforms.

Fix this by first rounding the region to be marked unused *in* to
multiples of the physical page size, so that when we ask the kernel to
mark it unused, it releases exactly the requested region.

Fixes #9993.

Change-Id: I96d5fdc2f77f9d69abadcea29bcfe55e68288cb1
Reviewed-on: https://go-review.googlesource.com/22066
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: check that sysUnused is always physical-page aligned
Austin Clements [Thu, 14 Apr 2016 17:40:35 +0000 (13:40 -0400)]
runtime: check that sysUnused is always physical-page aligned

If sysUnused is passed an address or length that is not aligned to the
physical page boundary, the kernel will unmap more memory than the
caller wanted. Add a check for this.

For #9993.

Change-Id: I68ff03032e7b65cf0a853fe706ce21dc7f2aaaf8
Reviewed-on: https://go-review.googlesource.com/22065
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
9 years agoruntime: check kernel physical page size during init
Austin Clements [Thu, 14 Apr 2016 17:27:36 +0000 (13:27 -0400)]
runtime: check kernel physical page size during init

The runtime hard-codes an assumed physical page size. If this is
smaller than the kernel's page size or not a multiple of it, sysUnused
may incorrectly release more memory to the system than intended.

Add a runtime startup check that the runtime's assumed physical page
is compatible with the kernel's physical page size.

For #9993.

Change-Id: Ida9d07f93c00ca9a95dd55fc59bf0d8a607f6728
Reviewed-on: https://go-review.googlesource.com/22064
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: remove empty 386 archauxv
Austin Clements [Thu, 14 Apr 2016 19:08:24 +0000 (15:08 -0400)]
runtime: remove empty 386 archauxv

archauxv no longer does anything on 386, so remove it.

Change-Id: I94545238e40fa6a6832a7c3b40aedfc6c1f6a97b
Reviewed-on: https://go-review.googlesource.com/22063
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: common handling of _AT_RANDOM auxv
Austin Clements [Thu, 14 Apr 2016 16:32:28 +0000 (12:32 -0400)]
runtime: common handling of _AT_RANDOM auxv

The Linux kernel provides 16 bytes of random data via the auxv vector
at startup. Currently we consume this separately on 386, amd64, arm,
and arm64. Now that we have a common auxv parser, handle _AT_RANDOM in
the common path.

Change-Id: Ib69549a1d37e2d07a351cf0f44007bcd24f0d20d
Reviewed-on: https://go-review.googlesource.com/22062
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: common auxv parser
Austin Clements [Thu, 14 Apr 2016 16:12:45 +0000 (12:12 -0400)]
runtime: common auxv parser

Currently several different Linux architectures have separate copies
of the auxv parser. Bring these all together into a single copy of the
parser that calls out to a per-arch handler for each tag/value pair.
This is in preparation for handling common auxv tags in one place.

For #9993.

Change-Id: Iceebc3afad6b4133b70fca7003561ae370445c10
Reviewed-on: https://go-review.googlesource.com/22061
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
9 years agonet/http: normalize empty port in URL.Host's ":port"
Emmanuel Odeke [Sat, 16 Apr 2016 09:04:00 +0000 (02:04 -0700)]
net/http: normalize empty port in URL.Host's ":port"

- Ensures that the empty port and preceeding ":"
in a URL.Host are stripped.
Normalize the empty port in a URL.Host's ":port" as
mandated by RFC 3986 Section 6.2.3 which states that:
`Likewise an explicit ":port", for which the port is empty or
the default for the scheme, is equivalent to one where the port
and its ":" delimiter are elided and thus should be
removed by scheme-based normalization.`

- Moves function `hasPort` from client.go (where it was defined but
not used directly), to http.go the common area.

Fixes #14836

Change-Id: I2067410377be9c71106b1717abddc2f8b1da1c03
Reviewed-on: https://go-review.googlesource.com/22140
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet/http: add Transport.Dialer, plumb RoundTrip contexts to net package
Brad Fitzpatrick [Fri, 15 Apr 2016 22:59:36 +0000 (22:59 +0000)]
net/http: add Transport.Dialer, plumb RoundTrip contexts to net package

This simply connects the contexts, pushing them down the call stack.
Future CLs will utilize them.

For #12580 (http.Transport tracing/analytics)
Updates #13021

Change-Id: I5b2074d6eb1e87d79a767fc0609c84e7928d1a16
Reviewed-on: https://go-review.googlesource.com/22124
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet: ignore lack of deadline support on Plan 9
David du Colombier [Sat, 16 Apr 2016 02:36:42 +0000 (04:36 +0200)]
net: ignore lack of deadline support on Plan 9

Since CL 22101, network tests are failing on Plan 9
due to the lack of deadline support.

Instead of panicking, we just ignore the deadline
when set.

Update #11932.
Fixes #15328.

Change-Id: I1399303b0b3d6d81e0b8b8d327980d978b411a46
Reviewed-on: https://go-review.googlesource.com/22127
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet: fix looking up port numbers starting with numbers.
Morten Siebuhr [Fri, 19 Feb 2016 20:53:17 +0000 (21:53 +0100)]
net: fix looking up port numbers starting with numbers.

LookupPort() correctly parses service names beginning with numerals by
implementing a new parser, mainly taken from strconv/atoi.go.

Also testes some previously undefined behaviours around port numbers
larger than 65535 that previously could lead to some tests fail with
EOPNOTSUPP (Operation Not Supported).

Fixes #14322

Change-Id: I1b90dbed434494723e261d84e73fe705e5c0507a
Reviewed-on: https://go-review.googlesource.com/19720
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
9 years agonet: context plumbing, add Dialer.DialContext
Brad Fitzpatrick [Fri, 15 Apr 2016 00:47:25 +0000 (17:47 -0700)]
net: context plumbing, add Dialer.DialContext

For #12580 (http.Transport tracing/analytics)
Updates #13021

Change-Id: I126e494a7bd872e42c388ecb58499ecbf0f014cc
Reviewed-on: https://go-review.googlesource.com/22101
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
9 years agocmd/cgo: add missing formatting directive in error message
Ian Lance Taylor [Thu, 14 Apr 2016 23:51:18 +0000 (16:51 -0700)]
cmd/cgo: add missing formatting directive in error message

Fixes #15310.

Change-Id: I588b3c630a20a6878f7cd00f9af29b1dd8a4abf6
Reviewed-on: https://go-review.googlesource.com/22100
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: remove dead flags
Matthew Dempsky [Fri, 15 Apr 2016 21:22:27 +0000 (14:22 -0700)]
cmd/compile: remove dead flags

For some time now, the -d flag has been used to control various named
debug options, rather than setting Debug['d']. Consequently, that
means dflag() always returns false, which means the -y flag is also
useless.

Similarly, Debug['L'] is never used anywhere, so the -L flag can be
dropped too.

Change-Id: I4bb12454e462410115ec4f5565facf76c5c2f255
Reviewed-on: https://go-review.googlesource.com/22121
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoarchive/tar: style nit: s/nano_buf/nanoBuf/
Matthew Dempsky [Fri, 15 Apr 2016 20:39:47 +0000 (13:39 -0700)]
archive/tar: style nit: s/nano_buf/nanoBuf/

Pointed out during review of golang.org/cl/22104.

Change-Id: If8842e7f8146441e918ec6a2b6e893b7cf88615c
Reviewed-on: https://go-review.googlesource.com/22120
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime: don't always unblock all signals on dragonfly, freebsd and openbsd
Mikio Hara [Fri, 15 Jan 2016 05:57:41 +0000 (14:57 +0900)]
runtime: don't always unblock all signals on dragonfly, freebsd and openbsd

https://golang.org/cl/10173 intrduced msigsave, ensureSigM and
_SigUnblock but didn't enable the new signal save/restore mechanism for
SIG{HUP,INT,QUIT,ABRT,TERM} on DragonFly BSD, FreeBSD and OpenBSD.

At present, it looks like they have the implementation. This change
enables the new mechanism on DragonFly BSD, FreeBSD and OpenBSD the same
as Darwin, NetBSD.

Change-Id: Ifb4b4743b3b4f50bfcdc7cf1fe1b59c377fa2a41
Reviewed-on: https://go-review.googlesource.com/18657
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agofmt: optimize struct layout and intbuf size
Martin Möhrmann [Mon, 21 Mar 2016 13:36:21 +0000 (14:36 +0100)]
fmt: optimize struct layout and intbuf size

Move boolean fields to the end of the pp struct for better packing.

Increase the fmt.intbuf size to leave no padding space unused
at the end of the fmt struct on 32 bit architectures.

The size of the pp struct on amd64 is decreased from 192 byte
to 184 byte and on 386 from 132 byte to 128 byte.

Simplify buffer size calculation in fmt_integer.

Consolidate test cases for intbuf overflow checks.

amd64 Haswell:

name                     old time/op  new time/op  delta
SprintfPadding-2          227ns ± 2%   227ns ± 1%    ~     (p=0.941 n=25+25)
SprintfEmpty-2           38.4ns ± 6%  35.8ns ±23%  -6.71%  (p=0.030 n=24+25)
SprintfString-2           100ns ± 0%   101ns ± 0%  +1.00%  (p=0.000 n=19+18)
SprintfTruncateString-2   142ns ± 1%   142ns ± 1%  +0.37%  (p=0.028 n=25+25)
SprintfQuoteString-2      397ns ± 0%   393ns ± 0%  -0.82%  (p=0.000 n=21+24)
SprintfInt-2              101ns ± 2%   102ns ± 4%    ~     (p=0.159 n=21+24)
SprintfIntInt-2           155ns ± 3%   155ns ± 3%    ~     (p=0.934 n=25+25)
SprintfPrefixedInt-2      252ns ± 2%   251ns ± 2%    ~     (p=0.198 n=25+25)
SprintfFloat-2            184ns ± 3%   179ns ± 2%  -3.07%  (p=0.000 n=24+25)
SprintfComplex-2          532ns ± 2%   535ns ± 2%  +0.64%  (p=0.046 n=25+24)
SprintfBoolean-2         90.5ns ± 3%  91.6ns ± 2%  +1.17%  (p=0.000 n=22+22)
SprintfHexString-2        164ns ± 2%   165ns ± 3%    ~     (p=0.066 n=25+25)
SprintfHexBytes-2         171ns ± 3%   170ns ± 3%    ~     (p=0.941 n=25+24)
SprintfBytes-2            320ns ± 1%   313ns ± 1%  -2.31%  (p=0.000 n=24+21)
SprintfStringer-2         347ns ± 2%   348ns ± 2%    ~     (p=0.426 n=24+24)
SprintfStructure-2        753ns ± 1%   742ns ± 1%  -1.49%  (p=0.000 n=24+25)
FprintInt-2               145ns ± 0%   144ns ± 0%  -0.69%  (p=0.000 n=24+23)
FprintfBytes-2            163ns ± 0%   163ns ± 0%  -0.27%  (p=0.000 n=25+25)
FprintIntNoAlloc-2        108ns ± 0%   105ns ± 0%  -2.78%  (p=0.000 n=25+2

386 Haswell:

name                     old time/op  new time/op  delta
SprintfPadding-2          426ns ± 2%   422ns ± 1%  -0.89%  (p=0.000 n=25+24)
SprintfEmpty-2           24.6ns ± 1%  24.5ns ± 0%  -0.39%  (p=0.000 n=22+15)
SprintfString-2          99.1ns ± 3%  95.6ns ± 0%  -3.52%  (p=0.000 n=25+24)
SprintfTruncateString-2   156ns ± 4%   153ns ± 1%  -1.65%  (p=0.000 n=24+23)
SprintfQuoteString-2      500ns ± 2%   493ns ± 1%  -1.49%  (p=0.000 n=25+24)
SprintfInt-2             92.6ns ± 9%  88.3ns ± 1%  -4.72%  (p=0.000 n=25+25)
SprintfIntInt-2           143ns ± 7%   137ns ± 2%  -4.01%  (p=0.000 n=23+25)
SprintfPrefixedInt-2      268ns ±19%   264ns ±16%    ~     (p=0.826 n=24+24)
SprintfFloat-2            242ns ± 4%   246ns ± 2%  +1.60%  (p=0.000 n=25+25)
SprintfComplex-2         1.04µs ± 3%  1.03µs ± 1%  -0.89%  (p=0.026 n=25+25)
SprintfBoolean-2         82.2ns ± 9%  80.7ns ± 2%    ~     (p=0.163 n=24+24)
SprintfHexString-2        240ns ± 5%   224ns ± 2%  -6.94%  (p=0.000 n=25+25)
SprintfHexBytes-2         245ns ± 3%   234ns ± 2%  -4.55%  (p=0.000 n=25+25)
SprintfBytes-2            432ns ±13%   419ns ± 2%    ~     (p=0.081 n=23+25)
SprintfStringer-2         356ns ± 4%   356ns ± 4%    ~     (p=0.988 n=25+25)
SprintfStructure-2        968ns ± 5%   948ns ± 2%  -2.11%  (p=0.000 n=25+25)
FprintInt-2               206ns ± 0%   201ns ± 0%  -2.43%  (p=0.000 n=25+21)
FprintfBytes-2            187ns ± 1%   187ns ± 1%    ~     (p=0.420 n=25+25)
FprintIntNoAlloc-2        173ns ± 0%   168ns ± 0%  -2.89%  (p=0.000 n=25+2

amd64 Ivy Bridge:

name                     old time/op  new time/op  delta
SprintfPadding-4          203ns ± 4%   210ns ± 8%  +3.27%  (p=0.000 n=23+25)
SprintfEmpty-4           24.4ns ± 2%  24.4ns ± 3%    ~     (p=0.487 n=24+25)
SprintfString-4          92.4ns ± 2%  93.1ns ± 3%    ~     (p=0.087 n=22+25)
SprintfTruncateString-4   137ns ± 3%   136ns ± 2%  -1.02%  (p=0.002 n=25+25)
SprintfQuoteString-4      378ns ± 1%   373ns ± 1%  -1.32%  (p=0.000 n=24+22)
SprintfInt-4             89.9ns ± 3%  90.3ns ± 4%    ~     (p=0.444 n=25+25)
SprintfIntInt-4           137ns ± 4%   138ns ± 3%    ~     (p=0.112 n=25+23)
SprintfPrefixedInt-4      155ns ±14%   154ns ±14%    ~     (p=0.791 n=25+25)
SprintfFloat-4            154ns ± 2%   154ns ± 3%    ~     (p=0.789 n=25+25)
SprintfComplex-4          396ns ± 2%   402ns ± 3%  +1.53%  (p=0.001 n=23+25)
SprintfBoolean-4         71.0ns ± 3%  71.2ns ± 2%    ~     (p=0.515 n=25+24)
SprintfHexString-4        156ns ± 3%   150ns ± 5%  -3.69%  (p=0.000 n=24+25)
SprintfHexBytes-4         154ns ± 3%   157ns ± 5%  +1.72%  (p=0.003 n=24+25)
SprintfBytes-4            297ns ± 4%   291ns ± 3%  -1.86%  (p=0.000 n=25+25)
SprintfStringer-4         275ns ± 3%   265ns ± 3%  -3.51%  (p=0.000 n=25+25)
SprintfStructure-4        878ns ± 2%   823ns ± 2%  -6.21%  (p=0.000 n=25+22)
FprintInt-4               145ns ± 1%   147ns ± 2%  +0.94%  (p=0.001 n=23+25)
FprintfBytes-4            166ns ± 1%   168ns ± 2%  +0.81%  (p=0.000 n=24+25)
FprintIntNoAlloc-4        113ns ± 2%   109ns ± 2%  -3.79%  (p=0.000 n=24+25)

386 Ivy Bridge:

name                     old time/op  new time/op  delta
SprintfPadding-4          353ns ± 4%   354ns ± 4%    ~     (p=0.769 n=25+24)
SprintfEmpty-4           21.9ns ± 6%  21.1ns ± 3%  -3.45%  (p=0.000 n=24+25)
SprintfString-4          94.7ns ± 1%  93.0ns ± 3%  -1.77%  (p=0.000 n=24+23)
SprintfTruncateString-4   150ns ± 2%   147ns ± 0%  -1.71%  (p=0.000 n=25+21)
SprintfQuoteString-4      472ns ± 1%   479ns ± 1%  +1.48%  (p=0.000 n=25+23)
SprintfInt-4             87.0ns ± 2%  85.3ns ± 2%  -1.95%  (p=0.000 n=25+25)
SprintfIntInt-4           137ns ± 2%   134ns ± 2%  -1.97%  (p=0.000 n=24+23)
SprintfPrefixedInt-4      166ns ± 8%   161ns ± 8%  -3.07%  (p=0.023 n=24+24)
SprintfFloat-4            226ns ± 1%   219ns ± 1%  -2.97%  (p=0.000 n=24+25)
SprintfComplex-4          867ns ± 1%   784ns ± 1%  -9.47%  (p=0.000 n=24+23)
SprintfBoolean-4         77.2ns ± 2%  76.0ns ± 2%  -1.63%  (p=0.000 n=25+25)
SprintfHexString-4        212ns ± 2%   214ns ± 2%  +0.96%  (p=0.000 n=25+25)
SprintfHexBytes-4         221ns ± 2%   218ns ± 1%  -1.42%  (p=0.000 n=25+24)
SprintfBytes-4            423ns ± 3%   417ns ± 1%  -1.49%  (p=0.000 n=25+24)
SprintfStringer-4         306ns ± 3%   298ns ± 3%  -2.57%  (p=0.000 n=24+25)
SprintfStructure-4       1.00µs ± 2%  0.98µs ± 2%  -1.34%  (p=0.000 n=24+24)
FprintInt-4               202ns ± 3%   197ns ± 2%  -2.04%  (p=0.000 n=25+25)
FprintfBytes-4            186ns ± 2%   184ns ± 2%  -0.88%  (p=0.000 n=24+25)
FprintIntNoAlloc-4        170ns ± 2%   166ns ± 2%  -2.26%  (p=0.000 n=24+25)

Change-Id: I46e62bf8b6afa90a24f75b40f1d354b2084b910b
Reviewed-on: https://go-review.googlesource.com/20984
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agonet/mail: allow utf-8 in ParseAddress
Conrad Irwin [Fri, 19 Feb 2016 18:12:44 +0000 (10:12 -0800)]
net/mail: allow utf-8 in ParseAddress

The existing implementation correctly supported RFC 5322, this
change adds support for UTF-8 while parsing as specified by
RFC 6532. The serialization code is unchanged, so emails created
by go remain compatible with very legacy systems.

Fixes #14260

Change-Id: Ib57e510f5834d273605e1892679f2df19ea931b1
Reviewed-on: https://go-review.googlesource.com/19687
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexandre Cesaro <alexandre.cesaro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agohash/adler32: Unroll loop for extra performance.
Ilya Tocar [Tue, 12 Apr 2016 15:14:45 +0000 (18:14 +0300)]
hash/adler32: Unroll loop for extra performance.

name         old time/op    new time/op    delta
Adler32KB-4     592ns ± 0%     447ns ± 0%  -24.49%  (p=0.000 n=19+20)

name         old speed      new speed      delta
Adler32KB-4  1.73GB/s ± 0%  2.29GB/s ± 0%  +32.41%  (p=0.000 n=20+20)

Change-Id: I38990aa66ca4452a886200018a57c0bc3af30717
Reviewed-on: https://go-review.googlesource.com/21880
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoimage/color: order color computation to match rgb
Martin Möhrmann [Fri, 15 Apr 2016 06:56:01 +0000 (08:56 +0200)]
image/color: order color computation to match rgb

The order of computation was switched unintentionally
in https://go-review.googlesource.com/21910.

Revert the order to first compute g then b.

Change-Id: I8cedb5e45fbad2679246839f609bcac4f9052403
Reviewed-on: https://go-review.googlesource.com/22016
Reviewed-by: Nigel Tao <nigeltao@golang.org>
9 years agoall: remove unnecessary type conversions
Matthew Dempsky [Fri, 15 Apr 2016 02:09:36 +0000 (19:09 -0700)]
all: remove unnecessary type conversions

cmd and runtime were handled separately, and I'm intentionally skipped
syscall. This is the rest of the standard library.

CL generated mechanically with github.com/mdempsky/unconvert.

Change-Id: I9e0eff886974dedc37adb93f602064b83e469122
Reviewed-on: https://go-review.googlesource.com/22104
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocompress/flate: fix a fmt.Fprintf style nit in a test.
Nigel Tao [Fri, 15 Apr 2016 06:29:43 +0000 (16:29 +1000)]
compress/flate: fix a fmt.Fprintf style nit in a test.

It's not a big deal (the for loop drops from 130-ish to 120-ish
milliseconds for me) but it's not a big change either.

Change-Id: I161a49caab5cae5a2b87866ed1dfb93627be8013
Reviewed-on: https://go-review.googlesource.com/22110
Reviewed-by: Klaus Post <klauspost@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
9 years agocmd/internal/obj, cmd/link: random style cleanups
Matthew Dempsky [Fri, 15 Apr 2016 02:44:55 +0000 (19:44 -0700)]
cmd/internal/obj, cmd/link: random style cleanups

Identified during review of golang.org/cl/22103.

Change-Id: I86bab4cc17204df1e45deefdb0d0f9a8f6e17073
Reviewed-on: https://go-review.googlesource.com/22106
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd: remove unnecessary type conversions
Matthew Dempsky [Fri, 15 Apr 2016 02:04:45 +0000 (19:04 -0700)]
cmd: remove unnecessary type conversions

CL generated mechanically with github.com/mdempsky/unconvert.

Change-Id: Ic590315cbc7026163a1b3f8ea306ba35f1a53256
Reviewed-on: https://go-review.googlesource.com/22103
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
9 years agocmd/internal/sys: cleanup documentation
Matthew Dempsky [Fri, 15 Apr 2016 01:51:18 +0000 (18:51 -0700)]
cmd/internal/sys: cleanup documentation

Expand description of ArchFamily, because it seems to be a common
source of confusion.  Also, update InFamily's description to reflect
current name.

Change-Id: I66b7999aef64ab8fee39aec0f752ae4f3a08d36d
Reviewed-on: https://go-review.googlesource.com/22102
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet: cache IPv6 zone information for applications using IPv6 link-local address
Mikio Hara [Tue, 12 Apr 2016 21:19:53 +0000 (06:19 +0900)]
net: cache IPv6 zone information for applications using IPv6 link-local address

This change reduces the overhead of calling routing information per IPv6
link-local datagram read by caching IPv6 addressing scope zone
information.

Fixes #15237.

name                    old time/op    new time/op    delta
UDP6LinkLocalUnicast-8    64.9µs ± 0%    18.6µs ± 0%  -71.30%

name                    old alloc/op   new alloc/op   delta
UDP6LinkLocalUnicast-8    11.2kB ± 0%     0.2kB ± 0%  -98.42%

name                    old allocs/op  new allocs/op  delta
UDP6LinkLocalUnicast-8       101 ± 0%         3 ± 0%  -97.03%

Change-Id: I5ae2ef5058df1028bbb7f4ab32b13edfb330c3a7
Reviewed-on: https://go-review.googlesource.com/21952
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: relax TestInterfaces and TestInterfaceAddrs for BSD variants
Mikio Hara [Thu, 14 Apr 2016 07:31:52 +0000 (16:31 +0900)]
net: relax TestInterfaces and TestInterfaceAddrs for BSD variants

Fixes #15249.

Change-Id: I91fc3d6a2df294b21a67d085da6fe661827a850e
Reviewed-on: https://go-review.googlesource.com/22079
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: speed up dom checking in cse
Todd Neal [Thu, 14 Apr 2016 23:09:57 +0000 (19:09 -0400)]
cmd/compile: speed up dom checking in cse

Process a slice of equivalent values by setting replaced values to nil
instead of removing them from the slice to eliminate copying.  Also take
advantage of the entry number sort to break early once we reach a value
in a block that is not dominated.

For the code in issue #15112:

Before:
real    0m52.603s
user    0m56.957s
sys     0m1.213s

After:
real    0m22.048s
user    0m26.445s
sys     0m0.939s

Updates #15112

Change-Id: I06d9e1e1f1ad85d7fa196c5d51f0dc163907376d
Reviewed-on: https://go-review.googlesource.com/22068
Reviewed-by: David Chase <drchase@google.com>
9 years agocompress/gzip: fix Reader to properly check FHCRC
Joe Tsai [Sat, 2 Apr 2016 23:47:51 +0000 (16:47 -0700)]
compress/gzip: fix Reader to properly check FHCRC

RFC 1952, section 3.2.3 says:
>>>
If FHCRC is set, a CRC16 for the gzip header is present,
immediately before the compressed data. The CRC16 consists of the two
least significant bytes of the CRC32 for all bytes of the
gzip header up to and not including the CRC16.
<<<

Thus, instead of computing the CRC only over the first 10 bytes
of the header, we compute it over the whole header (minus CRC16).

Fixes #15070

Change-Id: I55703fd30b535b12abeb5e3962d4da0a86ed615a
Reviewed-on: https://go-review.googlesource.com/21466
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agodoc: add classes to version tags in source install instructions
Andrew Gerrand [Thu, 14 Apr 2016 02:12:11 +0000 (12:12 +1000)]
doc: add classes to version tags in source install instructions

This will allow us to mechanically substitute these strings
using javascript (in a forthcoming change to x/tools/godoc).

Updates #14371

Change-Id: I96e876283060ffbc9f3eabaf55d6b880685453e1
Reviewed-on: https://go-review.googlesource.com/22055
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: first cut at exporting position info
Robert Griesemer [Thu, 14 Apr 2016 00:53:03 +0000 (17:53 -0700)]
cmd/compile: first cut at exporting position info

- position info for all exported globals, plus methods and fields
- use delta-encoded line number info in most cases
- canonicalize all strings: each filename appears only once,
  but will also compact other strings (names) to at most one
  occurence in encoding
- positions not yet hooked up when reading in

Also:
- adjusted go/importer (gcimporter)
- some refactoring for better symmetry

Stats:
- comparison of export data size w/o and w/ position info (bytes).
- delta is increase in %
- overall (see bottom of table): 14% increase
- however, the current binary format decreased from
  the original binary format last week by 14%
- compared to original textual format: 65% decrease
  (increase by 14% after decrease by 14% still leads
  to a decrease from original textual format)

(caveat: we used the textual size from last week, assuming
it has not changed - there may be a small error here).

package w/o pos w/ pos delta

archive/tar 4234 4902 16%
archive/zip 6387 7340 15%
bufio 3106 3419 10%
bytes 4362 4757 9%
cmd/addr2line 27 70 159%
cmd/api 12065 13590 13%
cmd/asm 27 64 137%
cmd/asm/internal/arch 9957 11529 16%
cmd/asm/internal/asm 11788 13385 14%
cmd/asm/internal/flags 239 311 30%
cmd/asm/internal/lex 13415 15358 14%
cmd/cgo 13064 15006 15%
cmd/compile 27 67 148%
cmd/compile/internal/amd64 461 869 89%
cmd/compile/internal/arm 5963 7273 22%
cmd/compile/internal/arm64 363 657 81%
cmd/compile/internal/big 7186 8590 20%
cmd/compile/internal/gc 48242 56234 17%
cmd/compile/internal/mips64 367 666 81%
cmd/compile/internal/ppc64 372 721 94%
cmd/compile/internal/s390x 330 569 72%
cmd/compile/internal/ssa 30464 35058 15%
cmd/compile/internal/x86 429 770 79%
cmd/cover 3984 4731 19%
cmd/dist 74 154 108%
cmd/doc 7272 8591 18%
cmd/expdump 27 71 163%
cmd/fix 342 419 23%
cmd/go 8126 9520 17%
cmd/gofmt 27 70 159%
cmd/gofmt2 27 69 156%
cmd/gofmt2/internal/format 702 856 22%
cmd/gofmt2/internal/lexical 2954 3509 19%
cmd/gofmt2/internal/parse 6185 7295 18%
cmd/gofmt2/internal/syntax 3533 4738 34%
cmd/gofmt2/internal/test 540 615 14%
cmd/internal/bio 5395 6060 12%
cmd/internal/gcprog 533 663 24%
cmd/internal/goobj 1022 1277 25%
cmd/internal/obj 10951 12825 17%
cmd/internal/obj/arm 8612 9985 16%
cmd/internal/obj/arm64 15814 17638 12%
cmd/internal/obj/mips 10928 12487 14%
cmd/internal/obj/ppc64 13576 15277 13%
cmd/internal/obj/s390x 16513 18708 13%
cmd/internal/obj/x86 21152 23482 11%
cmd/internal/objfile 14442 16505 14%
cmd/internal/pprof/commands 1663 1885 13%
cmd/internal/pprof/driver 9517 10789 13%
cmd/internal/pprof/fetch 7632 8635 13%
cmd/internal/pprof/plugin 13150 14809 13%
cmd/internal/pprof/profile 7004 8248 18%
cmd/internal/pprof/report 7763 8942 15%
cmd/internal/pprof/svg 1332 1534 15%
cmd/internal/pprof/symbolizer 7376 8439 14%
cmd/internal/pprof/symbolz 6970 7976 14%
cmd/internal/pprof/tempfile 3645 4093 12%
cmd/internal/sys 505 619 23%
cmd/internal/unvendor/golang.org/x/arch/arm/armasm 73951 79188 7%
cmd/internal/unvendor/golang.org/x/arch/x86/x86asm 10140 11738 16%
cmd/link 27 64 137%
cmd/link/internal/amd64 9317 11034 18%
cmd/link/internal/arm 110 213 94%
cmd/link/internal/arm64 112 219 96%
cmd/link/internal/ld 53524 60149 12%
cmd/link/internal/mips64 113 222 96%
cmd/link/internal/ppc64 113 220 95%
cmd/link/internal/s390x 112 219 96%
cmd/link/internal/x86 110 212 93%
cmd/nm 27 61 126%
cmd/objdump 27 68 152%
cmd/pack 4141 4688 13%
cmd/pprof 27 67 148%
cmd/trace 624 842 35%
cmd/vet 11194 13140 17%
cmd/vet/internal/whitelist 52 113 117%
cmd/yacc 1141 1317 15%
compress/bzip2 2101 2484 18%
compress/flate 3619 4336 20%
compress/gzip 6261 7111 14%
compress/lzw 276 401 45%
compress/zlib 3630 4158 15%
container/heap 187 250 34%
container/list 1370 1506 10%
container/ring 466 546 17%
context 3005 3338 11%
crypto 728 856 18%
crypto/aes 181 321 77%
crypto/cipher 744 1163 56%
crypto/des 220 320 45%
crypto/dsa 4526 4990 10%
crypto/ecdsa 5341 5982 12%
crypto/elliptic 4969 5593 13%
crypto/hmac 188 250 33%
crypto/md5 560 706 26%
crypto/rand 4218 4746 13%
crypto/rc4 214 321 50%
crypto/rsa 5648 6355 13%
crypto/sha1 597 751 26%
crypto/sha256 228 351 54%
crypto/sha512 354 484 37%
crypto/subtle 586 621 6%
crypto/tls 20909 23438 12%
crypto/x509 14862 16857 13%
crypto/x509/pkix 8384 9278 11%
database/sql 6721 7715 15%
database/sql/driver 1243 1535 23%
debug/dwarf 7867 9153 16%
debug/elf 25479 28025 10%
debug/gosym 1887 2267 20%
debug/macho 7222 8846 22%
debug/pe 6921 8081 17%
debug/plan9obj 1084 1319 22%
encoding 217 280 29%
encoding/ascii85 587 722 23%
encoding/asn1 1043 1268 22%
encoding/base32 929 1112 20%
encoding/base64 1166 1368 17%
encoding/binary 2168 2410 11%
encoding/csv 3761 4203 12%
encoding/gob 11304 12936 14%
encoding/hex 510 606 19%
encoding/json 9965 11395 14%
encoding/pem 202 266 32%
encoding/xml 11817 13361 13%
errors 126 170 35%
expvar 930 1142 23%
flag 5905 6519 10%
fmt 1027 1190 16%
go/ast 12910 15541 20%
go/build 5460 6173 13%
go/constant 1645 1816 10%
go/doc 3107 3882 25%
go/format 1416 1729 22%
go/importer 1426 1668 17%
go/internal/gccgoimporter 1624 2028 25%
go/internal/gcimporter 2650 3095 17%
go/parser 6220 7073 14%
go/printer 1924 2306 20%
go/scanner 3137 3602 15%
go/token 3053 3474 14%
go/types 21793 25561 17%
hash 234 327 40%
hash/adler32 465 553 19%
hash/crc32 668 817 22%
hash/crc64 630 727 15%
hash/fnv 1413 1582 12%
html 76 114 50%
html/template 14382 16457 14%
image 10248 11409 11%
image/color 2247 2562 14%
image/color/palette 107 169 58%
image/draw 2313 2494 8%
image/gif 3079 3450 12%
image/internal/imageutil 3136 3456 10%
image/jpeg 2349 2735 16%
image/png 2404 2695 12%
index/suffixarray 4978 5596 12%
internal/race 225 278 24%
internal/singleflight 551 697 26%
internal/syscall/windows/sysdll 97 166 71%
internal/testenv 4488 5052 13%
internal/trace 1392 1680 21%
io 2811 3318 18%
io/ioutil 3988 4467 12%
log 3532 3907 11%
log/syslog 4247 4775 12%
math 3021 4499 49%
math/big 7250 8456 17%
math/cmplx 1034 1617 56%
math/rand 734 885 21%
mime 1889 2194 16%
mime/multipart 4313 4849 12%
mime/quotedprintable 1758 1996 14%
net 15686 18617 19%
net/http 42182 47848 13%
net/http/cgi 19496 21768 12%
net/http/cookiejar 4615 5248 14%
net/http/fcgi 17758 19771 11%
net/http/httptest 26108 29350 12%
net/http/httputil 20732 23286 12%
net/http/internal 2195 2497 14%
net/http/pprof 17596 19545 11%
net/internal/socktest 1689 2153 27%
net/mail 4328 4810 11%
net/rpc 24328 27249 12%
net/rpc/jsonrpc 11052 12438 13%
net/smtp 17127 19174 12%
net/textproto 3705 4329 17%
net/url 1193 1371 15%
os 8493 10113 19%
os/exec 6625 7532 14%
os/signal 137 236 72%
os/user 529 761 44%
path 295 372 26%
path/filepath 3452 3952 14%
reflect 5091 6028 18%
regexp 4848 5585 15%
regexp/syntax 2590 3076 19%
runtime 8721 11598 33%
runtime/cgo 17 17 0%
runtime/debug 2721 3130 15%
runtime/internal/atomic 569 704 24%
runtime/internal/sys 1874 2318 24%
runtime/pprof 478 582 22%
runtime/race 18 18 0%
runtime/trace 95 146 54%
sort 1052 1215 15%
strconv 1389 1667 20%
strings 3372 3772 12%
sync 946 1371 45%
sync/atomic 962 1079 12%
syscall 41574 45613 10%
testing 6184 7243 17%
testing/iotest 883 1116 26%
testing/quick 4659 5443 17%
text/scanner 2930 3269 12%
text/tabwriter 2333 2607 12%
text/template 13335 15274 15%
text/template/parse 8270 9285 12%
time 4687 5313 13%
unicode 3831 4355 14%
unicode/utf16 530 584 10%
unicode/utf8 872 946 8%
vendor/golang.org/x/net/http2/hpack 3386 3970 17%

1295440 1481566 14%
orig. textual 4253585 1481566 -65%
orig. binary 1724071 1481566 -14%

Change-Id: I4177c6511cc57ebe5eb80c89bf3aefc83376ce86
Reviewed-on: https://go-review.googlesource.com/22096
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agocmd/compile: fix register size for ODOTPTR result
Keith Randall [Thu, 14 Apr 2016 20:47:58 +0000 (13:47 -0700)]
cmd/compile: fix register size for ODOTPTR result

The result of ODOTPTR, as well as a bunch of other ops,
should be the type of the result, not always a pointer type.

This fixes an amd64p32 bug where we were incorrectly truncating
a 64-bit slice index to 32 bits, and then barfing on a weird
load-64-bits-but-then-truncate-to-32-bits op that doesn't exist.

Fixes #15252

Change-Id: Ie62f4315fffd79f233e5449324ccc0879f5ac343
Reviewed-on: https://go-review.googlesource.com/22094
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agosync/atomic: don't atomically write pointers twice
Austin Clements [Wed, 13 Apr 2016 19:12:32 +0000 (15:12 -0400)]
sync/atomic: don't atomically write pointers twice

sync/atomic.StorePointer (which is implemented in
runtime/atomic_pointer.go) writes the pointer twice (through two
completely different code paths, no less). Fix it to only write once.

Change-Id: Id3b2aef9aa9081c2cf096833e001b93d3dd1f5da
Reviewed-on: https://go-review.googlesource.com/21999
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: make sync_atomic_SwapPointer signature match sync/atomic
Austin Clements [Wed, 13 Apr 2016 19:06:01 +0000 (15:06 -0400)]
runtime: make sync_atomic_SwapPointer signature match sync/atomic

SwapPointer is declared as

  func SwapPointer(addr *unsafe.Pointer, new unsafe.Pointer) (old unsafe.Pointer)

in sync/atomic, but defined in the runtime (where it's actually
implemented) as

  func sync_atomic_SwapPointer(ptr unsafe.Pointer, new unsafe.Pointer) unsafe.Pointer

Make ptr a *unsafe.Pointer in the runtime definition to match the type
in sync/atomic.

Change-Id: I99bab651b995001bbe54f9e790fdef2417ef0e9e
Reviewed-on: https://go-review.googlesource.com/21998
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
9 years agoruntime/internal/sys: better fallback algorithms for intrinsics
Keith Randall [Thu, 14 Apr 2016 17:28:35 +0000 (10:28 -0700)]
runtime/internal/sys: better fallback algorithms for intrinsics

Use deBruijn sequences to count low-order zeros.
Reorg bswap to not use &^, it takes another instruction on x86.

Change-Id: I4a5ed9fd16ee6a279d88c067e8a2ba11de821156
Reviewed-on: https://go-review.googlesource.com/22084
Reviewed-by: David Chase <drchase@google.com>
9 years agocmd/go: deduplicate gccgo afiles by package path, not *Package
Michael Hudson-Doyle [Fri, 8 Apr 2016 03:06:04 +0000 (15:06 +1200)]
cmd/go: deduplicate gccgo afiles by package path, not *Package

This code was fixed a while ago to ensure that xtest and fake packages came
first on the link line, but golang.org/cl/16775 added --whole-archive ...
--no-whole-archive around all the .a files and rendered this fix useless.

So, take a different approach and only put one .a file on the linker command
line for each ImportPath we see while traversing the action graph, not for each
*Package we see. The way we walk the graph ensures that we'll see the .a files
that need to be first first.

Change-Id: I137f00f129ccc9fc99f40eee885cc04cc358a62e
Reviewed-on: https://go-review.googlesource.com/21692
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: fix "#cgo pkg-config:" comments with gccgo
Michael Hudson-Doyle [Thu, 21 Jan 2016 01:53:55 +0000 (14:53 +1300)]
cmd/go: fix "#cgo pkg-config:" comments with gccgo

The unique difficulty of #cgo pkg-config is that the linker flags are recorded
when the package is compiled but (obviously) must be used when the package is
linked into an executable -- so the flags need to be stored on disk somewhere.
As it happens cgo already writes out a _cgo_flags file: nothing uses it
currently, but this change adds it to the lib$pkg.a file when compiling a
package, reads it out when linking (and passes a version of the .a file with
_cgo_flags stripped out of it to the linker). It's all fairly ugly but it works
and I can't really think of any way of reducing the essential level of
ugliness.

Fixes #11739

Change-Id: I35621878014e1e107eda77a5b0b23d0240ec5750
Reviewed-on: https://go-review.googlesource.com/18790
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocrypto/aes: fix vet warnings in gcm_amd64.s
Josh Bleecher Snyder [Thu, 14 Apr 2016 19:41:54 +0000 (12:41 -0700)]
crypto/aes: fix vet warnings in gcm_amd64.s

Notably, this fixes two incorrect argument sizes.

Update #11041

Change-Id: Ie4a3b1a59cd6a6707f6d2f4d3be978fc70322b46
Reviewed-on: https://go-review.googlesource.com/22091
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agodoc: GCC 6 will have the Go 1.6.1 user libraries
Ian Lance Taylor [Thu, 14 Apr 2016 04:44:35 +0000 (21:44 -0700)]
doc: GCC 6 will have the Go 1.6.1 user libraries

Update #14759.

Change-Id: I8a174aad721beb62380e10071d9648b6b1c21b8c
Reviewed-on: https://go-review.googlesource.com/22072
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/compile: use type. prefix on importpath symbol
David Crawshaw [Thu, 14 Apr 2016 12:54:15 +0000 (08:54 -0400)]
cmd/compile: use type. prefix on importpath symbol

This ensures that importpath symbols are treated like other type data
and end up in the same section under all build modes.

Fixes: go test -buildmode=pie reflect
Change-Id: Ibb8348648e8dcc850f2424d206990a06090ce4c6
Reviewed-on: https://go-review.googlesource.com/22081
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: clear hidden value at end of channel range body
Josh Bleecher Snyder [Thu, 14 Apr 2016 15:48:36 +0000 (08:48 -0700)]
cmd/compile: clear hidden value at end of channel range body

While we’re here, clean up a few comments.

Fixes #15281

Change-Id: Ia6173e9941133db08f57bc80bdd3c5722122bfdb
Reviewed-on: https://go-review.googlesource.com/22082
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
9 years agotest: use correct value in error message in init1.go
Michael Munday [Thu, 14 Apr 2016 18:07:59 +0000 (14:07 -0400)]
test: use correct value in error message in init1.go

Print numGC followed by numGC1, rather than printing numGC twice.

Change-Id: I8e7144b6a11d4ae9be0d82d88b86fed04b906e2f
Reviewed-on: https://go-review.googlesource.com/22087
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: find a home for orphaned comments
Jeremy Jackins [Wed, 13 Apr 2016 09:16:21 +0000 (18:16 +0900)]
runtime: find a home for orphaned comments

These comments were left behind after runtime.h was converted
from C to Go. I examined the original code and tried to move these
to the places that the most sense.

Change-Id: I8769d60234c0113d682f9de3bd8d6c34c450c188
Reviewed-on: https://go-review.googlesource.com/21969
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocrypto/cipher: enable fastXORBytes on s390x
Michael Munday [Thu, 14 Apr 2016 17:29:37 +0000 (13:29 -0400)]
crypto/cipher: enable fastXORBytes on s390x

s390x can handle unaligned loads and stores of 64-bit values.

Change-Id: Iae5621781e3ba56e27b4a1f4788772c86e4f6475
Reviewed-on: https://go-review.googlesource.com/22086
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: fix use of original spill name after sinking
David Chase [Wed, 13 Apr 2016 17:30:03 +0000 (13:30 -0400)]
cmd/compile: fix use of original spill name after sinking

This is a fix for the ssacheck builder
http://build.golang.org/log/baa00f70c34e41186051cfe90568de3d91f115d7
after CL 21307 for sinking spills down loop exits
https://go-review.googlesource.com/#/c/21037/

The fix is to reuse (move) the original spill, thus preserving
the definition of the variable and its use count. Original and
copy both use the same stack slot, but ssacheck needs to see
a definition for the variable itself.

Fixes #15279.

Change-Id: I286285490193dc211b312d64dbc5a54867730bd6
Reviewed-on: https://go-review.googlesource.com/21995
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agogo/types: record CallExpr result type even if argument is invalid
Alan Donovan [Thu, 14 Apr 2016 17:41:32 +0000 (13:41 -0400)]
go/types: record CallExpr result type even if argument is invalid

+ test

Fixes #15305

Change-Id: Ica657c00c92f0b19f0df7452cdbe5a95d23cc8a4
Reviewed-on: https://go-review.googlesource.com/22085
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agocmd/vet: teach asm checker about PEXTRD’s op size
Josh Bleecher Snyder [Thu, 14 Apr 2016 16:39:40 +0000 (09:39 -0700)]
cmd/vet: teach asm checker about PEXTRD’s op size

Fixes #15271

Change-Id: I28e3fb5bde1e6fd5b263b1434873b8ce051aee97
Reviewed-on: https://go-review.googlesource.com/22083
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/internal/obj: remove use of package bio
Matthew Dempsky [Wed, 13 Apr 2016 00:58:46 +0000 (17:58 -0700)]
cmd/internal/obj: remove use of package bio

Also add MustClose and MustWriter to cmd/internal/bio, and use them in
cmd/asm.

Change-Id: I07f5df3b66c17bc5b2e6ec9c4357d9b653e354e0
Reviewed-on: https://go-review.googlesource.com/21938
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocrypto/x509: don't add an AuthorityKeyId to self-signed certificates.
Adam Langley [Tue, 12 Apr 2016 18:14:25 +0000 (11:14 -0700)]
crypto/x509: don't add an AuthorityKeyId to self-signed certificates.

The AuthorityKeyId is optional for self-signed certificates, generally
useless, and takes up space. This change causes an AuthorityKeyId not to
be added to self-signed certificates, although it can still be set in
the template if the caller really wants to include it.

Fixes #15194.

Change-Id: If5d3c3d9ca9ae5fe67458291510ec7140829756e
Reviewed-on: https://go-review.googlesource.com/21895
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocrypto/tls: make error prefix uniform.
Adam Langley [Tue, 12 Apr 2016 17:43:44 +0000 (10:43 -0700)]
crypto/tls: make error prefix uniform.

Error strings in this package were all over the place: some were
prefixed with “tls:”, some with “crypto/tls:” and some didn't have a
prefix.

This change makes everything use the prefix “tls:”.

Change-Id: Ie8b073c897764b691140412ecd6613da8c4e33a2
Reviewed-on: https://go-review.googlesource.com/21893
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agocmd/vet: allow untyped composite literals to be unkeyed
Luan Santos [Wed, 13 Apr 2016 15:10:41 +0000 (08:10 -0700)]
cmd/vet: allow untyped composite literals to be unkeyed

We can trust that untyped composite literals are part of a slice literal
and not emit a vet warning for those.

Fixes #9171

Change-Id: Ia7c081e543b850f8be1fd1f9e711520061e70bed
Reviewed-on: https://go-review.googlesource.com/22000
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agomisc/trace: update trace viewer html
Dmitry Vyukov [Thu, 14 Apr 2016 14:31:42 +0000 (16:31 +0200)]
misc/trace: update trace viewer html

The old trace-viewer is broken since Chrome 49:
https://bugs.chromium.org/p/chromium/issues/detail?id=569417
It was fixed in:
https://github.com/catapult-project/catapult/commit/506457cbd726324f327b80ae11f46c1dfeb8710d

This change updates trace-viewer to the latest version
(now it is called catapult).

This version has a bug in the lean config that we use, though:
https://github.com/catapult-project/catapult/issues/2247
So use full config for now (it works, but leads to larger html).
When the bug is fixed we need to switch back to lean config (issue #15302).

Change-Id: Ifb8d782ced66e3292d81c5604039fe18eaf267c5
Reviewed-on: https://go-review.googlesource.com/22013
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agotesting: removed flakey test
Marcel van Lohuizen [Thu, 14 Apr 2016 07:44:48 +0000 (15:44 +0800)]
testing: removed flakey test

The synchronization in this test is a bit complicated and likely
incorrect, judging from the sporadically hanging trybots.
Most of what this is supposed to test is already tested in
TestTestContext, so I'll just remove it.

Fixes #15170

Change-Id: If54db977503caa109cec4516974eda9191051888
Reviewed-on: https://go-review.googlesource.com/22080
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet: fix TestDialAddrError
Mikio Hara [Thu, 14 Apr 2016 05:53:12 +0000 (14:53 +0900)]
net: fix TestDialAddrError

Fixes #15291.

Change-Id: I563140c2acd37d4989a940488b217414cf73f6c2
Reviewed-on: https://go-review.googlesource.com/22077
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
9 years agonet: make use of internal/testenv package
Mikio Hara [Thu, 14 Apr 2016 03:17:44 +0000 (12:17 +0900)]
net: make use of internal/testenv package

Change-Id: I6644081df495cb92b3d208f867066f9acb08946f
Reviewed-on: https://go-review.googlesource.com/22074
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: make newLocalPacketListener handle network argument correcly
Mikio Hara [Thu, 14 Apr 2016 00:57:43 +0000 (09:57 +0900)]
net: make newLocalPacketListener handle network argument correcly

Change-Id: I41691134770d01805c19c0f84f8828b00b85de0c
Reviewed-on: https://go-review.googlesource.com/22058
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/internal/obj: change Link.Flag_shared to bool
Matthew Dempsky [Thu, 14 Apr 2016 01:41:59 +0000 (18:41 -0700)]
cmd/internal/obj: change Link.Flag_shared to bool

Change-Id: I9bda2ce6f45fb8292503f86d8f9f161601f222b7
Reviewed-on: https://go-review.googlesource.com/22053
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
9 years agocmd/compile/internal/gc: change flags to bool where possible
Matthew Dempsky [Thu, 14 Apr 2016 01:37:18 +0000 (18:37 -0700)]
cmd/compile/internal/gc: change flags to bool where possible

Some of the Debug[x] flags are actually boolean too, but not all, so
they need to be handled separately.

While here, change some obj.Flagstr and obj.Flagint64 calls to
directly use flag.StringVar and flag.Int64Var instead.

Change-Id: Iccedf6fed4328240ee2257f57fe6d66688f237c4
Reviewed-on: https://go-review.googlesource.com/22052
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>