]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agonet/http: refactored internal shouldClose for readability
Emmanuel Odeke [Fri, 19 Feb 2016 10:10:56 +0000 (02:10 -0800)]
net/http: refactored internal shouldClose for readability

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

9 years agoruntime: fix getcallerpc args
Dmitry Vyukov [Thu, 25 Feb 2016 18:16:18 +0000 (19:16 +0100)]
runtime: fix getcallerpc args

Change-Id: I6b14b8eecf125dd74bd40f4e7fff6b49de150e42
Reviewed-on: https://go-review.googlesource.com/19897
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
9 years agocmd/compile: remove rtype.ptrToThis
David Crawshaw [Thu, 18 Feb 2016 11:31:57 +0000 (06:31 -0500)]
cmd/compile: remove rtype.ptrToThis

Simplifies some code as ptrToThis was unreliable under dynamic
linking. Now the same type lookup is used regardless of execution
mode.

A synthetic relocation, R_USETYPE, is introduced to make sure the
linker includes *T on use of T, if *T is carrying methods.

Changes the heap dump format. Anything reading the format needs to
look at the last bool of a type of an interface value to determine
if the type should be the pointer-to type.

Reduces binary size of cmd/go by 0.2%.
For #6853.

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

9 years agoexpvar: document that Get returns nil for non-existent vars
Rick Arnold [Thu, 25 Feb 2016 00:25:38 +0000 (19:25 -0500)]
expvar: document that Get returns nil for non-existent vars

Also added a test to ensure the behavior.

Fixes #14150

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

9 years agonet: re-enable TestDualStack{TCP,UDP}Listener on dragonfly
Mikio Hara [Fri, 19 Feb 2016 08:39:27 +0000 (17:39 +0900)]
net: re-enable TestDualStack{TCP,UDP}Listener on dragonfly

It looks like the latest DragonFly BSD kernels, at least 4.4 and above,
have finished working on handling of shared IP control blocks. Let's
re-enbale test cases referring to IP control blocks and see what
happens.

Updates #13146.

Change-Id: Icbe2250e788f6a445a648541272c99b598c3013d
Reviewed-on: https://go-review.googlesource.com/19406
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: make TestGoLookupIPWithResolverConfig robust
Mikio Hara [Wed, 24 Feb 2016 02:59:49 +0000 (11:59 +0900)]
net: make TestGoLookupIPWithResolverConfig robust

It crashes when the node under the test is shaken up.

-- FAIL: TestGoLookupIPWithResolverConfig (11.73s)
panic: interface conversion: error is nil, not *net.DNSError [recovered]
panic: interface conversion: error is nil, not *net.DNSError

goroutine 23 [running]:
panic(0x2e2620, 0xc820181440)
/go/src/runtime/panic.go:483 +0x3f3
testing.tRunner.func1(0xc820136d80)
/go/src/testing/testing.go:467 +0x192
panic(0x2e2620, 0xc820181440)
/go/src/runtime/panic.go:441 +0x4f6
net.TestGoLookupIPWithResolverConfig(0xc820136d80)
/go/src/net/dnsclient_unix_test.go:358 +0x7ca
testing.tRunner(0xc820136d80, 0x49ddc0)
/go/src/testing/testing.go:473 +0x98
created by testing.RunTests
/go/src/testing/testing.go:582 +0x892
exit status 2

Change-Id: I9631f41a3c73f3269c7e30d679c025ae64d71a98
Reviewed-on: https://go-review.googlesource.com/19870
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: fix typo
Mikio Hara [Thu, 25 Feb 2016 00:55:40 +0000 (09:55 +0900)]
net: fix typo

Change-Id: Ic828256efe0f50a3e11a25d85092d7531b342d2e
Reviewed-on: https://go-review.googlesource.com/19873
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: adjust starting token value
Robert Griesemer [Thu, 25 Feb 2016 00:17:49 +0000 (16:17 -0800)]
cmd/compile: adjust starting token value

The actual values assigned to tokens was inherited from the yacc-based
grammar. With the most recent cleanups, all single-char tokens such as
commas, semis, parens, etc., that get returned from lexer.next simply
as their Unicode values are below utf8.RuneSelf (i.e., 7bit ASCII).
Lower the initial starting value for named token constants accordingly.

Change-Id: I7eb8e584dbb3bc7f9dab849d1b68a91320cffebd
Reviewed-on: https://go-review.googlesource.com/19913
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agocmd/compile: fix off-by-1 in getr
Matthew Dempsky [Thu, 25 Feb 2016 00:20:59 +0000 (16:20 -0800)]
cmd/compile: fix off-by-1 in getr

Introduced by (and missed during code review of) golang.org/cl/19847.

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

9 years agodoc: add android/arm as a valid GOOS/GOARCH combination
Burcu Dogan [Wed, 24 Feb 2016 23:06:03 +0000 (15:06 -0800)]
doc: add android/arm as a valid GOOS/GOARCH combination

Fixes #14497.

Change-Id: Ibdd55acf9e416873c64f8751c2f65f7ccdb1d500
Reviewed-on: https://go-review.googlesource.com/19914
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/asm: fix EOF message on operand parsing errors.
Tal Shprecher [Sat, 20 Feb 2016 00:02:54 +0000 (16:02 -0800)]
cmd/asm: fix EOF message on operand parsing errors.

If the parsing of an operand completes but the parser thinks there
is more to read, return an "expected end of operand" error message
instead of "expected EOF." This also removes extra "asm: " prefixes
in error strings since "asm: " is already set as the global log
prefix.

Fixes #14071

Change-Id: I7d621c1aea529a0eca3bcba032359bd25b3e1080
Reviewed-on: https://go-review.googlesource.com/19731
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile: cleanup escape sequence lexing
Matthew Dempsky [Wed, 24 Feb 2016 19:49:31 +0000 (11:49 -0800)]
cmd/compile: cleanup escape sequence lexing

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

9 years agocmd/go: skip consistent cgo build test on Solaris.
Damien Neil [Wed, 24 Feb 2016 23:18:41 +0000 (15:18 -0800)]
cmd/go: skip consistent cgo build test on Solaris.

See #13247.

Change-Id: I06636157028d98430eb29277c822270592907856
Reviewed-on: https://go-review.googlesource.com/19910
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: clean up getlinepragma
Josh Bleecher Snyder [Mon, 8 Jun 2015 17:17:38 +0000 (10:17 -0700)]
cmd/compile: clean up getlinepragma

Passes toolstash -cmp.

Change-Id: Ia497b51c74a9c760a873e1ed690e4408fd0fe596
Reviewed-on: https://go-review.googlesource.com/19844
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: don't free the Prog list if we look at it after flush
Keith Randall [Wed, 24 Feb 2016 22:07:25 +0000 (14:07 -0800)]
cmd/compile: don't free the Prog list if we look at it after flush

Only tests do this, provide them a hook to disable freeing
after flush.

Change-Id: I810c6c51414a93f476a18ba07b807e16092bf8cf
Reviewed-on: https://go-review.googlesource.com/19907
Reviewed-by: Keith Randall <khr@golang.org>
9 years agounicode/utf16: speed up and clean up Encode and EncodeRune
Alberto Donizetti [Tue, 23 Feb 2016 21:54:38 +0000 (22:54 +0100)]
unicode/utf16: speed up and clean up Encode and EncodeRune

name                        old time/op  new time/op  delta
EncodeValidASCII-4          74.1ns ± 1%  70.1ns ± 1%   -5.46%  (p=0.000 n=10+10)
EncodeValidJapaneseChars-4  61.3ns ± 0%  58.9ns ± 0%   -3.82%  (p=0.000 n=10+10)
EncodeRune-4                13.1ns ± 1%   9.8ns ± 0%  -25.24%   (p=0.000 n=10+9)

Fixes #6957

Change-Id: I9dde6d77420c34c6e2ef3e6213bb6be9b58a3074
Reviewed-on: https://go-review.googlesource.com/19891
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoos: fix tests on brillo
Burcu Dogan [Wed, 24 Feb 2016 19:58:57 +0000 (11:58 -0800)]
os: fix tests on brillo

Not every Android contains the /system/framework directory, e.g. Brillo.
Test against other Android-only system files.

Fixes #14489.

Change-Id: I6d9ec1c4d4ceba3803798015e6917d59cf515de8
Reviewed-on: https://go-review.googlesource.com/19904
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Burcu Dogan <jbd@google.com>
Run-TryBot: Burcu Dogan <jbd@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: reuseable cache of Prog structs
Keith Randall [Wed, 24 Feb 2016 17:53:27 +0000 (09:53 -0800)]
cmd/compile: reuseable cache of Prog structs

Reuseable cache of Prog entries.

Improves compiler speed by ~10%.

Update #13646

Change-Id: I01bd8606540d989ea8b8ba5131d1275ba380d976
Reviewed-on: https://go-review.googlesource.com/19868
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: Drop references to Prog structs after each function
Keith Randall [Wed, 24 Feb 2016 17:12:51 +0000 (09:12 -0800)]
cmd/compile: Drop references to Prog structs after each function

Don't accumulate a massive list of Prog structs during
compilation and write them all out at the end of compilation.
Instead, convert them to code+relocs (or data+relocs) after each
function is compiled.

Track down a few other places that were keeping Progs alive
and nil them out so the Progs get GCd promptly.

Saves ~20% in peak memory usage for the compiler.  Surprisingly not much
help speed-wise (only because we end up doing more GCs.  With a
compensating GOGC=120, it does help a bit), but this provides a base for
more changes (e.g. reusing a cache of Progs).

Change-Id: I838e01017c228995a687a8110d0cd67bf8596407
Reviewed-on: https://go-review.googlesource.com/19867
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoall: fix typos and spelling
Martin Möhrmann [Wed, 24 Feb 2016 10:55:20 +0000 (11:55 +0100)]
all: fix typos and spelling

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

9 years agoencoding/csv: clarify that TrimLeadingSpace can trim the delimiter
Eric Lagergren [Wed, 24 Feb 2016 02:19:52 +0000 (18:19 -0800)]
encoding/csv: clarify that TrimLeadingSpace can trim the delimiter

Fixes #14464

Change-Id: Iafc21641cca7d35b7a5631cfc94742ee8e7d5042
Reviewed-on: https://go-review.googlesource.com/19861
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: don't use duffzero on Plan 9
David du Colombier [Wed, 24 Feb 2016 18:00:10 +0000 (19:00 +0100)]
cmd/compile: don't use duffzero on Plan 9

In CL 14408, the implementation of duffzero on amd64
was changed to replace the use of the MOVQ instructions
by MOVUPS.

However, it broke the build on plan9/amd64, since
Plan 9 doesn't allow floating point in note handler.

This change disables the use of duffzero on Plan 9.
We also take care to not use the MOVUPS instruction.

Fixes #14471.

Change-Id: I8277b485dfe65a68d7d8338e52a048c5d45069bf
Reviewed-on: https://go-review.googlesource.com/19890
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: embed type string header in rtype
David Crawshaw [Wed, 17 Feb 2016 03:23:14 +0000 (22:23 -0500)]
cmd/compile: embed type string header in rtype

Reduces binary size of cmd/go by 1%.

For #6853.

Change-Id: I6f2992a4dd3699db1b532ab08683e82741b9c2e4
Reviewed-on: https://go-review.googlesource.com/19692
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: factor our literal lexing from main lexer function
Robert Griesemer [Wed, 24 Feb 2016 06:04:20 +0000 (22:04 -0800)]
cmd/compile: factor our literal lexing from main lexer function

Further reduces complexity of lexer.next which is now readable.
Also removes the need to initialize various local variables in
each next call even if they are not used for the current token.

No measurable performance change for `time go build -a net/http`
(best of 5 runs): difference < 0.3% (in the noise).

Change-Id: I0d74caa2768920af1ceee027e0f46595119d4210
Reviewed-on: https://go-review.googlesource.com/19865
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agosort: fix for nondeterministic less function in quicksort pivot
Jure Ham [Tue, 23 Feb 2016 10:41:27 +0000 (11:41 +0100)]
sort: fix for nondeterministic less function in quicksort pivot

Fixes #14377

Change-Id: I130a6e1b8bc827db44efd0a74e759b894ecc4977
Reviewed-on: https://go-review.googlesource.com/19823
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/go, go/build: add support for Fortran
kortschak [Thu, 18 Feb 2016 10:49:03 +0000 (21:19 +1030)]
cmd/go, go/build: add support for Fortran

This change adds support for Fortran files (.f, .F, .for, .f90) to the
go tool, in a similar fashion to Objective-C/C++. Only gfortran is
supported out of the box so far but leaves other Fortran compiler
toolchains the ability to pass the correct link options via CGO_LDFLAGS.
A simple test (misc/cgo/fortran) has been added and plugged into the
general test infrastructure. This test is only enabled when the $FC
environment variable is defined (or if 'gfortran' was found in $PATH.)

Derived from CL 4114.

Change-Id: Ifc855091942f95c6e9b17d91c17ceb4eee376408
Reviewed-on: https://go-review.googlesource.com/19670
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/vet: add a check for tests with malformed names
Catalin Nicutar [Sun, 21 Feb 2016 18:32:25 +0000 (18:32 +0000)]
cmd/vet: add a check for tests with malformed names

According to golang.org/pkg/testing the first character after Test has
to be non-lowercase. Functions that don't conform to this are not
considered tests and are not loaded which can cause surprises.

This change adds a check to warn about Test-like functions in a _test
file that are not actually run by go test.

Moved over from https://go-review.googlesource.com/#/c/19466/

Change-Id: I2f89676058b27a0e35f721bdabc9fa8a9d34430d
Reviewed-on: https://go-review.googlesource.com/19724
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/dist: introduce list subcommand to list all supported platforms
Shenghou Ma [Wed, 24 Feb 2016 17:34:56 +0000 (12:34 -0500)]
cmd/dist: introduce list subcommand to list all supported platforms

Fixes #12270.

Change-Id: Ie3dcbd0403d270b4b7f5c39049e12315eee159ed
Reviewed-on: https://go-review.googlesource.com/19837
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: towards simpler and faster lexing: always use getr
Robert Griesemer [Tue, 23 Feb 2016 07:07:30 +0000 (23:07 -0800)]
cmd/compile: towards simpler and faster lexing: always use getr

Always reading runes (rather than bytes) has negligible overhead
(a simple if at the moment - it can be eliminated eventually) but
simplifies the lexer logic and opens up the door for speedups.
In the process remove many int conversions that are now not needed
anymore.

Also, because identifiers are now more easily recognized, remove
talph label and move identifier lexing "in place".

Also, instead of accepting all chars < 0x80 and then check for
"frogs", only permit valid characters in the first place. Removes
an extra call for common simple tokens and leads to simpler logic.

`time go build -a net/http` (best of 5 runs) seems 1% faster.
Assuming this is in the noise, there is no noticeable performance
degradation with this change.

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

9 years ago.gitignore: ignore src/go/build/zcgo.go
Shenghou Ma [Wed, 24 Feb 2016 04:15:57 +0000 (23:15 -0500)]
.gitignore: ignore src/go/build/zcgo.go

Change-Id: I6d5db2781d05d6e7e49f5059db1fd84ad6ec328e
Reviewed-on: https://go-review.googlesource.com/19839
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
9 years agonet: rename test files
Mikio Hara [Tue, 23 Feb 2016 09:06:31 +0000 (18:06 +0900)]
net: rename test files

This change renames {ipraw,tcp,udp,unix}_test.go to
{ipraw,tcp,udp,unix}sock_test.go for clarification. Also moves
NSS-related system configuration test helpers into main_conf_test.go and
main_noconf_test.go.

Change-Id: I28ba1e8ceda7b182ee3aa85f0ca3321388ba45e2
Reviewed-on: https://go-review.googlesource.com/19787
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime, syscall: switch linux/386 to use int 0x80
Shenghou Ma [Tue, 23 Feb 2016 06:26:50 +0000 (01:26 -0500)]
runtime, syscall: switch linux/386 to use int 0x80

Like bionic, musl also doesn't provide vsyscall helper in %gs:0x10,
and as int $0x80 is as fast as calling %gs:0x10, just use int $0x80
always.

Because we're no longer using vsyscall in VDSO, get rid of VDSO code
for linux/386 too.

Fixes #14476.

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

9 years agoruntime: deflake TestCgoCheckBytes
Ian Lance Taylor [Wed, 24 Feb 2016 01:16:21 +0000 (17:16 -0800)]
runtime: deflake TestCgoCheckBytes

Bump up the multiplier to 20.  Also run the fast version first, so that
the slow version is likely to start up faster.

Change-Id: Ia0654cc1212ab03a45da1904d3e4b57d6a8d02a0
Reviewed-on: https://go-review.googlesource.com/19835
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/compile/internal/gc: update comment after c2go
Shenghou Ma [Wed, 24 Feb 2016 00:20:41 +0000 (19:20 -0500)]
cmd/compile/internal/gc: update comment after c2go

Change-Id: I02c60f6c767e917a8ed3772c2773fe266f781e44
Reviewed-on: https://go-review.googlesource.com/19834
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/dist, go/build: make cmd/dist generate cgoEnabled map for go/build
Shenghou Ma [Fri, 4 Sep 2015 00:27:12 +0000 (20:27 -0400)]
cmd/dist, go/build: make cmd/dist generate cgoEnabled map for go/build

This reduces the amount of duplication. Now there is only one list
of platforms supporting cgo.

Update #12270.

Change-Id: I5dcd55cb6be7c5bb6ce560383c71d90ab1189dc9
Reviewed-on: https://go-review.googlesource.com/14278
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: remove parser lineno hack for issue #13267
Matthew Dempsky [Tue, 23 Feb 2016 23:29:19 +0000 (15:29 -0800)]
cmd/compile: remove parser lineno hack for issue #13267

After golang.org/cl/19652 removed the bizarre lexlineno{++,--}
statements for parsing canned imports, this hack for #13267 is no
longer necessary:

    $ echo -n 0 > /tmp/0.go
    $ go tool compile /tmp/0.go
    /tmp/0.go:1: syntax error: package statement must be first

Apparently setting lexlineno to 2 while parsing the canned imports
caused prevlineno and lineno to also be set to 2.  After we finished
parsing imports and restored lexlineno to 1, since "package" is the
first token in a source file, we'll have fixed lineno = 1, but
prevlineno was still set to 2.

Change-Id: Ibcc49fe3402264819b9abb53505631f7a0ad4a36
Reviewed-on: https://go-review.googlesource.com/19859
Reviewed-by: Robert Griesemer <gri@golang.org>
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>