]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
7 years ago[dev.ssa] Merge remote-tracking branch 'origin/master' into mergebranch
Keith Randall [Wed, 13 Jul 2016 18:03:12 +0000 (11:03 -0700)]
[dev.ssa] Merge remote-tracking branch 'origin/master' into mergebranch

Semi-regular merge of tip into dev.ssa.

Change-Id: I855817c4746237792a2dab6eaf471087a3646be4

7 years agodoc/go1.7.html: document that http.Server now enforces request versions
Emmanuel Odeke [Tue, 5 Jul 2016 06:57:05 +0000 (23:57 -0700)]
doc/go1.7.html: document that http.Server now enforces request versions

Document that the http.Server is now stricter about rejecting
requests with invalid HTTP versions, and also that it rejects plaintext
HTTP/2 requests, except for `PRI * HTTP/2.0` upgrade requests.
The relevant CL is https://golang.org/cl/24505.

Updates #15810.

Change-Id: Ibbace23e001b5e2eee053bd341de50f9b6d3fde8
Reviewed-on: https://go-review.googlesource.com/24731
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc/effective_go: clarify advice on returning interfaces
Bryan C. Mills [Tue, 12 Jul 2016 22:56:07 +0000 (18:56 -0400)]
doc/effective_go: clarify advice on returning interfaces

New Gophers sometimes misconstrue the advice in the "Generality" section
as "export interfaces instead of implementations" and add needless
interfaces to their code as a result.  Down the road, they end up
needing to add methods and either break existing callers or have to
resort to unpleasant hacks (e.g. using "magic method" type-switches).

Weaken the first paragraph of this section to only advise leaving types
unexported when they will never need additional methods.

Change-Id: I32a1ae44012b5896faf167c02e192398a4dfc0b8
Reviewed-on: https://go-review.googlesource.com/24892
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
7 years agocmd/go: don't fail on invalid GOOS/GOARCH pair when using gccgo
Brad Fitzpatrick [Tue, 12 Jul 2016 17:19:16 +0000 (11:19 -0600)]
cmd/go: don't fail on invalid GOOS/GOARCH pair when using gccgo

Fixes #12272

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

7 years agoruntime: add ctxt parameter to cgocallback called from Go
Ian Lance Taylor [Mon, 11 Jul 2016 23:15:03 +0000 (16:15 -0700)]
runtime: add ctxt parameter to cgocallback called from Go

The cgocallback function picked up a ctxt parameter in CL 22508.
That CL updated the assembler implementation, but there are a few
mentions in Go code that were not updated. This CL fixes that.

Fixes #16326

Change-Id: I5f68e23565c6a0b11057aff476d13990bff54a66
Reviewed-on: https://go-review.googlesource.com/24848
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
7 years agoreflect: an unnamed type has no PkgPath
Ian Lance Taylor [Tue, 12 Jul 2016 05:34:30 +0000 (22:34 -0700)]
reflect: an unnamed type has no PkgPath

The reflect package was returning a non-empty PkgPath for an unnamed
type with methods, such as a type whose methods have a pointer
receiver.

Fixes #16328.

Change-Id: I733e93981ebb5c5c108ef9b03bf5494930b93cf3
Reviewed-on: https://go-review.googlesource.com/24862
Reviewed-by: David Crawshaw <crawshaw@golang.org>
7 years agoRevert "regexp: add the Fanout benchmark
Ian Lance Taylor [Tue, 12 Jul 2016 03:43:05 +0000 (03:43 +0000)]
Revert "regexp: add the Fanout benchmark

This is a copy of the "FANOUT" benchmark recently added to RE2 with the
following comment:

    // This has quite a high degree of fanout.
    // NFA execution will be particularly slow.

Most of the benchmarks on the regexp package have very little fanout and
are designed for comparing the regexp package's NFA with backtracking
engines found in other regular expression libraries. This benchmark
exercises the performance of the NFA on expressions with high fanout.Reviewed-on: https://go-review.googlesource.com/24846
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
"

This reverts commit fc803874d3a509ddd99a897da1c6a62dc4ce631e.

Reason for revert: Breaks the -race build because the benchmark takes too long to run.

Change-Id: I6ed4b466f74a4108d8bcd5b019b9abe971eb483e
Reviewed-on: https://go-review.googlesource.com/24861
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
7 years agoregexp: add the Fanout benchmark
Michael Matloob [Mon, 11 Jul 2016 20:59:03 +0000 (14:59 -0600)]
regexp: add the Fanout benchmark

This is a copy of the "FANOUT" benchmark recently added to RE2 with the
following comment:

    // This has quite a high degree of fanout.
    // NFA execution will be particularly slow.

Most of the benchmarks on the regexp package have very little fanout and
are designed for comparing the regexp package's NFA with backtracking
engines found in other regular expression libraries. This benchmark
exercises the performance of the NFA on expressions with high fanout.

Change-Id: Ie9c8e3bbeffeb1fe9fb90474ddd19e53f2f57a52
Reviewed-on: https://go-review.googlesource.com/24846
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agogofmt: remove unneeded call to os.Exit
Francesc Campoy [Mon, 11 Jul 2016 18:31:52 +0000 (12:31 -0600)]
gofmt: remove unneeded call to os.Exit

PrintDefaults already calls os.Exit(2).

Change-Id: I0d783a6476f42b6157853cdb34ba69618e3f3fcb
Reviewed-on: https://go-review.googlesource.com/24844
Reviewed-by: Andrew Gerrand <adg@golang.org>
7 years agodoc/go1.7.html: no concurrent calls of math/rand methods
Ian Lance Taylor [Mon, 11 Jul 2016 04:47:56 +0000 (21:47 -0700)]
doc/go1.7.html: no concurrent calls of math/rand methods

A follow-on to https://golang.org/cl/24852 that mentions the
documentation clarifications.

Updates #16308.

Change-Id: Ic2a6e1d4938d74352f93a6649021fb610efbfcd0
Reviewed-on: https://go-review.googlesource.com/24857
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
7 years agomath/rand: fix raciness in Rand.Read
Ian Lance Taylor [Sun, 10 Jul 2016 02:38:04 +0000 (19:38 -0700)]
math/rand: fix raciness in Rand.Read

There are no synchronization points protecting the readVal and readPos
variables. This leads to a race when Read is called concurrently.
Fix this by adding methods to lockedSource, which is the case where
a race matters.

Fixes #16308.

Change-Id: Ic028909955700906b2d71e5c37c02da21b0f4ad9
Reviewed-on: https://go-review.googlesource.com/24852
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
7 years agonet/http: fix vet warning of leaked context in error paths
Brad Fitzpatrick [Sun, 10 Jul 2016 00:24:45 +0000 (17:24 -0700)]
net/http: fix vet warning of leaked context in error paths

Updates #16230

Change-Id: Ie38f85419c41c00108f8843960280428a39789b5
Reviewed-on: https://go-review.googlesource.com/24850
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agosyscall: add another output for TestGroupCleanupUserNamespace
Ian Lance Taylor [Fri, 8 Jul 2016 18:42:19 +0000 (11:42 -0700)]
syscall: add another output for TestGroupCleanupUserNamespace

Fixes #16303.

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

7 years agoruntime: fix case in KeepAlive comment
Ian Lance Taylor [Fri, 8 Jul 2016 14:56:52 +0000 (07:56 -0700)]
runtime: fix case in KeepAlive comment

Fixes #16299.

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

7 years agodoc/go1.7.html: fix name of IsExist
Ian Lance Taylor [Fri, 8 Jul 2016 14:50:07 +0000 (07:50 -0700)]
doc/go1.7.html: fix name of IsExist

For better or for worse, it's IsExist, not IsExists.

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

7 years agoruntime: fix nanotime for macOS Sierra
Ian Lance Taylor [Thu, 7 Jul 2016 23:41:29 +0000 (16:41 -0700)]
runtime: fix nanotime for macOS Sierra

In the beta version of the macOS Sierra (10.12) release, the
gettimeofday system call changed on x86. Previously it always returned
the time in the AX/DX registers. Now, if AX is returned as 0, it means
that the system call has stored the values into the memory pointed to by
the first argument, just as the libc gettimeofday function does. The
libc function handles both cases, and we need to do so as well.

Fixes #16272.

Change-Id: Ibe5ad50a2c5b125e92b5a4e787db4b5179f6b723
Reviewed-on: https://go-review.googlesource.com/24812
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoruntime: handle selects with duplicate channels in shrinkstack
Ian Lance Taylor [Fri, 8 Jul 2016 00:43:08 +0000 (17:43 -0700)]
runtime: handle selects with duplicate channels in shrinkstack

The shrinkstack code locks all the channels a goroutine is waiting for,
but didn't handle the case of the same channel appearing in the list
multiple times. This led to a deadlock. The channels are sorted so it's
easy to avoid locking the same channel twice.

Fixes #16286.

Change-Id: Ie514805d0532f61c942e85af5b7b8ac405e2ff65
Reviewed-on: https://go-review.googlesource.com/24815
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
7 years agolib/time: update to IANA release 2016f (July 2016)
Brad Fitzpatrick [Wed, 6 Jul 2016 00:16:05 +0000 (00:16 +0000)]
lib/time: update to IANA release 2016f (July 2016)

Fixes #16273

Change-Id: I443e1f254fd683c4ff61beadae89c1c45ff5d972
Reviewed-on: https://go-review.googlesource.com/24744
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agonet/http: deflake TestClientRedirectContext
Brad Fitzpatrick [Wed, 6 Jul 2016 21:29:40 +0000 (21:29 +0000)]
net/http: deflake TestClientRedirectContext

The test was checking for 1 of 2 possible error values. But based on
goroutine scheduling and the randomness of select statement receive
cases, it was possible for a 3rd type of error to be returned.

This modifies the code (not the test) to make that third type of error
actually the second type of error, which is a nicer error message.

The test is no longer flaky. The flake was very reproducible with a
5ms sleep before the select at the end of Transport.getConn.

Thanks to Github user @jaredborner for debugging.

Fixes #16049

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

7 years agopath/filepath: fix typo in comment
Ian Lance Taylor [Thu, 7 Jul 2016 00:14:10 +0000 (17:14 -0700)]
path/filepath: fix typo in comment

Change-Id: I0c76e8deae49c1149647de421503c5175028b948
Reviewed-on: https://go-review.googlesource.com/24781
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agopath/filepath: document Clean behavior for each function
Ian Lance Taylor [Wed, 6 Jul 2016 20:07:53 +0000 (13:07 -0700)]
path/filepath: document Clean behavior for each function

Document explicitly which functions Clean the result rather than
documenting it in the package comment.

Updates #10122.
Fixes #16111.

Change-Id: Ia589c7ee3936c9a6a758725ac7f143054d53e41e
Reviewed-on: https://go-review.googlesource.com/24747
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/compile, syscall: add //go:uintptrescapes comment, and use it
Ian Lance Taylor [Tue, 28 Jun 2016 21:19:27 +0000 (14:19 -0700)]
cmd/compile, syscall: add //go:uintptrescapes comment, and use it

This new comment can be used to declare that the uintptr arguments to a
function may be converted from pointers, and that those pointers should
be considered to escape. This is used for the Call methods in
dll_windows.go that take uintptr arguments, because they call Syscall.

We can't treat these functions as we do syscall.Syscall, because unlike
Syscall they may cause the stack to grow. For Syscall we can assume that
stack arguments can remain on the stack, but for these functions we need
them to escape.

Fixes #16035.

Change-Id: Ia0e5b4068c04f8d303d95ab9ea394939f1f57454
Reviewed-on: https://go-review.googlesource.com/24551
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agoencoding/xml: update docs to follow convention
Sam Whited [Wed, 6 Jul 2016 01:06:00 +0000 (20:06 -0500)]
encoding/xml: update docs to follow convention

Fixes #8833

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

7 years ago[dev.ssa] cmd/compile: add some constant folding optimizations
Josh Bleecher Snyder [Tue, 5 Jul 2016 17:03:02 +0000 (10:03 -0700)]
[dev.ssa] cmd/compile: add some constant folding optimizations

These were helpful for some autogenerated code
I'm working with.

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

7 years ago[dev.ssa] cmd/compile: add some ARM optimization rewriting rules
Cherry Zhang [Mon, 13 Jun 2016 20:49:09 +0000 (16:49 -0400)]
[dev.ssa] cmd/compile: add some ARM optimization rewriting rules

Mostly constant folding rules, analogous to AMD64 ones. Along with
some simplifications.

Updates #15365.

Change-Id: If83bc1188bb05acb982ef3a1c21704c187e3eb24
Reviewed-on: https://go-review.googlesource.com/24210
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
7 years ago[dev.ssa] cmd/compile: enable SSA on ARM by default
Cherry Zhang [Tue, 7 Jun 2016 18:18:04 +0000 (14:18 -0400)]
[dev.ssa] cmd/compile: enable SSA on ARM by default

As Josh mentioned in CL 24716, there has been requests for using SSA
for ARM. SSA can still be disabled by setting -ssa=0 for cmd/compile,
or partially enabled with GOSSAFUNC, GOSSAPKG, and GOSSAHASH.

Not enable SSA by default on NaCl, which is not supported yet.

Enable SSA-specific tests on ARM: live_ssa.go and nilptr3_ssa.go;
disable non-SSA tests: live.go, nilptr3.go, and slicepot.go.

Updates #15365.

Change-Id: Ic2ca8d166aeca8517b9d262a55e92f2130683a16
Reviewed-on: https://go-review.googlesource.com/23953
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
7 years agoencoding/gob: document Encode, EncodeValue nil pointer panics
Emmanuel Odeke [Sun, 3 Jul 2016 21:57:35 +0000 (14:57 -0700)]
encoding/gob: document Encode, EncodeValue nil pointer panics

Fixes #16258.

Docs for Encode and EncodeValue do not mention that
nil pointers are not permitted hence we panic,
because Gobs encode values yet nil pointers have no value
to encode. It moves a comment that was internal to EncodeValue
to the top level to make it clearer to users what to expect
when they pass in nil pointers.
Supplements test TestTopLevelNilPointer.

Change-Id: Ie54f609fde4b791605960e088456047eb9aa8738
Reviewed-on: https://go-review.googlesource.com/24740
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agocmd/vet: remove copylock warning about result types and calls
Ian Lance Taylor [Fri, 1 Jul 2016 20:52:26 +0000 (13:52 -0700)]
cmd/vet: remove copylock warning about result types and calls

Don't issue a copylock warning about a result type; the function may
return a composite literal with a zero value, which is OK.

Don't issue a copylock warning about a function call on the RHS, or an
indirection of a function call; the function may return a composite
literal with a zero value, which is OK.

Updates #16227.

Change-Id: I94f0e066bbfbca5d4f8ba96106210083e36694a2
Reviewed-on: https://go-review.googlesource.com/24711
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
7 years agosyscall: fix missing use of use function in Getfsstat
Mikio Hara [Sun, 3 Jul 2016 23:45:10 +0000 (08:45 +0900)]
syscall: fix missing use of use function in Getfsstat

Updates #13372.

Change-Id: If383c14af14839a303425ba7b80b97e35ca9b698
Reviewed-on: https://go-review.googlesource.com/24750
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years ago[dev.ssa] cmd/compile: unify and check LoweredGetClosurePtr
Josh Bleecher Snyder [Sun, 3 Jul 2016 20:40:03 +0000 (13:40 -0700)]
[dev.ssa] cmd/compile: unify and check LoweredGetClosurePtr

The comments were mostly duplicated; unify them.
Add a check that the required invariant holds.

Change-Id: I42fe09dcd1fac76d3c4e191f7a58c591c5ce429b
Reviewed-on: https://go-review.googlesource.com/24719
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
7 years ago[dev.ssa] cmd/compile: remove dead amd64 ITab lowering rule
Josh Bleecher Snyder [Sun, 3 Jul 2016 19:56:29 +0000 (12:56 -0700)]
[dev.ssa] cmd/compile: remove dead amd64 ITab lowering rule

ITab is handled by decomposition.
The rule is vestigial. Remove it.

Change-Id: I6fdf3d14d466761c7665c7ea14f34ca0e1e3e646
Reviewed-on: https://go-review.googlesource.com/24718
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
7 years agocmd/go: remove noVCSSuffix check for OpenStack
Monty Taylor [Fri, 1 Jul 2016 13:47:41 +0000 (08:47 -0500)]
cmd/go: remove noVCSSuffix check for OpenStack

The original intent of the code was to allow both with and without .git
suffix for now to allow a transition period. The noVCSSuffix check was a
copy pasta error.

Fixes #15979.

Change-Id: I3d39aba8d026b40fc445244d6d01d8bc1979d1e4
Reviewed-on: https://go-review.googlesource.com/24645
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years ago[dev.ssa] cmd/compile: ensure alignment for Zero and Move in SSA for ARM
Cherry Zhang [Mon, 27 Jun 2016 20:54:57 +0000 (16:54 -0400)]
[dev.ssa] cmd/compile: ensure alignment for Zero and Move in SSA for ARM

Encode the size and the alignment into AuxInt of Zero and Move ops.
On AMD64, we simply don't look at the alignment. On ARM and PPC64, we
only generate aligned stores.

Updates #15365.

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

7 years agocmd/compile: mark live heap-allocated pparamout vars as needzero
Ian Lance Taylor [Fri, 1 Jul 2016 22:44:12 +0000 (15:44 -0700)]
cmd/compile: mark live heap-allocated pparamout vars as needzero

If we don't mark them as needzero, we have a live pointer variable
containing possible garbage, which will baffle the GC.

Fixes #16249.

Change-Id: I7c423ceaca199ddd46fc2c23e5965e7973f07584
Reviewed-on: https://go-review.googlesource.com/24715
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
7 years agocmd/compile: don't lose //go:nointerface pragma in export data
Robert Griesemer [Fri, 1 Jul 2016 17:51:59 +0000 (10:51 -0700)]
cmd/compile: don't lose //go:nointerface pragma in export data

Fixes #16243.

Change-Id: I207d1e8aa48abe453a23c709ccf4f8e07368595b
Reviewed-on: https://go-review.googlesource.com/24648
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/compile: don't set line number to 0 when building SSA
Cherry Zhang [Thu, 30 Jun 2016 10:36:31 +0000 (06:36 -0400)]
cmd/compile: don't set line number to 0 when building SSA

The frontend may emit node with line number missing. In this case,
use the parent line number. Instead of changing every call site of
pushLine, do it in pushLine itself.

Fixes #16214.

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

7 years agonet/http: update bundled http2
Brad Fitzpatrick [Thu, 30 Jun 2016 22:11:22 +0000 (22:11 +0000)]
net/http: update bundled http2

Updates x/net/http2 to git rev b400c2e for https://golang.org/cl/24214,
"http2: add additional blacklisted ciphersuites"

Both TLS_RSA_WITH_AES_128_GCM_SHA256 & TLS_RSA_WITH_AES_256_GCM_SHA384
are now blacklisted, per http://httpwg.org/specs/rfc7540.html#BadCipherSuites

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

7 years agocmd/vet: lostcancel: treat naked return as a use of named results
Alan Donovan [Thu, 30 Jun 2016 18:32:03 +0000 (14:32 -0400)]
cmd/vet: lostcancel: treat naked return as a use of named results

+ test.

Fixes #16230

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

7 years agoall: be consistent about spelling of cancelation
Brad Fitzpatrick [Thu, 30 Jun 2016 19:24:06 +0000 (19:24 +0000)]
all: be consistent about spelling of cancelation

We had ~30 one way, and these four new occurrences the other way.

Updates #11626

Change-Id: Ic6403dc4905874916ae292ff739d33482ed8e5bf
Reviewed-on: https://go-review.googlesource.com/24683
Reviewed-by: Rob Pike <r@golang.org>
7 years ago[dev.ssa] cmd/compile: improve stability of generated code
Josh Bleecher Snyder [Thu, 30 Jun 2016 18:13:24 +0000 (11:13 -0700)]
[dev.ssa] cmd/compile: improve stability of generated code

If the files in cmd/compile/internal/ssa/gen
are passed to go run in a different order,
e.g. due to shell differences or manual entry,
then the order of constants in opGen churns.

Sort archs by name to enforce stability.
The movement of the PPC constants is a one time cost.

Change-Id: Iebcfdb9e612d7dd8cde575f920f1292891f2f24a
Reviewed-on: https://go-review.googlesource.com/24680
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
7 years agocontext: cancel the context in ExampleWithTimeout, with explanation
Alan Donovan [Thu, 30 Jun 2016 18:55:01 +0000 (14:55 -0400)]
context: cancel the context in ExampleWithTimeout, with explanation

Fixes #16230

Change-Id: Ibb10234a6c3ab8bd0cfd93c2ebe8cfa66f80f6b0
Reviewed-on: https://go-review.googlesource.com/24682
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoruntime/internal/sys: implement Ctz and Bswap in assembly for 386
Austin Clements [Wed, 29 Jun 2016 21:41:50 +0000 (17:41 -0400)]
runtime/internal/sys: implement Ctz and Bswap in assembly for 386

Ctz is a hot-spot in the Go 1.7 memory manager. In SSA it's
implemented as an intrinsic that compiles to a few instructions, but
on the old backend (all architectures other than amd64), it's
implemented as a fairly complex Go function. As a result, switching to
bitmap-based allocation was a significant hit to allocation-heavy
workloads like BinaryTree17 on non-SSA platforms.

For unknown reasons, this hit 386 particularly hard. We can regain a
lot of the lost performance by implementing Ctz in assembly on the
386. This isn't as good as an intrinsic, since it still generates a
function call and prevents useful inlining, but it's much better than
the pure Go implementation:

name                      old time/op    new time/op    delta
BinaryTree17-12              3.59s ± 1%     3.06s ± 1%  -14.74%  (p=0.000 n=19+20)
Fannkuch11-12                3.72s ± 1%     3.64s ± 1%   -2.09%  (p=0.000 n=17+19)
FmtFprintfEmpty-12          52.3ns ± 3%    52.3ns ± 3%     ~     (p=0.829 n=20+19)
FmtFprintfString-12          156ns ± 1%     148ns ± 3%   -5.20%  (p=0.000 n=18+19)
FmtFprintfInt-12             137ns ± 1%     136ns ± 1%   -0.56%  (p=0.000 n=19+13)
FmtFprintfIntInt-12          227ns ± 2%     225ns ± 2%   -0.93%  (p=0.000 n=19+17)
FmtFprintfPrefixedInt-12     210ns ± 1%     208ns ± 1%   -0.91%  (p=0.000 n=19+17)
FmtFprintfFloat-12           375ns ± 1%     371ns ± 1%   -1.06%  (p=0.000 n=19+18)
FmtManyArgs-12               995ns ± 2%     978ns ± 1%   -1.63%  (p=0.000 n=17+17)
GobDecode-12                9.33ms ± 1%    9.19ms ± 0%   -1.59%  (p=0.000 n=20+17)
GobEncode-12                7.73ms ± 1%    7.73ms ± 1%     ~     (p=0.771 n=19+20)
Gzip-12                      375ms ± 1%     374ms ± 1%     ~     (p=0.141 n=20+18)
Gunzip-12                   61.8ms ± 1%    61.8ms ± 1%     ~     (p=0.602 n=20+20)
HTTPClientServer-12         87.7µs ± 2%    86.9µs ± 3%   -0.87%  (p=0.024 n=19+20)
JSONEncode-12               20.2ms ± 1%    20.4ms ± 0%   +0.53%  (p=0.000 n=18+19)
JSONDecode-12               65.3ms ± 0%    65.4ms ± 1%     ~     (p=0.385 n=16+19)
Mandelbrot200-12            4.11ms ± 1%    4.12ms ± 0%   +0.29%  (p=0.020 n=19+19)
GoParse-12                  3.75ms ± 1%    3.61ms ± 2%   -3.90%  (p=0.000 n=20+20)
RegexpMatchEasy0_32-12       104ns ± 0%     103ns ± 0%   -0.96%  (p=0.000 n=13+16)
RegexpMatchEasy0_1K-12       805ns ± 1%     803ns ± 1%     ~     (p=0.189 n=18+18)
RegexpMatchEasy1_32-12       111ns ± 0%     111ns ± 3%     ~     (p=1.000 n=14+19)
RegexpMatchEasy1_1K-12      1.00µs ± 1%    1.00µs ± 1%   +0.50%  (p=0.003 n=19+19)
RegexpMatchMedium_32-12      133ns ± 2%     133ns ± 2%     ~     (p=0.218 n=20+20)
RegexpMatchMedium_1K-12     41.2µs ± 1%    42.2µs ± 1%   +2.52%  (p=0.000 n=18+16)
RegexpMatchHard_32-12       2.35µs ± 1%    2.38µs ± 1%   +1.53%  (p=0.000 n=18+18)
RegexpMatchHard_1K-12       70.9µs ± 2%    72.0µs ± 1%   +1.42%  (p=0.000 n=19+17)
Revcomp-12                   1.06s ± 0%     1.05s ± 0%   -1.36%  (p=0.000 n=20+18)
Template-12                 86.2ms ± 1%    84.6ms ± 0%   -1.89%  (p=0.000 n=20+18)
TimeParse-12                 425ns ± 2%     428ns ± 1%   +0.77%  (p=0.000 n=18+19)
TimeFormat-12                517ns ± 1%     519ns ± 1%   +0.43%  (p=0.001 n=20+19)
[Geo mean]                  74.3µs         73.5µs        -1.05%

Prior to this commit, BinaryTree17-12 on 386 was 33% slower than at
the go1.6 tag. With this commit, it's 13% slower.

On arm and arm64, BinaryTree17-12 is only ~5% slower than it was at
go1.6. It may be worth implementing Ctz for them as well.

I consider this change low risk, since the functions it replaces are
simple, very well specified, and well tested.

For #16117.

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

7 years agoos/exec: start checking for context cancelation in Start
Ian Lance Taylor [Thu, 30 Jun 2016 02:20:51 +0000 (19:20 -0700)]
os/exec: start checking for context cancelation in Start

Previously we started checking for context cancelation in Wait, but
that meant that when using StdoutPipe context cancelation never took
effect.

Fixes #16222.

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

7 years agosyscall: accept more variants of id output when testing as root
Ian Lance Taylor [Thu, 30 Jun 2016 15:22:27 +0000 (08:22 -0700)]
syscall: accept more variants of id output when testing as root

This should fix the report at #16224, and also fixes running the test as
root on my Ubuntu Trusty system.

Fixes #16224.

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

7 years agonet/http: update bundled http2
Brad Fitzpatrick [Thu, 30 Jun 2016 00:01:10 +0000 (17:01 -0700)]
net/http: update bundled http2

Updates x/net/http2 to git rev 8e573f40 for https://golang.org/cl/24600,
"http2: merge multiple GOAWAY frames' contents into error message"

Fixes #14627 (more)

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

7 years agonet/http: be consistent about spelling of HTTP/1.x
Brad Fitzpatrick [Wed, 29 Jun 2016 23:56:43 +0000 (16:56 -0700)]
net/http: be consistent about spelling of HTTP/1.x

There was only one use of "HTTP/1.n" compared to "HTTP/1.x":

h2_bundle.go://   "Just as in HTTP/1.x, header field names are strings of ASCII
httputil/dump.go:// DumpRequest returns the given request in its HTTP/1.x wire
httputil/dump.go:// intact. HTTP/2 requests are dumped in HTTP/1.x form, not in their
response.go:// Write writes r to w in the HTTP/1.x server response format,
server.go:      // Request.Body. For HTTP/1.x requests, handlers should read any
server.go:// The default HTTP/1.x and HTTP/2 ResponseWriter implementations
server.go:// The default ResponseWriter for HTTP/1.x connections supports
server.go:// http1ServerSupportsRequest reports whether Go's HTTP/1.x server
server.go:      // about HTTP/1.x Handlers concurrently reading and writing, like
server.go:      // HTTP/1.x from here on.
transport.go:   return fmt.Errorf("net/http: HTTP/1.x transport connection broken: %v", err)

Be consistent.

Change-Id: I93c4c873e500f51af2b4762055e22f5487a625ac
Reviewed-on: https://go-review.googlesource.com/24610
Reviewed-by: Andrew Gerrand <adg@golang.org>
7 years agocrypto/ecdsa: Update documentation for Sign
Nick Harper [Wed, 29 Jun 2016 18:18:01 +0000 (11:18 -0700)]
crypto/ecdsa: Update documentation for Sign

Change-Id: I2b7a81cb809d109f10d5f0db957c614f466d6bfd
Reviewed-on: https://go-review.googlesource.com/24582
Reviewed-by: Adam Langley <agl@golang.org>
7 years agocrypto/tls: Use the same buffer size in the client and server in the TLS throughput...
Tom Bergan [Wed, 29 Jun 2016 14:45:23 +0000 (07:45 -0700)]
crypto/tls: Use the same buffer size in the client and server in the TLS throughput benchmark

I believe it's necessary to use a buffer size smaller than 64KB because
(at least some versions of) Window using a TCP receive window less than
64KB. Currently the client and server use buffer sizes of 16KB and 32KB,
respectively (the server uses io.Copy, which defaults to 32KB internally).
Since the server has been using 32KB, it should be safe for the client to
do so as well.

Fixes #15899

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

7 years agoruntime: fix race atomic operations on external memory
Dmitry Vyukov [Wed, 29 Jun 2016 09:09:36 +0000 (11:09 +0200)]
runtime: fix race atomic operations on external memory

The assembly is broken: it does `MOVQ g(R12), R14` expecting that
R12 contains tls address, but it does not do get_tls(R12) before.
This magically works on linux: `MOVQ g(R12), R14` is compiled to
`mov %fs:0xfffffffffffffff8,%r14` which does not use R12.
But it crashes on windows.

Add explicit `get_tls(R12)`.

Fixes #16206

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

7 years agoruntime: correct printing of blocked field in scheduler trace
Ian Lance Taylor [Wed, 29 Jun 2016 00:23:01 +0000 (17:23 -0700)]
runtime: correct printing of blocked field in scheduler trace

When the blocked field was first introduced back in
https://golang.org/cl/61250043 the scheduler trace code incorrectly used
m->blocked instead of mp->blocked.  That has carried through the
conversion to Go.  This CL fixes it.

Change-Id: Id81907b625221895aa5c85b9853f7c185efd8f4b
Reviewed-on: https://go-review.googlesource.com/24571
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoruntime: better error message for newosproc failure
Ian Lance Taylor [Wed, 29 Jun 2016 00:06:59 +0000 (17:06 -0700)]
runtime: better error message for newosproc failure

If creating a new thread fails with EAGAIN, point the user at ulimit.

Fixes #15476.

Change-Id: Ib36519614b5c72776ea7f218a0c62df1dd91a8ea
Reviewed-on: https://go-review.googlesource.com/24570
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agonet/http: update bundled http2
Brad Fitzpatrick [Tue, 28 Jun 2016 23:25:45 +0000 (16:25 -0700)]
net/http: update bundled http2

Updates x/net/http2 to git rev ef2e00e88 for https://golang.org/cl/24560,
"http2: make Transport return server's GOAWAY error back to the user"

Fixes #14627

Change-Id: I2bb123a3041e168db7c9446beef4ee47638f17ee
Reviewed-on: https://go-review.googlesource.com/24561
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agocmd/vet: make checking example names in _test packages more robust
Konstantin Shaposhnikov [Mon, 27 Jun 2016 09:13:15 +0000 (17:13 +0800)]
cmd/vet: make checking example names in _test packages more robust

Prior to this change package "foo" had to be installed in order to check
example names in "foo_test" package.

However by the time "foo_test" package is checked a parsed "foo" package
has been already constructed. Use it to check example names.

Also change TestDivergentPackagesExamples test to pass directory of the
package to the vet tool as it is the most common way to invoke it. This
requires changes to errchk to add support for grabbing source files from
a directory.

Fixes #16189

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

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 years ago[dev.ssa] cmd/compile: Add initial SSA configuration for PPC64
Lynn Boger [Fri, 24 Jun 2016 19:37:17 +0000 (14:37 -0500)]
[dev.ssa] cmd/compile: Add initial SSA configuration for PPC64

This adds the initial SSA implementation for PPC64.
Builds golang and all.bash runs correctly.  Simple hello.go
builds but does not run.

Change-Id: I7cec211b934cd7a2dd75a6cdfaf9f71867063466
Reviewed-on: https://go-review.googlesource.com/24453
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 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>
7 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>
7 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>

7 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>
7 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>

7 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>

7 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>

7 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>

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>

7 years ago[dev.ssa] cmd/compile: provide default types for all extension ops
Josh Bleecher Snyder [Sat, 25 Jun 2016 23:07:56 +0000 (16:07 -0700)]
[dev.ssa] cmd/compile: provide default types for all extension ops

Change-Id: I655327818297cc6792c81912f2cebdc321381561
Reviewed-on: https://go-review.googlesource.com/24465
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
7 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>

7 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>

7 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>
7 years ago[dev.ssa] cmd/compile: optimize NilCheck in SSA for ARM
Cherry Zhang [Fri, 24 Jun 2016 19:06:17 +0000 (15:06 -0400)]
[dev.ssa] cmd/compile: optimize NilCheck in SSA for ARM

Like AMD64, don't issue NilCheck instruction if the subsequent block
has a load or store at the same address.

Pass test/nilptr3_ssa.go.

Updates #15365.

Change-Id: Ic88780dab8c4893c57d1c95f663760cc185fe51e
Reviewed-on: https://go-review.googlesource.com/24451
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>

7 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>

7 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>

7 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>

7 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>
7 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>

7 years ago[dev.ssa] cmd/compile: move tuple selectors to generator's block in CSE
Cherry Zhang [Tue, 14 Jun 2016 15:18:39 +0000 (11:18 -0400)]
[dev.ssa] cmd/compile: move tuple selectors to generator's block in CSE

CSE may substitute a tuple generator with another one in a different
block. In this case, since we want tuple selectors to stay together
with the tuple generator, copy the selector to the new generator's
block and rewrite its use.

Op.isTupleGenerator and Op.isTupleSelector are introduced to assert
tuple ops. Use it in tighten as well.

Updates #15365.

Change-Id: Ia9e8c734b9cc3bc9fca4a2750041eef9cdfac5a5
Reviewed-on: https://go-review.googlesource.com/24137
Reviewed-by: David Chase <drchase@google.com>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>

7 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>
7 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>
7 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>
7 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>

7 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>
7 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>
7 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>