]> Cypherpunks repositories - gostls13.git/log
gostls13.git
8 years agodatabase/sql: deflake TestPendingConnsAfterErr and fix races, panics
Brad Fitzpatrick [Tue, 28 Jun 2016 19:06:08 +0000 (12:06 -0700)]
database/sql: deflake TestPendingConnsAfterErr and fix races, panics

TestPendingConnsAfterErr only cared that things didn't deadlock, so 5
seconds is a sufficient timer. We don't need 100 milliseconds.

I was able to reproduce with a tiny (5 nanosecond) timeout value,
instead of 100 milliseconds. In the process of testing with -race and
a high -count= value, I noticed several data races and panics
(sendings on a closed channel) which are also fixed in this change.

Fixes #15684

Change-Id: Ib4605fcc0f296e658cb948352ed642b801cb578c
Reviewed-on: https://go-review.googlesource.com/24550
Reviewed-by: Marko Tiikkaja <marko@joh.to>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agocmd/go: restore support for git submodules and update docs
Andrew Gerrand [Tue, 28 Jun 2016 08:09:56 +0000 (18:09 +1000)]
cmd/go: restore support for git submodules and update docs

Fixes #16165

Change-Id: Ic90e5873e0c8ee044f09543177192dcae1dcdbed
Reviewed-on: https://go-review.googlesource.com/24531
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agostrconv: clarify doc for Atoi return type
Justyn Temme [Sun, 19 Jun 2016 20:39:58 +0000 (20:39 +0000)]
strconv: clarify doc for Atoi return type

Change-Id: I47bd98509663d75b0d4dedbdb778e803d90053cf
Reviewed-on: https://go-review.googlesource.com/24216
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet/http: conditionally configure HTTP/2 in Server.Serve(Listener)
Brad Fitzpatrick [Mon, 27 Jun 2016 23:39:40 +0000 (16:39 -0700)]
net/http: conditionally configure HTTP/2 in Server.Serve(Listener)

Don't configure HTTP/2 in http.Server.Serve(net.Listener) if the
Server's TLSConfig is set and doesn't include the "h2" NextProto
value. This avoids mutating a *tls.Config already in use if
previously passed to tls.NewListener.

Also document this. (it's come up a few times now)

Fixes #15908

Change-Id: I283eed82fdb29a791f80d801aadd9f75db244de0
Reviewed-on: https://go-review.googlesource.com/24508
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agodoc: update 1.7 release notes on Unicode upgrade
Marcel van Lohuizen [Tue, 28 Jun 2016 15:47:27 +0000 (17:47 +0200)]
doc: update 1.7 release notes on Unicode upgrade

Fixes #16201

Change-Id: I38c17859db78c2868905da24217e0ad47739c320
Reviewed-on: https://go-review.googlesource.com/24541
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agodoc/go1.7.html: mention recent changes to Rand.Read
Joe Tsai [Tue, 28 Jun 2016 06:27:54 +0000 (23:27 -0700)]
doc/go1.7.html: mention recent changes to Rand.Read

Updates #16124

Change-Id: Ib58f2bb37fd1559efc512a2e3cba976f09b939a0
Reviewed-on: https://go-review.googlesource.com/24520
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agounicode: upgrade to version 9.0.0
Marcel van Lohuizen [Tue, 28 Jun 2016 10:31:02 +0000 (12:31 +0200)]
unicode: upgrade to version 9.0.0

Changes beyond generated tables:
- Now supports aliases to handle deprecated
  property classes.
- Some Mongolian letters are now modifiers.

Other changes:
- strconv: newly generated table to be in sync
- regexp/syntax: updated maxFold

Fixes #16191

Change-Id: I56bdf21ee2f775f2a82d0465b3772faf5c24cb61
Reviewed-on: https://go-review.googlesource.com/24496
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoreflect, runtime: optimize Name method
David Crawshaw [Tue, 28 Jun 2016 01:37:19 +0000 (21:37 -0400)]
reflect, runtime: optimize Name method

Several minor changes that remove a good chunk of the overhead added
to the reflect Name method over the 1.7 cycle, as seen from the
non-SSA architectures.

In particular, there are ~20 fewer instructions in reflect.name.name
on 386, and the method now qualifies for inlining.

The simple JSON decoding benchmark on darwin/386:

name           old time/op    new time/op    delta
CodeDecoder-8    49.2ms ± 0%    48.9ms ± 1%  -0.77%  (p=0.000 n=10+9)

name           old speed      new speed      delta
CodeDecoder-8  39.4MB/s ± 0%  39.7MB/s ± 1%  +0.77%  (p=0.000 n=10+9)

On darwin/amd64 the effect is less pronounced:

name           old time/op    new time/op    delta
CodeDecoder-8    38.9ms ± 0%    38.7ms ± 1%  -0.38%  (p=0.005 n=10+10)

name           old speed      new speed      delta
CodeDecoder-8  49.9MB/s ± 0%  50.1MB/s ± 1%  +0.38%  (p=0.006 n=10+10)

Counterintuitively, I get much more useful benchmark data out of my
MacBook Pro than a linux workstation with more expensive Intel chips.
While the laptop has fewer cores and an active GUI, the single-threaded
performance is significantly better (nearly 1.5x decoding throughput)
so the differences are more pronounced.

For #16117.

Change-Id: I4e0cc1cc2d271d47d5127b1ee1ca926faf34cabf
Reviewed-on: https://go-review.googlesource.com/24510
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoruntime/internal/atomic: Use power5 compatible instructions for ppc64
Lynn Boger [Thu, 16 Jun 2016 19:57:45 +0000 (14:57 -0500)]
runtime/internal/atomic: Use power5 compatible instructions for ppc64

This modifies a recent performance improvement to the
And8 and Or8 atomic functions which required both ppc64le
and ppc64 to use power8 instructions. Since then it was
decided that ppc64 (BE) should work for power5 and later.
This change uses instructions compatible with power5 for
ppc64 and uses power8 for ppc64le.

Fixes #16004

Change-Id: I623c75e8e6fd1fa063a53d250d86cdc9d0890dc7
Reviewed-on: https://go-review.googlesource.com/24181
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agonet/http/pprof: remove comments pointing to gperftools
Raul Silvera [Tue, 28 Jun 2016 02:06:17 +0000 (19:06 -0700)]
net/http/pprof: remove comments pointing to gperftools

The version of pprof in gperftools has been deprecated.
No need to have a pointer to that version since go tool pprof
is included with the Go distro.

Change-Id: I6d769a68f64280f5db89ff6fbc67bfea9c8f1526
Reviewed-on: https://go-review.googlesource.com/24509
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoencoding/gob: avoid allocating string for map key
David Crawshaw [Mon, 27 Jun 2016 15:07:08 +0000 (11:07 -0400)]
encoding/gob: avoid allocating string for map key

On linux/386 compared to tip:

name                     old time/op  new time/op  delta
DecodeInterfaceSlice-40  1.23ms ± 1%  1.17ms ± 1%  -4.93%  (p=0.000 n=9+10)

Recovers about half the performance regression from Go 1.6 on 386.

For #16117.

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

8 years agomath/rand: fix io.Reader implementation
Dmitri Popov [Mon, 20 Jun 2016 03:58:40 +0000 (20:58 -0700)]
math/rand: fix io.Reader implementation

Do not throw away the rest of Int63 value used for
generation random bytes. Save it in Rand struct and
re-use during the next Read call.

Fixes #16124

Change-Id: Ic70bd80c3c3a6590e60ac615e8b3c2324589bea3
Reviewed-on: https://go-review.googlesource.com/24251
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocompress/flate: don't ignore dict in Reader.Reset
Vladimir Mihailenco [Thu, 23 Jun 2016 07:42:22 +0000 (07:42 +0000)]
compress/flate: don't ignore dict in Reader.Reset

Fixes #16162.

Change-Id: I6f4ae906630079ef5fc29ee5f70e2e3d1c962170
Reviewed-on: https://go-review.googlesource.com/24390
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocrypto/tls: don't copy Mutex or Once values
Ian Lance Taylor [Tue, 21 Jun 2016 14:00:41 +0000 (07:00 -0700)]
crypto/tls: don't copy Mutex or Once values

This fixes some 40 warnings from go vet.

Fixes #16134.

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

8 years agonet/http/httptest: show usage of httptest.NewRequest in example
Konstantin Shaposhnikov [Sat, 25 Jun 2016 12:32:40 +0000 (20:32 +0800)]
net/http/httptest: show usage of httptest.NewRequest in example

Change ExampleResponseRecorder to use httptest.NewRequest instead of
http.NewRequest. This makes the example shorter and shows how to use
one more function from the httptest package.

Change-Id: I3d35869bd0a4daf1c7551b649428bb2f2a45eba2
Reviewed-on: https://go-review.googlesource.com/24480
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet/http: reject faux HTTP/0.9 and HTTP/2+ requests
Brad Fitzpatrick [Mon, 27 Jun 2016 17:28:08 +0000 (10:28 -0700)]
net/http: reject faux HTTP/0.9 and HTTP/2+ requests

Fixes #16197

Change-Id: Icaabacbb22bc18c52b9e04b47385ac5325fcccd1
Reviewed-on: https://go-review.googlesource.com/24505
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/compile: avoid function literal name collision with "glob"
Ian Lance Taylor [Mon, 27 Jun 2016 15:21:55 +0000 (08:21 -0700)]
cmd/compile: avoid function literal name collision with "glob"

The compiler was treating all global function literals as occurring in a
function named "glob", which caused a symbol name collision when there
was an actual function named "glob".  Fixed by adding a period.

Fixes #16193.

Change-Id: I67792901a8ca04635ba41d172bfaee99944f594d
Reviewed-on: https://go-review.googlesource.com/24500
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
8 years agoruntime/pprof: update comments to point to new pprof
Raul Silvera [Mon, 27 Jun 2016 16:43:14 +0000 (09:43 -0700)]
runtime/pprof: update comments to point to new pprof

In the comments for this file there is a reference to gperftools
for more info on pprof. pprof now live on its own repo on github,
and the version in gperftools is deprecated.

Change-Id: I8a188f129534f73edd132ef4e5a2d566e69df7e9
Reviewed-on: https://go-review.googlesource.com/24502
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/compile: keep heap pointer for escaping output parameters live
Keith Randall [Sun, 19 Jun 2016 02:40:57 +0000 (19:40 -0700)]
cmd/compile: keep heap pointer for escaping output parameters live

Make sure the pointer to the heap copy of an output parameter is kept
live throughout the function.  The function could panic at any point,
and then a defer could recover.  Thus, we need the pointer to the heap
copy always available so the post-deferreturn code can copy the return
value back to the stack.

Before this CL, the pointer to the heap copy could be considered dead in
certain situations, like code which is reverse dominated by a panic call.

Fixes #16095.

Change-Id: Ic3800423e563670e5b567b473bf4c84cddb49a4c
Reviewed-on: https://go-review.googlesource.com/24213
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 years agocmd/vet: fix name check for examples in _test package
Konstantin Shaposhnikov [Mon, 27 Jun 2016 05:37:01 +0000 (13:37 +0800)]
cmd/vet: fix name check for examples in _test package

This fixes the obvious bug and makes go vet look for identifiers in foo
package when checking example names in foo_test package.

Note that for this check to work the foo package have to be
installed (using go install).

This commit however doesn't fix TestDivergentPackagesExamples test that
is not implemented correctly and passes only by chance.

Updates #16189

Change-Id: I5c2f675cd07e5b66cf0432b2b3e422ab45c3dedd
Reviewed-on: https://go-review.googlesource.com/24487
Reviewed-by: Dmitri Shuralyov <shurcool@gmail.com>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
8 years agoencoding/json: copy-on-write cacheTypeFields
David Crawshaw [Sat, 25 Jun 2016 14:23:30 +0000 (10:23 -0400)]
encoding/json: copy-on-write cacheTypeFields

Swtich from a sync.RWMutex to atomic.Value for cacheTypeFields.

On GOARCH=386, this recovers most of the remaining performance
difference from the 1.6 release. Compared with tip on linux/386:

name            old time/op    new time/op    delta
CodeDecoder-40    92.8ms ± 1%    87.7ms ± 1%  -5.50%  (p=0.000 n=10+10)

name            old speed      new speed      delta
CodeDecoder-40  20.9MB/s ± 1%  22.1MB/s ± 1%  +5.83%  (p=0.000 n=10+10)

With more time and care, I believe more of the JSON decoder's work
could be shifted so it is done before decoding, and independent of
the number of bytes processed. Maybe someone could explore that for
Go 1.8.

For #16117.

Change-Id: I049655b2e5b76384a0d5f4b90e3ec7cc8d8c4340
Reviewed-on: https://go-review.googlesource.com/24472
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agomath/rand: fix comment about bits of seed used by the default Source
Konstantin Shaposhnikov [Thu, 26 May 2016 01:45:57 +0000 (09:45 +0800)]
math/rand: fix comment about bits of seed used by the default Source

Fixes #15788

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

8 years agocmd/pprof: don't use local symbolization for remote source
Ian Lance Taylor [Fri, 24 Jun 2016 23:59:39 +0000 (16:59 -0700)]
cmd/pprof: don't use local symbolization for remote source

If we are using a remote source (a URL), and the user did not specify
the executable file to use, then don't try to use a local source.
This was misbehaving because the local symbolizer will not fail
if there is any memory map available, but the presence of a memory map
does not ensure that the files and symbols are actually available.

We still need a pprof testsuite.

Fixes #16159.

Change-Id: I0250082a4d5181c7babc7eeec6bc95b2f3bcaec9
Reviewed-on: https://go-review.googlesource.com/24464
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/pprof: ignore symbols with address 0 and size 0
Ian Lance Taylor [Fri, 24 Jun 2016 20:19:46 +0000 (13:19 -0700)]
cmd/pprof: ignore symbols with address 0 and size 0

Handling a symbol with address 0 and size 0, such as an ELF STT_FILE
symbols, was causing us to disassemble the entire program.  We started
adding STT_FILE symbols to help fix issue #13247.

Fixes #16154.

Change-Id: I174b9614e66ddc3d65801f7c1af7650f291ac2af
Reviewed-on: https://go-review.googlesource.com/24460
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
8 years agomath/big: special-case a 0 mantissa during Rat parsing
Nathan VanBenschoten [Thu, 23 Jun 2016 23:46:13 +0000 (19:46 -0400)]
math/big: special-case a 0 mantissa during Rat parsing

Previously, a 0 mantissa was special-cased during big.Float
parsing, but not during big.Rat parsing. This meant that a value
like 0e9999999999 would parse successfully in big.Float.SetString,
but would hang in big.Rat.SetString. This discrepancy became an
issue in https://golang.org/src/go/constant/value.go?#L250,
where the big.Float would report an exponent of 0, so
big.Rat.SetString would be used and would subsequently hang.

A Go Playground example of this is https://play.golang.org/p/3fy28eUJuF

The solution is to special-case a zero mantissa during big.Rat
parsing as well, so that neither big.Rat nor big.Float will hang when
parsing a value with 0 mantissa but a large exponent.

This was discovered using go-fuzz on CockroachDB:
https://github.com/cockroachdb/go-fuzz/blob/master/examples/parser/main.go

Fixes #16176

Change-Id: I775558a8682adbeba1cc9d20ba10f8ed26259c56
Reviewed-on: https://go-review.googlesource.com/24430
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/compile, etc: use tflag to optimize Name()==""
David Crawshaw [Fri, 24 Jun 2016 19:28:58 +0000 (15:28 -0400)]
cmd/compile, etc: use tflag to optimize Name()==""

Improves JSON decoding benchmark:

name                  old time/op    new time/op    delta
CodeDecoder-8           41.3ms ± 6%    39.8ms ± 1%  -3.61%  (p=0.000 n=10+10)

name                  old speed      new speed      delta
CodeDecoder-8         47.0MB/s ± 6%  48.7MB/s ± 1%  +3.66%  (p=0.000 n=10+10)

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

8 years agotime: update documentation for Duration.String regarding the zero value
Rob Pike [Thu, 23 Jun 2016 22:28:36 +0000 (15:28 -0700)]
time: update documentation for Duration.String regarding the zero value

It was out of date; in 1.7 the format changes to 0s.

Change-Id: I2013a1b0951afc5607828f313641b51c74433257
Reviewed-on: https://go-review.googlesource.com/24421
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocontext: update documentation on cancelation and go vet check.
Sameer Ajmani [Fri, 24 Jun 2016 14:48:06 +0000 (10:48 -0400)]
context: update documentation on cancelation and go vet check.

Also replace double spaces after periods with single spaces.

Change-Id: Iedaea47595c5ce64e7e8aa3a368f36d49061c555
Reviewed-on: https://go-review.googlesource.com/24431
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoreflect: avoid lock for some NumMethod()==0 cases
David Crawshaw [Fri, 24 Jun 2016 15:09:48 +0000 (11:09 -0400)]
reflect: avoid lock for some NumMethod()==0 cases

The encoding/json package uses NumMethod()==0 as a fast check for
interface satisfaction. In the case when a type has no methods at
all, we don't need to grab the RWMutex.

Improves JSON decoding benchmark on linux/amd64:

name           old time/op    new time/op    delta
CodeDecoder-8    44.2ms ± 2%    40.6ms ± 1%  -8.11%  (p=0.000 n=10+10)

name           old speed      new speed      delta
CodeDecoder-8  43.9MB/s ± 2%  47.8MB/s ± 1%  +8.82%  (p=0.000 n=10+10)

For #16117

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

8 years agoA+C: automated updates
Brad Fitzpatrick [Thu, 23 Jun 2016 20:51:39 +0000 (20:51 +0000)]
A+C: automated updates

Add Aaron Zinman (corporate CLA for Empirical Interfaces Inc.)
Add Ayanamist Yang (individual CLA)
Add Christian Couder (individual CLA)
Add Eric Engestrom (individual CLA)
Add Filippo Valsorda (individual CLA)
Add Gyu-Ho Lee (individual CLA)
Add H. İbrahim Güngör (individual CLA)
Add Jacob Hoffman-Andrews (individual CLA)
Add Jason Barnett (individual CLA)
Add Joe Farrell (individual CLA)
Add Julian Kornberger (individual CLA)
Add Kris Rousey (corporate CLA for Google Inc.)
Add Miguel Mendez (individual CLA)
Add Nic Day (individual CLA)
Add Paulo Casaretto (individual CLA)
Add Philip Børgesen (individual CLA)
Add Quan Tran (individual CLA)
Add Sai Cheemalapati (corporate CLA for Google Inc.)
Add Sasha Sobol (individual CLA)
Add Seth Vargo (individual CLA)
Add Simon Thulbourn (individual CLA)
Add Wisdom Omuya (individual CLA)

Updates #12042

Change-Id: Ie8ab5e3500ee62000c0b176d4d71340446e72ab7
Reviewed-on: https://go-review.googlesource.com/24420
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoreflect: optimize (reflect.Type).Name
David Crawshaw [Thu, 23 Jun 2016 17:32:50 +0000 (13:32 -0400)]
reflect: optimize (reflect.Type).Name

Improves JSON decoding on linux/amd64.

name                   old time/op    new time/op    delta
CodeUnmarshal-40         89.3ms ± 2%    86.3ms ± 2%  -3.31%  (p=0.000 n=22+22)

name                   old speed      new speed      delta
CodeUnmarshal-40       21.7MB/s ± 2%  22.5MB/s ± 2%  +3.44%  (p=0.000 n=22+22)

Updates #16117

Change-Id: I52acf31d7729400cfe6693e46292d41e1addba3d
Reviewed-on: https://go-review.googlesource.com/24410
Run-TryBot: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/compile, etc: bring back ptrToThis
David Crawshaw [Thu, 23 Jun 2016 14:59:38 +0000 (10:59 -0400)]
cmd/compile, etc: bring back ptrToThis

This was removed in CL 19695 but it slows down reflect.New, which ends
up on the hot path of things like JSON decoding.

There is no immediate cost in binary size, but it will make it harder to
further shrink run time type information in Go 1.8.

Before

BenchmarkNew-40         30000000                36.3 ns/op

After

BenchmarkNew-40         50000000                29.5 ns/op

Fixes #16161
Updates #16117

Change-Id: If7cb7f3e745d44678f3f5cf3a5338c59847529d2
Reviewed-on: https://go-review.googlesource.com/24400
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agotesting: document that logs are dumped to standard output
Ian Lance Taylor [Tue, 21 Jun 2016 22:17:56 +0000 (15:17 -0700)]
testing: document that logs are dumped to standard output

Since at least 1.0.3, the testing package has said that logs are dumped
to standard error, but has in fact dumped the logs to standard output.
We could change to dump to standard error, but after doing it this way
for so long I think it's better to change the docs.

Fixes #16138.

Change-Id: If39c7ce91f51c7113f33ebabfb8f84fd4611b9e1
Reviewed-on: https://go-review.googlesource.com/24311
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agohtml/template: update security model link
Ian Lance Taylor [Wed, 22 Jun 2016 16:47:42 +0000 (09:47 -0700)]
html/template: update security model link

Fixes #16148.

Change-Id: Ifab773e986b768602476824d005eea9200761236
Reviewed-on: https://go-review.googlesource.com/24327
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agocmd/yacc: error rather than panic when TEMPSIZE is too small
Ian Lance Taylor [Wed, 22 Jun 2016 13:27:31 +0000 (06:27 -0700)]
cmd/yacc: error rather than panic when TEMPSIZE is too small

I tried simply increasing the size of the slice but then I got an error
because NSTATES was too small. Leaving a real fix for after 1.7.

Update #16144.

Change-Id: I8676772cb79845dd4ca1619977d4d54a2ce6de59
Reviewed-on: https://go-review.googlesource.com/24321
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agocmd/objdump: fix disassembly suffixes
Keith Randall [Wed, 1 Jun 2016 21:18:00 +0000 (14:18 -0700)]
cmd/objdump: fix disassembly suffixes

MOVB $1, (AX) was being disassembled as MOVL $1, (AX).

Use the memory size to override the standard size.
Fix the tests.

Fixes #15922

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

8 years agoCONTRIBUTORS: add people who contributed to s390x port (IBM CLA)
Michael Munday [Fri, 17 Jun 2016 20:09:15 +0000 (16:09 -0400)]
CONTRIBUTORS: add people who contributed to s390x port (IBM CLA)

Add Bill O'Farrell (corporate CLA for IBM)
Add Karan Dhiman (corporate CLA for IBM)
Add Sam Ding (corporate CLA for IBM)
Add Tristan Amini (corporate CLA for IBM)
Add Yu Heng Zhang (corporate CLA for IBM)
Add Yu Xuan Zhang (corporate CLA for IBM)

Change-Id: I9ab15e33954afc2c208fc2e420a72c5a4d865f9b
Reviewed-on: https://go-review.googlesource.com/24350
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/vet/internal/cfg: don't crash on malformed goto statement
Alan Donovan [Wed, 22 Jun 2016 14:41:30 +0000 (10:41 -0400)]
cmd/vet/internal/cfg: don't crash on malformed goto statement

Change-Id: Ib285c02e240f02e9d5511bd448163ec1d4e75516
Reviewed-on: https://go-review.googlesource.com/24323
Reviewed-by: Rob Pike <r@golang.org>
8 years agocmd/vet: fix a crash in lostcancel check
Alan Donovan [Wed, 22 Jun 2016 14:40:30 +0000 (10:40 -0400)]
cmd/vet: fix a crash in lostcancel check

Fixes issue 16143

Change-Id: Id9d257aee54d31fbf0d478cb07339729cd9712c0
Reviewed-on: https://go-review.googlesource.com/24325
Reviewed-by: Rob Pike <r@golang.org>
8 years agocmd/compile: fix error msg mentioning different packages with same name
Robert Griesemer [Tue, 21 Jun 2016 21:27:40 +0000 (14:27 -0700)]
cmd/compile: fix error msg mentioning different packages with same name

This is a regression from 1.6. The respective code in importimport
(export.go) was not exactly replicated with the new importer. Also
copied over the missing cyclic import check.

Added test cases.

Fixes #16133.

Change-Id: I1e0a39ff1275ca62a8054874294d400ed83fb26a
Reviewed-on: https://go-review.googlesource.com/24312
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>

8 years agotest: add -s flag to commands understood by run.go
Robert Griesemer [Tue, 21 Jun 2016 22:33:04 +0000 (15:33 -0700)]
test: add -s flag to commands understood by run.go

If -s is specified, each file is considered a separate
package even if multiple files have the same package names.

For instance, the action and flag "errorcheckdir -s"
will compile all files in the respective directory as
individual packages.

Change-Id: Ic5c2f9e915a669433f66c2d3fe0ac068227a502f
Reviewed-on: https://go-review.googlesource.com/24313
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agodoc: describe vet -lostcancel in go1.7 release notes
Alan Donovan [Tue, 21 Jun 2016 15:11:50 +0000 (11:11 -0400)]
doc: describe vet -lostcancel in go1.7 release notes

Change-Id: Ie1c95fd0869307551bfcf76bf45c13372723fbba
Reviewed-on: https://go-review.googlesource.com/24288
Reviewed-by: Rob Pike <r@golang.org>
8 years agocmd/vet: -lostcancel: check for discarded result of context.WithCancel
Alan Donovan [Wed, 15 Jun 2016 03:50:39 +0000 (23:50 -0400)]
cmd/vet: -lostcancel: check for discarded result of context.WithCancel

The cfg subpackage builds a control flow graph of ast.Nodes.
The lostcancel module checks this graph to find paths, from a call to
WithCancel to a return statement, on which the cancel variable is
not used.  (A trivial case is simply assigning the cancel result to
the blank identifier.)

In a sample of 50,000 source files, the new check found 2068 blank
assignments and 118 return-before-cancel errors.  I manually inspected
20 of the latter and didn't find a single false positive among them.

Change-Id: I84cd49445f9f8d04908b04881eb1496a96611205
Reviewed-on: https://go-review.googlesource.com/24150
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
8 years agocmd/cgo: error, not panic, if not enough arguments to function
qeed [Tue, 21 Jun 2016 01:11:53 +0000 (21:11 -0400)]
cmd/cgo: error, not panic, if not enough arguments to function

Fixes #16116.

Change-Id: Ic3cb0b95382bb683368743bda49b4eb5fdcc35c0
Reviewed-on: https://go-review.googlesource.com/24286
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agotext/template: clarify the default formatting used for values
Rob Pike [Mon, 20 Jun 2016 22:39:03 +0000 (15:39 -0700)]
text/template: clarify the default formatting used for values

Fixes #16105.

Change-Id: I94467f2adf861eb38f3119ad30d46a87456d5305
Reviewed-on: https://go-review.googlesource.com/24281
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agocmd/pprof: don't use offset if we don't have a start address
Ian Lance Taylor [Mon, 20 Jun 2016 21:00:58 +0000 (14:00 -0700)]
cmd/pprof: don't use offset if we don't have a start address

The test is in the runtime package because there are other tests of
pprof there. At some point we should probably move them all into a pprof
testsuite.

Fixes #16128.

Change-Id: Ieefa40c61cf3edde11fe0cf04da1debfd8b3d7c0
Reviewed-on: https://go-review.googlesource.com/24274
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agoruntime: panic with the right error on iface conversion
Ian Lance Taylor [Mon, 20 Jun 2016 22:53:11 +0000 (15:53 -0700)]
runtime: panic with the right error on iface conversion

A straight conversion from a type T to an interface type I, where T does
not implement I, should always panic with an interface conversion error
that shows the missing method.  This was not happening if the conversion
was done once using the comma-ok form (the result would not be OK) and
then again in a straight conversion.  Due to an error in the runtime
package the second conversion was failing with a nil pointer
dereference.

Fixes #16130.

Change-Id: I8b9fca0f1bb635a6181b8b76de8c2385bb7ac2d2
Reviewed-on: https://go-review.googlesource.com/24284
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michel Lespinasse <walken@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
8 years agoruntime: set PPROF_TMPDIR before running pprof
Ian Lance Taylor [Mon, 20 Jun 2016 16:16:17 +0000 (09:16 -0700)]
runtime: set PPROF_TMPDIR before running pprof

Fixes #16121.

Change-Id: I7b838fb6fb9f098e6c348d67379fdc81fb0d69a4
Reviewed-on: https://go-review.googlesource.com/24270
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
8 years agocmd/go: for generate, use build context values for GOOS/GOARCH
Andrew Gerrand [Mon, 20 Jun 2016 03:30:04 +0000 (13:30 +1000)]
cmd/go: for generate, use build context values for GOOS/GOARCH

Fixes #16120

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

8 years agotest: add missing copyright notice
Ian Lance Taylor [Mon, 20 Jun 2016 22:43:21 +0000 (15:43 -0700)]
test: add missing copyright notice

Change-Id: I2a5353203ca2958fa37fc7a5ea3f22ad4fc62b0e
Reviewed-on: https://go-review.googlesource.com/24282
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 years agodoc: update architectures on source install instructions
Andrew Gerrand [Mon, 20 Jun 2016 05:33:52 +0000 (15:33 +1000)]
doc: update architectures on source install instructions

Fixes #16099

Change-Id: I334c1f04dfc98c4a07e33745819d890b5fcb1673
Reviewed-on: https://go-review.googlesource.com/24243
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
8 years agodoc/go1.7.html: don't mention obsolete RFC
Mikio Hara [Mon, 20 Jun 2016 01:40:07 +0000 (10:40 +0900)]
doc/go1.7.html: don't mention obsolete RFC

Change-Id: Ia978c10a97e4c24fd7cf1fa4a7c3bd886d20bbf8
Reviewed-on: https://go-review.googlesource.com/24241
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agodoc/go1.7.html: net/http RFC 2616 conformation + timeoutHandler on empty body
Emmanuel Odeke [Mon, 20 Jun 2016 00:30:29 +0000 (17:30 -0700)]
doc/go1.7.html: net/http RFC 2616 conformation + timeoutHandler on empty body

- Mention RFC 2616 conformation in which the server now only sends one
"Transfer-Encoding" header when "chunked" is explicitly set.
- Mention that a timeout handler now sends a 200 status code on
encountering an empty response body instead of sending back 0.

Change-Id: Id45e2867390f7e679ab40d7a66db1f7b9d92ce17
Reviewed-on: https://go-review.googlesource.com/24250
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agodebug/pe: handle files with no string table
Alex Brainman [Fri, 17 Jun 2016 04:05:35 +0000 (14:05 +1000)]
debug/pe: handle files with no string table

pecoff.doc (https://goo.gl/ayvckk) in section 5.6 says:

Immediately following the COFF symbol table is the COFF string table.
The position of this table is found by taking the symbol table address
in the COFF header, and adding the number of symbols multiplied by
the size of a symbol.

So it is unclear what to do when symbol table address is 0.
Lets assume executable does not have any string table.

Added new test with executable with no symbol table. The

gcc -s testdata\hello.c -o testdata\gcc-386-mingw-no-symbols-exec.

command was used to generate the executable.

Fixes #16084

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

8 years agocmd/compile: use power5 instructions for uint64 to float casts
Michael Munday [Thu, 16 Jun 2016 22:12:48 +0000 (18:12 -0400)]
cmd/compile: use power5 instructions for uint64 to float casts

Use the same technique as mips64 for these casts (CL 22835).

We could use the FCFIDU instruction for ppc64le however it seems
better to keep it the same as ppc64 for now.

Updates #15539, updates #16004.

Change-Id: I550680e485327568bf3238c4615a6cc8de6438d7
Reviewed-on: https://go-review.googlesource.com/24191
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: eliminate poisonStack checks
Austin Clements [Fri, 17 Jun 2016 15:07:56 +0000 (11:07 -0400)]
runtime: eliminate poisonStack checks

We haven't used poisonStack since we switched to 1-bit stack maps
(4d0f3a1), but the checks are still there. However, nothing prevents
us from genuinely allocating an object at this address on 32-bit and
causing the runtime to crash claiming that it's found a bad pointer.

Since we're not using poisonStack anyway, just pull it out.

Fixes #15831.

Change-Id: Ia6ef604675b8433f75045e369f5acd4644a5bb38
Reviewed-on: https://go-review.googlesource.com/24211
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
8 years agoruntime: fix stale comment in lfstack go1.7beta2
Austin Clements [Thu, 16 Jun 2016 19:41:33 +0000 (15:41 -0400)]
runtime: fix stale comment in lfstack

Change-Id: I6ef08f6078190dc9df0b2df4f26a76456602f5e8
Reviewed-on: https://go-review.googlesource.com/24176
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agocmd/dist: make zosarch.go deterministic
Austin Clements [Thu, 16 Jun 2016 18:38:33 +0000 (14:38 -0400)]
cmd/dist: make zosarch.go deterministic

Currently zosarch.go is written out in non-deterministic map order.
Sort the keys and write it out in sorted order to make the generated
file contents deterministic.

Change-Id: Id490f0e8665a2c619c5a7a00a30f4fc64f333258
Reviewed-on: https://go-review.googlesource.com/24174
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agointernal/trace: err if binary is not supplied for old trace
Hana Kim [Wed, 15 Jun 2016 16:53:05 +0000 (12:53 -0400)]
internal/trace: err if binary is not supplied for old trace

Change-Id: Id25c90993c4cbb7449d7031301b6d214a67d7633
Reviewed-on: https://go-review.googlesource.com/24134
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: remove useless loop from CgoCCodeSIGPROF test program
Ian Lance Taylor [Wed, 15 Jun 2016 17:36:48 +0000 (10:36 -0700)]
runtime: remove useless loop from CgoCCodeSIGPROF test program

I verified that the test fails if I undo the change that it tests for.

Updates #14732.

Change-Id: Ib30352580236adefae946450ddd6cd65a62b7cdf
Reviewed-on: https://go-review.googlesource.com/24151
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
8 years agogo/ast: fix comments misinterpreted as documentation
Matthew Dempsky [Wed, 15 Jun 2016 19:33:47 +0000 (12:33 -0700)]
go/ast: fix comments misinterpreted as documentation

The comments describing blocks of Pos/End implementations for various
nodes types are being misinterpreted as documentation for BadDecl,
BadExpr, BadStmt, and ImportSpec's Pos methods.

Change-Id: I935b0bc38dbc13e9305f3efeb437dd3a6575d9a1
Reviewed-on: https://go-review.googlesource.com/24152
Reviewed-by: Robert Griesemer <gri@golang.org>
8 years agoruntime: if the test program hangs, try to get a stack trace
Ian Lance Taylor [Tue, 14 Jun 2016 21:38:22 +0000 (14:38 -0700)]
runtime: if the test program hangs, try to get a stack trace

This is an attempt to get more information for #14809, which seems to
occur rarely.

Updates #14809.

Change-Id: Idbeb136ceb57993644e03266622eb699d2685d02
Reviewed-on: https://go-review.googlesource.com/24110
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Austin Clements <austin@google.com>
8 years agosyscall: skip TestUnshare if kernel does not support net namespace
Cherry Zhang [Tue, 14 Jun 2016 19:33:15 +0000 (15:33 -0400)]
syscall: skip TestUnshare if kernel does not support net namespace

Fixes #16056.

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

8 years agonet/http: pass through server side Transfer-Encoding headers
Andrew Gerrand [Wed, 15 Jun 2016 00:52:42 +0000 (10:52 +1000)]
net/http: pass through server side Transfer-Encoding headers

Fixes #16063

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

8 years agocontext: document how to release resources associated with Contexts.
Sameer Ajmani [Tue, 14 Jun 2016 20:48:42 +0000 (16:48 -0400)]
context: document how to release resources associated with Contexts.

Some users don't realize that creating a Context with a CancelFunc
attaches a subtree to the parent, and that that subtree is not released
until the CancelFunc is called or the parent is canceled.  Make this
clear early in the package docs, so that people learning about this
package have the right conceptual model.

Change-Id: I7c77a546c19c3751dd1f3a5bc827ad106dd1afbf
Reviewed-on: https://go-review.googlesource.com/24090
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet: don't run TestLookupDotsWithLocalSource in short mode
Ian Lance Taylor [Tue, 14 Jun 2016 22:32:39 +0000 (15:32 -0700)]
net: don't run TestLookupDotsWithLocalSource in short mode

Do run it on the builders, though.

Fixes #15881.

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

8 years agoos: fix blockUntilWaitable on freebsd/{386,arm}
Mikio Hara [Tue, 14 Jun 2016 16:09:51 +0000 (01:09 +0900)]
os: fix blockUntilWaitable on freebsd/{386,arm}

The previous fix was wrong because it had two misunderstandings on
freebsd32 calling convention like the following:
- 32-bit id1 implies that it is the upper half of 64-bit id, indeed it
  depends on machine endianness.
- 32-bit ARM calling convension doesn't conform to freebsd32_args,
  indeed it does.

This change fixes the bugs and makes blockUntilWaitable work correctly
on freebsd/{386,arm}.

Fixes #16064.

Change-Id: I820c6d01d59a43ac4f2ab381f757c03b14bca75e
Reviewed-on: https://go-review.googlesource.com/24064
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/compile, etc: handle many struct fields
David Crawshaw [Tue, 14 Jun 2016 14:20:11 +0000 (10:20 -0400)]
cmd/compile, etc: handle many struct fields

This adds 8 bytes of binary size to every type that has methods. It is
the smallest change I could come up with for 1.7.

Fixes #16037

Change-Id: Ibe15c3165854a21768596967757864b880dbfeed
Reviewed-on: https://go-review.googlesource.com/24070
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocrypto/x509: don't ignore asn1.Marshal error
Ian Lance Taylor [Tue, 7 Jun 2016 16:42:48 +0000 (09:42 -0700)]
crypto/x509: don't ignore asn1.Marshal error

I don't see how the call could fail, so, no test. Just a code cleanup in
case it can fail in the future.

Fixes #15987.

Change-Id: If4af0d5e7d19cc8b13fb6a4f7661c37fb0015e83
Reviewed-on: https://go-review.googlesource.com/23860
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
8 years agocmd/go: include .syso files even if CGO_ENABLED=0
Ian Lance Taylor [Mon, 13 Jun 2016 18:55:30 +0000 (11:55 -0700)]
cmd/go: include .syso files even if CGO_ENABLED=0

A .syso file may include information that should go into the object file
that is not object code, and should be included even if not using cgo.
The example in the issue is a Windows manifest file.

Fixes #16050.

Change-Id: I1f4f3f80bb007e84d153ca2d26e5919213ea4f8d
Reviewed-on: https://go-review.googlesource.com/24032
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
8 years agocmd/go: remove obsolete comment referring to deleted parameter
Ian Lance Taylor [Fri, 10 Jun 2016 17:41:36 +0000 (10:41 -0700)]
cmd/go: remove obsolete comment referring to deleted parameter

The dir parameter was removed in https://golang.org/cl/5732045.

Fixes #15503.

Change-Id: I02a6d8317233bea08633715a095ea2514822032b
Reviewed-on: https://go-review.googlesource.com/24011
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <shurcool@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agoos: fix build on freebsd/arm
Mikio Hara [Tue, 14 Jun 2016 01:14:28 +0000 (10:14 +0900)]
os: fix build on freebsd/arm

Change-Id: I21fad94ff94e342ada18e0e41ca90296d030115f
Reviewed-on: https://go-review.googlesource.com/24061
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoos: use wait6 to avoid wait/kill race on freebsd
Mikio Hara [Sat, 11 Jun 2016 10:55:34 +0000 (19:55 +0900)]
os: use wait6 to avoid wait/kill race on freebsd

This change is a followup to https://go-review.googlesource.com/23967
for FreeBSD.

Updates #13987.
Updates #16028.

Change-Id: I0f0737372fce6df89d090fe9847305749b79eb4c
Reviewed-on: https://go-review.googlesource.com/24021
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoos: use waitid to avoid wait/kill race on darwin
Mikio Hara [Sat, 11 Jun 2016 10:36:17 +0000 (19:36 +0900)]
os: use waitid to avoid wait/kill race on darwin

This change is a followup to https://go-review.googlesource.com/23967
for Darwin.

Updates #13987.
Updates #16028.

Change-Id: Ib1fb9f957fafd0f91da6fceea56620e29ad82b00
Reviewed-on: https://go-review.googlesource.com/24020
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoruntime: collect stack trace if SIGPROF arrives on non-Go thread
Ian Lance Taylor [Wed, 8 Jun 2016 04:46:25 +0000 (21:46 -0700)]
runtime: collect stack trace if SIGPROF arrives on non-Go thread

Fixes #15994.

Change-Id: I5aca91ab53985ac7dcb07ce094ec15eb8ec341f8
Reviewed-on: https://go-review.googlesource.com/23891
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/link: put padding between functions, not at the end of a function
Keith Randall [Sun, 12 Jun 2016 00:12:28 +0000 (17:12 -0700)]
cmd/link: put padding between functions, not at the end of a function

Functions should be declared to end after the last real instruction, not
after the last padding byte. We achieve this by adding the padding while
assembling the text section in the linker instead of adding the padding
to the function symbol in the compiler. This change makes dtrace happy.

TODO: check that this works with external linking

Fixes #15969

Change-Id: I973e478d0cd34b61be1ddc55410552cbd645ad62
Reviewed-on: https://go-review.googlesource.com/24040
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/compile: fix OASWB rewriting in racewalk
David Chase [Fri, 10 Jun 2016 15:51:46 +0000 (11:51 -0400)]
cmd/compile: fix OASWB rewriting in racewalk

Special case for rewriting OAS inits omitted OASWB, added
that and OAS2FUNC.  The special case cannot be default case,
that causes racewalk to fail in horrible ways.

Fixes #16008.

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

8 years agocmd/go: remove invalid space in import comment docs
Dmitri Shuralyov [Fri, 10 Jun 2016 08:38:43 +0000 (01:38 -0700)]
cmd/go: remove invalid space in import comment docs

Generate package comment in alldocs.go using line comments rather than
general comments. This scales better, general comments cannot contain the
"*/" character sequence. Line comments do not have any restrictions on
the comment text that can be contained.

Remove the dependency on sed, which is not cross-platform, not go-gettable
external command.

Remove trailing whitespace from usage string in test.go. It's unnecessary.

Fixes #16030.

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

8 years agoruntime: aeshash, xor seed in earlier
Keith Randall [Thu, 26 May 2016 15:56:49 +0000 (08:56 -0700)]
runtime: aeshash, xor seed in earlier

Instead of doing:

x = input
one round of aes on x
x ^= seed
two rounds of aes on x

Do:

x = input
x ^= seed
three rounds of aes on x

This change provides some additional seed-dependent scrambling
which should help prevent collisions.

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

8 years agoos: on GNU/Linux use waitid to avoid wait/kill race
Ian Lance Taylor [Fri, 10 Jun 2016 05:24:40 +0000 (22:24 -0700)]
os: on GNU/Linux use waitid to avoid wait/kill race

On systems that support the POSIX.1-2008 waitid function, we can use it
to block until a wait will succeed. This avoids a possible race
condition: if a program calls p.Kill/p.Signal and p.Wait from two
different goroutines, then it is possible for the wait to complete just
before the signal is sent. In that case, it is possible that the system
will start a new process using the same PID between the wait and the
signal, causing the signal to be sent to the wrong process. The
Process.isdone field attempts to avoid that race, but there is a small
gap of time between when wait returns and isdone is set when the race
can occur.

This CL avoids that race by using waitid to wait until the process has
exited without actually collecting the PID. Then it sets isdone, then
waits for any active signals to complete, and only then collects the PID.

No test because any plausible test would require starting enough
processes to recycle all the process IDs.

Update #13987.
Update #16028.

Change-Id: Id2939431991d3b355dfb22f08793585fc0568ce8
Reviewed-on: https://go-review.googlesource.com/23967
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agogo/parser: document that parse functions need valid token.FileSet
Robert Griesemer [Fri, 10 Jun 2016 17:27:37 +0000 (10:27 -0700)]
go/parser: document that parse functions need valid token.FileSet

+ panic with explicit error if no file set it provided

(Not providing a file set is invalid use of the API; panic
is the appropriate action rather than returning an error.)

Fixes #16018.

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

8 years agocmd/go: clarify go get documentation
Ian Lance Taylor [Thu, 9 Jun 2016 13:42:42 +0000 (06:42 -0700)]
cmd/go: clarify go get documentation

Make the documentation for `go get` match the documentation for `go
install`, since `go get` essentially invokes `go install`.

Update #15825.

Change-Id: I374d80efd301814b6d98b86b7a4a68dd09704c92
Reviewed-on: https://go-review.googlesource.com/23925
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agosyscall: add a padding field to EpollEvent on s390x
Michael Munday [Thu, 9 Jun 2016 16:01:43 +0000 (12:01 -0400)]
syscall: add a padding field to EpollEvent on s390x

Fixes #16021.

Change-Id: I55df38bbccd2641abcb54704115002a9aa04325d
Reviewed-on: https://go-review.googlesource.com/23962
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoencoding/csv: update doc about comments whitespace
Jess Frazelle [Fri, 20 May 2016 21:35:28 +0000 (14:35 -0700)]
encoding/csv: update doc about comments whitespace

This patch updates the doc about comments whitespace for the
encoding/csv package to reflect that leading whitespace before
the hash will treat the line as not a comment.

Fixes #13775.

Change-Id: Ia468c75b242a487b4b2b4cd3d342bfb8e07720ba
Reviewed-on: https://go-review.googlesource.com/23302
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoruntime: set $sp before $pc in gdb python script
Cherry Zhang [Thu, 9 Jun 2016 02:22:35 +0000 (22:22 -0400)]
runtime: set $sp before $pc in gdb python script

When setting $pc, gdb does a backtrace using the current value of $sp,
and it may complain if $sp does not match that $pc (although the
assignment went through successfully).

This happens with ARM SSA backend: when setting $pc it prints
> Cannot access memory at address 0x0

As well as occasionally on MIPS64:
> warning: GDB can't find the start of the function at 0xc82003fe07.
> ...

Setting $sp before setting $pc makes it happy.

Change-Id: Idd96dbef3e9b698829da553c6d71d5b4c6d492db
Reviewed-on: https://go-review.googlesource.com/23940
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
8 years agocmd/compile: for tail calls in stubs, ensure args are alive
Keith Randall [Thu, 9 Jun 2016 18:07:36 +0000 (11:07 -0700)]
cmd/compile: for tail calls in stubs, ensure args are alive

The generated code for interface stubs sometimes just messes
with a few of the args and then tail-calls to the target routine.
The args that aren't explicitly modified appear to not be used.
But they are used, by the thing we're tail calling.

Fixes #16016

Change-Id: Ib9b3a8311bb714a201daee002885fcb59e0463fa
Reviewed-on: https://go-review.googlesource.com/23960
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 years agocmd/cgo: fix use of unsafe argument in new deferred function
Ian Lance Taylor [Thu, 9 Jun 2016 18:19:26 +0000 (11:19 -0700)]
cmd/cgo: fix use of unsafe argument in new deferred function

The combination of https://golang.org/cl/23650 and
https://golang.org/cl/23675 did not work--they were tested separately
but not together.

The problem was that 23650 introduced deferred argument checking, and
the deferred function loses the type that 23675 started requiring. The
fix is to go back to using an empty interface type in a deferred
argument check.

No new test required--fixes broken build.

Change-Id: I5ea023c5aed71d70e57b11c4551242d3ef25986d
Reviewed-on: https://go-review.googlesource.com/23961
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
8 years agocmd/cgo: use function arg type for _cgoCheckPointerN function
Ian Lance Taylor [Thu, 2 Jun 2016 04:32:47 +0000 (21:32 -0700)]
cmd/cgo: use function arg type for _cgoCheckPointerN function

When cgo writes a _cgoCheckPointerN function to handle unsafe.Pointer,
use the function's argument type rather than interface{}. This permits
type errors to be detected at build time rather than run time.

Fixes #13830.

Change-Id: Ic7090905e16b977e2379670e0f83640dc192b565
Reviewed-on: https://go-review.googlesource.com/23675
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
8 years agotime: document that RFC822/1123 don't parse all RFC formats
Ian Lance Taylor [Thu, 9 Jun 2016 04:15:26 +0000 (21:15 -0700)]
time: document that RFC822/1123 don't parse all RFC formats

Fixes #14505.

Change-Id: I46196b26c9339609e6e3ef9159de38c5b50c2a1b
Reviewed-on: https://go-review.googlesource.com/23922
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agotime: genzabbrs.go skips Feb when checking months
Kenny Grant [Sat, 21 May 2016 16:19:22 +0000 (17:19 +0100)]
time: genzabbrs.go skips Feb when checking months

getAbbrs looks like it is checking each month looking for a change
in the time zone abbreviation, but starts in Dec of the previous year
and skips the month of February because of the overflow rules for
AddDate. Changing the day to 1 starts at Jan 1 and tries all months
in the current year. This isn't very important or likely to change
output as zones usually span several months. Discovered when
looking into time.AddDate behavior when adding months.

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

8 years agocrypto/subtle: expand abbreviation to eliminate confusion
Jason Barnett [Tue, 24 May 2016 19:50:02 +0000 (15:50 -0400)]
crypto/subtle: expand abbreviation to eliminate confusion

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

8 years agoos: document that the runtime can write to standard error
Ian Lance Taylor [Thu, 9 Jun 2016 04:09:09 +0000 (21:09 -0700)]
os: document that the runtime can write to standard error

Fixes #15970.

Change-Id: I3f7d8316069a69d0e3859aaa96bc1414487fead0
Reviewed-on: https://go-review.googlesource.com/23921
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agocmd/go: only run TestGoGetHTTPS404 where it works
Ian Lance Taylor [Thu, 9 Jun 2016 00:45:55 +0000 (17:45 -0700)]
cmd/go: only run TestGoGetHTTPS404 where it works

The test TestGoGetHTTPS404 downloads a package that does not build on
every OS, so change it to only run where the package builds. It's not
great for the test to depend on an external package, but this is an
improvement on the current situation.

Fixes #15644.

Change-Id: I1679cee5ab1e61a5b26f4ad39dc8a397fbc0da69
Reviewed-on: https://go-review.googlesource.com/23920
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agocmd/compile: nilcheck interface value in go/defer interface call for SSA
Cherry Zhang [Mon, 6 Jun 2016 20:00:33 +0000 (16:00 -0400)]
cmd/compile: nilcheck interface value in go/defer interface call for SSA

This matches the behavior of the legacy backend.

Fixes #15975 (if this is the intended behavior)

Change-Id: Id277959069b8b8bf9958fa8f2cbc762c752a1a19
Reviewed-on: https://go-review.googlesource.com/23820
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime/cgo: restore the g pointer correctly in crosscall_s390x
Michael Munday [Wed, 8 Jun 2016 16:11:44 +0000 (16:11 +0000)]
runtime/cgo: restore the g pointer correctly in crosscall_s390x

R13 needs to be set to g because C code may have clobbered R13.

Fixes #16006.

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

8 years agomisc/android: make the exec wrapper exit code parsing more robust
Elias Naur [Fri, 3 Jun 2016 09:41:26 +0000 (11:41 +0200)]
misc/android: make the exec wrapper exit code parsing more robust

Before, the Android exec wrapper expected the trailing exit code
output on its own line, like this:

PASS
exitcode=0

However, some tests can sometimes squeeze in some output after
the test harness outputs "PASS" and the newline. The
TestWriteHeapDumpFinalizers test is particularly prone to this,
since its finalizers println to standard out. When it happens, the
output looks like this:

PASS
finalizedexitcode=0

Two recent failures caused by this race:

https://build.golang.org/log/185605e1b936142c22350eef22d20e982be53c29
https://build.golang.org/log/e61cf6a050551d10360bd90be3c5f58c3eb07605

Since the "exitcode=" string is always echoed after the test output,
the fix is simple: instead of looking for the last newline in the
output, look for the last exitcode string instead.

Change-Id: Icd6e53855eeba60b982ad3108289d92549328b86
Reviewed-on: https://go-review.googlesource.com/23750
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
8 years agomisc/cgo/testsanitizers: don't run some TSAN tests on GCC < 7
Ian Lance Taylor [Tue, 7 Jun 2016 04:44:24 +0000 (21:44 -0700)]
misc/cgo/testsanitizers: don't run some TSAN tests on GCC < 7

Before GCC 7 defined __SANITIZE_THREAD__ when using TSAN,
runtime/cgo/libcgo.h could not determine reliably whether TSAN was in
use when using GCC.

Fixes #15983.

Change-Id: I5581c9f88e1cde1974c280008b2230fe5e971f44
Reviewed-on: https://go-review.googlesource.com/23833
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
8 years agonet/http: update bundled http2
Andrew Gerrand [Wed, 8 Jun 2016 02:57:00 +0000 (12:57 +1000)]
net/http: update bundled http2

Updates x/net/http2 to git rev 313cf39 for CLs 23812 and 23880:

http2: GotFirstResponseByte hook should only fire once
http2: fix data race on pipe

Fixes #16000

Change-Id: I9c3f1b2528bbd99968aa5a0529ae9c5295979d1d
Reviewed-on: https://go-review.googlesource.com/23881
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
8 years agocmd/compile: cgen_append can handle complex targets
Keith Randall [Tue, 7 Jun 2016 22:43:48 +0000 (15:43 -0700)]
cmd/compile: cgen_append can handle complex targets

Post-liveness fix, the slices on both sides can now be
indirects of & variables.  The cgen code handles those
cases just fine.

Fixes #15988

Change-Id: I378ad1d5121587e6107a9879c167291a70bbb9e4
Reviewed-on: https://go-review.googlesource.com/23863
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
8 years agocmd/compile: fix heap dump test on android
Keith Randall [Tue, 7 Jun 2016 16:54:09 +0000 (09:54 -0700)]
cmd/compile: fix heap dump test on android

go_android_exec is looking for "exitcode=" to decide the result
of running a test.  The heap dump test nondeterministically prints
"finalized" right at the end of the test.  When the timing is just
right, we print "finalizedexitcode=0" and confuse go_android_exec.

This failure happens occasionally on the android builders.

Change-Id: I4f73a4db05d8f40047ecd3ef3a881a4ae3741e26
Reviewed-on: https://go-review.googlesource.com/23861
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>