]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agonet: fix TestLookupDotsWithLocalSource
Mikio Hara [Thu, 21 Jan 2016 08:22:30 +0000 (17:22 +0900)]
net: fix TestLookupDotsWithLocalSource

Fixes #14050.

Change-Id: I2d9c32213b0da35703edf28f92ed3efb23325921
Reviewed-on: https://go-review.googlesource.com/18792
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 agounsafe: document valid uses of Pointer
Russ Cox [Thu, 14 Jan 2016 01:14:03 +0000 (20:14 -0500)]
unsafe: document valid uses of Pointer

Add docs for valid uses of Pointer.
Then document change made for #13372 in CL 18584.

Fixes #8994.

Change-Id: Ifba71e5aeafd11f684aed0b7ddacf3c8ec07c580
Reviewed-on: https://go-review.googlesource.com/18640
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agocmd/internal/obj/mips, cmd/internal/obj: reduce MIPS register space
Shenghou Ma [Thu, 21 Jan 2016 21:45:36 +0000 (16:45 -0500)]
cmd/internal/obj/mips, cmd/internal/obj: reduce MIPS register space

Change-Id: I43458ce0e78ffc3d0943d28dc8df8e1c9e4cf679
Reviewed-on: https://go-review.googlesource.com/18821
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: update vendored copy of math/big
Robert Griesemer [Fri, 22 Jan 2016 00:48:14 +0000 (16:48 -0800)]
cmd/compile: update vendored copy of math/big

- obtained by running sh vendor.bash
- contains updated tests and some bug fixes for Montgomery mult.
  (not used by compiler)
- for consistency of math/big versions only

Change-Id: Ib47e48d5b7f6d0e05d7837b1bc74bdb03f2b094e
Reviewed-on: https://go-review.googlesource.com/18831
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: remove unused (dead) fields
Robert Griesemer [Fri, 22 Jan 2016 00:36:36 +0000 (16:36 -0800)]
cmd/compile: remove unused (dead) fields

Change-Id: I4816a788e7b89b76dc70d05f4b176e99684d0680
Reviewed-on: https://go-review.googlesource.com/18830
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: skip TestSignalExitStatus on NetBSD
Ian Lance Taylor [Thu, 21 Jan 2016 23:18:23 +0000 (15:18 -0800)]
runtime: skip TestSignalExitStatus on NetBSD

It doesn't work and I don't know why.

Update #14063.

Change-Id: I42735012cf6247eca5336f29fcf713e08c8477f8
Reviewed-on: https://go-review.googlesource.com/18817
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agolib/time: update to IANA release 2015g.
David Symonds [Thu, 21 Jan 2016 23:06:08 +0000 (10:06 +1100)]
lib/time: update to IANA release 2015g.

Change-Id: Id82209dc313fa6b54e623eb325412737e7a055fe
Reviewed-on: https://go-review.googlesource.com/18794
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoruntime: save context value in NetBSD sigtramp
Ian Lance Taylor [Thu, 21 Jan 2016 20:43:34 +0000 (12:43 -0800)]
runtime: save context value in NetBSD sigtramp

On NetBSD a signal handler returns to the kernel by calling the
setcontext system call with the context passed to the signal handler.
The implementation of runtime·sigreturn_tramp for amd64, copied from the
NetBSD libc, expects that context address to be in r15.  That works in
the NetBSD libc because r15 is preserved across the call to the signal
handler.  It fails in the Go library because r15 is not preserved.
There are various ways to fix this; this one uses the simple approach,
essentially identical to the one in the NetBSD libc, of preserving r15
across the signal handler proper.

Looking at the code for 386 and arm suggests that they are OK.  However,
I have not actually tested them.

Update #14052.

Change-Id: I2b516b1d05fe5d3b8911e65ca761d621dc37fa1b
Reviewed-on: https://go-review.googlesource.com/18815
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: on NetBSD and DragonFly drop signal stack in new thread
Ian Lance Taylor [Thu, 21 Jan 2016 20:38:05 +0000 (12:38 -0800)]
runtime: on NetBSD and DragonFly drop signal stack in new thread

On NetBSD and DragonFly a newly created thread inherits the signal stack
of the creating thread.  This breaks horribly if both threads get a
signal at the same time.  Fix this by dropping the signal stack in the
newly created thread.  The right signal stack will then get installed
later.

Note that cgo code that calls pthread_create will have the wrong,
duplicated, signal stack in the newly created thread.  I don't see any
way to fix that in Go.  People using cgo to call pthread_create will
have to be aware of the problem.

Fixes #13945.
Fixes #13947.

Change-Id: I0c7bd2cdf9ada575d57182ca5e9523060de34931
Reviewed-on: https://go-review.googlesource.com/18814
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet: improve netsh usage in Windows unit tests
Tim Ebringer [Mon, 18 Jan 2016 10:33:25 +0000 (21:33 +1100)]
net: improve netsh usage in Windows unit tests

The TestInterfaceAddrsWithNetsh Windows unit test parses and compares the
output of the "netsh" command against more low level Windows API calls. In
at least two cases, some quirks of netsh cause these comparisons to fail.

One example appears to be wi-fi adapters. After a reboot, before it has
been allowed to connect to a network, netsh for IPv4 will not show an
address, whereas netsh for IPv6 will. If the interface is allowed to
connect, and then disconnected, netsh for IPv4 now shows an address and
the test will pass.

The fix is to not compare netsh output if the interface is down.

A related issue is that the IPv6 version of "netsh" can return an
IPv4-embedded IPv6 address where the IPv4 component of the address
is in decimal form, whilst the test is expecting hexadecimal form.

For example, output might be:

  Address fe80::5efe:192.168.1.7%6 Parameters
    ...

Whilst this is valid notation, the fix is to recognise this format in the
"netsh" output and re-parse the address into the all-hexadecimal
representation that the test is expecting.

Fixes #13981

Change-Id: Ie8366673f4d43d07bad80d6d5d1d6e33f654b6cc
Reviewed-on: https://go-review.googlesource.com/18711
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocrypto/tls: note in comment that Certificate.Leaf is nil after parsing.
Adam Langley [Tue, 19 Jan 2016 16:27:10 +0000 (08:27 -0800)]
crypto/tls: note in comment that Certificate.Leaf is nil after parsing.

LoadX509KeyPair and X509KeyPair don't retain the parsed form of
certificates in their return value because it's generally not needed.
This change makes that clear in the comment.

See https://groups.google.com/d/msg/golang-dev/VResvFj2vF8/Wt6WkVT2AwAJ

Change-Id: Ibb759cd6e84c00f4450a012992088422c0546638
Reviewed-on: https://go-review.googlesource.com/18734
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agotext/template: fix documentation for pipelines
Rob Pike [Thu, 21 Jan 2016 00:08:31 +0000 (16:08 -0800)]
text/template: fix documentation for pipelines

The header was in the wrong place, so the definition of a pipeline
was not in the section labeled "Pipelines".

Fixes #13972

Change-Id: Ibca791a4511ca112047b57091c391f6e959fdd78
Reviewed-on: https://go-review.googlesource.com/18775
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agonet/http: make Client propagate Request.Cancel over redirected requests
Olivier Poitrey [Thu, 21 Jan 2016 06:53:50 +0000 (22:53 -0800)]
net/http: make Client propagate Request.Cancel over redirected requests

On HTTP redirect, the HTTP client creates a new request and don't copy
over the Cancel channel. This prevents any redirected request from being
cancelled.

Fixes #14053

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

9 years agocmd/go: document PackageError in go list output
Ian Lance Taylor [Mon, 18 Jan 2016 23:40:47 +0000 (15:40 -0800)]
cmd/go: document PackageError in go list output

Fixes #14007.

Change-Id: I1f73dfccb466d8fd00efbd8c92a31ac538bf5988
Reviewed-on: https://go-review.googlesource.com/18731
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: update http2 to check header values, move from vendor to internal
Brad Fitzpatrick [Wed, 20 Jan 2016 22:41:52 +0000 (22:41 +0000)]
net/http: update http2 to check header values, move from vendor to internal

Updates x/net/http2 to git rev b2ed34f for https://golang.org/cl/18727

Updates #14029 (fixes it enough for Go 1.6)
Fixes #13961

Change-Id: Id301247545507671f4e79df0e7c6ec9c421d5a7c
Reviewed-on: https://go-review.googlesource.com/18728
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/link: allow symbols from .a files to override those from .so files
Michael Hudson-Doyle [Wed, 20 Jan 2016 02:31:26 +0000 (15:31 +1300)]
cmd/link: allow symbols from .a files to override those from .so files

https://golang.org/s/execmodes defines rules for how multiple codes of a go
package work when they end up in the address space of a single process, but
currently the linker blows up in this situation. Fix that by loading all .a
files before any .so files and ignoring duplicate symbols found when loading
shared libraries.

I know this is very very late for 1.6 but at least it should clearly not have
any effect when shared libraries are not in use.

Change-Id: I512ac912937e7502ff58eb5628b658ecce3c38e5
Reviewed-on: https://go-review.googlesource.com/18714
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

9 years agocmd/dist: pass -tags race to go list in -race mode
Shenghou Ma [Tue, 19 Jan 2016 03:42:40 +0000 (22:42 -0500)]
cmd/dist: pass -tags race to go list in -race mode

so that runtime/race tests are included in the race builder.

Update #14011.

Change-Id: I04ac6e47366fdb1fe84ba89da556c6d38f7d4a47
Reviewed-on: https://go-review.googlesource.com/18686
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: don't print (empty) package name in errors referring to built-ins
Robert Griesemer [Tue, 19 Jan 2016 22:17:29 +0000 (14:17 -0800)]
cmd/compile: don't print (empty) package name in errors referring to built-ins

Fixes #14010.

Change-Id: Idfd4b063eecf453fe00f3e798099023707a65963
Reviewed-on: https://go-review.googlesource.com/18738
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>

9 years agoruntime/race: fix test so it compiles
Michael Hudson-Doyle [Tue, 19 Jan 2016 03:27:14 +0000 (16:27 +1300)]
runtime/race: fix test so it compiles

I'm not sure what the convert function was intended to be.

Fixes #14011

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

9 years agocmd/compile: add VARLIVE to opnames list
Keith Randall [Tue, 19 Jan 2016 21:52:51 +0000 (13:52 -0800)]
cmd/compile: add VARLIVE to opnames list

Change-Id: Ie8cb7c7428ae9026c11643b22f9ecf7977e25f5f
Reviewed-on: https://go-review.googlesource.com/18737
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/compile: don't crash on invalid labeled statement
Robert Griesemer [Tue, 19 Jan 2016 21:14:03 +0000 (13:14 -0800)]
cmd/compile: don't crash on invalid labeled statement

Fixes #14006.

Change-Id: Ia819073677ad6993c02255e23760ee21598427b4
Reviewed-on: https://go-review.googlesource.com/18736
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: set importpkg.Direct correctly when using binary imports
Robert Griesemer [Fri, 15 Jan 2016 22:52:06 +0000 (14:52 -0800)]
cmd/compile: set importpkg.Direct correctly when using binary imports

Fixes #13977.

Change-Id: Icf54b4d2d746d30da207d1e17c975d18188b1cf8
Reviewed-on: https://go-review.googlesource.com/18702
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agocmd/link: fix elf64phdr to allow using upx (and other broken ELF loaders).
OneOfOne [Fri, 15 Jan 2016 17:24:44 +0000 (19:24 +0200)]
cmd/link: fix elf64phdr to allow using upx (and other broken ELF loaders).

The linker already applies the fix for elf32, so this just extends it to elf64.

Inspired by https://github.com/pwaller/goupx

Fixes #13974

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

9 years agonet: add timeout to DNS requests sent by TestSpecialDomainName
Michael Munday [Thu, 14 Jan 2016 21:36:43 +0000 (16:36 -0500)]
net: add timeout to DNS requests sent by TestSpecialDomainName

The timeout means that TestSpecialDomainName will not hang if
the DNS server does not respond to the request.

Fixes #13939

Change-Id: I46e30bbd3c11b6c560656134e704331cf6f8af3f
Reviewed-on: https://go-review.googlesource.com/18661
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet/http: make hidden http2 Transport respect remaining Transport fields
Brad Fitzpatrick [Tue, 19 Jan 2016 05:10:58 +0000 (05:10 +0000)]
net/http: make hidden http2 Transport respect remaining Transport fields

Updates x/net/http2 to git rev 72aa00c6 for https://golang.org/cl/18721
(but actually at https://golang.org/cl/18722 now)

Fixes #14008

Change-Id: If05d5ad51ec0ba5ba7e4fe16605c0a83f0484bc8
Reviewed-on: https://go-review.googlesource.com/18723
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agobuild: test linux/mips64 and linux/mips64le with buildall.bash
Shenghou Ma [Tue, 19 Jan 2016 03:55:11 +0000 (22:55 -0500)]
build: test linux/mips64 and linux/mips64le with buildall.bash

Both mips64 architectures share the same runtime/rt0 file, so
we have to hardcode them in buildall.bash.

Ideally we should have cmd/dist report all supported platforms,
see #12270.

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

9 years agoruntime: print address as hex in messages
Shenghou Ma [Mon, 18 Jan 2016 22:55:06 +0000 (17:55 -0500)]
runtime: print address as hex in messages

Change-Id: I7ccf1b5001d77c4390479f53c0137ab02f98595b
Reviewed-on: https://go-review.googlesource.com/18685
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet/http: clarify docs on Request.Proto field
Brad Fitzpatrick [Mon, 18 Jan 2016 06:38:56 +0000 (06:38 +0000)]
net/http: clarify docs on Request.Proto field

No need to say "by default" because there is no alternative and no way
to override. Always HTTP/2.0 is officially spelled HTTP/2 these days.

Fixes #13985 harder

Change-Id: Ib1ec03cec171ca865342b8e7452cd4c707d7b770
Reviewed-on: https://go-review.googlesource.com/18720
Reviewed-by: Rob Pike <r@golang.org>
9 years agonet/http: make http2 Transport send Content Length
Brad Fitzpatrick [Mon, 18 Jan 2016 22:50:52 +0000 (14:50 -0800)]
net/http: make http2 Transport send Content Length

Updates x/net/http2 to git rev 5c0dae8 for https://golang.org/cl/18709

Fixes #14003

Change-Id: I8bc205d6d089107b017e3458bbc7e05f6d0cae60
Reviewed-on: https://go-review.googlesource.com/18730
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet/http: panic on bogus use of CloseNotifier or Hijacker
Brad Fitzpatrick [Mon, 18 Jan 2016 19:43:32 +0000 (11:43 -0800)]
net/http: panic on bogus use of CloseNotifier or Hijacker

Fixes #14001

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

9 years agonet: disable TestInterfaceAddrsWithNetsh on windows
Mikio Hara [Sun, 17 Jan 2016 00:04:58 +0000 (09:04 +0900)]
net: disable TestInterfaceAddrsWithNetsh on windows

Updates #13981.

Change-Id: Id8f3cd56a81a7a993cea5c757e619407da491fed
Reviewed-on: https://go-review.googlesource.com/18710
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: don't run TestEnsureDropM on windows or plan9
Ian Lance Taylor [Mon, 18 Jan 2016 17:01:48 +0000 (09:01 -0800)]
runtime: don't run TestEnsureDropM on windows or plan9

This is testing code in asm_GOARCH.s, so it's not necessary to run the
test on systems where it doesn't build.

Fixes #13991.

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

9 years agonet/http: update bundled http2, pass through Transport.CloseIdleConnections
Brad Fitzpatrick [Fri, 15 Jan 2016 18:53:51 +0000 (10:53 -0800)]
net/http: update bundled http2, pass through Transport.CloseIdleConnections

Wire up Transport.CloseIdleConnections to http2.Transport.CloseIdleConnections.

Updates x/net/http2 to git rev c92cdcb0 for https://golang.org/cl/18678

Fixes #13975

Change-Id: I1183a31256104ff95ae7621e5788cfeee741b1aa
Reviewed-on: https://go-review.googlesource.com/18679
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime: fix sleep/wakeup race for GC assists
Austin Clements [Fri, 15 Jan 2016 18:28:41 +0000 (13:28 -0500)]
runtime: fix sleep/wakeup race for GC assists

GC assists check gcBlackenEnabled under the assist queue lock to avoid
going to sleep after gcWakeAllAssists has already woken all assists.
However, currently we clear gcBlackenEnabled shortly *after* waking
all assists, which opens a window where this exact race can happen.

Fix this by clearing gcBlackenEnabled before waking blocked assists.
However, it's unlikely this actually matters because the world is
stopped between waking assists and clearing gcBlackenEnabled and there
aren't any obvious allocations during this window, so I don't think an
assist could actually slip in to this race window.

Updates #13645.

Change-Id: I7571f059530481dc781d8fd96a1a40aadebecb0d
Reviewed-on: https://go-review.googlesource.com/18682
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: readjust signal code for dragonfly-2.6 and above
Mikio Hara [Fri, 15 Jan 2016 07:37:47 +0000 (16:37 +0900)]
runtime: readjust signal code for dragonfly-2.6 and above

Also adds missing nosplit to unminit.

Fixes #13964.

Change-Id: I07d93a8c872a255a89f91f808b66c889f0a6a69c
Reviewed-on: https://go-review.googlesource.com/18658
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet/http: update bundled http2
Brad Fitzpatrick [Fri, 15 Jan 2016 00:29:24 +0000 (16:29 -0800)]
net/http: update bundled http2

If a user starts two HTTP requests when no http2 connection is
available, both end up creating new TCP connections, since the
server's protocol (h1 or h2) isn't yet known. Once it turns out that
the server supports h2, one of the connections is useless. Previously
we kept upgrading both TLS connections to h2 (SETTINGS frame exchange,
etc).  Now the unnecessary connections are closed instead, before the
h2 preface/SETTINGS.

Updates x/net/http2 to git rev a8e212f3d for https://golang.org/cl/18675

This CL contains the tests for https://golang.org/cl/18675

Semi-related change noticed while writing the tests: now that we have
TLSNextProto in Go 1.6, which consults the TLS
ConnectionState.NegotiatedProtocol, we have to gurantee that the TLS
handshake has been done before we look at the ConnectionState. So add
that check after the DialTLS hook. (we never documented that users
have to call Handshake, so do it for them, now that it matters)

Updates #13957

Change-Id: I9a70e9d1282fe937ea654d9b1269c984c4e366c0
Reviewed-on: https://go-review.googlesource.com/18676
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime: use at least "system" traceback level for runtime tests
Austin Clements [Thu, 14 Jan 2016 21:43:40 +0000 (16:43 -0500)]
runtime: use at least "system" traceback level for runtime tests

While the default behavior of eliding runtime frames from tracebacks
usually makes sense, this is not the case when you're trying to test
the runtime itself. Fix this by forcing the traceback level to at
least "system" in the runtime tests.

This will specifically help with debugging issue #13645, which has
proven remarkably resistant to reproduction outside of the build
dashboard itself.

Change-Id: I2a8356ba6c3c5badba8bb3330fc527357ec0d296
Reviewed-on: https://go-review.googlesource.com/18648
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
9 years agoruntime: fix darwin/arm64 build
Matthew Dempsky [Thu, 14 Jan 2016 20:14:05 +0000 (12:14 -0800)]
runtime: fix darwin/arm64 build

Fixes #13916.

Change-Id: If2cad5473a749460909519ac20aca19dea8a2e7a
Reviewed-on: https://go-review.googlesource.com/18671
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/go: fix vendor directory check on Windows
Russ Cox [Thu, 14 Jan 2016 19:40:54 +0000 (14:40 -0500)]
cmd/go: fix vendor directory check on Windows

Fixes build.

Change-Id: Idd7d87f0bf3fe553b3ab00dd32eee4925a4fe3ff
Reviewed-on: https://go-review.googlesource.com/18647
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
9 years agoruntime: remove erroneous go:noescape declaration
Ian Lance Taylor [Thu, 14 Jan 2016 17:10:57 +0000 (09:10 -0800)]
runtime: remove erroneous go:noescape declaration

Change-Id: I6b1dc789e54a385c958961e7ba16bfd9d0f3b313
Reviewed-on: https://go-review.googlesource.com/18629
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet/http: fix flaky TestServerValidatesHostHeader
Brad Fitzpatrick [Thu, 14 Jan 2016 05:36:03 +0000 (05:36 +0000)]
net/http: fix flaky TestServerValidatesHostHeader

Passes with go test -race -count=1000 -name=TestServerValidatesHostHeader now
without hanging.

Fixes #13950

Change-Id: I41c3a555c642595c95c8c52f19a05a4c68e67630
Reviewed-on: https://go-review.googlesource.com/18660
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: minimize time between lockextra/unlockextra
Ian Lance Taylor [Tue, 12 Jan 2016 23:34:03 +0000 (15:34 -0800)]
runtime: minimize time between lockextra/unlockextra

This doesn't fix a bug, but may improve performance in programs that
have many concurrent calls from C to Go.  The old code made several
system calls between lockextra and unlockextra.  That could be happening
while another thread is spinning acquiring lockextra.  This changes the
code to not make any system calls while holding the lock.

Change-Id: I50576478e478670c3d6429ad4e1b7d80f98a19d8
Reviewed-on: https://go-review.googlesource.com/18548
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: respect internal directories during 'go run'
Russ Cox [Thu, 14 Jan 2016 03:35:17 +0000 (22:35 -0500)]
cmd/go: respect internal directories during 'go run'

Fixes #12217.

Change-Id: I5ee6cb18eaa66bdec1affe689aa531c05e719fc9
Reviewed-on: https://go-review.googlesource.com/18645
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoruntime: fix several issues in TestFutexsleep
Austin Clements [Wed, 13 Jan 2016 20:14:26 +0000 (15:14 -0500)]
runtime: fix several issues in TestFutexsleep

TestFutexsleep is supposed to clean up before returning by waking up
the goroutines it started and left blocked in futex sleeps. However,
it currently fails at this in several ways:

1. Both the sleep and wakeup are done on the address of tt.mtx, but in
   both cases tt is a *local copy* of the futexsleepTest created by a
   loop, so the sleep and wakeup happen on completely different
   addresses. Fix this by making them both use the address of the
   global tt.mtx.

2. If the sleep happens after the wakeup (not likely, but not
   impossible), it won't wake up. Fix this by using the futex protocol
   properly: sleep if the mutex's value is 0, and set the mutex's
   value to non-zero before doing the wakeup.

3. If TestFutexsleep runs more than once, channels and mutex values
   left over from the first run will interfere with later runs. Fix
   this by clearing the mutex value and creating a new channel for
   each test and waiting for goroutines to finish before returning
   (lest they send their completion to the channel for the next run).

As an added bonus, this test now actually tests that futex
sleep/wakeup work. Previously this test would have been satisfied if
futexsleep was an infinite loop and futexwakeup was a no-op.

Change-Id: I1cbc6871cc9dcb8f4601b3621913bec2b79b0fc3
Reviewed-on: https://go-review.googlesource.com/18617
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
9 years agocmd/go, go/build: ignore vendor directories with no Go source files
Russ Cox [Thu, 14 Jan 2016 02:34:13 +0000 (21:34 -0500)]
cmd/go, go/build: ignore vendor directories with no Go source files

Otherwise it is impossible to vendor a/b/c without hiding the real a/b.
I also updated golang.org/s/go15vendor.

Fixes #13832.

Change-Id: Iee3d53c11ea870721803f6e8e67845b405686e79
Reviewed-on: https://go-review.googlesource.com/18644
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agobuild: use consistent shebang line
Shenghou Ma [Thu, 14 Jan 2016 02:33:33 +0000 (21:33 -0500)]
build: use consistent shebang line

Fixes #13948.

Change-Id: I37d734c1241f3d72d8fe33dfdf79b573e5476b1f
Reviewed-on: https://go-review.googlesource.com/18643
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc: revise help page with categories and more links
Andrew Gerrand [Thu, 14 Jan 2016 02:44:45 +0000 (13:44 +1100)]
doc: revise help page with categories and more links

Fixes #12489

Change-Id: I25dd3f76e4cfe9a71b987c3b31445724568391e9
Reviewed-on: https://go-review.googlesource.com/18625
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc: document archive/tar changes
Russ Cox [Thu, 14 Jan 2016 02:13:02 +0000 (21:13 -0500)]
doc: document archive/tar changes

Fixes #13647.

Change-Id: I28df7ade9b5abd79ce6b9c3d14ceaa988e86fc01
Reviewed-on: https://go-review.googlesource.com/18642
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agodebug/dwarf: fix nil pointer dereference in cyclic type structures
Austin Clements [Fri, 8 Jan 2016 21:25:29 +0000 (16:25 -0500)]
debug/dwarf: fix nil pointer dereference in cyclic type structures

Currently readType simultaneously constructs a type graph and resolves
the sizes of the types. However, these two operations are
fundamentally at odds: the order we parse a cyclic structure in may be
different than the order we need to resolve type sizes in. As a
result, it's possible that when readType attempts to resolve the size
of a typedef, it may dereference a nil Type field of another typedef
retrieved from the type cache that's only partially constructed.

To fix this, we delay resolving typedef sizes until the end of the
readType recursion, when the full type graph is constructed.

Fixes #13039.

Change-Id: I9889af37fb3be5437995030fdd61e45871319d07
Reviewed-on: https://go-review.googlesource.com/18459
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: add AVARLIVE to peep for arm, arm64, mips64, ppc64
Russ Cox [Thu, 14 Jan 2016 02:02:12 +0000 (21:02 -0500)]
cmd/compile: add AVARLIVE to peep for arm, arm64, mips64, ppc64

Fixes build on those systems.

Also fix printing of AVARLIVE.

Change-Id: I1b38cca0125689bc08e4e1bdd0d0c140b1ea079a
Reviewed-on: https://go-review.googlesource.com/18641
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/internal/obj: separate code layout from object writing
Russ Cox [Tue, 5 Jan 2016 14:27:40 +0000 (09:27 -0500)]
cmd/internal/obj: separate code layout from object writing

This will allow the compiler to crunch Prog lists down to code as each
function is compiled, instead of waiting until the end, which should
reduce the working set of the compiler. But not until Go 1.7.

This also makes it easier to write some machine code output tests
for the assembler, which is why it's being done now.

For #13822.

Change-Id: I0811123bc6e5717cebb8948f9cea18e1b9baf6f7
Reviewed-on: https://go-review.googlesource.com/18311
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: recognize Syscall-like functions for liveness analysis
Russ Cox [Wed, 13 Jan 2016 05:46:28 +0000 (00:46 -0500)]
cmd/compile: recognize Syscall-like functions for liveness analysis

Consider this code:

func f(*int)

func g() {
p := new(int)
f(p)
}

where f is an assembly function.
In general liveness analysis assumes that during the call to f, p is dead
in this frame. If f has retained p, p will be found alive in f's frame and keep
the new(int) from being garbage collected. This is all correct and works.
We use the Go func declaration for f to give the assembly function
liveness information (the arguments are assumed live for the entire call).

Now consider this code:

func h1() {
p := new(int)
syscall.Syscall(1, 2, 3, uintptr(unsafe.Pointer(p)))
}

Here syscall.Syscall is taking the place of f, but because its arguments
are uintptr, the liveness analysis and the garbage collector ignore them.
Since p is no longer live in h once the call starts, if the garbage collector
scans the stack while the system call is blocked, it will find no reference
to the new(int) and reclaim it. If the kernel is going to write to *p once
the call finishes, reclaiming the memory is a mistake.

We can't change the arguments or the liveness information for
syscall.Syscall itself, both for compatibility and because sometimes the
arguments really are integers, and the garbage collector will get quite upset
if it finds an integer where it expects a pointer. The problem is that
these arguments are fundamentally untyped.

The solution we have taken in the syscall package's wrappers in past
releases is to insert a call to a dummy function named "use", to make
it look like the argument is live during the call to syscall.Syscall:

func h2() {
p := new(int)
syscall.Syscall(1, 2, 3, uintptr(unsafe.Pointer(p)))
use(unsafe.Pointer(p))
}

Keeping p alive during the call means that if the garbage collector
scans the stack during the system call now, it will find the reference to p.

Unfortunately, this approach is not available to users outside syscall,
because 'use' is unexported, and people also have to realize they need
to use it and do so. There is much existing code using syscall.Syscall
without a 'use'-like function. That code will fail very occasionally in
mysterious ways (see #13372).

This CL fixes all that existing code by making the compiler do the right
thing automatically, without any code modifications. That is, it takes h1
above, which is incorrect code today, and makes it correct code.

Specifically, if the compiler sees a foreign func definition (one
without a body) that has uintptr arguments, it marks those arguments
as "unsafe uintptrs". If it later sees the function being called
with uintptr(unsafe.Pointer(x)) as an argument, it arranges to mark x
as having escaped, and it makes sure to hold x in a live temporary
variable until the call returns, so that the garbage collector cannot
reclaim whatever heap memory x points to.

For now I am leaving the explicit calls to use in package syscall,
but they can be removed early in a future cycle (likely Go 1.7).

The rule has no effect on escape analysis, only on liveness analysis.

Fixes #13372.

Change-Id: I2addb83f70d08db08c64d394f9d06ff0a063c500
Reviewed-on: https://go-review.googlesource.com/18584
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agogo/types: rename Importer2 to ImporterFrom go1.6beta2
Brad Fitzpatrick [Wed, 13 Jan 2016 23:20:20 +0000 (23:20 +0000)]
go/types: rename Importer2 to ImporterFrom

Per https://groups.google.com/forum/#!topic/golang-dev/javNmryAh0I

Change-Id: I08d7cbc94da4fc61c848f3dbee4637bf8fcfeb01
Reviewed-on: https://go-review.googlesource.com/18630
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agoruntime: don't use CMOV for 386
Keith Randall [Wed, 13 Jan 2016 21:09:46 +0000 (13:09 -0800)]
runtime: don't use CMOV for 386

CMOVs were not introduced until P6.  We need 386 to run on
Pentium MMX.

Fixes #13923

Change-Id: Iee9572cd83e64c3a1336bc1e6b300b048fbcc996
Reviewed-on: https://go-review.googlesource.com/18621
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agonet/http: update bundled http2
Brad Fitzpatrick [Wed, 13 Jan 2016 22:14:40 +0000 (22:14 +0000)]
net/http: update bundled http2

Updates x/net/http2 to git rev 341cd08 for https://golang.org/cl/18576

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

9 years agonet/http: clarify ConnState StateActive docs for HTTP/2
Brad Fitzpatrick [Wed, 13 Jan 2016 19:36:51 +0000 (19:36 +0000)]
net/http: clarify ConnState StateActive docs for HTTP/2

Update #13925

Change-Id: I7cd0625fad841eb0e3f364629f9bc225aa2fdce9
Reviewed-on: https://go-review.googlesource.com/18575
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agogo/importer: fix field/method package for binary importer
Robert Griesemer [Wed, 13 Jan 2016 18:52:56 +0000 (10:52 -0800)]
go/importer: fix field/method package for binary importer

This is the equivalent of https://golang.org/cl/18549 for
the binary importer (which is usually not used because by
default the gc compiler produces the traditional textual
export format).

For #13898.

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

9 years agocmd/go: fix gccSupportsNoPie for old GCC's that don't exit 0
Ian Lance Taylor [Wed, 13 Jan 2016 18:45:54 +0000 (10:45 -0800)]
cmd/go: fix gccSupportsNoPie for old GCC's that don't exit 0

GCC 4.8 exits 1 on an unrecognized option, but GCC 4.4 and 4.5 exit 0.
I didn't check other versions, or try to figure out just when this
changed.

Fixes #13937.

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

9 years agogo/importer: revert incorrect change that slipped in prior CL
Robert Griesemer [Wed, 13 Jan 2016 18:41:37 +0000 (10:41 -0800)]
go/importer: revert incorrect change that slipped in prior CL

The package of anonymous fields is the package in which they were
declared, not the package of the anonymous field's type. Was correct
before and incorrectly changed with https://golang.org/cl/18549.

Change-Id: I9fd5bfbe9d0498c8733b6ca7b134a85defe16113
Reviewed-on: https://go-review.googlesource.com/18596
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agocmd/link: add LC_VERSION_MIN_MACOSX to linkmode=internal OS X binaries
Russ Cox [Wed, 13 Jan 2016 14:59:16 +0000 (09:59 -0500)]
cmd/link: add LC_VERSION_MIN_MACOSX to linkmode=internal OS X binaries

This makes lldb willing to debug them.
The minimum version is hard-coded at OS X 10.7,
because that is the minimum that Go requires.
For more control over the version, users can
use linkmode=external and pass the relevant flags to the host linker.

Fixes #12941.

Change-Id: I20027be8aa034d07dd2a3326828f75170afe905f
Reviewed-on: https://go-review.googlesource.com/18588
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: allow for C pointers between arena_start and arena_used in cgo check
Russ Cox [Wed, 13 Jan 2016 17:23:44 +0000 (12:23 -0500)]
runtime: allow for C pointers between arena_start and arena_used in cgo check

Fixes #13928.

Change-Id: Ia04c6bdef5ae6924d03982682ee195048f8f387f
Reviewed-on: https://go-review.googlesource.com/18611
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: arrange to show a few local variables when cgoCheckUnknownPointer panics
Russ Cox [Wed, 13 Jan 2016 17:45:52 +0000 (12:45 -0500)]
runtime: arrange to show a few local variables when cgoCheckUnknownPointer panics

For #13934.

Change-Id: Id399e35598def96f8bb89b9fcd1bf14ee06e2e62
Reviewed-on: https://go-review.googlesource.com/18612
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agogo/importer: associate exported field and interface methods with correct package
Robert Griesemer [Wed, 13 Jan 2016 01:02:32 +0000 (17:02 -0800)]
go/importer: associate exported field and interface methods with correct package

In gc export data, exported struct field and interface method names appear
in unqualified form (i.e., w/o package name). The (gc)importer assumed that
unqualified exported names automatically belong to the package being imported.
This is not the case if the field or method belongs to a struct or interface
that was declared in another package and re-exported.

The issue becomes visible if a type T (say an interface with a method M)
is declared in a package A, indirectly re-exported by a package B (which
imports A), and then imported in C. If C imports both A and B, if A is
imported before B, T.M gets associated with the correct package A. If B
is imported before A, T.M appears to be exported by B (even though T itself
is correctly marked as coming from A). If T.M is imported again via the
import of A if gets dropped (as it should) because it was imported already.

The fix is to pass down the parent package when we parse imported types
so that the importer can use the correct package when creating fields
and methods.

Fixes #13898.

Change-Id: I7ec2ee2dda15859c582b65db221c3841899776e1
Reviewed-on: https://go-review.googlesource.com/18549
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agocmd/go: -buildmode=c-shared should work on darwin/386
Joe Sylve [Mon, 11 Jan 2016 05:23:51 +0000 (23:23 -0600)]
cmd/go: -buildmode=c-shared should work on darwin/386

* Enable c-shared buildmode on darwin/386
* dyld does not support text relocation on i386. Add -read_only_relocs suppress flag to linker

Fixes #13904

Change-Id: I9adbd20d3f36ce9bbccf1bffb746b391780d088f
Reviewed-on: https://go-review.googlesource.com/18500
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: update bundled http2
Brad Fitzpatrick [Wed, 13 Jan 2016 17:53:57 +0000 (17:53 +0000)]
net/http: update bundled http2

Updates x/net/http2 to git rev c93a9b4f2a for https://golang.org/cl/18474

Forgot to submit this four days ago.

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

9 years agodatabase/sql/driver: clarify DefaultParameterConverter docs
Brad Fitzpatrick [Mon, 11 Jan 2016 19:54:29 +0000 (11:54 -0800)]
database/sql/driver: clarify DefaultParameterConverter docs

Fixes #11489

Change-Id: I887ebac2dcb772e73ee393891c487f694028aaf2
Reviewed-on: https://go-review.googlesource.com/18520
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: fix Transport crash when abandoning dial which upgrades protos
Brad Fitzpatrick [Wed, 13 Jan 2016 16:30:00 +0000 (16:30 +0000)]
net/http: fix Transport crash when abandoning dial which upgrades protos

When the Transport was creating an bound HTTP connection (protocol
unknown initially) and then ends up deciding it doesn't need it, a
goroutine sits around to clean up whatever the result was. That
goroutine made the false assumption that the result was always an
HTTP/1 connection or an error. It may also be an alternate protocol
in which case the *persistConn.conn net.Conn field is nil, and the
alt field is non-nil.

Fixes #13839

Change-Id: Ia4972e5eb1ad53fa00410b3466d4129c753e0871
Reviewed-on: https://go-review.googlesource.com/18573
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agodoc: document Go 1.5.3
Russ Cox [Wed, 13 Jan 2016 11:52:27 +0000 (06:52 -0500)]
doc: document Go 1.5.3

Change-Id: I9b4b76abfba66ff655aef55b43d9b4721aba604a
Reviewed-on: https://go-review.googlesource.com/18587
Reviewed-by: Chris Broadfoot <cbro@golang.org>
9 years agonet/http: reject non three digit status codes in ReadResponse
Emmanuel Odeke [Mon, 11 Jan 2016 06:20:06 +0000 (23:20 -0700)]
net/http: reject non three digit status codes in ReadResponse

Change-Id: If4a90c4017ef4b5c9f497cf117c8ad62b7e15c62
Reviewed-on: https://go-review.googlesource.com/18501
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: stop using fucomi* ops for 387 builds
Keith Randall [Tue, 12 Jan 2016 20:42:28 +0000 (12:42 -0800)]
cmd/compile: stop using fucomi* ops for 387 builds

The fucomi* opcodes were only introduced for the Pentium Pro.
They do not exist for an MMX Pentium.  Use the fucom* instructions
instead and move the condition codes from the fp flags register to
the integer flags register explicitly.

The use of fucomi* opcodes in ggen.go was introduced in 1.5 (CL 8738).
The bad ops were generated for 64-bit floating-point comparisons.

The use of fucomi* opcodes in gsubr.go dates back to at least 1.1.
The bad ops were generated for float{32,64} to uint64 conversions.

Fixes #13923

Change-Id: I5290599f5edea8abf8fb18036f44fa78bd1fc9e6
Reviewed-on: https://go-review.googlesource.com/18590
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: fixes for -compiler=gccgo -buildmode=c-shared
Ian Lance Taylor [Wed, 13 Jan 2016 05:24:49 +0000 (21:24 -0800)]
cmd/go: fixes for -compiler=gccgo -buildmode=c-shared

Install pkg.h rather than libpkg.h.

Link against -lc.

Fixes #13860.

Change-Id: I4e429426f8363712a5dbbd2655b9aab802ab2888
Reviewed-on: https://go-review.googlesource.com/18592
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/internal/obj/x86: add new instructions, cleanup.
Ilya Tocar [Wed, 13 Jan 2016 13:43:22 +0000 (16:43 +0300)]
cmd/internal/obj/x86: add new instructions, cleanup.

Add several instructions that were used via BYTE and use them.
Instructions added: PEXTRB, PEXTRD, PEXTRQ, PINSRB, XGETBV, POPCNT.

Change-Id: I5a80cd390dc01f3555dbbe856a475f74b5e6df65
Reviewed-on: https://go-review.googlesource.com/18593
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet: LookupAddr("127.0.0.1") is "localhost" not "localhost." on Plan 9 and Windows
Mikio Hara [Wed, 13 Jan 2016 12:04:10 +0000 (21:04 +0900)]
net: LookupAddr("127.0.0.1") is "localhost" not "localhost." on Plan 9 and Windows

This change applies the fix for #13564 to Plan 9 and Windows.
Also enables Lookup API test cases on builders.

Updates #13564.

Change-Id: I863f03c7cb6fbe58b3a55223bfa0ac5f9bf9c3df
Reviewed-on: https://go-review.googlesource.com/18559
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http2: update bundled http2
Brad Fitzpatrick [Wed, 13 Jan 2016 04:51:08 +0000 (20:51 -0800)]
net/http2: update bundled http2

Update bundled http2 to git rev 76365a4 for https://golang.org/issue/18571

Fixes golang/go#13924

Change-Id: Ibb48cd6935b35d9965df70fb8761be5986d79ffc
Reviewed-on: https://go-review.googlesource.com/18591
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocrypto/tls: don't block in Conn.Close if Writes are in-flight
Brad Fitzpatrick [Tue, 12 Jan 2016 21:15:51 +0000 (21:15 +0000)]
crypto/tls: don't block in Conn.Close if Writes are in-flight

Conn.Close sends an encrypted "close notify" to signal secure EOF.
But writing that involves acquiring mutexes (handshake mutex + the
c.out mutex) and writing to the network. But if the reason we're
calling Conn.Close is because the network is already being
problematic, then Close might block, waiting for one of those mutexes.

Instead of blocking, and instead of introducing new API (at least for
now), distinguish between a normal Close (one that sends a secure EOF)
and a resource-releasing destructor-style Close based on whether there
are existing Write calls in-flight.

Because io.Writer and io.Closer aren't defined with respect to
concurrent usage, a Close with active Writes is already undefined, and
should only be used during teardown after failures (e.g. deadlines or
cancelations by HTTP users). A normal user will do a Write then
serially do a Close, and things are unchanged for that case.

This should fix the leaked goroutines and hung net/http.Transport
requests when there are network errors while making TLS requests.

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

9 years agocmd/compile: better modeling of escape across loop levels
David Chase [Mon, 4 Jan 2016 21:44:20 +0000 (16:44 -0500)]
cmd/compile: better modeling of escape across loop levels

Brief background on "why heap allocate".  Things can be
forced to the heap for the following reasons:

1) address published, hence lifetime unknown.
2) size unknown/too large, cannot be stack allocated
3) multiplicity unknown/too large, cannot be stack allocated
4) reachable from heap (not necessarily published)

The bug here is a case of failing to enforce 4) when an
object Y was reachable from a heap allocation X forced
because of 3).  It was found in the case of a closure
allocated within a loop (X) and assigned to a variable
outside the loop (multiplicity unknown) where the closure
also captured a map (Y) declared outside the loop (reachable
from heap). Note the variable declared outside the loop (Y)
is not published, has known size, and known multiplicity
(one). The only reason for heap allocation is that it was
reached from a heap allocated item (X), but because that was
not forced by publication, it has to be tracked by loop
level, but escape-loop level was not tracked and thus a bug
results.

The fix is that when a heap allocation is newly discovered,
use its looplevel as the minimum loop level for downstream
escape flooding.

Every attempt to generalize this bug to X-in-loop-
references-Y-outside loop succeeded, so the fix was aimed
to be general.  Anywhere that loop level forces heap
allocation, the loop level is tracked.  This is not yet
tested for all possible X and Y, but it is correctness-
conservative and because it caused only one trivial
regression in the escape tests, it is probably also
performance-conservative.

The new test checks the following:
1) in the map case, that if fn escapes, so does the map.
2) in the map case, if fn does not escape, neither does the map.
3) in the &x case, that if fn escapes, so does &x.
4) in the &x case, if fn does not escape, neither does &x.

Fixes #13799.

Change-Id: Ie280bef2bb86ec869c7c206789d0b68f080c3fdb
Reviewed-on: https://go-review.googlesource.com/18234
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime/internal/atomic: use //go:noinline to prevent inlining, not assembly nop
Michael Hudson-Doyle [Mon, 11 Jan 2016 22:40:17 +0000 (11:40 +1300)]
runtime/internal/atomic: use //go:noinline to prevent inlining, not assembly nop

A bit cleanuppy for 1.6 maybe, but something I happened to notice.

Change-Id: I70f3b48445f4f527d67f7b202b6171195440b09f
Reviewed-on: https://go-review.googlesource.com/18550
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: make NumGoroutine and Stack agree not to include system goroutines
Russ Cox [Thu, 7 Jan 2016 02:16:01 +0000 (21:16 -0500)]
runtime: make NumGoroutine and Stack agree not to include system goroutines

[Repeat of CL 18343 with build fixes.]

Before, NumGoroutine counted system goroutines and Stack (usually) didn't show them,
which was inconsistent and confusing.

To resolve which way they should be consistent, it seems like

package main
import "runtime"
func main() { println(runtime.NumGoroutine()) }

should print 1 regardless of internal runtime details. Make it so.

Fixes #11706.

Change-Id: If26749fec06aa0ff84311f7941b88d140552e81d
Reviewed-on: https://go-review.googlesource.com/18432
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>

9 years agomath/big: fix Exp(x, x, x) for certain large x
Russ Cox [Mon, 11 Jan 2016 14:52:56 +0000 (09:52 -0500)]
math/big: fix Exp(x, x, x) for certain large x

Fixes #13907.

Change-Id: Ieaa5183f399b12a9177372212adf481c8f0b4a0d
Reviewed-on: https://go-review.googlesource.com/18491
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Vlad Krasnov <vlad@cloudflare.com>
Reviewed-by: Adam Langley <agl@golang.org>
9 years agocmd/cgo: document C.sizeof_T and zero-sized field restriction
Ian Lance Taylor [Tue, 12 Jan 2016 15:03:28 +0000 (07:03 -0800)]
cmd/cgo: document C.sizeof_T and zero-sized field restriction

Update #9401.
Update #11925.
Update #13919.

Change-Id: I52c679353693e8165b2972d4d3974ee8bb1207ef
Reviewed-on: https://go-review.googlesource.com/18542
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: support URLs without schemes in http.Redirect
Denys Honsiorovskyi [Wed, 2 Sep 2015 10:40:34 +0000 (13:40 +0300)]
net/http: support URLs without schemes in http.Redirect

Many browsers now support schemeless URLs in the Location headers
and also it is allowed in the draft HTTP/1.1 specification (see
http://stackoverflow.com/q/4831741#comment25926312_4831741), but
Go standard library lacks support for them.

This patch implements schemeless URLs support in http.Redirect().
Since url.Parse() correctly handles schemeless URLs, I've just added
an extra condition to verify URL's Host part in the absoulute/relative
check in the http.Redirect function.

Also I've moved oldpath variable initialization inside the block
of code where it is used.

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

9 years agoruntime: mark greyobject go:nowritebarrierrec
Austin Clements [Tue, 24 Nov 2015 19:03:58 +0000 (14:03 -0500)]
runtime: mark greyobject go:nowritebarrierrec

It would certainly be a mistake to invoke a write barrier while
greying an object.

Change-Id: I34445a15ab09655ea8a3628a507df56aea61e618
Reviewed-on: https://go-review.googlesource.com/18533
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime: remove out-of-date comment
Austin Clements [Mon, 11 Jan 2016 21:52:11 +0000 (16:52 -0500)]
runtime: remove out-of-date comment

It used to be the case that repeatedly getting one GC pointer and
enqueuing one GC pointer could cause contention on the work buffers as
each operation passed over the boundary of a work buffer. As of
b6c0934, we use a two buffer cache that prevents this sort of
contention.

Change-Id: I4f1111623f76df9c5493dd9124dec1e0bfaf53b7
Reviewed-on: https://go-review.googlesource.com/18532
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: fix incorrect comment
Austin Clements [Tue, 24 Nov 2015 18:52:28 +0000 (13:52 -0500)]
runtime: fix incorrect comment

This comment is probably a hold-over from when the heap bitmap was
interleaved and the shift was 0, 2, 4, or 6. Now the shift is 0, 1, 2,
or 3.

Change-Id: I096ec729e1ca31b708455c98b573dd961d16aaee
Reviewed-on: https://go-review.googlesource.com/18531
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agodoc: add Overview and other small edits to How To Write Go Code
Andrew Gerrand [Fri, 8 Jan 2016 01:06:45 +0000 (12:06 +1100)]
doc: add Overview and other small edits to How To Write Go Code

Fixes #9228

Change-Id: Ic4df4a39f6f363bdd6eb9228c8164e6e9dccee1b
Reviewed-on: https://go-review.googlesource.com/5561
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/go: pass -no-pie along with -Wl,-r to gcc when supported on linux
Michael Hudson-Doyle [Thu, 7 Jan 2016 23:57:02 +0000 (12:57 +1300)]
cmd/go: pass -no-pie along with -Wl,-r to gcc when supported on linux

Go fails to build on a system which has PIE enabled by default like this:

/usr/bin/ld: -r and -pie may not be used together
collect2: error: ld returned 1 exit status

The only system I know that has this property right now is Ubuntu Xenial
running on s390x, which is hardly the most accessible system, but it's planned
to enable this on amd64 soon too. The fix is to pass -no-pie along with -Wl,-r
to the compiler, but unfortunately that flag is very new as well. So this does
a test compile of a trivial file to see if the flag is supported.

Change-Id: I1345571142b7c3a96212e43297d19e84ec4a3d41
Reviewed-on: https://go-review.googlesource.com/18359
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet: disable sendfile on Solaris for now
Brad Fitzpatrick [Mon, 11 Jan 2016 20:27:37 +0000 (12:27 -0800)]
net: disable sendfile on Solaris for now

There are reports of corruption. Let's disable it for now (for Go 1.6,
especially) until we can investigate and fix properly.

Update #13892

Change-Id: I557275e5142fe616e8a4f89c00ffafb830eb3b78
Reviewed-on: https://go-review.googlesource.com/18540
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agoruntime: fix ppc64le cgocallback code
Ian Lance Taylor [Mon, 11 Jan 2016 19:18:23 +0000 (11:18 -0800)]
runtime: fix ppc64le cgocallback code

Change-Id: I5a4a842cab2173357e8d3e349011c0c2b63be4f9
Reviewed-on: https://go-review.googlesource.com/18512
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: return full error for first test to be built
Ian Lance Taylor [Mon, 11 Jan 2016 17:34:38 +0000 (09:34 -0800)]
runtime: return full error for first test to be built

Change-Id: I5a0206e8074f3a2790954c45a217922b7b3fe851
Reviewed-on: https://go-review.googlesource.com/18487
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agogo/types: slightly better doc strings
Robert Griesemer [Mon, 11 Jan 2016 18:59:36 +0000 (10:59 -0800)]
go/types: slightly better doc strings

Per suggestion from adonovan.

Change-Id: Icbb4d2f201590bc94672b8d8141b6e7901e11dc5
Reviewed-on: https://go-review.googlesource.com/18510
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agogo/importer: use correct path for path->package map
Robert Griesemer [Sat, 9 Jan 2016 01:56:50 +0000 (17:56 -0800)]
go/importer: use correct path for path->package map

In the presence of vendored packages, the path found in a package
declaration may not be the path at which the package imported from
srcDir was found. Use the correct package path.

Change-Id: I74496c3cdf82a5dbd6a5bd189bb3cd0ca103fd52
Reviewed-on: https://go-review.googlesource.com/18460
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agoruntime: fix arm/arm64/ppc64/mips64 to dropm when necessary
Ian Lance Taylor [Sat, 9 Jan 2016 00:56:02 +0000 (16:56 -0800)]
runtime: fix arm/arm64/ppc64/mips64 to dropm when necessary

Fixes #13881.

Change-Id: Idff77db381640184ddd2b65022133bb226168800
Reviewed-on: https://go-review.googlesource.com/18449
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

9 years agoruntime: eagerly share GC work buffers
Rick Hudson [Wed, 6 Jan 2016 22:07:58 +0000 (17:07 -0500)]
runtime: eagerly share GC work buffers

Currently, due to an oversight, we only balance work buffers
in background and idle workers and not in assists. As a
result, in assist-heavy workloads, assists are likely to tie
up large work buffers in per-P caches increasing the
likelihood that the global list will be empty. This increases
the likelihood that other GC workers will exit and assists
will block, slowing down the system as a whole. Fix this by
eagerly balancing work buffers as soon as the assists notice
that the global buffers are empty. This makes it much more
likely that work will be immediately available to other
workers and assists.

This change reduces the garbage benchmark time by 39% and
fixes the regresssion seen at CL 15893 golang.org/cl/15893.

Garbage benchmark times before and after this CL.
Before GOPERF-METRIC:time=4427020
After  GOPERF-METRIC:time=2721645

Fixes #13827

Change-Id: I9cb531fb873bab4b69ce9c1617e30df6c49cdcfe
Reviewed-on: https://go-review.googlesource.com/18341
Reviewed-by: Austin Clements <austin@google.com>
9 years agodoc: note GCM behaviour change in Go 1.6.
Adam Langley [Sun, 10 Jan 2016 03:10:33 +0000 (19:10 -0800)]
doc: note GCM behaviour change in Go 1.6.

This change documents the behaviour change caused by
https://go-review.googlesource.com/18480 in Go 1.6.

Updates #13886

Change-Id: I2daa08a62775bbc209f0f4cbeae21b8184ce7609
Reviewed-on: https://go-review.googlesource.com/18481
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocrypto/cipher: always zero dst buffer on GCM authentication failure.
Adam Langley [Sun, 10 Jan 2016 02:31:35 +0000 (18:31 -0800)]
crypto/cipher: always zero dst buffer on GCM authentication failure.

The AESNI GCM code decrypts and authenticates concurrently and so
overwrites the destination buffer even in the case of an authentication
failure.

This change updates the documentation to make that clear and also
mimics that behaviour in the generic code so that different platforms
act identically.

Fixes #13886

Change-Id: Idc54e51f01e27b0fc60c1745d50bb4c099d37e94
Reviewed-on: https://go-review.googlesource.com/18480
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/dist: restrict parallel tests to NumCPU on mips64x
Yao Zhang [Sun, 10 Jan 2016 03:22:58 +0000 (22:22 -0500)]
cmd/dist: restrict parallel tests to NumCPU on mips64x

mips64 builder and one machine of the mips64le builder has small amount
of memory. Since CL 18199, they have been running slowly, as more
processes were launched in running 'test' directory, and a lot of swap
were used. This CL brings all.bash from 5h back to 3h on Loongson 2E
with 512 MB memory.

Change-Id: I4a22e239a542a99ba5986753205d8cd1f4b3d3c6
Reviewed-on: https://go-review.googlesource.com/18483
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: update bundled http2
Brad Fitzpatrick [Sat, 9 Jan 2016 23:34:56 +0000 (15:34 -0800)]
net/http: update bundled http2

Updates http2 to x/net git rev 0e6d34ef942 for https://golang.org/cl/18472
which means we'll get to delete a ton of grpc-go code and just use the
standard library's HTTP client instead.

Also, the comments in this CL aren't entirely accurate it turns out.
RFC 2616 says:

"The Trailer header field can be used to indicate which header fields
are included in a trailer (see section 14.40)."

And 14.40:

"  An HTTP/1.1 message SHOULD include a Trailer header field in a
   message using chunked transfer-coding with a non-empty trailer. Doing
   so allows the recipient to know which header fields to expect in the
   trailer.

   If no Trailer header field is present, the trailer SHOULD NOT include
   any header fields. See section 3.6.1 for restrictions on the use of
   trailer fields in a "chunked" transfer-coding."

So it's really a SHOULD more than a MUST.

And gRPC (at least Google's server) doesn't predeclare "grpc-status"
ahead of time in a Trailer Header, so we'll be lenient. We were too
strict anyway. It's also not a concern for the Go client we have a
different place to populate the Trailers, and it won't confuse clients
which aren't looking for them. The ResponseWriter server side is more
complicated (and strict), though, since we don't want to widen the
ResponseWriter interface. So the Go server still requires that you
predeclare Trailers.

Change-Id: Ia2defc11a2469fb8570ecfabb8453537121084eb
Reviewed-on: https://go-review.googlesource.com/18473
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: don't remove Expect Request header in Server.
Harshavardhana [Sat, 9 Jan 2016 19:55:32 +0000 (11:55 -0800)]
net/http: don't remove Expect Request header in Server.

Fixes #13893

Change-Id: I2577b38fdb19299227dc146f707cf9df663dcdfc
Reviewed-on: https://go-review.googlesource.com/18471
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: improve ReadResponse test coverage
Emmanuel Odeke [Sun, 3 Jan 2016 14:32:52 +0000 (07:32 -0700)]
net/http: improve ReadResponse test coverage

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

9 years agonet: fix typo in lookup_windows getprotobyname
Matt Robenolt [Sat, 9 Jan 2016 06:22:59 +0000 (22:22 -0800)]
net: fix typo in lookup_windows getprotobyname

Change-Id: Ia6d40ead1e54dd0b8998370cbabc2d7cd8b7aa0b
Reviewed-on: https://go-review.googlesource.com/18470
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>