]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agocmd/compile: keep JMPs around with -N
Keith Randall [Tue, 23 Feb 2016 18:54:36 +0000 (10:54 -0800)]
cmd/compile: keep JMPs around with -N

When -N, make sure we don't drop every instruction from
a block, even ones which would otherwise be empty.
Helps keep line numbers around for debugging, particularly
for break and continue statements (which often compile
down to nothing).

Fixes #14379

Change-Id: I33722c4f0dcd502f146fa48af262ba3a477c959a
Reviewed-on: https://go-review.googlesource.com/19854
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agonet: fix for DialTimeout errors with large timeout
Prashant Varanasi [Sat, 20 Feb 2016 17:43:15 +0000 (09:43 -0800)]
net: fix for DialTimeout errors with large timeout

The existing implementation converts the deadline time to an int64,
but does not handle overflow. If the calculated deadline is negative
but the user specified deadline is in the future, then we can assume
the calculation overflowed, and set the deadline to math.MaxInt64.

Fixes #14431

Change-Id: I54dbb4f02bc7ffb9cae8cf62e4e967e9c6541ec6
Reviewed-on: https://go-review.googlesource.com/19758
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
9 years agocmd/compile: give informative error instead of "stupid shift"
Robert Griesemer [Tue, 23 Feb 2016 21:35:12 +0000 (13:35 -0800)]
cmd/compile: give informative error instead of "stupid shift"

Fixes #13940.

Change-Id: I00fe377c949e5be4cbc035f6ca18e547e326bfba
Reviewed-on: https://go-review.googlesource.com/19856
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agotext/tabwriter: clarify documentation
Robert Griesemer [Tue, 23 Feb 2016 19:15:56 +0000 (11:15 -0800)]
text/tabwriter: clarify documentation

More clearly distinguish between tab-terminated cells
which are part of an (aligned) column, and non-tab terminated
cells which are not part of a column. Added additional examples.

For #14412.

Change-Id: If72607385752e221eaa2518238b11f48fbcb8a90
Reviewed-on: https://go-review.googlesource.com/19855
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agounicode/utf16: speed up and clean up Decode
Alberto Donizetti [Tue, 23 Feb 2016 17:45:38 +0000 (18:45 +0100)]
unicode/utf16: speed up and clean up Decode

name                        old time/op  new time/op  delta
DecodeValidASCII-4          94.7ns ± 1%  87.4ns ± 1%  -7.71%  (p=0.000 n=10+9)
DecodeValidJapaneseChars-4  91.0ns ± 2%  84.8ns ± 0%  -6.77%  (p=0.000 n=9+10)
DecodeRune-4                16.5ns ± 0%  16.6ns ± 2%    ~     (p=0.108 n=9+10)

For #6957

Change-Id: I618c15c2a42ef7ec6a5cd163b7c3f1a65ca4ad01
Reviewed-on: https://go-review.googlesource.com/19826
Reviewed-by: Rob Pike <r@golang.org>
9 years agoRevert "cmd/compile: move hiter, hmap, and scase definitions into builtin.go"
Matthew Dempsky [Tue, 23 Feb 2016 07:46:01 +0000 (07:46 +0000)]
Revert "cmd/compile: move hiter, hmap, and scase definitions into builtin.go"

This reverts commit f28bbb776a050cc3edca2bbe1241d81217a7a251.

Change-Id: I82fb81dcff3ddcaefef72949f1ef3a41bcd22301
Reviewed-on: https://go-review.googlesource.com/19849
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
9 years agonet: use dialTCP cancelation for DualStack dialing.
Paul Marks [Tue, 9 Feb 2016 04:25:38 +0000 (20:25 -0800)]
net: use dialTCP cancelation for DualStack dialing.

The previous Happy Eyeballs implementation would intentionally leak
connections, because dialTCP could not be reliably terminated upon
losing the race.

Now that dialTCP supports cancelation (plan9 excluded), dialParallel can
wait for responses from both the primary and fallback racers, strictly
before returning control to the caller.

In dial_test.go, we no longer need Sleep to avoid leaks.
Also, fix a typo in the Benchmark IPv4 address.

Updates #11225
Fixes #14279

Change-Id: Ibf3fe5c7ac2f7a438c1ab2cdb57032beb8bc27b5
Reviewed-on: https://go-review.googlesource.com/19390
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agospec: fix EBNF for slice syntax
Robert Griesemer [Tue, 23 Feb 2016 18:42:06 +0000 (10:42 -0800)]
spec: fix EBNF for slice syntax

The () parentheses grouped wrongly. Removed them completely in
favor of separate 2- and 3-index slice alternatives which is
clearer.

Fixes #14477.

Change-Id: I0b7521ac912130d9ea8740b8793b3b88e2609418
Reviewed-on: https://go-review.googlesource.com/19853
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: stop aligning string data
David Crawshaw [Thu, 18 Feb 2016 16:02:39 +0000 (11:02 -0500)]
cmd/compile: stop aligning string data

Makes godoc 10KB smaller.
For #6853.

Change-Id: Id54bd8c82cb2a1ba11d2d724e3107f73024b19d9
Reviewed-on: https://go-review.googlesource.com/19696
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoregexp: remove unreachable code
Alberto Donizetti [Sat, 30 Jan 2016 21:01:00 +0000 (22:01 +0100)]
regexp: remove unreachable code

Found running go vet on the package. It barks that
regexp/backtrack.go:257: unreachable code
regexp/backtrack.go:302: unreachable code

For #11041

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

9 years agonet/http/httputil: Keep response headers when response ContentLength is 0.
Harshavardhana [Wed, 13 Jan 2016 23:52:54 +0000 (15:52 -0800)]
net/http/httputil: Keep response headers when response ContentLength is 0.

Current code does not print any response headers from httputil.DumpResponse().

   PUT /miniocloud/new-file HTTP/1.1
   Host: s3.amazonaws.com
   User-Agent: Go-http-client/1.1
   Content-Length: 11
   Accept-Encoding: gzip

   HTTP/1.1 200 OK

With this fix we get an appropriate output for httputil.DumpResponse().

   PUT /miniocloud/new-file HTTP/1.1
   Host: s3.amazonaws.com
   User-Agent: Go-http-client/1.1
   Content-Length: 11
   Accept-Encoding: gzip

   HTTP/1.1 200 OK
   Content-Length: 0
   Date: Thu, 14 Jan 2016 03:04:42 GMT
   Etag: "3e25960a79dbc69b674cd4ec67a72c62"
   Server: AmazonS3
   X-Amz-Id-2: qnXyH6sknlovV0Myy3emFAXTNtI/sQIcu1ZXNq/6wd17K32tQ7WNGB1qb3nzCpW2DhfeZ/MbWfw=
   X-Amz-Request-Id: 8422EACB0CC492BD

Fixes #13942

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

9 years agoall: fix typos
Shawn Smith [Sat, 6 Feb 2016 11:35:29 +0000 (20:35 +0900)]
all: fix typos

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

9 years agounicode/utf16: add benchmarks
Alberto Donizetti [Fri, 29 Jan 2016 20:22:11 +0000 (21:22 +0100)]
unicode/utf16: add benchmarks

For #6957

Change-Id: Ic497c12f33efc933e9fe81f6cd1b2a0a01abbabf
Reviewed-on: https://go-review.googlesource.com/19820
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: add copyright notice to util.go
Matthew Dempsky [Tue, 23 Feb 2016 10:19:25 +0000 (02:19 -0800)]
cmd/compile: add copyright notice to util.go

util.go was originally added in golang.org/cl/4851, and later moved to
its current location in golang.org/cl/10287.

Change-Id: I10b4941d42ae1ff2e78990c497c1347bbbae4e3d
Reviewed-on: https://go-review.googlesource.com/19851
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/compile: use path.Join in importfile
Matthew Dempsky [Tue, 23 Feb 2016 10:14:32 +0000 (02:14 -0800)]
cmd/compile: use path.Join in importfile

Change-Id: Ib413b0cb16405965455d7764a8c4a22bf431389b
Reviewed-on: https://go-review.googlesource.com/19850
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/compile: move Io state into lexer and remove Io type
Robert Griesemer [Mon, 22 Feb 2016 19:53:20 +0000 (11:53 -0800)]
cmd/compile: move Io state into lexer and remove Io type

Pass lexer around so state is accessible and dependency is explicit.
In the process remove EOF -> '\n' conversion that has to be corrected
for when reporting errors.

Change-Id: If95564b70e7484dedc1f5348e585cd19acbc1243
Reviewed-on: https://go-review.googlesource.com/19819
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agonet/http: fix typo in doc string
Robert Griesemer [Tue, 23 Feb 2016 03:41:17 +0000 (19:41 -0800)]
net/http: fix typo in doc string

Fixes #14475.

Change-Id: I1b5b0a9793a417572ec55f313185d03ad5ae9d01
Reviewed-on: https://go-review.googlesource.com/19846
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agoruntime: unify memeq and memequal
Keith Randall [Mon, 22 Feb 2016 21:20:38 +0000 (13:20 -0800)]
runtime: unify memeq and memequal

They do the same thing, except memequal also has the short-circuit
check if the two pointers are equal.

A) We might as well always do the short-circuit check, it is only 2 instructions.
B) The extra function call (memequal->memeq) is expensive.

benchmark                 old ns/op     new ns/op     delta
BenchmarkArrayEqual-8     8.56          5.31          -37.97%

No noticeable affect on the former memeq user (maps).

Fixes #14302

Change-Id: I85d1ada59ed11e64dd6c54667f79d32cc5f81948
Reviewed-on: https://go-review.googlesource.com/19843
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocrypto/tls: Improve ambiguous comment in cipher_suites.go
Brady Sullivan [Mon, 22 Feb 2016 23:19:18 +0000 (15:19 -0800)]
crypto/tls: Improve ambiguous comment in cipher_suites.go

A comment existed referencing RC4 coming before AES because of it's
vulnerability to the Lucky 13 attack. This clarifies that the Lucky 13 attack
only effects AES-CBC, and not AES-GCM.

Fixes #14474

Change-Id: Idcb07b5e0cdb0f9257cf75abea60129ba495b5f5
Reviewed-on: https://go-review.googlesource.com/19845
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/doc: handle embedded fields properly
Rob Pike [Fri, 19 Feb 2016 05:36:03 +0000 (16:36 +1100)]
cmd/doc: handle embedded fields properly

The structure of the code meant that an embedded field was never
checked for export status. We need to check the name of the type,
which is either of type T or type *T, and T might be unexported.

Fixes #14356.

Change-Id: I56f468e9b8ae67e9ed7509ed0b91d860507baed2
Reviewed-on: https://go-review.googlesource.com/19701
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agoruntime: move machport into darwin's mOS
Matthew Dempsky [Mon, 22 Feb 2016 19:32:56 +0000 (11:32 -0800)]
runtime: move machport into darwin's mOS

It's not needed on other OSes.

Change-Id: Ia6b13510585392a7062374806527d33876beba2a
Reviewed-on: https://go-review.googlesource.com/19818
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime: simplify stack copying in ThreadCreateProfile
Matthew Dempsky [Mon, 22 Feb 2016 19:27:32 +0000 (11:27 -0800)]
runtime: simplify stack copying in ThreadCreateProfile

Change-Id: I7414d2fab18ae6e7e7c50f8697ec64d38290f409
Reviewed-on: https://go-review.googlesource.com/19817
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: disable checknils during alg eq generation
Josh Bleecher Snyder [Tue, 5 May 2015 01:16:50 +0000 (18:16 -0700)]
cmd/compile: disable checknils during alg eq generation

Cuts 20k off cmd/go and 32k off golang.org/x/tools/cmd/godoc, approx 0.15% each.

For #6853 and #9930

Change-Id: Ic510b76b80a9153b1ede7b3533d2dbc16caa5c63
Reviewed-on: https://go-review.googlesource.com/19768
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/cover: don't overskip children nodes when adding counters
Caio Marcelo de Oliveira Filho [Sun, 21 Feb 2016 02:23:01 +0000 (23:23 -0300)]
cmd/cover: don't overskip children nodes when adding counters

When visiting the AST to add counters, there are special cases in which
the code calls cuts the walking short by returning nil. In some cases
certain nodes are ignored, e.g. Init and Cond inside IfStmt.

The fix is to explicitly walk all the children nodes (not only
Body and Else) when cutting the current walk. Similar approach
was taken with SwitchStmt and TypeSwitchStmt.

While the existing test code doesn't handle different counters in the
same line, the generated HTML report does it correctly (because it takes
column into account).

The previous behavior caused lines in function literals to not be
tracked when those literals were inside Init or Cond of an IfStmt for
example.

Fixes #14039.

Change-Id: Iad591363330843ad833bd79a0388d709c8d0c8aa
Reviewed-on: https://go-review.googlesource.com/19775
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile: bring vendored copy of math/big up-to-date
Robert Griesemer [Tue, 2 Feb 2016 18:14:36 +0000 (10:14 -0800)]
cmd/compile: bring vendored copy of math/big up-to-date

These files were not added to the repo. They contain conversion
routines and corresponding tests not used by the compiler and
thus are technically not needed.

However, future changes to math/big (and corresponding updates
of this vendored version) may require these files to exist.
Add them to avoid unnecessary confusion.

Change-Id: Ie390fb54f499463b2bba2fdc084967539afbeeb3
Reviewed-on: https://go-review.googlesource.com/19730
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agocmd/compile: reuse []Flow
Josh Bleecher Snyder [Thu, 11 Jun 2015 20:56:28 +0000 (13:56 -0700)]
cmd/compile: reuse []Flow

Benchmarked using compilebench on a quiet
but rather old OS X laptop.

Benchmarks from others would be welcome,
since the numbers look too good to be true.

name      old time/op    new time/op    delta
Template     331ms ± 9%     303ms ± 4%   -8.25%  (p=0.000 n=24+24)
GoTypes      946ms ± 4%     888ms ± 3%   -6.17%  (p=0.000 n=24+25)
Compiler     3.20s ± 1%     3.10s ± 2%   -3.07%  (p=0.000 n=24+25)

name      old alloc/op   new alloc/op   delta
Template    72.5MB ± 0%    61.8MB ± 0%  -14.76%  (p=0.000 n=25+24)
GoTypes      224MB ± 0%     189MB ± 0%  -15.65%  (p=0.000 n=25+25)
Compiler     695MB ± 0%     561MB ± 0%  -19.26%  (p=0.000 n=25+25)

name      old allocs/op  new allocs/op  delta
Template      498k ± 0%      497k ± 0%   -0.21%  (p=0.000 n=25+23)
GoTypes      1.47M ± 0%     1.47M ± 0%   -0.25%  (p=0.000 n=25+25)
Compiler     4.09M ± 0%     4.08M ± 0%   -0.18%  (p=0.000 n=25+23)

Change-Id: I2394bc748128d721863453257fa5756c410f7898
Reviewed-on: https://go-review.googlesource.com/19771
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: move hiter, hmap, and scase definitions into builtin.go
Matthew Dempsky [Mon, 2 Nov 2015 18:46:58 +0000 (10:46 -0800)]
cmd/compile: move hiter, hmap, and scase definitions into builtin.go

Also eliminates per-maptype hiter and hmap types, since they're not
really needed anyway.  Update packages reflect and runtime
accordingly.

Reduces golang.org/x/tools/cmd/godoc's text segment by ~170kB:

   text    data     bss     dec     hex filename
13085702  140640  151520 13377862  cc2146 godoc.before
12915382  140640  151520 13207542  c987f6 godoc.after

Updates #6853.

Change-Id: I948b2bc1f22d477c1756204996b4e3e1fb568d81
Reviewed-on: https://go-review.googlesource.com/16610
Reviewed-by: Keith Randall <khr@golang.org>
9 years agocmd/compile: inline {i,e}facethash
Keith Randall [Mon, 22 Feb 2016 04:43:14 +0000 (20:43 -0800)]
cmd/compile: inline {i,e}facethash

These functions are really simple, the overhead of calling
them (in both time and code size) is larger than the inlined versions.

Reorganize how the nil case in a type switch is handled, as we have
to check for nil explicitly now anyway.

Saves about 0.8% in the binary size of the go tool.

Change-Id: I8501b62d72fde43650b79f52b5f699f1fbd0e7e7
Reviewed-on: https://go-review.googlesource.com/19814
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agocmd/compile: make cmpstackvarlt properly asymmetric
Matthew Dempsky [Sun, 21 Feb 2016 05:36:12 +0000 (21:36 -0800)]
cmd/compile: make cmpstackvarlt properly asymmetric

Previously, given two Nodes n1 and n2 of different non-PAUTO classes
(e.g., PPARAM and PPARAMOUT), cmpstackvarlt(n1, n2) and
cmpstackvarlt(n2, n1) both returned true, which is nonsense.

This doesn't seem to cause any visible miscompilation problems, but
notably fixing it does cause toolstash/buildall to fail.

Change-Id: I33b2c66e902c5eced875d8fbf18b7cfdc81e8aed
Reviewed-on: https://go-review.googlesource.com/19778
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime: remove unused parfor code
Austin Clements [Thu, 18 Feb 2016 22:28:04 +0000 (17:28 -0500)]
runtime: remove unused parfor code

Change-Id: Ibbfae20cab48163f22d661604ef730705f2b97ba
Reviewed-on: https://go-review.googlesource.com/19661
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: replace Order's use of NodeLists with slices
Matthew Dempsky [Sun, 21 Feb 2016 02:49:22 +0000 (18:49 -0800)]
cmd/compile: replace Order's use of NodeLists with slices

Order's "temp" and "free" fields use NodeLists in a rather
non-idiomatic way.  Instead of using the "list" or "concat" functions,
it manipulates them directly and without the normal invariants (e.g.,
it doesn't maintain the "End" field).

Rather than convert it to more typical usage, just replace with a
slice, which ends up much simpler anyway.

Passes toolstash/buildall.

Change-Id: Ibd0f24324bd674c0d5bb1bc40d073b01e7824ad5
Reviewed-on: https://go-review.googlesource.com/19776
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: fix missing word in comment
Shenghou Ma [Sun, 21 Feb 2016 04:24:27 +0000 (23:24 -0500)]
runtime: fix missing word in comment

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

9 years agogo/types: skip $GOROOT/src/*.go in TestStdlib
Shenghou Ma [Sat, 19 Sep 2015 10:59:06 +0000 (06:59 -0400)]
go/types: skip $GOROOT/src/*.go in TestStdlib

Change-Id: I4a75d98a48675e2beb5b4843fb2c6ff5d4c8d2a2
Reviewed-on: https://go-review.googlesource.com/14769
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agonet: fix TestUpdateResolvConf after CL 18860
Matthew Dempsky [Sun, 21 Feb 2016 04:33:34 +0000 (20:33 -0800)]
net: fix TestUpdateResolvConf after CL 18860

When writing a fake dnsConfig to conf.dnsConfig, set lastChecked to an
hour into the future.  This causes dnsclient_unix.go's
tryUpdate("/etc/resolv.conf") calls to short-circuit and ignore that
/etc/resolv.conf's mtime differs from the test's fake resolv.conf
file.  We only need to zero out lastChecked in teardown.

While here, this makes two other tryUpdate(conf.path) test calls
pointless, since they'll now short circuit too.

Fixes #14437.

Change-Id: Ieb520388e319b9826dfa49f134907f4927608a53
Reviewed-on: https://go-review.googlesource.com/19777
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
9 years agocmd/compile, runtime: eliminate unnecessary algorithm types
Matthew Dempsky [Sun, 21 Feb 2016 06:52:15 +0000 (22:52 -0800)]
cmd/compile, runtime: eliminate unnecessary algorithm types

There's no need for 8 different ways to represent that a type is
non-comparable.

While here, move AMEM out of the runtime-known algorithm values since
it's not needed at run-time, and get rid of the unused AUNK constant.

Change-Id: Ie23972b692c6f27fc5f1a908561b3e26ef5a50e9
Reviewed-on: https://go-review.googlesource.com/19779
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoruntime: when crash with panic, call user Error/String methods before freezing the...
Shenghou Ma [Sun, 21 Feb 2016 18:56:08 +0000 (13:56 -0500)]
runtime: when crash with panic, call user Error/String methods before freezing the world

Fixes #14432.

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

9 years agocmd/compile: use && in generated eq algs
Josh Bleecher Snyder [Mon, 4 May 2015 23:12:52 +0000 (16:12 -0700)]
cmd/compile: use && in generated eq algs

This allows the compiler to generate better code
containing fewer jumps and only a single return value.

Cuts 12k off cmd/go and 16k off golang.org/x/tools/cmd/godoc, approx 0.1% each.

For #6853 and #9930

Change-Id: I009616df797760b01e09f06357a2d6fd6ebcf307
Reviewed-on: https://go-review.googlesource.com/19767
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: don't generate algs for [0]T and [1]T
Josh Bleecher Snyder [Mon, 4 May 2015 22:02:09 +0000 (15:02 -0700)]
cmd/compile: don't generate algs for [0]T and [1]T

All [0]T values are equal.
[1]T values are equal iff their sole components are.

This types show up most frequently as a by-product of variadic
function calls, such as fmt.Printf("abc") or fmt.Printf("%v", x).

Cuts 12k off cmd/go and 22k off golang.org/x/tools/cmd/godoc, approx 0.1% each.

For #6853 and #9930

Change-Id: Ic9b7aeb8cc945804246340f6f5e67bbf6008773e
Reviewed-on: https://go-review.googlesource.com/19766
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet: ensure lookupStatic* returns copy of slice to disallow cache corruption.
Suharsh Sivakumar [Wed, 3 Feb 2016 21:22:40 +0000 (13:22 -0800)]
net: ensure lookupStatic* returns copy of slice to disallow cache corruption.

Fixes #14212

Change-Id: I74325dfaa1fb48f4b281c2d42157b563f1e42a94
Reviewed-on: https://go-review.googlesource.com/19201
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
9 years agoall: use cannot instead of can not
Josh Bleecher Snyder [Wed, 27 Jan 2016 20:49:13 +0000 (12:49 -0800)]
all: use cannot instead of can not

You can not use cannot, but you cannot spell cannot can not.

Change-Id: I2f0971481a460804de96fd8c9e46a9cc62a3fc5b
Reviewed-on: https://go-review.googlesource.com/19772
Reviewed-by: Rob Pike <r@golang.org>
9 years agofmt: fix zero padding for NaN
Martin Möhrmann [Sun, 21 Feb 2016 09:46:59 +0000 (10:46 +0100)]
fmt: fix zero padding for NaN

Makes zero padding of NaN and infinities consistent
by using spaces instead of zeroes to pad NaN.
Adds more tests for NaN formatting.

Fixes #14421

Change-Id: Ia20f8e878cc81ac72a744ec10d65e84b94e09c6a
Reviewed-on: https://go-review.googlesource.com/19723
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile: set lexer nlsemi state directly
Robert Griesemer [Sat, 20 Feb 2016 20:53:34 +0000 (12:53 -0800)]
cmd/compile: set lexer nlsemi state directly

The old code used an extra function call and switch to inspect the
current token and determine the new state of curio.nlsemi. However,
the lexer knows the token w/o the need of an extra test and thus
can set curio.nlsemi directly:

- removed need for extra function call in next
- renamed _yylex to next
- set nlsemi at the point a token is identified
- moved nlsemi from curio to lexer - it's really part of the lexer state

This change makes the lexer call sequence less convoluted and should
also speed up the lexing a bit.

Change-Id: Iaf2683081f04231cb62c94e1400d455f98f6f82a
Reviewed-on: https://go-review.googlesource.com/19765
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agocmd/compile: test for lower-case letters first in isAlpha
Robert Griesemer [Sat, 20 Feb 2016 19:16:21 +0000 (11:16 -0800)]
cmd/compile: test for lower-case letters first in isAlpha

Lower-case letters are more common in identifiers.

Change-Id: I49c39e3ac810eea57d15c1433608daec212c9792
Reviewed-on: https://go-review.googlesource.com/19760
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agocmd/compile: remove gratuituous copying of lexer token data
Robert Griesemer [Sat, 20 Feb 2016 19:06:35 +0000 (11:06 -0800)]
cmd/compile: remove gratuituous copying of lexer token data

Rename yySymType to lexer; should eventually capture all lexer state.
Embed lexer in parser and access lexer token data directly.

Change-Id: I246194705d594f80426f3ba77d8580af9185daf7
Reviewed-on: https://go-review.googlesource.com/19759
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agocmd/compile: simplify import path handling
Matthew Dempsky [Sat, 20 Feb 2016 07:01:10 +0000 (23:01 -0800)]
cmd/compile: simplify import path handling

Change-Id: I64c9b4c4978520a9bc989b7fd7d5708d364dc88a
Reviewed-on: https://go-review.googlesource.com/19755
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agonet/url: simplify value lookup
Josh Bleecher Snyder [Tue, 26 May 2015 22:41:42 +0000 (15:41 -0700)]
net/url: simplify value lookup

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

9 years agoencoding/hex: minor cleanup
Josh Bleecher Snyder [Mon, 4 May 2015 21:56:52 +0000 (14:56 -0700)]
encoding/hex: minor cleanup

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

9 years agobytes: make Buffer comment more accurate
Josh Bleecher Snyder [Fri, 3 Jul 2015 00:56:13 +0000 (17:56 -0700)]
bytes: make Buffer comment more accurate

Change-Id: Ief22b3dbba9616dd40bf3ea8e2633d3c5e7d1886
Reviewed-on: https://go-review.googlesource.com/19761
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet: add missing aborted connection handling on accept test
Mikio Hara [Fri, 19 Feb 2016 08:45:22 +0000 (17:45 +0900)]
net: add missing aborted connection handling on accept test

This change adds TestAcceptIgnoreAbortedConnRequest to test accepting
aborted connection requests on all supported platforms except Plan 9.

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

9 years agonet/internal/socktest: add missing support for AcceptEx
Mikio Hara [Fri, 19 Feb 2016 08:34:54 +0000 (17:34 +0900)]
net/internal/socktest: add missing support for AcceptEx

Change-Id: I37faedc6fa316fffac80093b01e15429995b0f5b
Reviewed-on: https://go-review.googlesource.com/19705
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: make newLocalListener handle network argument correcly
Mikio Hara [Fri, 19 Feb 2016 08:37:04 +0000 (17:37 +0900)]
net: make newLocalListener handle network argument correcly

Change-Id: I8987e705af069846e6668e2f2104e0254e695139
Reviewed-on: https://go-review.googlesource.com/19706
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: deflake TestDialerDualStackFDLeak
Mikio Hara [Fri, 19 Feb 2016 08:41:44 +0000 (17:41 +0900)]
net: deflake TestDialerDualStackFDLeak

We need to stop the mock listener certainly for preventing it from
pulling up pending connections during measurement.

Fixes #14223.

Change-Id: Ia40db01d1262963697b83ca867563dec77d772e3
Reviewed-on: https://go-review.googlesource.com/19246
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: update some type names in comments
David Crawshaw [Tue, 16 Feb 2016 20:30:32 +0000 (15:30 -0500)]
cmd/compile: update some type names in comments

Change-Id: I741a1205bc6256c08b36efed43652bfbb75e4401
Reviewed-on: https://go-review.googlesource.com/19691
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/link: typo in error message
David Crawshaw [Wed, 17 Feb 2016 14:41:12 +0000 (09:41 -0500)]
cmd/link: typo in error message

Change-Id: Ideeef320d6a01a10c89524b6d895a64210a60f64
Reviewed-on: https://go-review.googlesource.com/19693
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: simplify if statement parsing
Matthew Dempsky [Sat, 20 Feb 2016 08:00:53 +0000 (00:00 -0800)]
cmd/compile: simplify if statement parsing

Somewhat notably, this means long if statement chains are now parsed
recursively, rather than iteratively.  This shouldn't be a concern
though, as several other functions (e.g., gen, typecheck, walk)
already use recursion to process the parsed if statement Node trees.

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

9 years agonet: fix race in (*resolverConfig).tryUpdate
Matthew Dempsky [Fri, 22 Jan 2016 21:31:57 +0000 (13:31 -0800)]
net: fix race in (*resolverConfig).tryUpdate

Fixes #14072.

Change-Id: Ie31caa06690ac621906fc5acd34da2efa4e2049f
Reviewed-on: https://go-review.googlesource.com/18860
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>

9 years agoruntime: use correct psABI SP alignment before calling libc mmap
Shenghou Ma [Thu, 18 Feb 2016 21:29:39 +0000 (16:29 -0500)]
runtime: use correct psABI SP alignment before calling libc mmap

Fixes #14384.

Change-Id: Ib025cf2d20754b4c2db52f0a8a4717fd303371d6
Reviewed-on: https://go-review.googlesource.com/19660
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/compile: eliminate global fileparser
Matthew Dempsky [Sat, 20 Feb 2016 02:51:24 +0000 (18:51 -0800)]
cmd/compile: eliminate global fileparser

Change-Id: I9b8b13731ccc2ba33d21642b12cc614dde0804b1
Reviewed-on: https://go-review.googlesource.com/19752
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>

9 years agocmd/compile: eliminate pushedio and savedstate
Matthew Dempsky [Sat, 20 Feb 2016 02:47:01 +0000 (18:47 -0800)]
cmd/compile: eliminate pushedio and savedstate

While here, get drop the lexlineno{++,--} hacks for canned imports.
They were added in commit d3237f9, but don't seem to serve any
purpose.

Change-Id: I00f9e6be0ae9f217f2fa113b85e041dfd0303757
Reviewed-on: https://go-review.googlesource.com/19652
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>

9 years agocmd/compile: change two pushedio.bin tests to use importpkg instead
Matthew Dempsky [Sat, 20 Feb 2016 02:39:25 +0000 (18:39 -0800)]
cmd/compile: change two pushedio.bin tests to use importpkg instead

pushedio.bin and importpkg are both non-nil iff we're parsing an
package's export data, so "pushedio.bin == nil" and "importpkg == nil"
are equivalent tests.

Change-Id: I571ee908fef867117ef72c5da1eb24fe9b3fd12d
Reviewed-on: https://go-review.googlesource.com/19751
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agocmd/compile: eliminate Io.infile and Io.cp
Matthew Dempsky [Wed, 2 Dec 2015 19:30:34 +0000 (11:30 -0800)]
cmd/compile: eliminate Io.infile and Io.cp

infile is never read and cp is never written.  Both are unneeded.

Change-Id: I0a90bb772a53a580ea4be8e5f0f770da7c1acf3a
Reviewed-on: https://go-review.googlesource.com/19651
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agocmd/compile: switch cannedimports to use a Biobuf
Matthew Dempsky [Sat, 20 Feb 2016 02:36:02 +0000 (18:36 -0800)]
cmd/compile: switch cannedimports to use a Biobuf

Allows eliminating the separate lexer code paths for reading from cp
in the next CL.

Change-Id: I49098ecef32b735c4a01374443c2f847235ff964
Reviewed-on: https://go-review.googlesource.com/19750
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agocmd/compile: refactor export data parsing
Matthew Dempsky [Tue, 1 Dec 2015 20:19:36 +0000 (12:19 -0800)]
cmd/compile: refactor export data parsing

Merge push_parser and pop_parser into a single parse_import function
and inline unimportfile. Shake out function boundaries a little bit so
that the symmetry is readily visible.

Move the import_package call into parse_import (and inline
import_there into import_package).  This means importfile no longer
needs to provide fake import data to be needlessly lexed/parsed every
time it's called.

Also, instead of indicating import success/failure by whether the next
token is "package", import_spec can just check whether importpkg is
non-nil.

Tangentially, this somehow alters the diagnostics produced for
test/fixedbugs/issue11610.go.  However, the new diagnostics are more
consistent with those produced when the empty import statement is
absent, which seems more desirable than maintaining the previous
errors.

Change-Id: I5cd1c22aa14da8a743ef569ff084711d137279d5
Reviewed-on: https://go-review.googlesource.com/19650
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agocmd/api: fix benchmark to ignore internal packages
Ian Lance Taylor [Fri, 19 Feb 2016 19:42:34 +0000 (11:42 -0800)]
cmd/api: fix benchmark to ignore internal packages

Change-Id: I8ee46287ae0744efa83ad343997ad6835520fa5c
Reviewed-on: https://go-review.googlesource.com/19688
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agofmt: remove math package dependency and avoid float operations
Martin Möhrmann [Fri, 19 Feb 2016 21:45:38 +0000 (22:45 +0100)]
fmt: remove math package dependency and avoid float operations

Remove floating point comparisons and rely only on the information
directly provided by appendFloat.
Make restoring the zero padding flag explicit instead of using a defer.
Rearrange some case distinctions to remove duplicated code.
Add more test cases for zero padded floating point numbers with sign.

benchmark                   old ns/op     new ns/op     delta
BenchmarkSprintfFloat-4     187           180           -3.74%

Change-Id: Ifa2ae85257909f40b1b18118c92b516933271729
Reviewed-on: https://go-review.googlesource.com/19721
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile: refactor import statement parsing
Matthew Dempsky [Tue, 1 Dec 2015 20:15:25 +0000 (12:15 -0800)]
cmd/compile: refactor import statement parsing

Combine parser's import_stmt and import_here methods as a single new
importdcl method, and cleanup conditional logic slightly to make the
code easier to follow.

Also, eliminate importfile's unused line parameter, and get rid of all
of its duplicate type assertions.

Change-Id: Ic37ae8490afedc533f98ead9feef383e3599bc01
Reviewed-on: https://go-review.googlesource.com/19629
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: make -A and -newexport compatible
Matthew Dempsky [Tue, 1 Dec 2015 20:05:30 +0000 (12:05 -0800)]
cmd/compile: make -A and -newexport compatible

Packages compiled with -A may reference the builtin "any" type, so it
needs to be included in the list of predeclared types for binary
import/export.

Also, when -A is used, mark all symbols as SymExport instead of
SymPackage in importsym.  This parallels the logic in autoexport and
is necessary to prevent a "export/package mismatch" errors in
exportsym during dumpexport's verifyExport pass.

Change-Id: Iff5ec5fbfe2219525ec9d1a975307fa8936af9b9
Reviewed-on: https://go-review.googlesource.com/19627
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: load builtin export data only once
Matthew Dempsky [Tue, 1 Dec 2015 20:02:42 +0000 (12:02 -0800)]
cmd/compile: load builtin export data only once

Previously, the builtin runtime export data was reparsed before every
Go source file, and the unsafe export data was reparsed for every
import of package unsafe.  Now, we parse both of them just once ahead
of time.

This does mean package unsafe's export data will be loaded even when
compiling packages that don't import it, but it's tiny anyway.

Change-Id: Ic6931bc58f6d62f664348bfa932f92d4ccacc3ef
Reviewed-on: https://go-review.googlesource.com/19626
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agocmd/compile: don't walk field-name syntax in esc.go
David Chase [Fri, 19 Feb 2016 17:06:31 +0000 (12:06 -0500)]
cmd/compile: don't walk field-name syntax in esc.go

Walking the field name as if it were an expression
caused a called to haspointers with a TFIELD, which panics.
Trigger was a field at a large offset within a large struct,
combined with a struct literal expression mentioning that
field.

Fixes #14405

Change-Id: I4589badae27cf3d7cf365f3a66c13447512f41f9
Reviewed-on: https://go-review.googlesource.com/19699
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/go: don't assume cc supports -gno-record-gcc-switches
Damien Neil [Fri, 19 Feb 2016 17:58:22 +0000 (09:58 -0800)]
cmd/go: don't assume cc supports -gno-record-gcc-switches

NetBSD's C compiler appears to support -fdebug-prefix-map but
not -gno-record-gcc-switches. Remove assumption that support
for the former implies the latter.

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

9 years agocmd/compile: refresh builtin.go
Matthew Dempsky [Fri, 19 Feb 2016 00:44:06 +0000 (16:44 -0800)]
cmd/compile: refresh builtin.go

The export data format was augmented with a new "unsafe-uintptr" tag
in https://golang.org/cl/18584, but builtin.go was not regenerated.

While here, add a test to make sure builtin.go stays up to date in the
future.

Change-Id: I4ae17da29f0855bef6ec0fcc10e7082c8427d39c
Reviewed-on: https://go-review.googlesource.com/19681
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agocmd/compile: avoid leak of dottype expression if type does not contain pointers.
Tal Shprecher [Sun, 14 Feb 2016 06:39:16 +0000 (22:39 -0800)]
cmd/compile: avoid leak of dottype expression if type does not contain pointers.

Fixes #13805

Change-Id: Ica9aae2e054b74f67d28ab27f72c52a3f03eeb59
Reviewed-on: https://go-review.googlesource.com/19489
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
9 years agoruntime: skip cgo check for non-pointer slice elements
Ian Lance Taylor [Thu, 18 Feb 2016 19:04:05 +0000 (11:04 -0800)]
runtime: skip cgo check for non-pointer slice elements

Fixes #14387.

Change-Id: Icc98be80f549c5e1f55c5e693bfea97b456a6c41
Reviewed-on: https://go-review.googlesource.com/19621
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: don't set GO15VENDOREXPERIMENT in TestSymlinksVendor
Mohit Agarwal [Fri, 19 Feb 2016 14:05:46 +0000 (19:35 +0530)]
cmd/go: don't set GO15VENDOREXPERIMENT in TestSymlinksVendor

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

9 years agocmd/dist: accept "//+build" with no spaces, like go/build
Russ Cox [Mon, 8 Feb 2016 12:08:14 +0000 (07:08 -0500)]
cmd/dist: accept "//+build" with no spaces, like go/build

The go/build parser accepts "//+build", with no spaces.
Make the cmd/dist bootstrap parser do the same.
While in theory we should always use the space form,
I copied some code that did not into the standard tree,
and I was very confused that 'go test' had had no problem
but then make.bash died.

(As a reminder, cmd/dist does not use go/build because
cmd/dist must build against earlier versions of Go.)

Change-Id: I90a18014bd878247b8811487e5c1a7589260cbfc
Reviewed-on: https://go-review.googlesource.com/19618
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/internal/obj: hoist fieldtrack code out of x86 back end
Russ Cox [Thu, 4 Feb 2016 19:16:58 +0000 (14:16 -0500)]
cmd/internal/obj: hoist fieldtrack code out of x86 back end

Change-Id: I38e59088c37426d914ce2b4dfc79f3d476e06f49
Reviewed-on: https://go-review.googlesource.com/19617
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/cgo: do not use gcc -xc - to compile standard input
Russ Cox [Mon, 1 Feb 2016 17:22:39 +0000 (12:22 -0500)]
cmd/cgo: do not use gcc -xc - to compile standard input

We have private reports of compilers that mishandle that.
Write to a temporary file instead.

Change-Id: I92e3cf4274b1a8048741e07fb52b8900c93b915e
Reviewed-on: https://go-review.googlesource.com/19616
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: remove GO15VENDOREXPERIMENT variable
Russ Cox [Fri, 29 Jan 2016 03:51:50 +0000 (22:51 -0500)]
cmd/go: remove GO15VENDOREXPERIMENT variable

The Go 1.6 release notes say that Go 1.7 will remove support
for the GO15VENDOREXPERIMENT environment variable,
making vendoring always on. Do that.

Change-Id: Iba8b79532455828869c1a8076a82edce84259468
Reviewed-on: https://go-review.googlesource.com/19615
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/link: remove alternate -X flag spelling
Russ Cox [Fri, 29 Jan 2016 03:50:03 +0000 (22:50 -0500)]
cmd/link: remove alternate -X flag spelling

The Go 1.6 release notes say we'll remove the “-X name value” form
(in favor of the “-X name=value” form) in Go 1.7.
Do that.

Also establish the doc/go1.7.txt file.

Change-Id: Ie4565a6bc5dbcf155181754d8d92bfbb23c75338
Reviewed-on: https://go-review.googlesource.com/19614
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/asm: remove nonexistent amd64 instructions
Russ Cox [Mon, 25 Jan 2016 20:21:10 +0000 (15:21 -0500)]
cmd/asm: remove nonexistent amd64 instructions

These have no accepted input syntax and,
as far as I can tell, do not actually exist.

Change-Id: Iafdfb71adccad76230191d922eb7ddf78b7d5898
Reviewed-on: https://go-review.googlesource.com/19612
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/asm: remove support for amd64 3DNow! instructions
Russ Cox [Sun, 24 Jan 2016 16:14:46 +0000 (11:14 -0500)]
cmd/asm: remove support for amd64 3DNow! instructions

3DNotAnymore!

These only ever existed on AMD (not Intel) processors,
and AMD cancelled support for them in August 2010.

Change-Id: Ia362259add9d4f5788fd151fb373f91288677407
Reviewed-on: https://go-review.googlesource.com/19611
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoall: replace strings.Index with strings.Contains where possible
Nathan VanBenschoten [Tue, 22 Dec 2015 07:40:47 +0000 (02:40 -0500)]
all: replace strings.Index with strings.Contains where possible

Change-Id: Ia613f1c37bfce800ece0533a5326fca91d99a66a
Reviewed-on: https://go-review.googlesource.com/18120
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>

9 years agonet: fix packDomainName encoding of root and invalid names
Ian Gudger [Thu, 18 Feb 2016 19:29:05 +0000 (11:29 -0800)]
net: fix packDomainName encoding of root and invalid names

Fixes #14372

Change-Id: I40d594582639e87ef2574d37ac868e37ffaa17dc
Reviewed-on: https://go-review.googlesource.com/19623
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agocmd/gofmt: Ignore file not found errors.
Benoit Sigoure [Sat, 6 Feb 2016 01:18:46 +0000 (17:18 -0800)]
cmd/gofmt: Ignore file not found errors.

gofmt prints an error to stderr when a file is deleted during its
`filepath.Walk()', which can happen in builds that change the tree
concurrently with gofmt running.

Change-Id: Ia1aa4804f6bc2172baf061c093e16fe56a3ee50c
Reviewed-on: https://go-review.googlesource.com/19301
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agonet/http: fix bug where http2 wasn't enabled on DefaultTransport
Brad Fitzpatrick [Thu, 18 Feb 2016 22:59:13 +0000 (04:29 +0530)]
net/http: fix bug where http2 wasn't enabled on DefaultTransport

I had accidentally disabled a headline feature at the last second. :(

Fixes #14391

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

9 years agocmd/link/internal/ld: remove unused call to os.Getwd
Rhys Hiltner [Thu, 18 Feb 2016 21:35:49 +0000 (13:35 -0800)]
cmd/link/internal/ld: remove unused call to os.Getwd

This call to os.Getwd (or getwd) has been part of the linker since the C
implementation in 7d507dc6e6. It stopped being used in 26438d4d80, and
survived the conversion to Go in 1f9dbb60ef.

Its return value goes unused (the linker gets the value for AT_comp_dir in
dwarf.go), remove it.

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

9 years agocmd/compile: cleanup mkbuiltin.go
Matthew Dempsky [Tue, 1 Dec 2015 19:52:32 +0000 (11:52 -0800)]
cmd/compile: cleanup mkbuiltin.go

Changes largely in preparation for eventually switching the builtin
export data to use the new binary format.

Replace fancy incremental line-by-line scanning with simply reading
the entire object file into memory, finding the export data section,
and processing it that way.

Just use "package runtime" and "package unsafe" in the builtin Go
source files so we don't need to rewrite references to "PACKAGE".

Stop looking for init_PACKAGE_function; it doesn't exist anyway.

Compile package runtime with -u so that its export data marks it as a
"safe" package.

Eliminate requirement to pass "runtime" and "unsafe" as command-line
arguments so that just "go run mkbuiltin.go" works.

Only rewrite builtin.go when successful.

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

9 years agocmd/compile: eliminate Io.importsafe
Matthew Dempsky [Tue, 1 Dec 2015 19:58:41 +0000 (11:58 -0800)]
cmd/compile: eliminate Io.importsafe

It was only really necessary for ensuring that package runtime should
be treated as safe even without a "safe" marker, but mkbuiltin.go now
compiles it with -u.

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

9 years agocmd/go, cmd/link: make builds deterministic
Damien Neil [Tue, 9 Feb 2016 01:20:59 +0000 (17:20 -0800)]
cmd/go, cmd/link: make builds deterministic

Add the following flags when supported by the compiler:
  -gno-record-gcc-switches
  -fdebug-prefix-map=$WORK=/tmp/go-build

Add an empty NAME symbol to the ELF .symtab. GNU ld will add a NAME
symbol when one is not present; including one of our own prevents it
from adding a reference to the link tempdir.

Fixes #13247 for compilers that support -fdebug-prefix-map. (gcc, clang
in the near future.)

Change-Id: I221c71fc59cd23ee8c99bcc038793ff4623c9ffc
Reviewed-on: https://go-review.googlesource.com/19363
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>

9 years agocmd/cgo: support multiple-value special form in VarDecl
Matthew Dempsky [Wed, 13 Jan 2016 23:51:16 +0000 (15:51 -0800)]
cmd/cgo: support multiple-value special form in VarDecl

Fixes #13930.

Change-Id: I124b7d31d1f2be05b7f23dafd1e52d9f3f02f3f0
Reviewed-on: https://go-review.googlesource.com/18623
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agotext/scanner: mention package when reporting errors to stderr
Robert Griesemer [Thu, 18 Feb 2016 19:43:52 +0000 (11:43 -0800)]
text/scanner: mention package when reporting errors to stderr

Fixes #14166.

Change-Id: I325b283a1d53e73a6d862611c446820ab94a161c
Reviewed-on: https://go-review.googlesource.com/19622
Reviewed-by: Damien Neil <dneil@google.com>
9 years agosort: Fix typo in stable sort comment
Matt Bostock [Tue, 16 Feb 2016 18:53:46 +0000 (18:53 +0000)]
sort: Fix typo in stable sort comment

Fix `reverences`, which I believe should read as `references`.

Change-Id: I450efcbeee0f8861a84b209f2e6636764034232a
Reviewed-on: https://go-review.googlesource.com/19469
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agogo/internal/gcimporter: add missing argument to error message
Alberto Donizetti [Sat, 30 Jan 2016 20:50:07 +0000 (21:50 +0100)]
go/internal/gcimporter: add missing argument to error message

Change-Id: I3071f0e876506c6dc283e97bc15f157bf2ff011e
Reviewed-on: https://go-review.googlesource.com/19641
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agogo/constant: fix doc strings
Robert Griesemer [Thu, 18 Feb 2016 17:42:28 +0000 (09:42 -0800)]
go/constant: fix doc strings

Fixes #14357.

Change-Id: I91acff0b0cc7be2bcbad68925a19a437dbd4c83d
Reviewed-on: https://go-review.googlesource.com/19620
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agodoc: fix typo in go1.6 release date.
Rahul Chaudhry [Wed, 17 Feb 2016 22:55:16 +0000 (14:55 -0800)]
doc: fix typo in go1.6 release date.

Change-Id: If15fdcd3cd49394a0c1dffd39fbbeede11081ccb
Reviewed-on: https://go-review.googlesource.com/19528
Reviewed-by: Chris Broadfoot <cbro@golang.org>
9 years agodoc: document Go 1.6
Chris Broadfoot [Wed, 17 Feb 2016 22:02:26 +0000 (14:02 -0800)]
doc: document Go 1.6

Change-Id: I4910105d48ed650289ecb1490d556929db05bc38
Reviewed-on: https://go-review.googlesource.com/19526
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-on: https://go-review.googlesource.com/19527

9 years agodoc: remove DRAFT tags from go1.6.html
Russ Cox [Wed, 17 Feb 2016 15:39:13 +0000 (10:39 -0500)]
doc: remove DRAFT tags from go1.6.html

Go 1.6 is soon (but not yet).

Fixes #14301.

Change-Id: I85e329b643adcb5d4fa680c5333fbc1f928d4d9d
Reviewed-on: https://go-review.googlesource.com/19550
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
9 years agonet/http: update bundle command
Russ Cox [Wed, 17 Feb 2016 15:41:03 +0000 (10:41 -0500)]
net/http: update bundle command

This is the bundle command's new usage and new output header,
after CL 19428.

Actually running this command would work but would bring in
a newer x/net/http2 that we don't want yet.

Change-Id: Ic6082ca00102a2df1f7632eebf9aca41fdcdb444
Reviewed-on: https://go-review.googlesource.com/19551
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
9 years agodoc: mention multi-change branches in contribute.html
Russ Cox [Wed, 17 Feb 2016 15:46:30 +0000 (10:46 -0500)]
doc: mention multi-change branches in contribute.html

Fixes #13651.

Change-Id: I1d21b49e2b5bc6c507eb084d6d2553e5a9c607cf
Reviewed-on: https://go-review.googlesource.com/19552
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
9 years agocmd/go: avoid race on test environment
Ian Lance Taylor [Tue, 16 Feb 2016 15:13:10 +0000 (07:13 -0800)]
cmd/go: avoid race on test environment

Fixes #14337.

Change-Id: I58aef7e08d936b0712da577dd1ce5c9ed5d8bfd2
Reviewed-on: https://go-review.googlesource.com/19513
Reviewed-by: Russ Cox <rsc@golang.org>