]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
8 years agoMerge "[dev.ssa] Merge remote-tracking branch 'origin/master' into mergebranch" into...
Gerrit Code Review [Thu, 11 Feb 2016 21:32:48 +0000 (21:32 +0000)]
Merge "[dev.ssa] Merge remote-tracking branch 'origin/master' into mergebranch" into dev.ssa

8 years ago[dev.ssa] cmd/compile: remove redundant compare ops
Keith Randall [Fri, 5 Feb 2016 02:02:03 +0000 (18:02 -0800)]
[dev.ssa] cmd/compile: remove redundant compare ops

Flagalloc was recalculating flags is some situations
when it didn't need to.  Fixed by using the same name
for the original flag calculation instruction throughout.

Change-Id: Ic0bf58f728a8d87748434dd25a67b0708755e1f8
Reviewed-on: https://go-review.googlesource.com/19237
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 years ago[dev.ssa] Merge remote-tracking branch 'origin/master' into mergebranch
Keith Randall [Tue, 9 Feb 2016 20:28:02 +0000 (12:28 -0800)]
[dev.ssa] Merge remote-tracking branch 'origin/master' into mergebranch

Semi-regular merge from tip to dev.ssa.

Two fixes:
1) Mark selectgo as not returning.  This caused problems
   because there are no VARKILL ops on the selectgo path,
   causing things to be marked live that shouldn't be.
2) Tell the amd64 assembler that addressing modes like
   name(SP)(AX*4) are ok.

Change-Id: I9ca81c76391b1a65cc47edc8610c70ff1a621913

8 years ago[dev.ssa] cmd/compile/internal/ssa: more simplifications and normalization
Alexandru Moșoi [Tue, 9 Feb 2016 18:13:43 +0000 (19:13 +0100)]
[dev.ssa] cmd/compile/internal/ssa: more simplifications and normalization

Found by inspecting random generated code.

Change-Id: I57d0fed7c3a8dc91fd13cdccb4819101f9976ec9
Reviewed-on: https://go-review.googlesource.com/19413
Reviewed-by: Keith Randall <khr@golang.org>
8 years ago[dev.ssa] cmd/compile/internal/ssa: handle rewrite of Phis.
Alexandru Moșoi [Tue, 9 Feb 2016 18:46:26 +0000 (19:46 +0100)]
[dev.ssa] cmd/compile/internal/ssa: handle rewrite of Phis.

* Phis can have variable number of arguments, but rulegen assumed that
each operation has fixed number of arguments.
* Rewriting Phis is necessary to handle the following case:

func f1_ssa(a bool, x int) int {
        v := 0
        if a {
                v = -1
        } else {
                v = -1
        }
        return x|v
}

Change-Id: Iff6bd411b854f3d1d6d3ce21934bf566757094f2
Reviewed-on: https://go-review.googlesource.com/19412
Reviewed-by: Keith Randall <khr@golang.org>
8 years ago[dev.ssa] cmd/compile: split decompose pass in two
Keith Randall [Mon, 8 Feb 2016 19:00:43 +0000 (11:00 -0800)]
[dev.ssa] cmd/compile: split decompose pass in two

A first pass to decompose user types (structs, maybe
arrays someday), and a second pass to decompose builtin
types (strings, interfaces, slices, complex).  David wants
this for value range analysis so he can have structs decomposed
but slices and friends will still be intact and he can deduce
things like the length of a slice is >= 0.

Change-Id: Ia2300d07663329b51ed6270cfed21d31980daa7c
Reviewed-on: https://go-review.googlesource.com/19340
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: David Chase <drchase@google.com>
8 years ago[dev.ssa] cmd/compile: add test to detect cse bug
Todd Neal [Tue, 9 Feb 2016 00:06:12 +0000 (18:06 -0600)]
[dev.ssa] cmd/compile: add test to detect cse bug

Adds a test to detect the bug that slipped in earlier when partioning
by the Aux value, but not sorting by it.

Change-Id: I56d0ba76383bbc1514b3dabd295e369771c26645
Reviewed-on: https://go-review.googlesource.com/19382
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 years agonet/http: make ListenAndServeTLS treat GetCertificate as a set cert too
Brad Fitzpatrick [Mon, 8 Feb 2016 23:23:36 +0000 (23:23 +0000)]
net/http: make ListenAndServeTLS treat GetCertificate as a set cert too

ListenAndServeTLS doesn't require cert and key file names if the
server's TLSConfig has a cert configured. This code was never updated
when the GetCertificate hook was added to *tls.Config, however.

Fixes #14268

Change-Id: Ib282ebb05697edd37ed8ff105972cbd1176d900b
Reviewed-on: https://go-review.googlesource.com/19381
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agogo/constant: fix String() implementation
Robert Griesemer [Mon, 8 Feb 2016 22:50:45 +0000 (14:50 -0800)]
go/constant: fix String() implementation

Fixes #14262.

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

8 years agoruntime: fix comment
Brad Fitzpatrick [Mon, 8 Feb 2016 21:10:18 +0000 (21:10 +0000)]
runtime: fix comment

Fixes #14259

Change-Id: I23fedec0eb85ae28e56bc24539bc864674856130
Reviewed-on: https://go-review.googlesource.com/19318
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years ago[dev.ssa] cmd/compile: use INC/DEC instead of add when we can
Ilya Tocar [Fri, 5 Feb 2016 16:24:53 +0000 (19:24 +0300)]
[dev.ssa] cmd/compile: use INC/DEC instead of add when we can

INC/DEC produces slightly faster and smaller code.

Change-Id: I329d9bdb01b90041be45e053d9df640818bf0c2d
Reviewed-on: https://go-review.googlesource.com/19238
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 years ago[dev.ssa] cmd/compile/internal/ssa/gen: constant fold Neg*.
Alexandru Moșoi [Mon, 8 Feb 2016 17:55:56 +0000 (18:55 +0100)]
[dev.ssa] cmd/compile/internal/ssa/gen: constant fold Neg*.

Change-Id: Id51e5c97e9653b764b809bf3424f1a6d31b6ffea
Reviewed-on: https://go-review.googlesource.com/19338
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: David Chase <drchase@google.com>
8 years ago[dev.ssa] cmd/compile: fix for bug in cse speed improvements
David Chase [Mon, 8 Feb 2016 17:07:39 +0000 (12:07 -0500)]
[dev.ssa] cmd/compile: fix for bug in cse speed improvements

Problem was caused by use of Args[].Aux differences
in early partitioning.  This artificially separated
two equivalent expressions because sort ignores the
Aux field, hence things can end with equal things
separated by unequal things and thus the equal things
are split into more than one partition.  For example:
SliceLen(a), SliceLen(b), SliceLen(a).

Fix: don't use Args[].Aux in initial partitioning.

Left in a debugging flag and some debugging Fprintf's;
not sure if that is house style or not.  We'll probably
want to be more systematic in our naming conventions,
e.g. ssa.cse, ssa.scc, etc.

Change-Id: Ib1412539cc30d91ea542c0ac7b2f9b504108ca7f
Reviewed-on: https://go-review.googlesource.com/19316
Reviewed-by: Keith Randall <khr@golang.org>
8 years agogo/types: make sure constants valid in integer operations are in integer form
Robert Griesemer [Fri, 5 Feb 2016 23:23:47 +0000 (15:23 -0800)]
go/types: make sure constants valid in integer operations are in integer form

The operation where this manifested in a crash was % (only defined on integers).
However, the existing code was sloppy in that it didn't retain the integer form
after a value (e.g., 3.0) was accepted as representable in integer form (3 for
the example). We would have seen a crash in such cases for / as well except
that there was code to fix it for just that case.

Remove the special code for / and fix more generally by retaining the integer
form for all operations if applicable.

Fixes #14229.

Change-Id: I8bef769e6299839fade27c6e8b5ff29ad6521d0d
Reviewed-on: https://go-review.googlesource.com/19300
Reviewed-by: Alan Donovan <adonovan@google.com>
8 years ago[dev.ssa] cmd/compile: speed up cse
Todd Neal [Sun, 7 Feb 2016 02:56:50 +0000 (20:56 -0600)]
[dev.ssa] cmd/compile: speed up cse

Examine both Aux and AuxInt to form more precise initial partitions.
Restructure loop to avoid repeated type.Equal() call.  Speeds up
compilation of testdata/gen/arithConst_ssa by 25%.

Change-Id: I3cfb1d254adf0601ee69239e1885b0cf2a23575b
Reviewed-on: https://go-review.googlesource.com/19313
Run-TryBot: Todd Neal <todd@tneal.org>
Reviewed-by: Keith Randall <khr@golang.org>
8 years ago[dev.ssa] cmd/compile: panic doesn't return
Keith Randall [Sun, 7 Feb 2016 06:35:34 +0000 (22:35 -0800)]
[dev.ssa] cmd/compile: panic doesn't return

Panic doesn't return, so record that we immediately exit after a panic
call.  This will help code analysis.

Change-Id: I4d1f67494f97b6aee130c43ff4e44307b2b0f149
Reviewed-on: https://go-review.googlesource.com/19303
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 years agoruntime: don't call testing.Fatal from worker goroutines
Mikio Hara [Fri, 5 Feb 2016 00:37:13 +0000 (09:37 +0900)]
runtime: don't call testing.Fatal from worker goroutines

Change-Id: I630d4d2d8a914d6c07f22351a56d5e44a937123e
Reviewed-on: https://go-review.googlesource.com/19245
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet/http: deflake TestCloseNotifierPipelined
Ian Lance Taylor [Fri, 5 Feb 2016 22:59:46 +0000 (14:59 -0800)]
net/http: deflake TestCloseNotifierPipelined

The test sends two HTTP/1.1 pipelined requests.  The first is
completedly by the second, and as such triggers an immediate call to the
CloseNotify channel.  The second calls the CloseNotify channel after the
overall connection is closed.

The test was passing fine on gc because the code would enter the select
loop before running the handler, so the send on gotReq would always be
seen first.  On gccgo the code would sometimes enter the select loop
after the handler had already finished, meaning that the select could
choose between gotReq and sawClose.  If it picked sawClose, it would
never close the overall connection, and the httptest server would hang.
The same hang could be induced with gc by adding a time.Sleep
immediately before the select loop.

Deflake the test by 1) don't close the overall connection until both
requests have been seen; 2) don't exit the loop until both closes have
been seen.

Fixes #14231.

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

8 years ago[dev.ssa] cmd/compile: strength-reduce 64-bit constant divides
Keith Randall [Sat, 6 Feb 2016 04:26:18 +0000 (20:26 -0800)]
[dev.ssa] cmd/compile: strength-reduce 64-bit constant divides

The frontend does this for 32 bits and below, but SSA needs
to do it for 64 bits.  The algorithms are all copied from
cgen.go:cgen_div.

Speeds up TimeFormat substantially: ~40% slower to ~10% slower.

Change-Id: I023ea2eb6040df98ccd9105e15ca6ea695610a7a
Reviewed-on: https://go-review.googlesource.com/19302
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
8 years agonet/http: fix doc typo
Brad Fitzpatrick [Fri, 5 Feb 2016 15:05:35 +0000 (15:05 +0000)]
net/http: fix doc typo

Change-Id: I93201fa4152f2d60b3eedb8d321a152819033121
Reviewed-on: https://go-review.googlesource.com/19270
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years ago[dev.ssa] cmd/compile: reorg write barriers a bit
Keith Randall [Sat, 30 Jan 2016 05:57:57 +0000 (21:57 -0800)]
[dev.ssa] cmd/compile: reorg write barriers a bit

Use just a single write barrier flag test, even if there
are multiple pointer fields in a struct.

This helps move more of the wb-specific code (like the LEA
needed to materialize the write address) into the unlikely path.

Change-Id: Ic7a67145904369c4ff031e464d51267d71281c8f
Reviewed-on: https://go-review.googlesource.com/19085
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 years agonet/http: update bundled http2
Brad Fitzpatrick [Fri, 5 Feb 2016 01:44:52 +0000 (01:44 +0000)]
net/http: update bundled http2

Updates x/net/http2 to git rev 493a262 for https://golang.org/cl/19223

Fixes #14227

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

8 years ago[dev.ssa] cmd/compile: add store constant indexed operations
Keith Randall [Thu, 4 Feb 2016 23:53:33 +0000 (15:53 -0800)]
[dev.ssa] cmd/compile: add store constant indexed operations

Change-Id: Ifb8eba1929c79ee7a8cae2191613c55a3b8f74e5
Reviewed-on: https://go-review.googlesource.com/19236
Reviewed-by: Todd Neal <todd@tneal.org>
8 years agonet/http: document Request.Header and Request.Close more
Brad Fitzpatrick [Thu, 4 Feb 2016 19:40:38 +0000 (19:40 +0000)]
net/http: document Request.Header and Request.Close more

Updates #14227

Change-Id: If39f11471ecd307c9483f64e73f9c89fe906ae71
Reviewed-on: https://go-review.googlesource.com/19222
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years ago[dev.ssa] cmd/compile: Use ADD instead of LEA when we can
Keith Randall [Thu, 4 Feb 2016 23:08:47 +0000 (15:08 -0800)]
[dev.ssa] cmd/compile: Use ADD instead of LEA when we can

If the output register is one of the input registers,
we can use a real add instead of LEA.

Change-Id: Ide58f1536afb077c0b939d3a8c7555807fd1c5e3
Reviewed-on: https://go-review.googlesource.com/19234
Reviewed-by: Alexandru Moșoi <alexandru@mosoi.ro>
8 years agoruntime: don't expose stack buffer in stringto{byte,rune}slice
Keith Randall [Thu, 4 Feb 2016 21:38:38 +0000 (13:38 -0800)]
runtime: don't expose stack buffer in stringto{byte,rune}slice

When using a stack-allocated buffer for the result, don't
expose the uninitialized portion of it by restricting its
capacity to its length.

The other option is to zero the portion between len and cap.
That seems like more work, but might be worth it if the caller
then appends some stuff to the result.  But this close to 1.6,
I'm inclined to do the simplest fix possible.

Fixes #14232

Change-Id: I21c50d3cda02fd2df4d60ba5e2cfe2efe272f333
Reviewed-on: https://go-review.googlesource.com/19231
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agodoc: rewrite references to plan9.bell-labs.com to 9p.io
Andrew Gerrand [Thu, 4 Feb 2016 22:43:46 +0000 (09:43 +1100)]
doc: rewrite references to plan9.bell-labs.com to 9p.io

The plan9.bell-labs.com site has fallen into disrepair.
We'll instead use the site maintained by contributor David du Colombier.

Fixes #14233

Change-Id: I0c702e5d3b091cccd42b288ea32f34d507a4733d
Reviewed-on: https://go-review.googlesource.com/19240
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
8 years ago[dev.ssa] cmd/compile/internal/ssa/gen: enclose rules' code in a for loop
Alexandru Moșoi [Thu, 4 Feb 2016 18:52:10 +0000 (19:52 +0100)]
[dev.ssa] cmd/compile/internal/ssa/gen: enclose rules' code in a for loop

* Enclose each rule's code in a for with no condition
* The loop is ran at most once because it's always terminated by a return.
* Use break when matching condition fails
* Drop rule hashes
* Shaves about 3 lines of code per rule

The binary size is not afected.

Change-Id: I27c3e40dc8cae98dcd50739342dc38db2ef9c247
Reviewed-on: https://go-review.googlesource.com/19220
Reviewed-by: Keith Randall <khr@golang.org>
8 years ago[dev.ssa] cmd/compile: more combining of ops into instructions
Keith Randall [Tue, 2 Feb 2016 19:13:50 +0000 (11:13 -0800)]
[dev.ssa] cmd/compile: more combining of ops into instructions

Mostly indexed loads.  A few more LEA cases.

Change-Id: Idc1d447ed0dd6e906cd48e70307a95e77f61cf5f
Reviewed-on: https://go-review.googlesource.com/19172
Reviewed-by: Todd Neal <todd@tneal.org>
Run-TryBot: Keith Randall <khr@golang.org>

8 years ago[dev.ssa] cmd/internal/obj/x86: don't clobber flags with dynlink rewrite
Keith Randall [Thu, 4 Feb 2016 19:21:31 +0000 (11:21 -0800)]
[dev.ssa] cmd/internal/obj/x86: don't clobber flags with dynlink rewrite

LEAQ symbol+100(SB), AX

Under dynamic link, rewrites to

MOVQ symbol@GOT(SB), AX
ADDQ $100, AX

but ADDQ clobbers flags, whereas the original LEAQ (when not dynamic
linking) doesn't.

Use LEAQ instead of ADDQ to add that constant in so we preserve flags.

Change-Id: Ibb055403d94a4c5163e1c7d2f45da633ffd0b6a3
Reviewed-on: https://go-review.googlesource.com/19230
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years ago[dev.ssa] cmd/compile/internal/ssa/gen: move variable reset code into a function
Alexandru Moșoi [Thu, 4 Feb 2016 16:21:57 +0000 (17:21 +0100)]
[dev.ssa] cmd/compile/internal/ssa/gen: move variable reset code into a function

Shaves about 3 lines per generated rule.

Change-Id: I94adc94ab79f90ac5fd033f896ece3b1eddf0f3d
Reviewed-on: https://go-review.googlesource.com/19197
Reviewed-by: Keith Randall <khr@golang.org>
8 years ago[dev.ssa] cmd/compile: rewrites for constant shifts
Todd Neal [Wed, 3 Feb 2016 11:21:24 +0000 (06:21 -0500)]
[dev.ssa] cmd/compile: rewrites for constant shifts

Add rewrite rules to optimize constant shifts.

Fixes #10637

Change-Id: I74b724d3e81aeb7098c696d02c050f7fdfd5b523
Reviewed-on: https://go-review.googlesource.com/19106
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years ago[dev.ssa] src/cmd/compile/internal/ssa/gen: detect type earlier when generating rules.
Alexandru Moșoi [Wed, 3 Feb 2016 19:50:12 +0000 (20:50 +0100)]
[dev.ssa] src/cmd/compile/internal/ssa/gen: detect type earlier when generating rules.

Removes approx. one assignment per rule.

Change-Id: Ie9f0a7082ae12c4447ff6b4d40678cd92bdbb6f2
Reviewed-on: https://go-review.googlesource.com/19194
Reviewed-by: Keith Randall <khr@golang.org>
8 years ago[dev.ssa] cmd/compile/internal/ssa: simplify comparisons with constants
Alexandru Moșoi [Wed, 3 Feb 2016 18:43:46 +0000 (19:43 +0100)]
[dev.ssa] cmd/compile/internal/ssa: simplify comparisons with constants

* Simplify comparisons of form a + const1 == const2 or a + const1 != const2.
* Canonicalize Eq, Neq, Add, Sub to have a constant as first argument.
Needed for the above new rules and helps constant folding.

Change-Id: I8078702a5daa706da57106073a3e9f640a67f486
Reviewed-on: https://go-review.googlesource.com/19192
Reviewed-by: Keith Randall <khr@golang.org>
8 years ago[dev.ssa] cmd/compile: use sparsetree in checkFunc
Todd Neal [Thu, 4 Feb 2016 02:06:21 +0000 (21:06 -0500)]
[dev.ssa] cmd/compile: use sparsetree in checkFunc

Modify the simple domCheck to use the sparse tree code.  This
speeds up compilation of one of the generated test cases from
1m48s to 17s.

Change-Id: If577410ee77b54918147a66917a8e3721297ee0a
Reviewed-on: https://go-review.googlesource.com/19187
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
8 years agoruntime: skip TestSignalExitStatus on Solaris
Ian Lance Taylor [Thu, 4 Feb 2016 05:49:45 +0000 (21:49 -0800)]
runtime: skip TestSignalExitStatus on Solaris

Update #14063.

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

8 years agodoc: correct old function names in strconv comments in go1.6 doc
Ian Lance Taylor [Thu, 4 Feb 2016 02:56:24 +0000 (18:56 -0800)]
doc: correct old function names in strconv comments in go1.6 doc

Fixes #14219.

Change-Id: Id398dcfe6e9978d7eefddcdaaaa2256c16237cf3
Reviewed-on: https://go-review.googlesource.com/19207
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
8 years ago[dev.ssa] cmd/compile: remove dead code
Todd Neal [Thu, 4 Feb 2016 00:27:43 +0000 (19:27 -0500)]
[dev.ssa] cmd/compile: remove dead code

Change-Id: I1738e3af7de0972c54d74325d80781059d0796d8
Reviewed-on: https://go-review.googlesource.com/19186
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
8 years agonet/http/httputil: also remove non-standard Proxy-Connection hop-by-hop header
Brad Fitzpatrick [Wed, 3 Feb 2016 21:35:03 +0000 (21:35 +0000)]
net/http/httputil: also remove non-standard Proxy-Connection hop-by-hop header

libcurl sends this (despite never being standardized), and the Google
GFE rejects it with a 400 bad request (but only when over http2?).

So nuke it.

Change-Id: I3fc95523d50f33a0e23bb26b9195f70ab0aed0f4
Reviewed-on: https://go-review.googlesource.com/19184
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

8 years agosync: deflake TestWaitGroupMisuse3
Brad Fitzpatrick [Wed, 3 Feb 2016 16:58:43 +0000 (16:58 +0000)]
sync: deflake TestWaitGroupMisuse3

Previous flakes:
https://build.golang.org/log/223365dedb6b6aa0cfdf5afd0a50fd433a16bade
https://build.golang.org/log/edbea4cd3f24e707ef2ae8378559bb0fcc453c22

Dmitry says in email about this:

> The stack trace points to it pretty clearly. Done can indeed unblock
> Wait first and then panic. I guess we need to recover after first
> Done as well.

And it looks like TestWaitGroupMisuse2 was already hardened against
this.  Do the same in TestWaitGroupMisuse3.

Change-Id: I317800c7e46f13c97873f0873c759a489dd5f47d
Reviewed-on: https://go-review.googlesource.com/19183
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/go: fix rebuild after installation of new Go release
Russ Cox [Tue, 2 Feb 2016 14:19:47 +0000 (09:19 -0500)]
cmd/go: fix rebuild after installation of new Go release

The loading of zversion.go was expecting it to be in
package runtime, but it moved to runtime/internal/sys.
Worse, the load was not checking the error.

Update the path, check the error, add a test.

Fixes #14176.

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

8 years agocmd/vet: don't crash in cgo checker if type is unknown
Ian Lance Taylor [Tue, 2 Feb 2016 21:23:32 +0000 (13:23 -0800)]
cmd/vet: don't crash in cgo checker if type is unknown

Fixes #14201.

Change-Id: Ib61f8c00cae72463f59b90ae199fbdc1e7422a79
Reviewed-on: https://go-review.googlesource.com/19174
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agomisc: update timezone database to IANA 2016a
Rob Pike [Tue, 2 Feb 2016 21:46:49 +0000 (13:46 -0800)]
misc: update timezone database to IANA 2016a

Fixes #14202

Change-Id: Ia6dccecb1b9b3f6c0838c99090e6ddf1ad43303c
Reviewed-on: https://go-review.googlesource.com/19175
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/go: document that -msan requires clang
Russ Cox [Tue, 2 Feb 2016 03:07:06 +0000 (22:07 -0500)]
cmd/go: document that -msan requires clang

Fixes #14171.

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

8 years agoruntime/pprof: mark dragonfly and solaris as bad at pprof
Brad Fitzpatrick [Tue, 2 Feb 2016 17:34:48 +0000 (17:34 +0000)]
runtime/pprof: mark dragonfly and solaris as bad at pprof

Updates #13841

Change-Id: I121bce054e2756c820c76444e51357f474b7f3d6
Reviewed-on: https://go-review.googlesource.com/19161
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agonet/http/httputil: fix spelling of Trailer hop-by-hop header per errata
Brad Fitzpatrick [Mon, 1 Feb 2016 15:58:34 +0000 (15:58 +0000)]
net/http/httputil: fix spelling of Trailer hop-by-hop header per errata

RFC Errata 4522 (http://www.rfc-editor.org/errata_search.php?eid=4522)
notes that RFC 2616 had a typo in a list of headers that the
httputil.ReverseProxy code copied. Fix the typo in our code.

Fixes #14174

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

8 years ago[dev.ssa] cmd/compile: cache sparse sets in Config
Todd Neal [Tue, 2 Feb 2016 11:35:34 +0000 (06:35 -0500)]
[dev.ssa] cmd/compile: cache sparse sets in Config

Move the cached sparse sets to the Config.  I tested make.bash with
pre-allocating sets of size 150 and not caching very small sets, but the
difference between this implementation (no min size, no preallocation)
and a min size with preallocation was fairly negligible:

Number of sparse sets allocated:
Cached in Config w/none preallocated no min size    3684 *this CL*
Cached in Config w/three preallocated no min size   3370
Cached in Config w/three preallocated min size=150  3370
Cached in Config w/none preallocated min size=150  15947
Cached in Func,  w/no min                          96996 *previous code*

Change-Id: I7f9de8a7cae192648a7413bfb18a6690fad34375
Reviewed-on: https://go-review.googlesource.com/19152
Reviewed-by: Keith Randall <khr@golang.org>
8 years agonet/http: mark TestTLSServerClosesConnection as flaky on all systems
Brad Fitzpatrick [Tue, 2 Feb 2016 16:05:47 +0000 (16:05 +0000)]
net/http: mark TestTLSServerClosesConnection as flaky on all systems

Fixes #14195

Change-Id: I245b3ca3fd7d1a76aa95f2e058f8432ba5ce31ee
Reviewed-on: https://go-review.googlesource.com/19160
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoarchive/zip: handle pre-zip64 zip files containing 2³²-1-byte content
Russ Cox [Tue, 2 Feb 2016 03:02:52 +0000 (22:02 -0500)]
archive/zip: handle pre-zip64 zip files containing 2³²-1-byte content

This corrects a regression from Go 1.5 introduced by CL 18317.

Fixes #14185.

Change-Id: Ic3215714846d9f28809cd04e3eb3664b599244f4
Reviewed-on: https://go-review.googlesource.com/19151
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/go: avoid use of git -C, which does not exist in RHEL 7
Russ Cox [Tue, 2 Feb 2016 15:10:27 +0000 (10:10 -0500)]
cmd/go: avoid use of git -C, which does not exist in RHEL 7

Tested manually with "go test -run TestGetSubmodules".

Fixes #14194.

Change-Id: I4f563b2b8a38f3040d7631f74a7908ab65e0860b
Reviewed-on: https://go-review.googlesource.com/19154
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime: deflake TestGoroutineProfileTrivial
Russ Cox [Tue, 2 Feb 2016 15:15:34 +0000 (10:15 -0500)]
runtime: deflake TestGoroutineProfileTrivial

Failed at https://storage.googleapis.com/go-build-log/9875de36/nacl-amd64p32_931ba6cf.log

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

8 years ago[dev.ssa] cmd/compile: add aux typing, flags to ops
Keith Randall [Sun, 31 Jan 2016 19:39:39 +0000 (11:39 -0800)]
[dev.ssa] cmd/compile: add aux typing, flags to ops

Add the aux type to opcodes.
Add rematerializeable as a flag.

Change-Id: I906e19281498f3ee51bb136299bf26e13a54b2ec
Reviewed-on: https://go-review.googlesource.com/19088
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
8 years ago[dev.ssa] cmd/compile: reducing alloc footprint of dominator calc
David Chase [Sat, 30 Jan 2016 22:37:38 +0000 (17:37 -0500)]
[dev.ssa] cmd/compile: reducing alloc footprint of dominator calc

Converted working slices of pointer into slices of pointer
index.  Half the size (on 64-bit machine) and no pointers
to trace if GC occurs while they're live.

TODO - could expose slice mapping ID->*Block; some dom
clients also construct these.

Minor optimization in regalloc that cuts allocation count.

Minor optimization in compile.go that cuts calls to Sprintf.

Change-Id: I28f0bfed422b7344af333dc52ea272441e28e463
Reviewed-on: https://go-review.googlesource.com/19104
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
8 years agoruntime: start an M when handing off a P when there's GC work
Austin Clements [Mon, 1 Feb 2016 19:06:51 +0000 (14:06 -0500)]
runtime: start an M when handing off a P when there's GC work

Currently it's possible for the scheduler to deadlock with the right
confluence of locked Gs, assists, and scheduling of background mark
workers. Broadly, this happens because handoffp is stricter than
findrunnable, and if the only work for a P is GC work, handoffp will
put the P into idle, rather than starting an M to execute that P. One
way this can happen is as follows:

0. There is only one user G, which we'll call G 1. There is more than
   one P, but they're all idle except the one running G 1.

1. G 1 locks itself to an M using runtime.LockOSThread.

2. GC starts up and enters mark 1.

3. G 1 performs a GC assist, which completes mark 1 without being
   fully satisfied. Completing mark 1 causes all background mark
   workers to park. And since the assist isn't fully satisfied, it
   parks as well, waiting for a background mark worker to satisfy its
   remaining assist debt.

4. The assist park enters the scheduler. Since G 1 is locked to the M,
   the scheduler releases the P and calls handoffp to hand the P to
   another M.

5. handoffp checks the local and global run queues, which are empty,
   and sees that there are idle Ps, so rather than start an M, it puts
   the P into idle.

At this point, all of the Gs are waiting and all of the Ps are idle.
In particular, none of the GC workers are running, so no mark work
gets done and the assist on the main G is never satisfied, so the
whole process soft locks up.

Fix this by making handoffp start an M if there is GC work. This
reintroduces a key invariant: that in any situation where findrunnable
would return a G to run on a P, handoffp for that P will start an M to
run work on that P.

Fixes #13645.

Tested by running 2,689 iterations of `go tool dist test -no-rebuild
runtime:cpu124` across 10 linux-amd64-noopt VMs with no failures.
Without this change, the failure rate was somewhere around 1%.

Performance change is negligible.

name              old time/op  new time/op  delta
XBenchGarbage-12  2.48ms ± 2%  2.48ms ± 1%  -0.24%  (p=0.000 n=92+93)

name                      old time/op    new time/op    delta
BinaryTree17-12              2.86s ± 2%     2.87s ± 2%    ~     (p=0.667 n=19+20)
Fannkuch11-12                2.52s ± 1%     2.47s ± 1%  -2.05%  (p=0.000 n=18+20)
FmtFprintfEmpty-12          51.7ns ± 1%    51.5ns ± 3%    ~     (p=0.931 n=16+20)
FmtFprintfString-12          170ns ± 1%     168ns ± 1%  -0.65%  (p=0.000 n=19+19)
FmtFprintfInt-12             160ns ± 0%     160ns ± 0%  +0.18%  (p=0.033 n=17+19)
FmtFprintfIntInt-12          265ns ± 1%     273ns ± 1%  +2.98%  (p=0.000 n=17+19)
FmtFprintfPrefixedInt-12     235ns ± 1%     239ns ± 1%  +1.99%  (p=0.000 n=16+19)
FmtFprintfFloat-12           315ns ± 0%     315ns ± 1%    ~     (p=0.250 n=17+19)
FmtManyArgs-12              1.04µs ± 1%    1.05µs ± 0%  +0.87%  (p=0.000 n=17+19)
GobDecode-12                7.93ms ± 0%    7.85ms ± 1%  -1.03%  (p=0.000 n=16+18)
GobEncode-12                6.62ms ± 1%    6.58ms ± 1%  -0.60%  (p=0.000 n=18+19)
Gzip-12                      322ms ± 1%     320ms ± 1%  -0.46%  (p=0.009 n=20+20)
Gunzip-12                   42.5ms ± 1%    42.5ms ± 0%    ~     (p=0.751 n=19+19)
HTTPClientServer-12         69.7µs ± 1%    70.0µs ± 2%    ~     (p=0.056 n=19+19)
JSONEncode-12               16.9ms ± 1%    16.7ms ± 1%  -1.13%  (p=0.000 n=19+19)
JSONDecode-12               61.5ms ± 1%    61.3ms ± 1%  -0.35%  (p=0.001 n=20+17)
Mandelbrot200-12            3.94ms ± 0%    3.91ms ± 0%  -0.67%  (p=0.000 n=20+18)
GoParse-12                  3.71ms ± 1%    3.70ms ± 1%    ~     (p=0.244 n=17+19)
RegexpMatchEasy0_32-12       101ns ± 1%     102ns ± 2%  +0.54%  (p=0.037 n=19+20)
RegexpMatchEasy0_1K-12       349ns ± 0%     350ns ± 0%  +0.33%  (p=0.000 n=17+18)
RegexpMatchEasy1_32-12      84.5ns ± 2%    84.2ns ± 1%  -0.43%  (p=0.048 n=19+20)
RegexpMatchEasy1_1K-12       510ns ± 1%     513ns ± 2%  +0.58%  (p=0.002 n=18+20)
RegexpMatchMedium_32-12      132ns ± 1%     134ns ± 1%  +0.95%  (p=0.000 n=20+20)
RegexpMatchMedium_1K-12     40.1µs ± 1%    39.6µs ± 1%  -1.39%  (p=0.000 n=20+20)
RegexpMatchHard_32-12       2.08µs ± 0%    2.06µs ± 1%  -0.95%  (p=0.000 n=18+18)
RegexpMatchHard_1K-12       62.2µs ± 1%    61.9µs ± 1%  -0.42%  (p=0.001 n=19+20)
Revcomp-12                   537ms ± 0%     536ms ± 0%    ~     (p=0.076 n=20+20)
Template-12                 71.3ms ± 1%    69.3ms ± 1%  -2.75%  (p=0.000 n=20+20)
TimeParse-12                 361ns ± 0%     360ns ± 1%    ~     (p=0.056 n=19+19)
TimeFormat-12                353ns ± 0%     352ns ± 0%  -0.23%  (p=0.000 n=17+18)
[Geo mean]                  62.6µs         62.5µs       -0.17%

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

8 years agonet/http: update bundled http2, fix Transport memory leak
Brad Fitzpatrick [Mon, 1 Feb 2016 22:16:42 +0000 (22:16 +0000)]
net/http: update bundled http2, fix Transport memory leak

Updates x/net/http2 to git rev 644ffc for three CLs since the last update:

http2: don't add *Response to activeRes in Transport on Headers.END_STREAM
https://golang.org/cl/19134

http2: add mechanism to send undeclared Trailers mid handler
https://golang.org/cl/19131

http2: remove unused variable
https://golang.org/cl/18936

The first in the list above is the main fix that's necessary. The
other are two are in the git history but along for the cmd/bundle
ride. The middle CL is well-tested, small (mostly comments),
non-tricky, and almost never seen (since nobody really uses Trailers).
The final CL is just deleting an unused global variable.

Fixes #14084 again (with more tests)

Change-Id: Iac51350acee9c51d32bf7779d57e9d5a5482b928
Reviewed-on: https://go-review.googlesource.com/19135
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agoruntime: avoid write barrier in cgo mmap code
Ian Lance Taylor [Fri, 29 Jan 2016 23:43:24 +0000 (15:43 -0800)]
runtime: avoid write barrier in cgo mmap code

Tested by hand with a runtime/cgo modified to return an mmap failure
after 10 calls.

This is an interim patch.  For 1.7 we should fix mmap properly to avoid
using the same value as both a pointer and an errno value.

Fixes #14149.

Change-Id: I8f2bbd47d711e283001ba73296f1c34a26c59241
Reviewed-on: https://go-review.googlesource.com/19084
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/compile: fix parsing of inlined interface types with unexported methods
Robert Griesemer [Sat, 30 Jan 2016 22:29:02 +0000 (14:29 -0800)]
cmd/compile: fix parsing of inlined interface types with unexported methods

Fixes #14164.

Change-Id: Ib1d1d29674c99cf88e0ae12724823a31f5dbb95c
Reviewed-on: https://go-review.googlesource.com/19087
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years ago[dev.ssa] cmd/compile: regenerate code
Todd Neal [Mon, 1 Feb 2016 03:18:55 +0000 (21:18 -0600)]
[dev.ssa] cmd/compile: regenerate code

These changes were left out of the 1cc5789df9 commit.

Change-Id: Id7f49973da281a567b69228dbaea31846b82b4af
Reviewed-on: https://go-review.googlesource.com/19105
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
8 years ago[dev.ssa] cmd/compile: lots of small rewrite optimizations
Keith Randall [Sat, 30 Jan 2016 19:25:38 +0000 (11:25 -0800)]
[dev.ssa] cmd/compile: lots of small rewrite optimizations

Small optimizations I noticed while looking at Giovanni's test cases.

More shifts by constants.
Indexed stores for smaller types.
Fold LEA into loads/stores.
More extending loads.
CMP $0 of AND -> TEST

Fix order of TEST ops.

Giovanni's test cases at https://gist.github.com/rasky/62fba94e3a20d1b05b2a

Change-Id: I7077bc0b5319bf05767eeb39f401f4bb4b39f635
Reviewed-on: https://go-review.googlesource.com/19086
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
Reviewed-by: David Chase <drchase@google.com>
8 years ago[dev.ssa] cmd/compile: reuse sparse sets across compiler passes
Todd Neal [Fri, 29 Jan 2016 04:19:46 +0000 (22:19 -0600)]
[dev.ssa] cmd/compile: reuse sparse sets across compiler passes

Cache sparse sets in the function so they can be reused by subsequent
compiler passes.

benchmark                        old ns/op     new ns/op     delta
BenchmarkDSEPass-8               206945        180022        -13.01%
BenchmarkDSEPassBlock-8          5286103       2614054       -50.55%
BenchmarkCSEPass-8               1790277       1790655       +0.02%
BenchmarkCSEPassBlock-8          18083588      18112771      +0.16%
BenchmarkDeadcodePass-8          59837         41375         -30.85%
BenchmarkDeadcodePassBlock-8     1651575       511169        -69.05%
BenchmarkMultiPass-8             531529        427506        -19.57%
BenchmarkMultiPassBlock-8        7033496       4487814       -36.19%

benchmark                        old allocs     new allocs     delta
BenchmarkDSEPass-8               11             4              -63.64%
BenchmarkDSEPassBlock-8          599            120            -79.97%
BenchmarkCSEPass-8               18             18             +0.00%
BenchmarkCSEPassBlock-8          2700           2700           +0.00%
BenchmarkDeadcodePass-8          4              3              -25.00%
BenchmarkDeadcodePassBlock-8     30             9              -70.00%
BenchmarkMultiPass-8             24             20             -16.67%
BenchmarkMultiPassBlock-8        1800           1000           -44.44%

benchmark                        old bytes     new bytes     delta
BenchmarkDSEPass-8               221367        142           -99.94%
BenchmarkDSEPassBlock-8          3695207       3846          -99.90%
BenchmarkCSEPass-8               303328        303328        +0.00%
BenchmarkCSEPassBlock-8          5006400       5006400       +0.00%
BenchmarkDeadcodePass-8          84232         10506         -87.53%
BenchmarkDeadcodePassBlock-8     1274940       163680        -87.16%
BenchmarkMultiPass-8             608674        313834        -48.44%
BenchmarkMultiPassBlock-8        9906001       5003450       -49.49%

Change-Id: Ib1fa58c7f494b374d1a4bb9cffbc2c48377b59d3
Reviewed-on: https://go-review.googlesource.com/19100
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
8 years ago[dev.ssa] cmd/compile: exposed do-log boolean to reduce allocations
David Chase [Fri, 29 Jan 2016 19:44:15 +0000 (14:44 -0500)]
[dev.ssa] cmd/compile: exposed do-log boolean to reduce allocations

From memory profiling, about 3% reduction in allocation count.

Change-Id: I4b662d55b8a94fe724759a2b22f05a08d0bf40f8
Reviewed-on: https://go-review.googlesource.com/19103
Reviewed-by: Keith Randall <khr@golang.org>
8 years ago[dev.ssa] cmd/compile: tweak init function prologue
Keith Randall [Tue, 26 Jan 2016 23:55:05 +0000 (15:55 -0800)]
[dev.ssa] cmd/compile: tweak init function prologue

We used to compare the init state with == to 0 and 2, which
requires 2 comparisons.  Instead, compare with 1 and use
<, ==.  That requires only one comparison.

This isn't a big deal performance-wise, as it is just init
code.  But there is a fair amount of init code, so this
should help a bit with code size.

Change-Id: I4a2765f1005776f0edce28ac143f4b7596d95a68
Reviewed-on: https://go-review.googlesource.com/18948
Reviewed-by: David Chase <drchase@google.com>
8 years ago[dev.ssa] cmd/compile: prepare for some load+op combining
Keith Randall [Tue, 26 Jan 2016 23:47:08 +0000 (15:47 -0800)]
[dev.ssa] cmd/compile: prepare for some load+op combining

Rename StoreConst to ValAndOff so we can use it for other ops.
Make ValAndOff print nicely.

Add some notes & checks related to my aborted attempt to
implement combined CMP+load ops.

Change-Id: I2f901d12d42bc5a82879af0334806aa184a97e27
Reviewed-on: https://go-review.googlesource.com/18947
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: David Chase <drchase@google.com>
8 years agoos: document that FindProcess always succeeds on Unix
Brad Fitzpatrick [Fri, 29 Jan 2016 17:45:23 +0000 (17:45 +0000)]
os: document that FindProcess always succeeds on Unix

Fixes #14146

Change-Id: I892ca4ccdc1ba785750e1eae800852dc5825156c
Reviewed-on: https://go-review.googlesource.com/19093
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

8 years ago[dev.ssa] cmd/compile: fix write barriers for SSA
Keith Randall [Tue, 26 Jan 2016 01:06:54 +0000 (17:06 -0800)]
[dev.ssa] cmd/compile: fix write barriers for SSA

The old write barriers used _nostore versions, which
don't work for Ian's cgo checker.  Instead, we adopt the
same write barrier pattern as the default compiler.

It's a bit trickier to code up but should be more efficient.

Change-Id: I6696c3656cf179e28f800b0e096b7259bd5f3bb7
Reviewed-on: https://go-review.googlesource.com/18941
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 years ago[dev.ssa] cmd/compile: optimization for && and || expressions
Keith Randall [Mon, 25 Jan 2016 17:21:17 +0000 (09:21 -0800)]
[dev.ssa] cmd/compile: optimization for && and || expressions

Compiling && and || expressions often leads to control
flow of the following form:

p:
  If a goto b else c
b: <- p ...
  x = phi(a, ...)
  If x goto t else u

Note that if we take the edge p->b, then we are guaranteed
to take the edge b->t also.  So in this situation, we might
as well go directly from p to t.

Change-Id: I6974f1e6367119a2ddf2014f9741fdb490edcc12
Reviewed-on: https://go-review.googlesource.com/18910
Reviewed-by: David Chase <drchase@google.com>
8 years agocmd/go: avoid a few symlink-induced errors in internal and vendor checks
Russ Cox [Fri, 29 Jan 2016 17:18:32 +0000 (12:18 -0500)]
cmd/go: avoid a few symlink-induced errors in internal and vendor checks

This CL expands symlinks only when an error would be reported otherwise.
Since the expansions are only on error paths, anything that worked yesterday
should still work after this CL.

This CL fixes a regression from Go 1.5 in "go run", or else we'd probably
postpone it.

Changing only the error paths is meant as a way to reduce the risk of
making this change so late in the release cycle, but it may actually be
the right strategy for symlinks in general.

Fixes #14054.

Change-Id: I42ed1276f67a0c395297a62bcec7d36c14c06404
Reviewed-on: https://go-review.googlesource.com/19102
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years ago[dev.ssa] cmd/compile: simple forward-looking register allocation tweak
Keith Randall [Tue, 19 Jan 2016 04:00:15 +0000 (20:00 -0800)]
[dev.ssa] cmd/compile: simple forward-looking register allocation tweak

For each value that needs to be in a fixed register at the end of the
block, and try to pick that fixed register when the instruction
generating that value is scheduled (or restored from a spill).

Just used for end-of-block register requirements for now.
Fixed-register instruction requirements (e.g. shift in ecx) can be
added later.  Also two-instruction constraints (input reg == output
reg) might be recorded in a similar manner.

Change-Id: I59916e2e7f73657bb4fc3e3b65389749d7a23fa8
Reviewed-on: https://go-review.googlesource.com/18774
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 years ago[dev.ssa] cmd/compile: fix -N build
Keith Randall [Fri, 29 Jan 2016 01:43:45 +0000 (17:43 -0800)]
[dev.ssa] cmd/compile: fix -N build

The OpSB hack didn't quite work.  We need to really
CSE these ops to make regalloc happy.

Change-Id: I9f4d7bfb0929407c84ee60c9e25ff0c0fbea84af
Reviewed-on: https://go-review.googlesource.com/19083
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: report uncalled functions in Printf %v
Russ Cox [Fri, 29 Jan 2016 15:16:24 +0000 (10:16 -0500)]
cmd/vet: report uncalled functions in Printf %v

Given, say, var f *os.File, a new vet check in CL 14122 diagnoses:

fmt.Printf("%s\n", f.Name)
fmt.Println(f.Name)

but not

fmt.Printf("%v\n", f.Name)

In all three cases the error is that the argument should be f.Name().

Diagnosing Println but not Printf %v seems oddly inconsistent,
so I changed %v to have the check too. In fact, all verbs now have
the check except %p and %T.

Fixes Dave Cheney's confusion when trying to write an example
of the new vet check advertised in the Go 1.6 release notes.

Change-Id: I92fa6a7a1d5d9339a6a59ae4e587a254e633f500
Reviewed-on: https://go-review.googlesource.com/19101
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
8 years agonet: deflake TestListenerClose
Mikio Hara [Thu, 28 Jan 2016 02:05:03 +0000 (11:05 +0900)]
net: deflake TestListenerClose

Fixes #14124.

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

8 years agodoc: link to block example in go1.6 doc
Andrew Gerrand [Fri, 29 Jan 2016 05:44:16 +0000 (16:44 +1100)]
doc: link to block example in go1.6 doc

Fixes #14143

Change-Id: I2d77e55bc0b6bb42e11de291e0ddb5ad5d620646
Reviewed-on: https://go-review.googlesource.com/19110
Reviewed-by: Russ Cox <rsc@golang.org>
8 years ago[dev.ssa] cmd/compile: add backing store buffers for block.{Preds,Succs,Values}
Keith Randall [Thu, 28 Jan 2016 23:54:45 +0000 (15:54 -0800)]
[dev.ssa] cmd/compile: add backing store buffers for block.{Preds,Succs,Values}

Speeds up compilation by 6%.

Change-Id: Ibaad95710323ddbe13c1b0351843fe43a48d776e
Reviewed-on: https://go-review.googlesource.com/19080
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agounsafe: fix typo in documentation of valid Pointer->uintptr->Pointer conversions
Rahul Chaudhry [Fri, 29 Jan 2016 00:33:35 +0000 (16:33 -0800)]
unsafe: fix typo in documentation of valid Pointer->uintptr->Pointer conversions

Change-Id: Ib669d5241372326a46361ee096570e960b7a957f
Reviewed-on: https://go-review.googlesource.com/19082
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years ago[dev.ssa] cmd/compile: fix build
Keith Randall [Fri, 29 Jan 2016 00:11:56 +0000 (16:11 -0800)]
[dev.ssa] cmd/compile: fix build

Some tests make multiple Funcs per Config at once.
With value & block caching, we can't do that any more.

Change-Id: Ibdb60aa2fcf478f1726b3be0fcaa06b04433eb67
Reviewed-on: https://go-review.googlesource.com/19081
Reviewed-by: Keith Randall <khr@golang.org>
8 years ago[dev.ssa] cmd/compile: preallocate small-numbered values and blocks
Keith Randall [Thu, 28 Jan 2016 21:46:30 +0000 (13:46 -0800)]
[dev.ssa] cmd/compile: preallocate small-numbered values and blocks

Speeds up the compiler ~5%.

Change-Id: Ia5cf0bcd58701fd14018ec77d01f03d5c7d6385b
Reviewed-on: https://go-review.googlesource.com/19060
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: don't imply that the new HTTP status 451 is from RFC 6585
Brad Fitzpatrick [Thu, 28 Jan 2016 20:53:41 +0000 (20:53 +0000)]
doc: don't imply that the new HTTP status 451 is from RFC 6585

From twitter bug report: https://twitter.com/ox/status/692737249411207168

Change-Id: Ic5f4eeb00d705217542db558edc25e206f6b640d
Reviewed-on: https://go-review.googlesource.com/19050
Reviewed-by: Russ Cox <rsc@golang.org>
8 years ago[dev.ssa] cmd/compile: make cse faster
Keith Randall [Thu, 28 Jan 2016 00:47:23 +0000 (16:47 -0800)]
[dev.ssa] cmd/compile: make cse faster

It is one of the slowest compiler phases right now, and we
run two of them.

Instead of using a map to make the initial partition, use a sort.
It is much less memory intensive.

Do a few optimizations to avoid work for size-1 equivalence classes.

Implement -N.

Change-Id: I1d2d85d3771abc918db4dd7cc30b0b2d854b15e1
Reviewed-on: https://go-review.googlesource.com/19024
Reviewed-by: David Chase <drchase@google.com>
8 years agoruntime: align stack in sigfwd for darwin/386
Ian Lance Taylor [Thu, 28 Jan 2016 06:00:59 +0000 (22:00 -0800)]
runtime: align stack in sigfwd for darwin/386

We might be forwarding to a C signal handler.  C code expects the stack
to be aligned.  Should fix darwin/386 build: the testcarchive tests were
hanging as the program got an endless series of SIGSEGV signals.

Change-Id: Ia02485d3736a3c40e12259f02d25f842cf8e4d29
Reviewed-on: https://go-review.googlesource.com/19025
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime: handle kindString in cgoCheckArg
Ian Lance Taylor [Wed, 27 Jan 2016 22:07:25 +0000 (14:07 -0800)]
runtime: handle kindString in cgoCheckArg

It's awkward to get a string value in cgoCheckArg, but SWIG testing
revealed that it is possible.  The new handling of extra files in the
ptr.go test emulates what SWIG does with an exported function that
returns a string.

Change-Id: I453717f867b8a49499576c28550e7c93053a0cf8
Reviewed-on: https://go-review.googlesource.com/19020
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agomisc/cgo/test: disable sigaltstack test on darwin/386
Russ Cox [Wed, 27 Jan 2016 22:24:03 +0000 (17:24 -0500)]
misc/cgo/test: disable sigaltstack test on darwin/386

It doesn't work there ("out of memory") and doesn't really matter.
Fixes build (now that we enable cgo on the darwin/386 builder.)

Change-Id: I1d91e51ecb88c54eae39ac9a76f2c0b4e45263b0
Reviewed-on: https://go-review.googlesource.com/19004
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime: deflake TestNumGoroutine
Russ Cox [Wed, 27 Jan 2016 21:21:33 +0000 (16:21 -0500)]
runtime: deflake TestNumGoroutine

Fixes #14107.

Change-Id: Icd9463b1a77b139c7ebc2d8732482d704ea332d0
Reviewed-on: https://go-review.googlesource.com/19002
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime/cgo: more +build cgo tags
Russ Cox [Wed, 27 Jan 2016 21:27:03 +0000 (16:27 -0500)]
runtime/cgo: more +build cgo tags

Followup to CL 19001.

Change-Id: I7fa838b1ee8df53229e9dd29a231c2f9b2aa3f69
Reviewed-on: https://go-review.googlesource.com/19003
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/internal/obj/x86: skip test when GOHOSTARCH is set
Brad Fitzpatrick [Wed, 27 Jan 2016 21:18:35 +0000 (13:18 -0800)]
cmd/internal/obj/x86: skip test when GOHOSTARCH is set

It's causing the darwin-386 builder to fail with:

--- FAIL: TestDynlink (0.07s)
    obj6_test.go:118: error exit status 3 output go tool: no such tool "asm"
FAIL
FAIL    cmd/internal/obj/x86    0.073s

So skip it for now. It's tested in enough other places.

Change-Id: I9a98ad7b8be807005750112d892ac6c676c17dd5
Reviewed-on: https://go-review.googlesource.com/18989
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime/cgo: add cgo build tag to C files
Russ Cox [Wed, 27 Jan 2016 20:58:52 +0000 (15:58 -0500)]
runtime/cgo: add cgo build tag to C files

This makes "CGO_ENABLED=0 go list runtime/cgo" work,
which fixes the current cmd/go test failure.

Change-Id: Ia55ce3ba1dbb09f618ae5f4c8547722670360f59
Reviewed-on: https://go-review.googlesource.com/19001
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime/race: run tests with GOMAXPROCS=1
Dmitry Vyukov [Wed, 27 Jan 2016 18:22:28 +0000 (19:22 +0100)]
runtime/race: run tests with GOMAXPROCS=1

We set GOMAXPROCS=1 to prevent test flakiness.
There are two sources of flakiness:
1. Some tests rely on particular execution order.
   If the order is different, race does not happen at all.
2. Ironically, ThreadSanitizer runtime contains a logical race condition
   that can lead to false negatives if racy accesses happen literally at the same time.
Tests used to work reliably in the good old days of GOMAXPROCS=1.
So let's set it for now. A more reliable solution is to explicitly annotate tests
with required execution order by means of a special "invisible" synchronization primitive
(that's what is done for C++ ThreadSanitizer tests). This is issue #14119.

This reduces flakes on RaceAsFunc3 test from 60/3000 to 1/3000.

Fixes #14086
Fixes #14079
Fixes #14035

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

8 years agoruntime: remove redundant empty function call from Breakpoint on arm
Richard Miller [Wed, 27 Jan 2016 19:10:11 +0000 (19:10 +0000)]
runtime: remove redundant empty function call from Breakpoint on arm

CL 18964 included an extra patch (sorry, my first experience of
git-codereview) which defined the conventional breakpoint instruction
used by Plan 9 on arm, but also introduced a benign but unneeded
call to runtime.emptyfunc.  This CL removes the redundant call again.

This completes the series of CLs which add support for Plan 9 on arm.

Change-Id: Id293cfd40557c9d79b4b6cb164ed7ed49295b178
Reviewed-on: https://go-review.googlesource.com/19010
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: mention ServeFile change in go1.6.html
Russ Cox [Wed, 27 Jan 2016 16:02:45 +0000 (11:02 -0500)]
doc: mention ServeFile change in go1.6.html

Also fix a few bad links.

Change-Id: If04cdd312db24a827a3c958a9974c50ab148656c
Reviewed-on: https://go-review.googlesource.com/18979
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/go: refine definition of 'standard' import paths to include vendored code
Russ Cox [Wed, 27 Jan 2016 15:05:18 +0000 (10:05 -0500)]
cmd/go: refine definition of 'standard' import paths to include vendored code

The vendored copy of golang.org/x/net/http/hpack was being treated
as not standard, which in turn was making it not subject to the mtime
exception for rebuilding the standard library in a release, which in turn
was making net/http look out of date.

One fix and three tests:

- Fix the definition of standard.
- Test that everything in $GOROOT/src/ is standard during 'go test cmd/go'.
(In general there can be non-standard things in $GOROOT/src/, but this
test implies that you can do that or you can run 'go test cmd/go',
but not both. That's fine.)
- Test that 'go list std cmd' shows our vendored code.
- Enforce that no standard package can depend on a non-standard one.

Also fix a few error printing nits.

Fixes #13713.

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

8 years agounsafe: clarify wording in recent Alignof changes
Ian Lance Taylor [Wed, 27 Jan 2016 17:23:48 +0000 (09:23 -0800)]
unsafe: clarify wording in recent Alignof changes

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

8 years agodoc: mention signal changes for c-archive/c-shared
Ian Lance Taylor [Wed, 27 Jan 2016 14:42:10 +0000 (06:42 -0800)]
doc: mention signal changes for c-archive/c-shared

Change-Id: Ibba7fccba9617612e026bd0a208eb12918de465a
Reviewed-on: https://go-review.googlesource.com/18985
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agonet/http: add protections against misuse of ServeFile
Brad Fitzpatrick [Tue, 26 Jan 2016 19:57:19 +0000 (19:57 +0000)]
net/http: add protections against misuse of ServeFile

Martin Lenord pointed out that bad patterns have emerged in online
examples of how to use ServeFile, where people pass r.URL.Path[1:] to
ServeFile. This is unsafe. Document that it's unsafe, and add some
protections.

Fixes #14110

Change-Id: Ifeaa15534b2b3e46d3a8137be66748afa8fcd634
Reviewed-on: https://go-review.googlesource.com/18939
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

8 years agocmd/go: recognise plan9_arm object files
Richard Miller [Wed, 27 Jan 2016 11:27:50 +0000 (11:27 +0000)]
cmd/go: recognise plan9_arm object files

Add magic word for Plan 9 ARM object header to objectMagic table.

Change-Id: I21eb8845a2ee2e8cdddc0849eedf43481aee9cde
Reviewed-on: https://go-review.googlesource.com/18963
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/link: correct byte ordering in plan9_arm object header
Richard Miller [Wed, 27 Jan 2016 11:49:58 +0000 (11:49 +0000)]
cmd/link: correct byte ordering in plan9_arm object header

Fields in Plan 9 object headers are big-endian, on all architectures.

Change-Id: If95ad29750b776338178d660646568bf26a4abda
Reviewed-on: https://go-review.googlesource.com/18964
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agounsafe: clarify that Alignof returns required alignment
Ian Lance Taylor [Wed, 27 Jan 2016 01:23:33 +0000 (17:23 -0800)]
unsafe: clarify that Alignof returns required alignment

Also document the special behavior of Alignof(s.f), and mention the
correspondence between Alignof and reflect.Type.{Align,FieldAlign}.

Change-Id: I6f81047a04c86887f1b1164473225616cae45a26
Reviewed-on: https://go-review.googlesource.com/18949
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agodatabase/sql: implement Scan of time.Time, document, clarify Scan error text
Brad Fitzpatrick [Tue, 26 Jan 2016 20:58:00 +0000 (20:58 +0000)]
database/sql: implement Scan of time.Time, document, clarify Scan error text

Fixes #9157

Change-Id: Iadf305a172a0ec53ae91e1b2db3f3351691a48ff
Reviewed-on: https://go-review.googlesource.com/18935
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agoruntime: fix upper bound on out-of-memory print
Russ Cox [Wed, 27 Jan 2016 03:13:01 +0000 (22:13 -0500)]
runtime: fix upper bound on out-of-memory print

It's possible for arena_start+MaxArena32 to wrap.
We do the right thing in the bounds check but not in the print.

For #13992 (to fix the print there, not the bug).

Change-Id: I4df845d0c03f0f35461b128e4f6765d3ccb71c6d
Reviewed-on: https://go-review.googlesource.com/18975
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
8 years agoruntime: guard against array out of bounds in GoroutineProfile
Russ Cox [Wed, 27 Jan 2016 04:00:41 +0000 (23:00 -0500)]
runtime: guard against array out of bounds in GoroutineProfile

The previous CL is the real fix. This one is just insurance.

Fixes #14046 again.

Change-Id: I553349504bb1789e4b66c888dbe4034568918ad6
Reviewed-on: https://go-review.googlesource.com/18977
Reviewed-by: Austin Clements <austin@google.com>
8 years agoruntime: fix crash in GoroutineProfile
Russ Cox [Wed, 27 Jan 2016 03:58:59 +0000 (22:58 -0500)]
runtime: fix crash in GoroutineProfile

It was just completely broken if you gave it the number
of records it asked for. Make it impossible for that particular
inconsistency to happen again.

Also make it exclude system goroutines, to match both
NumGoroutine and Stack.

Fixes #14046.

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

8 years agocmd/go: disable broken test for code.google.com
Russ Cox [Wed, 27 Jan 2016 01:03:32 +0000 (20:03 -0500)]
cmd/go: disable broken test for code.google.com

For Go 1.7 we can remove all the code.google.com code
(except maybe the shutdown warning).

See #10193.

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