1
0
mirror of https://github.com/golang/go synced 2024-11-06 08:26:12 -07:00
Commit Graph

31509 Commits

Author SHA1 Message Date
Patrick Pelletier
1ef3a77e18 mime/multipart: allow boundary len <= 70
As per RFC 2046, the boundary for multipart MIME is allowed up to 70
characters. The old SetBoundary implementation only allowed up to 69 so
this bumps it to the correct value of 70.

The relevant RFC is at https://www.ietf.org/rfc/rfc2046.txt and section
5.1.1 defines the boundary specification.

Fixes #18793

Change-Id: I91d2ed4549c3d27d6049cb473bac680a750fb520
Reviewed-on: https://go-review.googlesource.com/35830
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-01 21:06:49 +00:00
Kevin Burke
ec4062f8ea database/sql: fix spelling mistake
Change-Id: I67db3b342929a7bd11f01bf3b9afb49f4da69a0a
Reviewed-on: https://go-review.googlesource.com/35841
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-01 21:06:35 +00:00
Josh Bleecher Snyder
a246f61637 cmd/compile: report more non-inlineable functions
Many non-inlineable functions were not being
reported in '-m -m' mode.

Updates #17858.

Change-Id: I7d96361b39dd317f5550e57334a8a6dd1a836598
Reviewed-on: https://go-review.googlesource.com/32971
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-02-01 20:34:34 +00:00
Michael Munday
457ac38e7a cmd/compile: fix generic.rules
generic.rules wasn't updated when rewritegeneric.go was. This commit
updates it so that the rewritegeneric.go file can be regenerated.

Fixes #18885.

Change-Id: Ie7dab653ca0a9ea1c255fd12e311a0d9e66afdd2
Reviewed-on: https://go-review.googlesource.com/36032
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2017-02-01 20:27:12 +00:00
Matthew Dempsky
166b1219b8 cmd/compile: allocate Nodes together with Name/Param/Func
After allocating a Node that needs a Name, Param, and/or Func field,
we never clear that field, so we can reduce GC overhead slightly by
allocating them together with the owner Node.

name       old time/op     new time/op     delta
Template       325ms ± 7%      325ms ± 7%    ~           (p=0.910 n=29+30)
Unicode        177ms ±12%      173ms ±11%    ~           (p=0.110 n=29+30)
GoTypes        1.06s ± 7%      1.05s ± 5%  -1.22%        (p=0.027 n=30+30)
Compiler       4.48s ± 3%      4.47s ± 3%    ~           (p=0.423 n=30+30)

name       old user-ns/op  new user-ns/op  delta
Template        476M ±22%       467M ±14%    ~           (p=0.310 n=29+30)
Unicode         298M ±22%       294M ±25%    ~           (p=0.335 n=30+30)
GoTypes        1.54G ± 9%      1.48G ± 9%  -4.06%        (p=0.000 n=30+30)
Compiler       6.26G ± 6%      6.14G ± 6%  -1.90%        (p=0.004 n=30+30)

name       old alloc/op    new alloc/op    delta
Template      40.9MB ± 0%     41.1MB ± 0%  +0.53%        (p=0.000 n=30+30)
Unicode       30.9MB ± 0%     31.0MB ± 0%  +0.16%        (p=0.000 n=30+30)
GoTypes        122MB ± 0%      123MB ± 0%  +0.37%        (p=0.000 n=30+30)
Compiler       477MB ± 0%      479MB ± 0%  +0.37%        (p=0.000 n=30+29)

name       old allocs/op   new allocs/op   delta
Template        400k ± 1%       376k ± 1%  -5.96%        (p=0.000 n=30+30)
Unicode         330k ± 1%       325k ± 1%  -1.48%        (p=0.000 n=30+30)
GoTypes        1.22M ± 0%      1.16M ± 0%  -4.38%        (p=0.000 n=30+30)
Compiler       4.35M ± 0%      4.13M ± 0%  -5.08%        (p=0.000 n=30+29)

Change-Id: I9bdc7d9223bb32f785df71810564e82d9a76d109
Reviewed-on: https://go-review.googlesource.com/36022
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-01 20:26:08 +00:00
Matthew Dempsky
b761b07bf9 cmd/compile: simplify noding const declarations
By grouping all the logic into constDecl, we're able to get rid of the
lastconst and lasttype globals, and simplify the logic slightly. Still
clunky, but much easier to reason about.

Change-Id: I446696c31084b3bfc1fd5d3651655a81ddd159ab
Reviewed-on: https://go-review.googlesource.com/36023
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-01 20:25:37 +00:00
Josh Bleecher Snyder
1cbc5aa529 cmd/compile: insertVarPhis micro-optimization
Algorithmic improvements here are hard.
Lifting a lookup out of the loop helps a little, though.

To compile the code in #17926:

name  old s/op   new s/op   delta
Real   146 ± 3%   140 ± 4%  -3.87%  (p=0.002 n=10+10)
User   143 ± 3%   139 ± 4%  -3.08%  (p=0.005 n=10+10)
Sys   8.28 ±35%  8.08 ±28%    ~     (p=0.684 n=10+10)

Updates #17926.

Change-Id: Ic255ac8b7b409c1a53791058818b7e2cf574abe3
Reviewed-on: https://go-review.googlesource.com/33305
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2017-02-01 20:23:36 +00:00
Josh Bleecher Snyder
302474c61c cmd/compile: disable memory profiling when not in use
The default value of runtime.MemProfileRate
is non-zero, which means that a small portion
of allocations go through the (slow) profiled
allocation path.

This is never useful in the compiler
unless the -memprofile flag has been passed.
I noticed this when samples from mprof.go
showed up in a compiler cpu pprof listing.

name       old time/op      new time/op      delta
Template        207ms ± 4%       205ms ± 4%  -0.86%  (p=0.001 n=97+90)
Unicode        91.8ms ± 4%      91.4ms ± 4%  -0.44%  (p=0.030 n=93+93)
GoTypes         628ms ± 4%       624ms ± 3%  -0.73%  (p=0.001 n=95+92)
Compiler        2.70s ± 3%       2.69s ± 3%  -0.39%  (p=0.000 n=97+95)
Flate           131ms ± 5%       130ms ± 4%  -0.82%  (p=0.000 n=93+90)
GoParser        154ms ± 5%       153ms ± 4%  -0.57%  (p=0.019 n=98+96)
Reflect         394ms ± 5%       392ms ± 5%  -0.62%  (p=0.026 n=94+97)
Tar             112ms ± 6%       112ms ± 5%    ~     (p=0.455 n=97+98)
XML             214ms ± 3%       213ms ± 4%  -0.68%  (p=0.000 n=91+93)

name       old user-ns/op   new user-ns/op   delta
Template   246user-ms ± 3%  244user-ms ± 4%  -0.48%  (p=0.016 n=92+91)
Unicode    114user-ms ± 5%  113user-ms ± 4%  -0.78%  (p=0.002 n=98+94)
GoTypes    817user-ms ± 3%  813user-ms ± 2%  -0.50%  (p=0.006 n=96+94)
Compiler   3.58user-s ± 2%  3.57user-s ± 2%  -0.38%  (p=0.003 n=97+95)
Flate      158user-ms ± 5%  157user-ms ± 4%  -0.80%  (p=0.000 n=94+90)
GoParser   191user-ms ± 4%  191user-ms ± 4%    ~     (p=0.122 n=98+98)
Reflect    500user-ms ± 4%  498user-ms ± 4%    ~     (p=0.057 n=95+99)
Tar        134user-ms ± 3%  134user-ms ± 4%    ~     (p=0.529 n=98+98)
XML        265user-ms ± 3%  265user-ms ± 3%  -0.30%  (p=0.033 n=92+96)


Change-Id: Ied5384e337800d567895ff8d47f15d631edf4f0b
Reviewed-on: https://go-review.googlesource.com/35916
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-01 20:20:16 +00:00
Matthew Dempsky
9f26b9b93e cmd/compile: eliminate iota_
Change-Id: Iad9c1961aedcc754ad2f6010a49f94c5a0a4bfee
Reviewed-on: https://go-review.googlesource.com/32487
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2017-02-01 20:19:06 +00:00
Josh Bleecher Snyder
986768de7f context: lazily initialize cancelCtx done channel
This CL reduces allocations when a context
created with WithCancel either

(1) never has its Done channel used or
(2) gets cancelled before its Done channel is used

This is not uncommon. Many contexts are created
for tasks that end up not using them.

name                                                old time/op    new time/op    delta
ContextCancelTree/depth=1/Root=Background-8            112ns ± 2%      74ns ± 1%  -34.03%  (p=0.000 n=17+18)
ContextCancelTree/depth=1/Root=OpenCanceler-8          601ns ± 3%     544ns ± 1%   -9.56%  (p=0.000 n=20+20)
ContextCancelTree/depth=1/Root=ClosedCanceler-8        367ns ± 4%     257ns ± 1%  -30.01%  (p=0.000 n=20+20)
ContextCancelTree/depth=10/Root=Background-8          2.91µs ± 2%    2.87µs ± 0%   -1.38%  (p=0.000 n=20+18)
ContextCancelTree/depth=10/Root=OpenCanceler-8        4.36µs ± 2%    4.26µs ± 1%   -2.34%  (p=0.000 n=20+18)
ContextCancelTree/depth=10/Root=ClosedCanceler-8      2.02µs ± 2%    1.51µs ± 1%  -25.18%  (p=0.000 n=19+19)
ContextCancelTree/depth=100/Root=Background-8         30.5µs ± 6%    30.5µs ± 1%     ~     (p=0.941 n=20+20)
ContextCancelTree/depth=100/Root=OpenCanceler-8       39.8µs ± 1%    41.1µs ± 1%   +3.15%  (p=0.000 n=18+19)
ContextCancelTree/depth=100/Root=ClosedCanceler-8     17.8µs ± 1%    13.9µs ± 1%  -21.61%  (p=0.000 n=18+20)
ContextCancelTree/depth=1000/Root=Background-8         302µs ± 1%     313µs ± 0%   +3.62%  (p=0.000 n=20+18)
ContextCancelTree/depth=1000/Root=OpenCanceler-8       412µs ± 2%     427µs ± 1%   +3.55%  (p=0.000 n=18+19)
ContextCancelTree/depth=1000/Root=ClosedCanceler-8     178µs ± 1%     139µs ± 1%  -21.80%  (p=0.000 n=19+17)

name                                                old alloc/op   new alloc/op   delta
ContextCancelTree/depth=1/Root=Background-8             176B ± 0%       80B ± 0%  -54.55%  (p=0.000 n=20+20)
ContextCancelTree/depth=1/Root=OpenCanceler-8           544B ± 0%      448B ± 0%  -17.65%  (p=0.000 n=20+20)
ContextCancelTree/depth=1/Root=ClosedCanceler-8         352B ± 0%      160B ± 0%  -54.55%  (p=0.000 n=20+20)
ContextCancelTree/depth=10/Root=Background-8          3.49kB ± 0%    3.39kB ± 0%   -2.75%  (p=0.000 n=20+20)
ContextCancelTree/depth=10/Root=OpenCanceler-8        3.86kB ± 0%    3.76kB ± 0%   -2.49%  (p=0.000 n=20+20)
ContextCancelTree/depth=10/Root=ClosedCanceler-8      1.94kB ± 0%    0.88kB ± 0%  -54.55%  (p=0.000 n=20+20)
ContextCancelTree/depth=100/Root=Background-8         36.6kB ± 0%    36.5kB ± 0%   -0.26%  (p=0.000 n=20+20)
ContextCancelTree/depth=100/Root=OpenCanceler-8       37.0kB ± 0%    36.9kB ± 0%   -0.26%  (p=0.000 n=20+20)
ContextCancelTree/depth=100/Root=ClosedCanceler-8     17.8kB ± 0%     8.1kB ± 0%  -54.55%  (p=0.000 n=20+20)
ContextCancelTree/depth=1000/Root=Background-8         368kB ± 0%     368kB ± 0%   -0.03%  (p=0.000 n=20+20)
ContextCancelTree/depth=1000/Root=OpenCanceler-8       368kB ± 0%     368kB ± 0%   -0.03%  (p=0.000 n=20+20)
ContextCancelTree/depth=1000/Root=ClosedCanceler-8     176kB ± 0%      80kB ± 0%  -54.55%  (p=0.000 n=20+20)

name                                                old allocs/op  new allocs/op  delta
ContextCancelTree/depth=1/Root=Background-8             3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=20+20)
ContextCancelTree/depth=1/Root=OpenCanceler-8           8.00 ± 0%      7.00 ± 0%  -12.50%  (p=0.000 n=20+20)
ContextCancelTree/depth=1/Root=ClosedCanceler-8         6.00 ± 0%      4.00 ± 0%  -33.33%  (p=0.000 n=20+20)
ContextCancelTree/depth=10/Root=Background-8            48.0 ± 0%      47.0 ± 0%   -2.08%  (p=0.000 n=20+20)
ContextCancelTree/depth=10/Root=OpenCanceler-8          53.0 ± 0%      52.0 ± 0%   -1.89%  (p=0.000 n=20+20)
ContextCancelTree/depth=10/Root=ClosedCanceler-8        33.0 ± 0%      22.0 ± 0%  -33.33%  (p=0.000 n=20+20)
ContextCancelTree/depth=100/Root=Background-8            498 ± 0%       497 ± 0%   -0.20%  (p=0.000 n=20+20)
ContextCancelTree/depth=100/Root=OpenCanceler-8          503 ± 0%       502 ± 0%   -0.20%  (p=0.000 n=20+20)
ContextCancelTree/depth=100/Root=ClosedCanceler-8        303 ± 0%       202 ± 0%  -33.33%  (p=0.000 n=20+20)
ContextCancelTree/depth=1000/Root=Background-8         5.00k ± 0%     5.00k ± 0%   -0.02%  (p=0.000 n=20+20)
ContextCancelTree/depth=1000/Root=OpenCanceler-8       5.00k ± 0%     5.00k ± 0%   -0.02%  (p=0.000 n=20+20)
ContextCancelTree/depth=1000/Root=ClosedCanceler-8     3.00k ± 0%     2.00k ± 0%  -33.33%  (p=0.000 n=20+20)

Change-Id: Ibd7a0c3d5c847861cf1497f8fead34329413d26d
Reviewed-on: https://go-review.googlesource.com/34979
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Sameer Ajmani <sameer@golang.org>
2017-02-01 20:08:41 +00:00
Michael Munday
fd118b69fa cmd/asm, cmd/internal/obj/s390x: fix encoding of VREPI{H,F,G}
Also adds tests for all missing VRI-a instructions (which may be
affected by this change).

Fixes #18749.

Change-Id: I48249dda626f32555da9ab58659e2e140de6504a
Reviewed-on: https://go-review.googlesource.com/35561
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2017-02-01 19:37:18 +00:00
Joe Tsai
7f31971f59 testing: synchronize writes to the root's Writer
Prior to this change it was possible to see interleaved messages:
<<<
=== RUN   Test/LongLongLongLongName48
=== RUN   Test/LongLon=== RUN   Test/LongLongLongLongName50
gLongLongName49
=== RUN   Test/LongLongLongLongName51
>>>

This change fixes it such that you see:
<<<
=== RUN   Test/LongLongLongLongName48
=== RUN   Test/LongLongLongLongName49
=== RUN   Test/LongLongLongLongName50
=== RUN   Test/LongLongLongLongName51
>>>

Fixes #18741

Change-Id: I2529d724065dc65b3e9eb3d7cbeeda82a2d0cfd4
Reviewed-on: https://go-review.googlesource.com/35556
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
2017-02-01 19:27:39 +00:00
Joe Tsai
048b8cecc6 reflect: adjust documentation on Value
Make the documentation more explicit that it is not safe to directly
compare Value. Get straight to the point on how to do it correctly.

Updates #18871

Change-Id: I2aa3253f779636b2f72a1aae8c9bb45d3c32c902
Reviewed-on: https://go-review.googlesource.com/36018
Reviewed-by: Keith Randall <khr@golang.org>
2017-02-01 19:11:34 +00:00
Russ Cox
47ce87877b all: merge dev.inline into master
Change-Id: I7715581a04e513dcda9918e853fa6b1ddc703770
2017-02-01 09:47:23 -05:00
Russ Cox
c47df7ae17 all: merge dev.typealias into master
For #18130.

f8b4123613 [dev.typealias] spec: use term 'embedded field' rather than 'anonymous field'
9ecc3ee252 [dev.typealias] cmd/compile: avoid false positive cycles from type aliases
49b7af8a30 [dev.typealias] reflect: add test for type aliases
9bbb07ddec [dev.typealias] cmd/compile, reflect: fix struct field names for embedded byte, rune
43c7094386 [dev.typealias] reflect: fix StructOf use of StructField to match StructField docs
9657e0b077 [dev.typealias] cmd/doc: update for type alias
de2e5459ae [dev.typealias] cmd/compile: declare methods after resolving receiver type
9259f3073a [dev.typealias] test: match gccgo error messages on alias2.go
5d92916770 [dev.typealias] cmd/compile: change Func.Shortname to *Sym
a7c884efc1 [dev.typealias] go/internal/gccgoimporter: support for type aliases
5802cfd900 [dev.typealias] cmd/compile: export/import test cases for type aliases
d7cabd40dd [dev.typealias] go/types: clarified doc string
cc2dcce3d7 [dev.typealias] cmd/compile: a few better comments related to alias types
5c160b28ba [dev.typealias] cmd/compile: improved error message for cyles involving type aliases
b2386dffa1 [dev.typealias] cmd/compile: type-check type alias declarations
ac8421f9a5 [dev.typealias] cmd/compile: various minor cleanups
f011e0c6c3 [dev.typealias] cmd/compile, go/types, go/importer: various alias related fixes
49de5f0351 [dev.typealias] cmd/compile, go/importer: define export format and implement importing of type aliases
5ceec42dc0 [dev.typealias] go/types: export TypeName.IsAlias so clients can use it
aa1f0681bc [dev.typealias] go/types: improved Object printing
c80748e389 [dev.typealias] go/types: remove some more vestiges of prior alias implementation
80d8b69e95 [dev.typealias] go/types: implement type aliases
a917097b5e [dev.typealias] go/build: add go1.9 build tag
3e11940437 [dev.typealias] cmd/compile: recognize type aliases but complain for now (not yet supported)
e0a05c274a [dev.typealias] cmd/gofmt: added test cases for alias type declarations
2e5116bd99 [dev.typealias] go/ast, go/parser, go/printer, go/types: initial type alias support

Change-Id: Ia65f2e011fd7195f18e1dce67d4d49b80a261203
2017-01-31 13:01:31 -05:00
Alberto Donizetti
7d8bfdde45 testing: stop timeout-timer after running tests
Fixes #18845

Change-Id: Icdc3e2067807781e42f2ffc94d1824aed94d3713
Reviewed-on: https://go-review.googlesource.com/35956
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-01-31 17:36:49 +00:00
Robert Griesemer
f8b4123613 [dev.typealias] spec: use term 'embedded field' rather than 'anonymous field'
First steps towards defining type aliases in the spec.
This is a nomenclature clarification, not a language change.

The spec used all three terms 'embedded type', 'anonymous field',
and 'embedded field'. Users where using the terms inconsistently.

The notion of an 'anonymous' field was always misleading since they
always had a de-facto name. With type aliases that name becomes even
more important because we may have different names for the same type.

Use the term 'embedded field' consistently and remove competing
terminology.

For #18130.

Change-Id: I2083bbc85788cab0b2e2cb1ff58b2f979491f001
Reviewed-on: https://go-review.googlesource.com/35108
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2017-01-31 17:12:17 +00:00
Elias Naur
3e55059f30 cmd/dist: really skip the testsanitizers tests on Android
The test.bash script in misc/cgo/testsanitizers use GOOS, not GOHOSTOS.
Fix the dist check from gohostos to goos accordingly.

The error was masked on the builders because they run on a darwin host
where the sanitizers tests never ran.

With this change, the Android test suite completes successfully on
Android/amd64.

Change-Id: Id7690429f78c6ac7a26fc9118d913b719b565bb2
Reviewed-on: https://go-review.googlesource.com/35959
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-01-30 20:38:03 +00:00
Ian Lance Taylor
0949659952 runtime: add explicit (void) in C to avoid GCC 7 problem
This avoids errors like
    ./traceback.go:80:2: call of non-function C.f1

I filed https://gcc.gnu.org/PR79289 for the GCC problem. I think this
is a bug in GCC, and it may be fixed before the final GCC 7 release.
This CL is correct either way.

Fixes #18855.

Change-Id: I0785a7b7c5b1d0ca87b454b5eca9079f390fcbd4
Reviewed-on: https://go-review.googlesource.com/35919
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-01-30 19:27:49 +00:00
Elias Naur
4cffe2b604 cmd/dist: use the target GOOS to skip the test for issue 18153
Fixes (skips) the test on Android, where stdout/stderr are not
terminals.

Updates #18153

Change-Id: Ieca65150362a5c423747ad751e00f76f0b890746
Reviewed-on: https://go-review.googlesource.com/35957
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-29 23:31:20 +00:00
Daniel Theophanes
6bdb0c11c7 doc: update go1.8 release notes after TxOptions change
Missed the release notes when updating the sql API.

Fixes #18825

Change-Id: I89056d46939ad4fc99590f3434d2881f5764e1b6
Reviewed-on: https://go-review.googlesource.com/35915
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-29 00:49:56 +00:00
Alberto Donizetti
09096bd3eb cmd/go: update alldocs after CL 35150
Author of CL 35150 forgot to run mkalldocs.sh to update
the autogenerated alldocs.go

Change-Id: Ib824562db6044702456a221a8c6f9af412927a98
Reviewed-on: https://go-review.googlesource.com/35952
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-28 20:18:44 +00:00
Michael Munday
96ea0918e6 cmd/compile: use CMPWU for 32-bit or smaller unsigned Geq on ppc64{,le}
Fixes #18808.

Change-Id: I49b266380b9d6804c9f6563ebac9c7c0e05f37f6
Reviewed-on: https://go-review.googlesource.com/35890
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-01-27 16:04:04 +00:00
Matthew Dempsky
9ecc3ee252 [dev.typealias] cmd/compile: avoid false positive cycles from type aliases
For #18130.
Fixes #18640.

Change-Id: I26cf1d1b78cca6ef207cc4333f30a9011ef347c9
Reviewed-on: https://go-review.googlesource.com/35831
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-01-26 18:35:13 +00:00
Chris Broadfoot
21a8db1c5f doc: document go1.7.5
Change-Id: Ic8d4e971edebba9412f2e7c3d3c29f296c4977ff
Reviewed-on: https://go-review.googlesource.com/35833
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-26 17:35:50 +00:00
Ian Lance Taylor
78860b2ad2 cmd/go: don't reject ./... matching top-level file outside GOPATH
This unwinds a small part of CL 31668: we now accept "./." in cleanImport.

Fixes #18778.

Change-Id: Ia7f1fde1cafcea3cc9e0b597a95a0e0bb410a3ed
Reviewed-on: https://go-review.googlesource.com/35646
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-01-26 14:41:37 +00:00
Daniel Theophanes
2b283cedef database/sql: fix race when canceling queries immediately
Previously the following could happen, though in practice it would
be rare.

Goroutine 1:
	(*Tx).QueryContext begins a query, passing in userContext

Goroutine 2:
	(*Tx).awaitDone starts to wait on the context derived from the passed in context

Goroutine 1:
	(*Tx).grabConn returns a valid (*driverConn)
	The (*driverConn) passes to (*DB).queryConn

Goroutine 3:
	userContext is canceled

Goroutine 2:
	(*Tx).awaitDone unblocks and calls (*Tx).rollback
	(*driverConn).finalClose obtains dc.Mutex
	(*driverConn).finalClose sets dc.ci = nil

Goroutine 1:
	(*DB).queryConn obtains dc.Mutex in withLock
	ctxDriverPrepare accepts dc.ci which is now nil
	ctxCriverPrepare panics on the nil ci

The fix for this is to guard the Tx methods with a RWLock
holding it exclusivly when closing the Tx and holding a read lock
when executing a query.

Fixes #18719

Change-Id: I37aa02c37083c9793dabd28f7f934a1c5cbc05ea
Reviewed-on: https://go-review.googlesource.com/35550
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-26 06:25:37 +00:00
Robert Griesemer
1cf08182f9 go/printer: fix format with leading comments in composite literal
This fix is less pervasive than it seems. The only change affecting
formatting is on printer.go:760. The remaining changes have no effect
on formatting since the value of p.level is ignored except on this
specific line.

The remaining changes are:
- renamed adjBlock to funcBody since that's how it is used
- introduced new printer field 'level' tracking the composite
  literal nesting level
- update/restore the composite literal nesting level as needed

Fixes #18782.

Change-Id: Ie833a9b5a559c4ec0f2eef2c5dc97aa263dca53a
Reviewed-on: https://go-review.googlesource.com/35811
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-26 00:06:54 +00:00
David Crawshaw
b531eb3062 runtime: reorder modules so main.main comes first
Modules appear in the moduledata linked list in the order they are
loaded by the dynamic loader, with one exception: the
firstmoduledata itself the module that contains the runtime.
This is not always the first module (when using -buildmode=shared,
it is typically libstd.so, the second module).

The order matters for typelinksinit, so we swap the first module
with whatever module contains the main function.

Updates #18729

This fixes the test case extracted with -linkshared, and now

	go test -linkshared encoding/...

passes. However the original issue about a plugin failure is not
yet fixed.

Change-Id: I9f399ecc3518e22e6b0a350358e90b0baa44ac96
Reviewed-on: https://go-review.googlesource.com/35644
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-01-25 22:33:57 +00:00
Daniel Theophanes
165cfbc409 database/sql: let tests wait for db pool to come to expected state
Slower builders were failing TestQueryContext because the cancel
and return to conn pool happens async. TestQueryContext already
uses a wait method for this reason. Use the same method for
other context tests.

Fixes #18759

Change-Id: I84cce697392b867e4ebdfadd38027a06ca14655f
Reviewed-on: https://go-review.googlesource.com/35750
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-01-25 21:57:28 +00:00
Russ Cox
49b7af8a30 [dev.typealias] reflect: add test for type aliases
For #18130.

Change-Id: Idd77cb391178c185227cfd779c70fec16351f825
Reviewed-on: https://go-review.googlesource.com/35733
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-01-25 18:57:29 +00:00
Russ Cox
9bbb07ddec [dev.typealias] cmd/compile, reflect: fix struct field names for embedded byte, rune
Will also fix type aliases.

Fixes #17766.
For #18130.

Change-Id: I9e1584d47128782152e06abd0a30ef423d5c30d2
Reviewed-on: https://go-review.googlesource.com/35732
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-01-25 18:57:20 +00:00
Russ Cox
43c7094386 [dev.typealias] reflect: fix StructOf use of StructField to match StructField docs
The runtime internal structField interprets name=="" as meaning anonymous,
but the exported reflect.StructField has always set Name, even for anonymous
fields, and also set Anonymous=true.

The initial implementation of StructOf confused the internal and public
meanings of the StructField, expecting the runtime representation of
anonymous fields instead of the exported reflect API representation.
It also did not document this fact, so that users had no way to know how
to create an anonymous field.

This CL changes StructOf to use the previously documented interpretation
of reflect.StructField instead of an undocumented one.

The implementation of StructOf also, in some cases, allowed creating
structs with unexported fields (if you knew how to ask) but set the
PkgPath incorrectly on those fields. Rather than try to fix that, this CL
changes StructOf to reject attempts to create unexported fields.
(I think that may be the right design choice, not just a temporary limitation.
In any event, it's not the topic for today's work.)

For #17766.
Fixes #18780.

Change-Id: I585a4e324dc5a90551f49d21ae04d2de9ea04b6c
Reviewed-on: https://go-review.googlesource.com/35731
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-01-25 18:56:51 +00:00
Russ Cox
9657e0b077 [dev.typealias] cmd/doc: update for type alias
For #18130.

Change-Id: I06b05a2b45a2aa6764053fc51e05883063572dad
Reviewed-on: https://go-review.googlesource.com/35670
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-01-25 17:27:07 +00:00
Matthew Dempsky
de2e5459ae [dev.typealias] cmd/compile: declare methods after resolving receiver type
For #18130.
Fixes #18655.

Change-Id: I58e2f076b9d8273f128cc033bba9edcd06c81567
Reviewed-on: https://go-review.googlesource.com/35575
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-01-25 08:04:17 +00:00
Ian Lance Taylor
9259f3073a [dev.typealias] test: match gccgo error messages on alias2.go
For #18130.

Change-Id: I9561ee2b8a9f7b11f0851f281a899f78b9e9703e
Reviewed-on: https://go-review.googlesource.com/35640
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-01-24 22:51:50 +00:00
Ian Lance Taylor
ea73649343 doc: update gccgo docs
Update docs on correspondence between Go releases and GCC releases.

Update C type that corresponds to Go type `int`.

Drop out of date comments about Ubuntu and RTEMS.

Change-Id: Ic1b5ce9f242789af23ec3b7e7a64c9d257d6913e
Reviewed-on: https://go-review.googlesource.com/35631
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-24 21:21:59 +00:00
Ian Lance Taylor
1db16711f5 doc: clarify what to do with Go 1.4 when installing from source
You have to actually run make.bash (or make.bat).

Update #18771.

Change-Id: Ie6672a4e4abde0150c1ae57cabb1222de2c78716
Reviewed-on: https://go-review.googlesource.com/35632
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-24 21:03:41 +00:00
Brad Fitzpatrick
3717b429f2 doc: note that plugins are not fully baked
Change-Id: I6341b8cce0b4a9922928f73f8b459cbb9ec25e79
Reviewed-on: https://go-review.googlesource.com/35571
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2017-01-24 20:10:28 +00:00
Brad Fitzpatrick
98842cabb6 net/http: don't send body on redirects for 301, 302, 303 when GetBody is set
The presence of Request.GetBody being set on a request was causing all
redirected requests to have a body, even if the redirect status didn't
warrant one.

This bug came from 307/308 support (https://golang.org/cl/29852) which
removed the line that set req.Body to nil after POST/PUT redirects.

Change-Id: I2a4dd5320f810ae25cfd8ea8ca7c9700e5dbd369
Reviewed-on: https://go-review.googlesource.com/35633
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2017-01-24 19:56:23 +00:00
Mikio Hara
314180e7f6 net/http: fix a nit
Change-Id: I31fa5f906ad2e8dc475dbbeb91f568f91e16861b
Reviewed-on: https://go-review.googlesource.com/35514
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-24 16:48:33 +00:00
Ian Lance Taylor
aad06da2b9 cmd/link: mark DWARF function symbols as reachable
Otherwise we don't emit any required ELF relocations when doing an
external link, because elfrelocsect skips unreachable symbols.

Fixes #18745.

Change-Id: Ia3583c41bb6c5ebb7579abd26ed8689370311cd6
Reviewed-on: https://go-review.googlesource.com/35590
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-01-24 03:37:56 +00:00
Matthew Dempsky
5d92916770 [dev.typealias] cmd/compile: change Func.Shortname to *Sym
A Func's Shortname is just an identifier. No need for an entire ONAME
Node.

Change-Id: Ie4d397e8d694c907fdf924ce57bd96bdb4aaabca
Reviewed-on: https://go-review.googlesource.com/35574
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-01-24 01:34:14 +00:00
Brad Fitzpatrick
be9dcfec29 doc: mention testing.MainStart signature change
Fixes #18766

Change-Id: Ic0f72f3b7bbccd0546692993c4ed414f8c88c1c6
Reviewed-on: https://go-review.googlesource.com/35573
Reviewed-by: Russ Cox <rsc@golang.org>
2017-01-24 00:28:27 +00:00
Keith Randall
a96e117a58 runtime: amd64, use 4-byte ops for memmove of 4 bytes
memmove used to use 2 2-byte load/store pairs to move 4 bytes.
When the result is loaded with a single 4-byte load, it caused
a store to load fowarding stall.  To avoid the stall,
special case memmove to use 4 byte ops for the 4 byte copy case.

We already have a special case for 8-byte copies.
386 already specializes 4-byte copies.
I'll do 2-byte copies also, but not for 1.8.

benchmark                 old ns/op     new ns/op     delta
BenchmarkIssue18740-8     7567          4799          -36.58%

3-byte copies get a bit slower.  Other copies are unchanged.
name         old time/op   new time/op   delta
Memmove/3-8   4.76ns ± 5%   5.26ns ± 3%  +10.50%  (p=0.000 n=10+10)

Fixes #18740

Change-Id: Iec82cbac0ecfee80fa3c8fc83828f9a1819c3c74
Reviewed-on: https://go-review.googlesource.com/35567
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2017-01-23 19:39:22 +00:00
Michael Munday
4cce27a3fa cmd/compile: fix constant propagation through s390x MOVDNE instructions
The constant propagation rules selected the wrong operand to
propagate. So MOVDNE (move if not equal) propagated operands as if
it were a MOVDEQ (move if equal).

Fixes #18735.

Change-Id: I87ac469172f9df7d5aabaf7106e2936ce54ae202
Reviewed-on: https://go-review.googlesource.com/35498
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-01-21 03:20:55 +00:00
Ian Lance Taylor
1be957d703 misc/cgo/test: pass current environment to syscall.Exec
This is needed for typical tests with gccgo, as it passes the
LD_LIBRARY_PATH environment variable to the new program.

Change-Id: I9bf4b0dbdff63f5449c7fcb8124eaeab10ed7f34
Reviewed-on: https://go-review.googlesource.com/35481
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-20 21:12:54 +00:00
Ian Lance Taylor
ec654e2251 misc/cgo/test: fix test when using GCC 7
With GCC 7 (not yet released), cgo fails with errors like

./sigaltstack.go:65:8: call of non-function C.restoreSignalStack

I do not know precisely why. Explicitly declaring that there are no
arguments to the static function is a simple fix for the debug info.

Change-Id: Id96e1cb1e55ee37a9f1f5ad243d7ee33e71584ac
Reviewed-on: https://go-review.googlesource.com/35480
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-20 21:12:19 +00:00
Keith Randall
256a605faa cmd/compile: don't use nilcheck information until the next block
When nilcheck runs, the values in a block are not in any particular
order.  So any facts derived from examining the blocks shouldn't be
used until we reach the next block.

This is suboptimal as it won't eliminate nil checks within a block.
But it's probably a better fix for now as it is a much smaller change
than other strategies for fixing this bug.

nilptr3.go changes are mostly because for this pattern:
  _ = *p
  _ = *p
either nil check is fine to keep, and this CL changes which one
the compiler tends to keep.
There are a few regressions from code like this:
  _ = *p
  f()
  _ = *p
For this pattern, after this CL we issue 2 nil checks instead of one.
(For the curious, this happens because intra-block nil check
 elimination now falls to CSE, not nilcheck proper.  The former
 pattern has two nil checks with the same store argument.  The latter
 pattern has two nil checks with different store arguments.)

Fixes #18725

Change-Id: I3721b494c8bc9ba1142dc5c4361ea55c66920ac8
Reviewed-on: https://go-review.googlesource.com/35485
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-01-20 20:21:55 +00:00
Josh Bleecher Snyder
e8d5989ed1 cmd/compile: fix compilebench -alloc
pprof.WriteHeapProfile is shorthand for
pprof.Lookup("heap").WriteTo(f, 0).
The second parameter is debug.
If it is non-zero, pprof writes legacy-format
pprof output, which compilebench can parse.

Fixes #18641

Change-Id: Ica69adeb9809e9b5933aed943dcf4a07910e43fc
Reviewed-on: https://go-review.googlesource.com/35484
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-01-20 18:57:23 +00:00