]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agonet: add helpers for server testing
Mikio Hara [Sun, 19 Apr 2015 14:42:11 +0000 (23:42 +0900)]
net: add helpers for server testing

Also moves a few server test helpers into mockserver_test.go.

Change-Id: I5a95c9bc6f0c4683751bcca77e26a8586a377466
Reviewed-on: https://go-review.googlesource.com/9106
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/internal/ld: set moduledatasize correctly when -linkshared
Michael Hudson-Doyle [Tue, 7 Apr 2015 02:51:29 +0000 (14:51 +1200)]
cmd/internal/ld: set moduledatasize correctly when -linkshared

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

10 years agocmd/6g: let the compiler use R15 when it is not needed for GOT indirection
Michael Hudson-Doyle [Fri, 17 Apr 2015 06:36:11 +0000 (08:36 +0200)]
cmd/6g: let the compiler use R15 when it is not needed for GOT indirection

Thanks to Russ for the hints.

Change-Id: Ie35a71d432b9d68bd30c7a364b4dce1bd3db806e
Reviewed-on: https://go-review.googlesource.com/9102
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

10 years agocmd/internal: C->Go printf cleanup
Brad Fitzpatrick [Mon, 20 Apr 2015 20:50:46 +0000 (13:50 -0700)]
cmd/internal: C->Go printf cleanup

Change-Id: I1cf94377c613fb51ae77f4fe1e3439268b1606a9
Reviewed-on: https://go-review.googlesource.com/9161
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: Speed up heapBitsForObject
Rick Hudson [Wed, 15 Apr 2015 21:08:58 +0000 (17:08 -0400)]
runtime: Speed up heapBitsForObject

Optimized heapBitsForObject by special casing
objects whose size is a power of two. When a
span holding such objects is initialized I
added a mask that when &ed with an interior pointer
results in the base of the pointer. For the garbage
benchmark this resulted in CPU_CLK_UNHALTED in
heapBitsForObject going from 7.7% down to 5.9%
of the total, INST_RETIRED went from 12.2 -> 8.7.

Here are the benchmarks that were at lease plus or minus 1%.

benchmark                          old ns/op      new ns/op      delta
BenchmarkFmtFprintfString          249            221            -11.24%
BenchmarkFmtFprintfInt             247            223            -9.72%
BenchmarkFmtFprintfEmpty           76.5           69.6           -9.02%
BenchmarkBinaryTree17              4106631412     3744550160     -8.82%
BenchmarkFmtFprintfFloat           424            399            -5.90%
BenchmarkGoParse                   4484421        4242115        -5.40%
BenchmarkGobEncode                 8803668        8449107        -4.03%
BenchmarkFmtManyArgs               1494           1436           -3.88%
BenchmarkGobDecode                 10431051       10032606       -3.82%
BenchmarkFannkuch11                2591306713     2517400464     -2.85%
BenchmarkTimeParse                 361            371            +2.77%
BenchmarkJSONDecode                70620492       68830357       -2.53%
BenchmarkRegexpMatchMedium_1K      54693          53343          -2.47%
BenchmarkTemplate                  90008879       91929940       +2.13%
BenchmarkTimeFormat                380            387            +1.84%
BenchmarkRegexpMatchEasy1_32       111            113            +1.80%
BenchmarkJSONEncode                21359159       21007583       -1.65%
BenchmarkRegexpMatchEasy1_1K       603            613            +1.66%
BenchmarkRegexpMatchEasy0_32       127            129            +1.57%
BenchmarkFmtFprintfIntInt          399            393            -1.50%
BenchmarkRegexpMatchEasy0_1K       373            378            +1.34%

Change-Id: I78e297161026f8b5cc7507c965fd3e486f81ed29
Reviewed-on: https://go-review.googlesource.com/8980
Reviewed-by: Austin Clements <austin@google.com>
10 years agocmd/internal/obj: remove useless Trimpath field and fix users
Matthew Dempsky [Mon, 20 Apr 2015 03:57:41 +0000 (20:57 -0700)]
cmd/internal/obj: remove useless Trimpath field and fix users

http://golang.org/cl/7623 refactored how line history works and
introduced a new TrimPathPrefix field to replace the existing Trimpath
field, but never removed the latter or updated its users.

Fixes #10503.

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

10 years agonet/http: fix Transport data race, double cancel panic, cancel error message
Brad Fitzpatrick [Tue, 7 Apr 2015 13:50:34 +0000 (15:50 +0200)]
net/http: fix Transport data race, double cancel panic, cancel error message

Fixes #9496
Fixes #9946
Fixes #10474
Fixes #10405

Change-Id: I4e65f1706e46499811d9ebf4ad6d83a5dfb2ddaa
Reviewed-on: https://go-review.googlesource.com/8550
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

10 years agocmd/internal/gc: clean up componentgen
Russ Cox [Thu, 16 Apr 2015 20:22:30 +0000 (16:22 -0400)]
cmd/internal/gc: clean up componentgen

This is primarily about making the code clearer, but as part of the cleanup
componentgen is now much more consistent about what it does and does
not attempt.

The new limit is to 8 move instructions.

The old limit was either 3 or 4 small things but in the details it was
quite inconsistent: ints, interfaces, strings, and slices all counted as small;
it handled a struct containing two ints, but not a struct containing a struct
containing two ints; it handled slices and interfaces and a struct containing
a slice but not a struct containing an interface; and so on.

The new code runs at about the same speed as the old code if limited to 4 moves,
but that's much more restrictive when the pieces are strings or interfaces.
With the limit raised to 8 moves, this CL is sometimes a significant improvement:

benchmark                          old ns/op      new ns/op      delta
BenchmarkBinaryTree17              4361174290     4362870005     +0.04%
BenchmarkFannkuch11                3008201483     2974408533     -1.12%
BenchmarkFmtFprintfEmpty           79.0           79.5           +0.63%
BenchmarkFmtFprintfString          281            261            -7.12%
BenchmarkFmtFprintfInt             264            262            -0.76%
BenchmarkFmtFprintfIntInt          447            443            -0.89%
BenchmarkFmtFprintfPrefixedInt     354            361            +1.98%
BenchmarkFmtFprintfFloat           500            452            -9.60%
BenchmarkFmtManyArgs               1688           1693           +0.30%
BenchmarkGobDecode                 11718456       11741179       +0.19%
BenchmarkGobEncode                 10144620       10161627       +0.17%
BenchmarkGzip                      437631642      435271877      -0.54%
BenchmarkGunzip                    109468858      110173606      +0.64%
BenchmarkHTTPClientServer          76248          75362          -1.16%
BenchmarkJSONEncode                24160474       23753091       -1.69%
BenchmarkJSONDecode                84470041       82902026       -1.86%
BenchmarkMandelbrot200             4676857        4687040        +0.22%
BenchmarkGoParse                   4954602        4923965        -0.62%
BenchmarkRegexpMatchEasy0_32       151            151            +0.00%
BenchmarkRegexpMatchEasy0_1K       450            452            +0.44%
BenchmarkRegexpMatchEasy1_32       131            130            -0.76%
BenchmarkRegexpMatchEasy1_1K       713            695            -2.52%
BenchmarkRegexpMatchMedium_32      227            218            -3.96%
BenchmarkRegexpMatchMedium_1K      63911          62966          -1.48%
BenchmarkRegexpMatchHard_32        3163           3026           -4.33%
BenchmarkRegexpMatchHard_1K        93985          90266          -3.96%
BenchmarkRevcomp                   650697093      649211600      -0.23%
BenchmarkTemplate                  107049170      106804076      -0.23%
BenchmarkTimeParse                 448            452            +0.89%
BenchmarkTimeFormat                468            460            -1.71%

Change-Id: I08563133883e88bb9db9e9e4dee438a5af2787da
Reviewed-on: https://go-review.googlesource.com/9004
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
10 years agoruntime: replace func-based write barrier skipping with type-based
Russ Cox [Fri, 17 Apr 2015 04:21:30 +0000 (00:21 -0400)]
runtime: replace func-based write barrier skipping with type-based

This CL revises CL 7504 to use explicitly uintptr types for the
struct fields that are going to be updated sometimes without
write barriers. The result is that the fields are now updated *always*
without write barriers.

This approach has two important properties:

1) Now the GC never looks at the field, so if the missing reference
could cause a problem, it will do so all the time, not just when the
write barrier is missed at just the right moment.

2) Now a write barrier never happens for the field, avoiding the
(correct) detection of inconsistent write barriers when GODEBUG=wbshadow=1.

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

10 years agocmd/internal/ld: prefer constants from cmd/internal/obj
Matthew Dempsky [Mon, 20 Apr 2015 02:33:58 +0000 (19:33 -0700)]
cmd/internal/ld: prefer constants from cmd/internal/obj

The majority of this CL was prepared via scripted invocations of
`gofmt -w -r "$SYM -> obj.$SYM" cmd/internal/ld/*.go` and `gofmt -w -r
"ld.$SYM -> obj.$SYM" cmd/?l/*.go`.

Because of issue #7417, that was followed by repeatedly running an AWK
script to identify lines that differed other than whitespace changes
or "ld." or "obj." prefixes and manually restoring comments.

Finally, the redundant constants from cmd/internal/ld/link.go were
removed, and "goimports -w" was used to cleanup import lines.

Passes rsc.io/toolstash/buildall, even when modified to also build cmd.

Fixes #10055.

Change-Id: Icd5dbe819a3b6520ce883748e60017dc8e9a2e85
Reviewed-on: https://go-review.googlesource.com/9112
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/dist: run commands in $GOROOT/src not $GOROOT when possible
Russ Cox [Fri, 17 Apr 2015 19:20:27 +0000 (15:20 -0400)]
cmd/dist: run commands in $GOROOT/src not $GOROOT when possible

The go command prints paths in errors relative to its current directory.
Since all.bash and run.bash are run in $GOROOT/src, prefer to run
the go command, so that the relative paths are correct.

Before this CL, running all.bash in $GOROOT/src:

##### Testing race detector
# net/http
src/net/http/transport.go:1257: cannot take the address of <node EFACE>

This is wrong (or at least less useful) because there is no $GOROOT/src/src/net/http directory.

Change-Id: I0c0d52c22830d79b3715f51a6329a3d33de52a72
Reviewed-on: https://go-review.googlesource.com/9157
Reviewed-by: Rob Pike <r@golang.org>
10 years agoruntime: save registers in linux/{386,amd64} lib entry point
Ian Lance Taylor [Mon, 20 Apr 2015 17:32:39 +0000 (10:32 -0700)]
runtime: save registers in linux/{386,amd64} lib entry point

The callee-saved registers must be saved because for the c-shared case
this code is invoked from C code in the system library, and that code
expects the registers to be saved.  The tests were passing because in
the normal case the code calls a cgo function that naturally saves
callee-saved registers anyhow.  However, it fails when the code takes
the non-cgo path.

Change-Id: I9c1f5e884f5a72db9614478049b1863641c8b2b9
Reviewed-on: https://go-review.googlesource.com/9114
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agoruntime: no deadlock error if buildmode=c-archive or c-shared
Ian Lance Taylor [Sun, 19 Apr 2015 01:19:06 +0000 (18:19 -0700)]
runtime: no deadlock error if buildmode=c-archive or c-shared

Change-Id: I4ee6dac32bd3759aabdfdc92b235282785fbcca9
Reviewed-on: https://go-review.googlesource.com/9083
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/internal/obj: manual C->Go cleanups
Brad Fitzpatrick [Mon, 20 Apr 2015 04:00:48 +0000 (21:00 -0700)]
cmd/internal/obj: manual C->Go cleanups

Change-Id: I5964fc55157dc1df7be400dfa0df591d6163e25e
Reviewed-on: https://go-review.googlesource.com/9084
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>

10 years agocmd/dist: enable c-archive test on darwin/arm64
David Crawshaw [Mon, 20 Apr 2015 15:32:11 +0000 (11:32 -0400)]
cmd/dist: enable c-archive test on darwin/arm64

Turns out all the necessary pieces have already been submitted.

Change-Id: I19c8d614cd756821ce400ca7a338029002780b18
Reviewed-on: https://go-review.googlesource.com/9076
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agomisc/cgo/testcarchive: enable test on darwin/arm
David Crawshaw [Mon, 20 Apr 2015 13:33:25 +0000 (09:33 -0400)]
misc/cgo/testcarchive: enable test on darwin/arm

Change-Id: I0d3f9841500e0a41f1c427244869bf3736a31e18
Reviewed-on: https://go-review.googlesource.com/9075
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agocmd/dist: include misc/cgo/testcshared test for linux/amd64
Hyang-Ah Hana Kim [Fri, 17 Apr 2015 18:50:07 +0000 (14:50 -0400)]
cmd/dist: include misc/cgo/testcshared test for linux/amd64

Change-Id: Ia2c0c617df523482ba1a25b7492267eb80f0819a
Reviewed-on: https://go-review.googlesource.com/9033
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/internal/gc, cmd/go: fix value of importpath symbol
Michael Hudson-Doyle [Sun, 5 Apr 2015 02:48:42 +0000 (14:48 +1200)]
cmd/internal/gc, cmd/go: fix value of importpath symbol

In https://golang.org/cl/7797 I attempted to use myimportpath to set the value
of the go.importpath.$foo. symbol for the module being compiled, but I messed
it up and only set the name (which the linker rewrites anyway). This lead to
the importpath for the module being compiled being "". This was hard to notice,
because all modules that import another define the importpath for their
imported modules correctly -- but main is not imported, and this meant that the
reflect module saw all fields of all types defined in the main module as
exported.

The fix is to do what I meant to do the first time, add a test and change the
go tool to compile main packages with -p main and not -p
command-line-arguments.

Fixes #10332

Change-Id: I5fc6e9b1dc2b26f058641e382f9a56a526eca291
Reviewed-on: https://go-review.googlesource.com/8481
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agonet: fix a nit found by vet
Mikio Hara [Sat, 18 Apr 2015 01:44:42 +0000 (10:44 +0900)]
net: fix a nit found by vet

Change-Id: Ic965b48bdc0e0ffba9bed5ff6b3d28ff742f8b2d
Reviewed-on: https://go-review.googlesource.com/9100
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agodoc/progs: build test programs in temp directory
Matthew Dempsky [Sat, 18 Apr 2015 04:04:39 +0000 (21:04 -0700)]
doc/progs: build test programs in temp directory

This avoids a race condition with go1.go wanting to examine files in
the current directory with filepath.Walk(".", walkFn).

Fixes #10497.

Change-Id: I2159f40a08d1a768195dbb7ea3c27e38cf9740bb
Reviewed-on: https://go-review.googlesource.com/9110
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agonet: fix inconsistent error values on Accept
Mikio Hara [Fri, 17 Apr 2015 05:35:54 +0000 (14:35 +0900)]
net: fix inconsistent error values on Accept

This change fixes inconsistent error values on Accept{,TCP,Unix}.

Updates #4856.

Change-Id: Ie3bb534c19a724cacb3ea3f3656e46c810b2123f
Reviewed-on: https://go-review.googlesource.com/8996
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agonet: fix inconsistent error values on Close
Mikio Hara [Fri, 17 Apr 2015 03:24:42 +0000 (12:24 +0900)]
net: fix inconsistent error values on Close

This change fixes inconsistent error values on Close, CloseRead and
CloseWrite.

Updates #4856.

Change-Id: I3c4d46ccd7d6e1a2f52d8e75b512f62c533a368d
Reviewed-on: https://go-review.googlesource.com/8994
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agonet: fix inconsistent error values on Write
Mikio Hara [Thu, 16 Apr 2015 02:26:44 +0000 (11:26 +0900)]
net: fix inconsistent error values on Write

This change fixes inconsistent error values on Write,
WriteTo{,UDP,IP,Unix} and WriteMsg{UDP,IP,Unix}.

Updates #4856.

Change-Id: I4208ab6a0650455ad7d70a80a2d6169351d6055f
Reviewed-on: https://go-review.googlesource.com/8993
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agonet: fix inconsistent error values on Read
Mikio Hara [Thu, 16 Apr 2015 14:10:56 +0000 (23:10 +0900)]
net: fix inconsistent error values on Read

This change fixes inconsistent error values on Read,
ReadFrom{,UDP,IP,Unix} and ReadMsg{UDP,IP,Unix}.

Updates #4856.

Change-Id: I7de5663094e09be2d78cdb18ce6f1e7ec260888d
Reviewed-on: https://go-review.googlesource.com/8992
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/...: fix vet issues and cull dead code
Josh Bleecher Snyder [Sat, 18 Apr 2015 00:23:51 +0000 (17:23 -0700)]
cmd/...: fix vet issues and cull dead code

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

10 years agonet: break up TestErrorNil into Test{Dial,Listen,ListenPacket}Error
Mikio Hara [Fri, 17 Apr 2015 05:55:07 +0000 (14:55 +0900)]
net: break up TestErrorNil into Test{Dial,Listen,ListenPacket}Error

Change-Id: I7c6c91a0551aacb49e1beb4a39215b93c8c7fcfa
Reviewed-on: https://go-review.googlesource.com/8997
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/cgo: more robust detection of clang
Matthew Dempsky [Sat, 18 Apr 2015 00:05:47 +0000 (17:05 -0700)]
cmd/cgo: more robust detection of clang

Fixes #10453.

Change-Id: I77470279865d4c954df615d6594c69edf68c28ca
Reviewed-on: https://go-review.googlesource.com/9090
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/6g, etc: cleanup, moving code out of near-empty gg.go files
Brad Fitzpatrick [Mon, 13 Apr 2015 23:26:08 +0000 (18:26 -0500)]
cmd/6g, etc: cleanup, moving code out of near-empty gg.go files

Clear out gg.go files, and move things into consistent places between
the cmd/?g directories.

Change-Id: I81e04180613b806e0bfbb88519e66111ce9f74a3
Reviewed-on: https://go-review.googlesource.com/9080
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agonet: clean up cgo
Mikio Hara [Fri, 17 Apr 2015 08:56:58 +0000 (17:56 +0900)]
net: clean up cgo

This change adds a type addrinfoErrno to represent getaddrinfo,
getnameinfo-specific errors, and uses it in cgo-based lookup functions.

Also retags cgo files for clarification and does minor cleanup.

Change-Id: I6db7130ad7bf35bbd4e8839a97759e1364c43828
Reviewed-on: https://go-review.googlesource.com/9020
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/internal/ld: replace Diag;Errorexit with Exitf
David Crawshaw [Thu, 9 Apr 2015 11:37:17 +0000 (07:37 -0400)]
cmd/internal/ld: replace Diag;Errorexit with Exitf

I have left the Diag calls in place where I believe Ctxt.Cursym != nil
which means this CL is not the improvement I had hoped for. However
it is now safe to call Exitf whereever you are in the linker, which
makes it easier to reason about some code.

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

10 years agomisc/cgo/testcarchive: check that os.Args is set
David Crawshaw [Fri, 17 Apr 2015 20:42:16 +0000 (16:42 -0400)]
misc/cgo/testcarchive: check that os.Args is set

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

10 years agoencoding/gob: fix hang from skipping large slices
Matthew Dempsky [Fri, 17 Apr 2015 21:45:51 +0000 (14:45 -0700)]
encoding/gob: fix hang from skipping large slices

Change-Id: I4e59b5b1702e08d7c6191d0a70fb0a555f3340c8
Reviewed-on: https://go-review.googlesource.com/9061
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Rob Pike <r@golang.org>
10 years agodoc/go1.5.txt: go generate: add $GOLINE
Rob Pike [Fri, 17 Apr 2015 20:34:55 +0000 (13:34 -0700)]
doc/go1.5.txt: go generate: add $GOLINE

Change-Id: I9968ce162996e71843eeaf9764d216c401427fed
Reviewed-on: https://go-review.googlesource.com/9040
Reviewed-by: Rob Pike <r@golang.org>
10 years agodoc/articles/go_command.html: mention go generate
Rob Pike [Fri, 17 Apr 2015 18:37:08 +0000 (11:37 -0700)]
doc/articles/go_command.html: mention go generate

Fix some out-of-date remarks.

Fixes #10489.

Change-Id: I8f0cce2588828052a5d013e7bac6bcfeb220579d
Reviewed-on: https://go-review.googlesource.com/9008
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/go: add $GOLINE to generate
Rob Pike [Fri, 17 Apr 2015 18:21:02 +0000 (11:21 -0700)]
cmd/go: add $GOLINE to generate

Also use os.Expand for variable substitution so ${x}y works.

Fixes #9960.

Change-Id: Ic8239b2e737d1f41910dde8ee9524ac48907cb03
Reviewed-on: https://go-review.googlesource.com/9007
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/gc, cmd/6g: generate boolean values without jumps
Josh Bleecher Snyder [Wed, 8 Apr 2015 16:54:15 +0000 (09:54 -0700)]
cmd/internal/gc, cmd/6g: generate boolean values without jumps

Use SETcc instructions instead of Jcc to generate boolean values.
This generates shorter, jump-free code, which may in turn enable other
peephole optimizations.

For example, given

func f(i, j int) bool {
return i == j
}

Before

"".f t=1 size=32 value=0 args=0x18 locals=0x0
0x0000 00000 (x.go:3) TEXT "".f(SB), $0-24
0x0000 00000 (x.go:3) FUNCDATA $0, gclocals·b4c25e9b09fd0cf9bb429dcefe91c353(SB)
0x0000 00000 (x.go:3) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
0x0000 00000 (x.go:4) MOVQ "".i+8(FP), BX
0x0005 00005 (x.go:4) MOVQ "".j+16(FP), BP
0x000a 00010 (x.go:4) CMPQ BX, BP
0x000d 00013 (x.go:4) JEQ 21
0x000f 00015 (x.go:4) MOVB $0, "".~r2+24(FP)
0x0014 00020 (x.go:4) RET
0x0015 00021 (x.go:4) MOVB $1, "".~r2+24(FP)
0x001a 00026 (x.go:4) JMP 20

After

"".f t=1 size=32 value=0 args=0x18 locals=0x0
0x0000 00000 (x.go:3) TEXT "".f(SB), $0-24
0x0000 00000 (x.go:3) FUNCDATA $0, gclocals·b4c25e9b09fd0cf9bb429dcefe91c353(SB)
0x0000 00000 (x.go:3) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
0x0000 00000 (x.go:4) MOVQ "".i+8(FP), BX
0x0005 00005 (x.go:4) MOVQ "".j+16(FP), BP
0x000a 00010 (x.go:4) CMPQ BX, BP
0x000d 00013 (x.go:4) SETEQ "".~r2+24(FP)
0x0012 00018 (x.go:4) RET

regexp benchmarks, best of 12 runs:

benchmark                                 old ns/op      new ns/op      delta
BenchmarkNotOnePassShortB                 782            733            -6.27%
BenchmarkLiteral                          180            171            -5.00%
BenchmarkNotLiteral                       2855           2721           -4.69%
BenchmarkMatchHard_32                     2672           2557           -4.30%
BenchmarkMatchHard_1K                     80182          76732          -4.30%
BenchmarkMatchEasy1_32M                   76440180       73304748       -4.10%
BenchmarkMatchEasy1_32K                   68798          66350          -3.56%
BenchmarkAnchoredLongMatch                482            465            -3.53%
BenchmarkMatchEasy1_1M                    2373042        2292692        -3.39%
BenchmarkReplaceAll                       2776           2690           -3.10%
BenchmarkNotOnePassShortA                 1397           1360           -2.65%
BenchmarkMatchClass_InRange               3842           3742           -2.60%
BenchmarkMatchEasy0_32                    125            122            -2.40%
BenchmarkMatchEasy0_32K                   11414          11164          -2.19%
BenchmarkMatchEasy0_1K                    668            654            -2.10%
BenchmarkAnchoredShortMatch               260            255            -1.92%
BenchmarkAnchoredLiteralShortNonMatch     164            161            -1.83%
BenchmarkOnePassShortB                    623            612            -1.77%
BenchmarkOnePassShortA                    801            788            -1.62%
BenchmarkMatchClass                       4094           4033           -1.49%
BenchmarkMatchEasy0_32M                   14078800       13890704       -1.34%
BenchmarkMatchHard_32K                    4095844        4045820        -1.22%
BenchmarkMatchEasy1_1K                    1663           1643           -1.20%
BenchmarkMatchHard_1M                     131261708      129708215      -1.18%
BenchmarkMatchHard_32M                    4210112412     4169292003     -0.97%
BenchmarkMatchMedium_32K                  2460752        2438611        -0.90%
BenchmarkMatchEasy0_1M                    422914         419672         -0.77%
BenchmarkMatchMedium_1M                   78581121       78040160       -0.69%
BenchmarkMatchMedium_32M                  2515287278     2498464906     -0.67%
BenchmarkMatchMedium_32                   1754           1746           -0.46%
BenchmarkMatchMedium_1K                   52105          52106          +0.00%
BenchmarkAnchoredLiteralLongNonMatch      185            185            +0.00%
BenchmarkMatchEasy1_32                    107            107            +0.00%
BenchmarkOnePassLongNotPrefix             505            505            +0.00%
BenchmarkOnePassLongPrefix                147            147            +0.00%

The godoc binary is ~0.12% smaller after this CL.

Updates #5729.

toolstash -cmp passes for all architectures other than amd64 and amd64p32.

Other architectures can be done in follow-up CLs.

Change-Id: I0e167e259274b722958567fc0af83a17ca002da7
Reviewed-on: https://go-review.googlesource.com/2284
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoruntime: add -buildmode=c-archive/c-shared support for linux/386
Ian Lance Taylor [Fri, 17 Apr 2015 18:38:58 +0000 (11:38 -0700)]
runtime: add -buildmode=c-archive/c-shared support for linux/386

Change-Id: I87147ca6bb53e3121cc4245449c519509f107638
Reviewed-on: https://go-review.googlesource.com/9009
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/internal/gc: make use of new String methods in prints
Russ Cox [Fri, 17 Apr 2015 16:03:22 +0000 (12:03 -0400)]
cmd/internal/gc: make use of new String methods in prints

$ sam -d cmd/internal/gc/*.{go,y} cmd/?g/*.go
X ,s/, (gc\.)?[BFHNST]conv\(([^()]+), 0\)/, \2/g
X/'/w
q
$

Change-Id: Ic28a4807d237b8ae53ceca1e4e7fdb43580ab560
Reviewed-on: https://go-review.googlesource.com/9032
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
10 years agocmd/internal/gc: add String methods to *Mpint, *Mpflt, *Node, *NodeList, *Sym, *Type
Russ Cox [Fri, 17 Apr 2015 15:56:29 +0000 (11:56 -0400)]
cmd/internal/gc: add String methods to *Mpint, *Mpflt, *Node, *NodeList, *Sym, *Type

The next CL will remove unnecessary conv calls.

Change-Id: I0e8dbd1756cdec1ef6095ae67629cd3fae0fb4a4
Reviewed-on: https://go-review.googlesource.com/9031
Reviewed-by: Austin Clements <austin@google.com>
10 years agoruntime: leave gccheckmark testing off by default
Russ Cox [Fri, 17 Apr 2015 14:11:44 +0000 (10:11 -0400)]
runtime: leave gccheckmark testing off by default

It's not helping anymore, and it's fooling people who try to
understand performance (like me).

Change-Id: I133a644acae0ddf1bfa17c654cdc01e2089da963
Reviewed-on: https://go-review.googlesource.com/9018
Reviewed-by: Austin Clements <austin@google.com>
10 years agocmd/internal/ld, cmd/dist: support -buildmode=c-archive on linux
Ian Lance Taylor [Thu, 16 Apr 2015 17:08:20 +0000 (10:08 -0700)]
cmd/internal/ld, cmd/dist: support -buildmode=c-archive on linux

Change-Id: I8c97751a79b57197428b0f0b66fc9575708a2eb0
Reviewed-on: https://go-review.googlesource.com/8979
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agoruntime: fix dangling pointer in readyExecute
Austin Clements [Mon, 13 Apr 2015 20:50:20 +0000 (16:50 -0400)]
runtime: fix dangling pointer in readyExecute

readyExecute passes a closure to mcall that captures an argument to
readyExecute. Since mcall is marked noescape, this closure lives on
the stack of the calling goroutine. However, the closure puts the
calling goroutine on the run queue (and switches to a new
goroutine). If the calling goroutine gets scheduled before the mcall
returns, this stack-allocated closure will become invalid while it's
still executing. One consequence of this we've observed is that the
captured gp variable can get overwritten before the call to
execute(gp), causing execute(gp) to segfault.

Fix this by passing the currently captured gp variable through a field
in the calling goroutine's g struct so that the func is no longer a
closure.

To prevent problems like this in the future, this change also removes
the go:noescape annotation from mcall. Due to a compiler bug, this
will currently cause a func closure passed to mcall to be implicitly
allocated rather than refusing the implicit allocation. However, this
is okay because there are no other closures passed to mcall right now
and the compiler bug will be fixed shortly.

Fixes #10428.

Change-Id: I49b48b85de5643323b89e9eaa4df63854e968c32
Reviewed-on: https://go-review.googlesource.com/8866
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agodoc/go1.5.txt: go generate -run
Rob Pike [Fri, 17 Apr 2015 17:50:56 +0000 (10:50 -0700)]
doc/go1.5.txt: go generate -run

Change-Id: I8029640fe74731d7847390f371af37b85dec96cc
Reviewed-on: https://go-review.googlesource.com/9006
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/go: implement the long-promised -run flag for go generate
Rob Pike [Fri, 17 Apr 2015 17:27:05 +0000 (10:27 -0700)]
cmd/go: implement the long-promised -run flag for go generate

Trivial to do, but overlooked for 1.4, which is good because I prefer
the new design, which is just to match against the source code of
the line rather than the command word alone.

Change-Id: Idcf7c4479e97bb7cd732f0d058012321b6057628
Reviewed-on: https://go-review.googlesource.com/9005
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocmd/internal/obj: cleanups from C transition and delete dead code
Brad Fitzpatrick [Fri, 17 Apr 2015 16:36:19 +0000 (09:36 -0700)]
cmd/internal/obj: cleanups from C transition and delete dead code

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

10 years agoregexp: set b.cap[0] and b.cap[1] only when captures requested
Michael Matloob [Mon, 6 Apr 2015 20:33:47 +0000 (13:33 -0700)]
regexp: set b.cap[0] and b.cap[1] only when captures requested

Fixes #10319

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

10 years agomisc/cgo/testcshared: test -buildmode=c-shared
Hyang-Ah Hana Kim [Thu, 16 Apr 2015 17:46:58 +0000 (13:46 -0400)]
misc/cgo/testcshared: test -buildmode=c-shared

Followed the same test pattern in misc/cgo/testcarchive.

Change-Id: I2f863b5c24a28f0b38b0128ed3e8a92c17fb5b9f
Reviewed-on: https://go-review.googlesource.com/8985
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/internal/gc: fix node print
Russ Cox [Fri, 17 Apr 2015 05:50:16 +0000 (01:50 -0400)]
cmd/internal/gc: fix node print

Change-Id: I0d2b909ceeba9da86c77de4ce23d7c6063f8f10f
Reviewed-on: https://go-review.googlesource.com/9017
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime/pprof: disable TestTraceStressStartStop
Dave Cheney [Thu, 16 Apr 2015 11:32:48 +0000 (21:32 +1000)]
runtime/pprof: disable TestTraceStressStartStop

Updates #10476

Change-Id: Ic4414f669104905c6004835be5cf0fa873553ea6
Reviewed-on: https://go-review.googlesource.com/8962
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agofmt: adjust formatting of invalid reflect.Value, add more tests
Russ Cox [Thu, 16 Apr 2015 19:18:27 +0000 (15:18 -0400)]
fmt: adjust formatting of invalid reflect.Value, add more tests

Repeat of CL 8951.

Change-Id: I5430e4a9eb5d8b7d0e3963657092bede67439056
Reviewed-on: https://go-review.googlesource.com/9003
Reviewed-by: Rob Pike <r@golang.org>
10 years agoruntime: export main.main for android
David Crawshaw [Fri, 17 Apr 2015 02:01:20 +0000 (22:01 -0400)]
runtime: export main.main for android

Previously we started the Go runtime from a JNI function call, which
eventually called the program's main function. Now the runtime is
initialized by an ELF initialization function as a c-shared library,
and the program's main function is not called. So now we export main
so it can be called from JNI.

This is necessary for all-Go apps because unlike a normal shared
library, the program loading the library is not written by or known
to the programmer. As far as they are concerned, the .so is
everything. In fact the same code is compiled for iOS as a normal Go
program.

Change-Id: I61c6a92243240ed229342362231b1bfc7ca526ba
Reviewed-on: https://go-review.googlesource.com/9015
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agoruntime: do not run main when buildmode=c-shared
David Crawshaw [Thu, 16 Apr 2015 20:05:52 +0000 (16:05 -0400)]
runtime: do not run main when buildmode=c-shared

Change-Id: Ie7f85873978adf3fd5c739176f501ca219592824
Reviewed-on: https://go-review.googlesource.com/9011
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agogo/build: deps check all std packages
Matthew Dempsky [Thu, 16 Apr 2015 19:03:10 +0000 (12:03 -0700)]
go/build: deps check all std packages

Instead of only checking packages that are already listed in pkgDeps,
apply deps checks to all standard library packages.

To avoid slowing testing down too much, instead of running "go list
std" in a subprocess like cmd/api or cmd/dist, this test manually
walks the GOROOT src directory to enumerate packages.

Timings on an HP Z620 using linux/amd64:

     short full
before 0.092s 4.880s
after 0.137s 5.104s

Additionally, a handful of packages that were previously unchecked are
now listed, along with their current dependencies.  These should
probably eventually be moved elsewhere and assigned appropriate
allowable-dependency sets.  For now, they've been grandfathered in by
simply assigning them their current dependencies, so that followup CLs
can review them individually as appropriate.

Fixes #10475.

Change-Id: I83ffd8ff329092f664bf3e3f2c9e3dad8e77ac02
Reviewed-on: https://go-review.googlesource.com/9001
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agocompress/flate: simplify the TestDegenerateHuffmanCoding data.
Nigel Tao [Fri, 17 Apr 2015 04:11:22 +0000 (14:11 +1000)]
compress/flate: simplify the TestDegenerateHuffmanCoding data.

Change-Id: I223a4bd6e3ee31324b46ac79a4022e40f1868491
Reviewed-on: https://go-review.googlesource.com/8995
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
10 years agocmd/internal/gc: clean up bgen
Josh Bleecher Snyder [Tue, 7 Apr 2015 02:36:36 +0000 (19:36 -0700)]
cmd/internal/gc: clean up bgen

This cleanup is in anticipation of implementing
jump-free booleans (CL 2284) and zero-aware
comparisons (issue 10381).

No functional changes. Passes toolstash -cmp.

Change-Id: I50f394c60fa2927e177d7fc85b75085060a9e912
Reviewed-on: https://go-review.googlesource.com/8738
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoruntime: delete cgo_allocate
Russ Cox [Wed, 15 Apr 2015 19:00:42 +0000 (15:00 -0400)]
runtime: delete cgo_allocate

This memory is untyped and can't be used anymore.
The next version of SWIG won't need it.

Change-Id: I592b287c5f5186975ee09a9b28d8efe3b57134e7
Reviewed-on: https://go-review.googlesource.com/8956
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agonet: fix inconsistent error values on Dial, Listen partially
Mikio Hara [Mon, 13 Apr 2015 14:45:00 +0000 (23:45 +0900)]
net: fix inconsistent error values on Dial, Listen partially

This change makes TestDialError, TestListenError work without any
external dependency, enables them by default, and removes unnecessary
-run_error_test flag for fixing #4856.

Also fixes inconsistent error values on Dial, Listen partially as a
first stab.

Updates #4856.

Change-Id: Ie10c151ae06759085f352c7db2ca45107a81914f
Reviewed-on: https://go-review.googlesource.com/8903
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agonet: rename netFD.proto to netFD.net on Plan 9
Mikio Hara [Thu, 16 Apr 2015 07:24:45 +0000 (16:24 +0900)]
net: rename netFD.proto to netFD.net on Plan 9

In followup changes, we'll move OpError around from the netFD layer to
the Conn layer for fixing #4856. Before doing that, this change makes
netFD of Plan 9 match netFD for POSIX platforms to avoid conflict.

Change-Id: Iea7632716d48722a1758e52effefec964a3a9442
Reviewed-on: https://go-review.googlesource.com/8990
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoimage/color: have Palette.Index honor alpha for closest match, not just
Nigel Tao [Thu, 16 Apr 2015 01:08:05 +0000 (11:08 +1000)]
image/color: have Palette.Index honor alpha for closest match, not just
red, green and blue.

Fixes #9902

Change-Id: Ibffd0aa2f98996170e39a919296f69e9d5c71545
Reviewed-on: https://go-review.googlesource.com/8907
Reviewed-by: Rob Pike <r@golang.org>
10 years agodoc: mention darwin/arm64 port in go1.5.txt
Shenghou Ma [Sat, 11 Apr 2015 10:01:54 +0000 (06:01 -0400)]
doc: mention darwin/arm64 port in go1.5.txt

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f08
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8787
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/internal/ld: use usual flooding for c-archive
David Crawshaw [Thu, 16 Apr 2015 19:53:05 +0000 (15:53 -0400)]
cmd/internal/ld: use usual flooding for c-archive

I said I removed this from cl/8711 in response to your comment, but
apparently I did not.

misc/cgo/testcarchive continues to pass on darwin/amd64.

Change-Id: I6410782f2a78bf117741628fb71cac56e289b590
Reviewed-on: https://go-review.googlesource.com/9010
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: aeshash stubs for arm64
David Crawshaw [Thu, 16 Apr 2015 19:23:17 +0000 (15:23 -0400)]
runtime: aeshash stubs for arm64

For some reason the absense of an implementation does not stop arm64
binaries being built. However it comes up with -buildmode=c-archive.

Change-Id: Ic0db5fd8fb4fe8252b5aa320818df0c7aec3db8f
Reviewed-on: https://go-review.googlesource.com/8989
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocmd/go: have go run, go list respect -buildmode/-linkshared
Michael Hudson-Doyle [Wed, 1 Apr 2015 02:53:52 +0000 (15:53 +1300)]
cmd/go: have go run, go list respect -buildmode/-linkshared

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

10 years agoruntime: darwin/arm64 c-archive entry point
David Crawshaw [Thu, 16 Apr 2015 17:49:36 +0000 (13:49 -0400)]
runtime: darwin/arm64 c-archive entry point

Change-Id: Ib227aa3e14d01a0ab1ad9e53d107858e045d1c42
Reviewed-on: https://go-review.googlesource.com/8984
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agonet: fix typo in comment
David du Colombier [Thu, 16 Apr 2015 18:42:21 +0000 (20:42 +0200)]
net: fix typo in comment

Change-Id: I8b2063e65d3454a694a789c1682dacfe0bea2e19
Reviewed-on: https://go-review.googlesource.com/8965
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocrypto/tls: fix test data generation
Jonathan Rudenberg [Wed, 15 Apr 2015 19:00:53 +0000 (15:00 -0400)]
crypto/tls: fix test data generation

- Multiple GetCertificate tests shared the same name and were
  overwriting each other, each test now has a unique name.
- expectAlert was not implemented in the data updater, the single
  test that used it has been replaced with a ClientHello failure
  test.

Fixes #10470

Change-Id: I500738f6302ffa863d7ee45d85fa8773155e0614
Reviewed-on: https://go-review.googlesource.com/8959
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>

10 years agoruntime/cgo: enable arm64 EXC_BAD_ACCESS handler
David Crawshaw [Thu, 16 Apr 2015 17:39:16 +0000 (13:39 -0400)]
runtime/cgo: enable arm64 EXC_BAD_ACCESS handler

Change-Id: I8e912ff9327a4163b63b8c628aa3546e86ddcc02
Reviewed-on: https://go-review.googlesource.com/8983
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
10 years agoRevert "fmt: add a few more reflect.Value tests"
Brad Fitzpatrick [Thu, 16 Apr 2015 16:58:16 +0000 (16:58 +0000)]
Revert "fmt: add a few more reflect.Value tests"

This reverts commit 3e6b7f35de96414a3a393f0ad25326f411101776.

Change-Id: Icad2b235b9880729fbdf80d7dfd71e56df4b1231
Reviewed-on: https://go-review.googlesource.com/8944
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocrypto/x509: build the builtin root certs also for darwin/arm64
Shenghou Ma [Sat, 11 Apr 2015 09:09:12 +0000 (05:09 -0400)]
crypto/x509: build the builtin root certs also for darwin/arm64

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f06
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8785
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoos: clarify that ModePerm permission bits are the Unix ones
Brad Fitzpatrick [Tue, 14 Apr 2015 22:22:02 +0000 (15:22 -0700)]
os: clarify that ModePerm permission bits are the Unix ones

Fixes #7075

Change-Id: I57fcebaaef768b00263b6b91211b1434f6a4b229
Reviewed-on: https://go-review.googlesource.com/8919
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
10 years agofmt: add a few more reflect.Value tests
Russ Cox [Wed, 15 Apr 2015 17:49:32 +0000 (13:49 -0400)]
fmt: add a few more reflect.Value tests

Change-Id: I86530a4fd240f3e056e3277355d2965f6863b852
Reviewed-on: https://go-review.googlesource.com/8951
Reviewed-by: Rob Pike <r@golang.org>
10 years agomime/quotedprintable: Return a Reader instead of an io.Reader
Alexandre Cesaro [Thu, 16 Apr 2015 14:08:09 +0000 (16:08 +0200)]
mime/quotedprintable: Return a Reader instead of an io.Reader

It is not needed right now, but it will allow more flexibility in
the future.

Fixes #10472

Change-Id: I2eaea70abeca5ed10f89b0b2dfdabdac376a0a41
Reviewed-on: https://go-review.googlesource.com/8964
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoreflect, cmd/internal/gc: look for pointer types by string before synthesizing
Michael Hudson-Doyle [Sun, 29 Mar 2015 23:11:47 +0000 (23:11 +0000)]
reflect, cmd/internal/gc: look for pointer types by string before synthesizing

The ptrto field of the type data cannot be relied on when dynamic linking: a
type T may be defined in a module that makes no use of pointers to that type,
but another module can contain a package that imports the first one and does use
*T pointers.  The second module will end up defining type data for *T and a
type.*T symbol pointing at it. It's important that calling .PtrTo() on the
refect.Type for T returns this type data and not some synthesized object, so we
need reflect to be able to find it!

Fortunately, the reflect package already has a mechanism for doing this sort of
thing: ChanOf/MapOf/etc look for pre-existing type data by name.  So this change
just extends PtrTo() to consult this too, and changes the compiler to include
pointer types in the data consulted when compiling for dynamic linking.

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

10 years agomisc/ios: fix teamID and appID use in entitlements
Josh Bleecher Snyder [Thu, 16 Apr 2015 00:00:05 +0000 (17:00 -0700)]
misc/ios: fix teamID and appID use in entitlements

This is a follow-up to CL 8910.
This is the version that I have tested and which works
when appID and teamID are not the same (which they appear
to be for the builder).

I am unsure how I submitted it with the wrong code.

Change-Id: I186e34e91953d082b507390c1cd2042e5419c4c9
Reviewed-on: https://go-review.googlesource.com/8943
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/internal/gc: registerize more in 7g and 9g
Josh Bleecher Snyder [Fri, 10 Apr 2015 00:58:52 +0000 (17:58 -0700)]
cmd/internal/gc: registerize more in 7g and 9g

7g and 9g disagree with componentgen
about what type len and cap have.

This results in an etype mismatch,
which inhibits registerization.

Fixing this results in 7406 more registerizations
while building the stdlib.
There are still 1512 missed opportunities.

This should improve the performance benefit
to 7g of enabling componentgen (CL 8636).

This CL reduces the size of godoc by 203k (-1.177%).

This was discovered by using the diagnostics
added in CL 8732 and running:

GOARCH=arm64 GOOS=linux go build -gcflags="-d registerization" std

See CL 91850043 for similar earlier fixes for 6g and 8g.

Change-Id: I57f478228a000ad7529d4136bad94a51343c4daa
Reviewed-on: https://go-review.googlesource.com/8733
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Keith Randall <khr@golang.org>
10 years agocmd/7g: change CHECKNIL sequence
Aram Hăvărneanu [Wed, 8 Apr 2015 13:39:25 +0000 (15:39 +0200)]
cmd/7g: change CHECKNIL sequence

We can use CBNZ instruction and make it one instruction shorter.

Saves 66kB in godoc.

Change-Id: Ie71fe7cf31e7f73644ee926f4f9624c009c3eb1a
Reviewed-on: https://go-review.googlesource.com/8634
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/7g: remove loads that only load an immediate to be later used by ADD/SUB
Aram Hăvărneanu [Wed, 8 Apr 2015 11:14:15 +0000 (13:14 +0200)]
cmd/7g: remove loads that only load an immediate to be later used by ADD/SUB

Optimize the sequence:
MOV $imm, Rt
ADD Rt, Rs, Rd

into:
ADD $imm, Rs, Rd

Saves 66k in godoc.

Change-Id: I27b4aaa0ec80a59472fe2e5816efdf3db9c901ee
Reviewed-on: https://go-review.googlesource.com/8632
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime: darwin/arm64 support
Shenghou Ma [Sat, 11 Apr 2015 02:14:43 +0000 (22:14 -0400)]
runtime: darwin/arm64 support

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f03
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8782
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agomisc/cgo/test: skip issue3261 test on darwin/arm64
Shenghou Ma [Sat, 11 Apr 2015 09:57:15 +0000 (05:57 -0400)]
misc/cgo/test: skip issue3261 test on darwin/arm64

Because there is no libgcc.

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f07
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8786
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agoiostest.bash: run detect.go as part of iostest
David Crawshaw [Wed, 15 Apr 2015 19:03:41 +0000 (15:03 -0400)]
iostest.bash: run detect.go as part of iostest

Change-Id: I402629b154ae36c879a8d5088cb0f71b075f31dc
Reviewed-on: https://go-review.googlesource.com/8958
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
10 years agoruntime/cgo: darwin/arm64 support
Shenghou Ma [Sat, 11 Apr 2015 02:16:11 +0000 (22:16 -0400)]
runtime/cgo: darwin/arm64 support

Fixes #10116.

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f05
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8784
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agosyscall: darwin/arm64 support
Shenghou Ma [Sat, 11 Apr 2015 02:15:31 +0000 (22:15 -0400)]
syscall: darwin/arm64 support

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f04
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8783
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agomisc/ios: adjust exec script for iOS 8.3
David Crawshaw [Wed, 15 Apr 2015 18:59:46 +0000 (14:59 -0400)]
misc/ios: adjust exec script for iOS 8.3

We no longer need the EXC_BAD_ACCESS watcher as runtime/cgo contains
a mach exception handler that catches it. And now lldb only
intermittently reports process connection and exiting, so instead
just look for the PASS from Go.

Change-Id: I403266558f5a900e0b87ec1019d9baec88148d23
Reviewed-on: https://go-review.googlesource.com/8957
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
10 years agocompress/flate: reject invalid Huffman bit sizes
Matthew Dempsky [Mon, 13 Apr 2015 22:31:28 +0000 (15:31 -0700)]
compress/flate: reject invalid Huffman bit sizes

If the requested coding bit sizes don't result in a full binary tree,
then reject the input as invalid.

Exception: We still need to allow degenerate Huffman codings with a
single 1-bit code to be compatible with zlib and files compressed with
Go's compress/flate package.

Update #10426.

Change-Id: I171b98d12e65b4deb9f4031cd802407ebb5e266c
Reviewed-on: https://go-review.googlesource.com/8922
Reviewed-by: Nigel Tao <nigeltao@golang.org>
10 years agoAdd reflect.FuncOf to docs/go1.5.text
Dave Day [Thu, 16 Apr 2015 05:37:51 +0000 (15:37 +1000)]
Add reflect.FuncOf to docs/go1.5.text

Change-Id: I6089cebf7de73ce9c4e53ad3e8ef2673d970bda2
Reviewed-on: https://go-review.googlesource.com/8908
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/internal/obj, cmd/internal/ld, cmd/7l: external linking for darwin/arm64
Shenghou Ma [Sat, 11 Apr 2015 01:28:09 +0000 (21:28 -0400)]
cmd/internal/obj, cmd/internal/ld, cmd/7l: external linking for darwin/arm64

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f02
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8781
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/7g: disable duff's device on darwin
Shenghou Ma [Sat, 11 Apr 2015 00:08:22 +0000 (20:08 -0400)]
cmd/7g: disable duff's device on darwin

ld64 cannot handle BR26 reloc with non-zero addend. It incorrectly
thinks that non-zero addend for BR26 means the code is not PIC, but
those BR26 relocs should be fully resolved at link time.

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f01
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8780
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/internal/obj/arm64: add SVC to unary destination list
Shenghou Ma [Sat, 11 Apr 2015 02:16:32 +0000 (22:16 -0400)]
cmd/internal/obj/arm64: add SVC to unary destination list

To support "SVC $0x80", which is needed for darwin/arm64.

Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f00
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8769
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocompress/flate: add optional runtime sanity checks
Matthew Dempsky [Wed, 15 Apr 2015 23:46:58 +0000 (16:46 -0700)]
compress/flate: add optional runtime sanity checks

This code's test coverage is ad hoc at best, and it's easy to make
changes that accidentally regress invariants.  This CL adds a "sanity"
constant that can be changed to "true" during development to add extra
runtime checking that the Huffman decoder tables are sane.

Change-Id: I0d0ca53ad7c9566be18046d9b255e1a30059f28b
Reviewed-on: https://go-review.googlesource.com/8974
Reviewed-by: Nigel Tao <nigeltao@golang.org>
10 years agocompress/flate: reject invalid Huffman encoding sequences
Matthew Dempsky [Mon, 13 Apr 2015 22:31:28 +0000 (15:31 -0700)]
compress/flate: reject invalid Huffman encoding sequences

When decoding Huffman codes, if an invalid bit sequence is discovered,
reject the input instead of treating it as a 0-length code.

Fixes #10426.

Change-Id: Ie2f1a3a718afd7c6bee73a67480d4b84936c21c9
Reviewed-on: https://go-review.googlesource.com/8893
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
10 years agoreflect: add FuncOf function
Dave Day [Tue, 23 Dec 2014 04:19:30 +0000 (15:19 +1100)]
reflect: add FuncOf function

This also involves adding functions to typelinks along with a minor
change to ensure they are sorted correctly.

Change-Id: I054a79b6498a634cbccce17579f52c299733c2cf
Reviewed-on: https://go-review.googlesource.com/1996
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoimage: spell coordinate consistently, without the hyphen.
Nigel Tao [Thu, 16 Apr 2015 00:13:23 +0000 (10:13 +1000)]
image: spell coordinate consistently, without the hyphen.

Change-Id: I211c0d33dc292c6a703d788f6d4d286107bcb6b0
Reviewed-on: https://go-review.googlesource.com/8906
Reviewed-by: Rob Pike <r@golang.org>
10 years agonet: fix TestDialGoogle with -ipv6 when CGO_ENABLED=0
Mikio Hara [Fri, 10 Apr 2015 08:24:43 +0000 (17:24 +0900)]
net: fix TestDialGoogle with -ipv6 when CGO_ENABLED=0

Under some dial tests that require external network connectivity, we
must prevent application traffic but must not interfere with control
plane traffic such as DNS message exchange. But test helper function
disableSocketConnect prevents both application and control plane traffic
unconditionally and makes some dial tests with -ipv6 fail when
CGO_ENABLED=0.

This change makes disableSocketConnect take a look at not only address
family but socket type for fixing some dial tests with -ipv6 when
CGO_ENBALED=0.

Change-Id: I32241d9592d31483424bb5e69cb4d56f3fc20312
Reviewed-on: https://go-review.googlesource.com/8743
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/6l: call runtime.addmoduledata from .init_array
Michael Hudson-Doyle [Wed, 1 Apr 2015 01:17:43 +0000 (14:17 +1300)]
cmd/6l: call runtime.addmoduledata from .init_array

Change-Id: I09e84161d106960a69972f5fc845a1e40c28e58f
Reviewed-on: https://go-review.googlesource.com/8331
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/go: support -buildmode=shared
Michael Hudson-Doyle [Sun, 22 Mar 2015 23:30:18 +0000 (12:30 +1300)]
cmd/go: support -buildmode=shared

You can now do 'go install -buildmode=shared std' and get yourself
a nice (33 meg) libstd.so (which is not useful until there is -linkshared
support as well, of course).

Change-Id: Ie9b7e7f72abc7d369a6e3ecc98903a9d197bd6e6
Reviewed-on: https://go-review.googlesource.com/8300
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agointernal/syscall: move to unix subdirectory
Ian Lance Taylor [Wed, 15 Apr 2015 23:28:00 +0000 (16:28 -0700)]
internal/syscall: move to unix subdirectory

Move the single file from internal/syscall to internal/syscall/unix,
to match the golang.org/x/sys layout.

Change-Id: I2fb2832b4cb22efc7666bd276f5401ac3e73dc40
Reviewed-on: https://go-review.googlesource.com/8972
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/test: require external linking for c-archive
David Crawshaw [Wed, 15 Apr 2015 18:47:08 +0000 (14:47 -0400)]
cmd/test: require external linking for c-archive

Change-Id: I9ceceb29291ea9f5d7b675dfabd665c5e3618471
Reviewed-on: https://go-review.googlesource.com/8955
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agogo/build: support -installsuffix with gccgo
Michael Hudson-Doyle [Tue, 14 Apr 2015 08:22:23 +0000 (10:22 +0200)]
go/build: support -installsuffix with gccgo

Fixes #10449

Change-Id: I1dc2d0213e6a46f3609222d5460c1a54081e2471
Reviewed-on: https://go-review.googlesource.com/8931
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agocmd/go, go/build: add build.Package.PkgTargetRoot
Michael Hudson-Doyle [Tue, 14 Apr 2015 08:20:18 +0000 (10:20 +0200)]
cmd/go, go/build: add build.Package.PkgTargetRoot

This is $GOPATH/pkg/linux_amd64 or similar.  cmd/go already had a grotty calculation
of this and I need to add another one for -buildmode=shared.

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

10 years agocmd/internal/ld: allow -r to override rpath when -linkshared
Michael Hudson-Doyle [Sun, 12 Apr 2015 00:31:28 +0000 (02:31 +0200)]
cmd/internal/ld: allow -r to override rpath when -linkshared

Including having -r "" preventing rpath from being set at all.

Change-Id: Ib40d7bf93a6e9ef21985c4a05b5703e4fbd1cd1b
Reviewed-on: https://go-review.googlesource.com/8806
Reviewed-by: Ian Lance Taylor <iant@golang.org>