]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agocmd/compile/internal/gc: convert fields of TempVar to bool
Marvin Stenger [Tue, 8 Sep 2015 18:04:43 +0000 (20:04 +0200)]
cmd/compile/internal/gc: convert fields of TempVar to bool

Convert two fields of struct TempVar in popt.go from uint8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

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

9 years agocmd/compile/internal/gc: convert fields of Symlink to bool
Marvin Stenger [Tue, 8 Sep 2015 18:29:10 +0000 (20:29 +0200)]
cmd/compile/internal/gc: convert fields of Symlink to bool

Convert two fields of struct Symlink in subr.go from uint8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

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

9 years agodoc: fix typo in go1.6.txt
Rob Pike [Wed, 9 Sep 2015 05:28:50 +0000 (22:28 -0700)]
doc: fix typo in go1.6.txt

Change-Id: I3bf1862c304ff08bfb87f84b6ccbb50204225244
Reviewed-on: https://go-review.googlesource.com/14407
Reviewed-by: Rob Pike <r@golang.org>
9 years agotext/template: provide a way to trim leading and trailing space between actions
Rob Pike [Tue, 8 Sep 2015 21:58:12 +0000 (14:58 -0700)]
text/template: provide a way to trim leading and trailing space between actions

Borrowing a suggestion from the issue listed below, we modify the lexer to
trim spaces at the beginning (end) of a block of text if the action immediately
before (after) is marked with a minus sign. To avoid parsing/lexing ambiguity,
we require an ASCII space between the minus sign and the rest of the action.
Thus:

{{23 -}}
<
{{- 45}}

produces the output
23<45

All the work is done in the lexer. The modification is invisible to the parser
or any outside package (except I guess for noticing some gaps in the input
if one tracks error positions). Thus it slips in without worry in text/template
and html/template both.

Fixes long-requested issue #9969.

Change-Id: I3774be650bfa6370cb993d0899aa669c211de7b2
Reviewed-on: https://go-review.googlesource.com/14391
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoall: minor documentation tweaks for constants
Konstantin Shaposhnikov [Tue, 8 Sep 2015 11:26:02 +0000 (19:26 +0800)]
all: minor documentation tweaks for constants

Block comments appear after a block in the HTML documentation generated by
godoc. Words like "following" should be avoided.

Change-Id: Iedfad67f4b8b9c84f128b98b9b06fa76919af388
Reviewed-on: https://go-review.googlesource.com/14357
Reviewed-by: Rob Pike <r@golang.org>
9 years agoimage/png: reject zero-width and zero-height images.
Nigel Tao [Wed, 9 Sep 2015 00:57:40 +0000 (10:57 +1000)]
image/png: reject zero-width and zero-height images.

http://www.w3.org/TR/PNG/#11IHDR says that "Zero is an invalid value".

This change only affects the decoder. The encoder already checks
non-positive instead of negative.

Fixes #12545.

Change-Id: Iba40e1a2f4e0eec8b2fbcd3bbdae886311434da7
Reviewed-on: https://go-review.googlesource.com/14411
Reviewed-by: Rob Pike <r@golang.org>
9 years agocompress/lzw: tidy up some flush calls.
Nigel Tao [Tue, 30 Jun 2015 04:02:04 +0000 (14:02 +1000)]
compress/lzw: tidy up some flush calls.

Change-Id: Ie7368188ad4a970a82c140962cf97347d24f0331
Reviewed-on: https://go-review.googlesource.com/14410
Reviewed-by: David Symonds <dsymonds@golang.org>
9 years agocmd/dist, cmd/link: force external linking for shared libs on arm
Michael Hudson-Doyle [Tue, 1 Sep 2015 02:07:14 +0000 (14:07 +1200)]
cmd/dist, cmd/link: force external linking for shared libs on arm

Also run testcshared.

Fixes #12425

Change-Id: I5baea8d772d3462f945aab96260b4197dbb20c0a
Reviewed-on: https://go-review.googlesource.com/14143
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: add high-level description of how stack barriers work
Austin Clements [Sat, 29 Aug 2015 04:35:25 +0000 (00:35 -0400)]
runtime: add high-level description of how stack barriers work

Change-Id: I6affe75b5fa9dbf513c16200bff4fd7aa5f3a985
Reviewed-on: https://go-review.googlesource.com/14051
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: move stack barrier code to its own file
Austin Clements [Sat, 29 Aug 2015 03:15:41 +0000 (23:15 -0400)]
runtime: move stack barrier code to its own file

Currently the stack barrier code is mixed in with the mark and scan
code. Move all of the stack barrier related functions and variables to
a new dedicated source file. There are no code modifications.

Change-Id: I604603045465ef8573b9f88915d28ab6b5910903
Reviewed-on: https://go-review.googlesource.com/14050
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agodoc: document go1.5.1
Chris Broadfoot [Wed, 9 Sep 2015 00:47:25 +0000 (17:47 -0700)]
doc: document go1.5.1

Change-Id: I56452559acc432e06c15844d3f25dbeacafe77b7
Reviewed-on: https://go-review.googlesource.com/14402
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/internal/obj: remove unused code
Dave Cheney [Mon, 7 Sep 2015 06:21:25 +0000 (16:21 +1000)]
cmd/internal/obj: remove unused code

Following on from CL 14350, remove the remaining dead code from data.go.

Also leave a TODO to be addressed later (with a unit test) to reduce
the overhead of SymGrow.

Change-Id: Iebad775b1280b54b89e87a3a073ca8af19a8bfba
Reviewed-on: https://go-review.googlesource.com/14359
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared...
Michael Hudson-Doyle [Thu, 21 May 2015 01:07:19 +0000 (13:07 +1200)]
cmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared object

Currently Go produces shared libraries that cannot be shared between processes
because they have relocations against the text segment (not text section). This
fixes this by moving some data to sections with magic names recognized by the
static linker.

The change in genasmsym to add STYPELINK to the switch should fix things on
darwin/arm64.

Fixes #10914
Updates #9210

Change-Id: Iab4a6678dd04cec6114e683caac5cf31b1063309
Reviewed-on: https://go-review.googlesource.com/14306
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile/internal/mips64: copy cmd/compile/internal/ppc64
Shenghou Ma [Sun, 6 Sep 2015 00:32:40 +0000 (20:32 -0400)]
cmd/compile/internal/mips64: copy cmd/compile/internal/ppc64

Just a mechanical copy, no code changes.
This is to reduce code difference when adding the mips64 port.

Change-Id: Id06e975f414a7b09f4827167b30813b228a3bfaf
Reviewed-on: https://go-review.googlesource.com/14324
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/internal/obj/mips: copy cmd/internal/obj/ppc64
Shenghou Ma [Sun, 6 Sep 2015 00:27:00 +0000 (20:27 -0400)]
cmd/internal/obj/mips: copy cmd/internal/obj/ppc64

Just a mechanical copy with filename renames, no code changes.
This is to reduce code difference when adding the mips64 port.

Change-Id: Id06e975f414a7b09f4827167b30813b228a3bfae
Reviewed-on: https://go-review.googlesource.com/14323
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/internal/obj: remove dead code and small cleanups
Michael Hudson-Doyle [Mon, 7 Sep 2015 03:00:52 +0000 (15:00 +1200)]
cmd/internal/obj: remove dead code and small cleanups

Change-Id: I88fa0cc245a2141af04acced8716e08b1133abd1
Reviewed-on: https://go-review.googlesource.com/14350
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoAUTHORS: add Oracle as corporate copyright holder
Brad Fitzpatrick [Tue, 8 Sep 2015 17:28:22 +0000 (10:28 -0700)]
AUTHORS: add Oracle as corporate copyright holder

Some commits made by Aram from his personal email address are
actually copyright Oracle:

a77fcb3 net: fix comment in sendFile
b0e71f4 net: link with networking libraries when net package is in use
92e959a syscall, net: use sendfile on Solaris
db8d5b7 net: try to fix setKeepAlivePeriod on Solaris
fe5ef5c runtime, syscall: link Solaris binaries directly instead of using dlopen/dlsym
2b90c3e go/build: enable cgo by default on solaris/amd64
2d18ab7 doc/progs: disable cgo tests that use C.Stdout on Solaris
2230e9d misc/cgo: add various solaris build lines
649c7b6 net: add cgo support for Solaris
24396da os/user: small fixes for Solaris
121489c runtime/cgo: add cgo support for solaris/amd64
83b25d9 cmd/ld: make .rela and .rela.plt sections contiguous
c94f1f7 runtime: always load address of libcFunc on Solaris
e481aac cmd/6l: use .plt instead of .got on Solaris

See bug for clarification.

Fixes #12452

Change-Id: I0aeb1b46c0c7d09c5c736e383ecf40240d2cf85f
Reviewed-on: https://go-review.googlesource.com/14380
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agodoc: mention that go install removes binaries built by go build
Rob Pike [Tue, 8 Sep 2015 17:58:21 +0000 (10:58 -0700)]
doc: mention that go install removes binaries built by go build

Fixes #12288.

For inclusion in the 1.5.1 release.

Change-Id: I9354b7eaa76000498465c4a5cbab7246de9ecb7c
Reviewed-on: https://go-review.googlesource.com/14382
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agodoc: strconv.QuoteToGraphic in go1.6.txt
Rob Pike [Tue, 8 Sep 2015 17:39:03 +0000 (10:39 -0700)]
doc: strconv.QuoteToGraphic in go1.6.txt

Change-Id: I2f05d0b62deb5d7d0886f6fc5af5e7b79792efba
Reviewed-on: https://go-review.googlesource.com/14381
Reviewed-by: Rob Pike <r@golang.org>
9 years agostrconv: add QuoteToGraphic and friends
Rob Pike [Wed, 2 Sep 2015 22:08:24 +0000 (15:08 -0700)]
strconv: add QuoteToGraphic and friends

This version of quoting allows runes in category Zs, such as the
ideographic space characters, to be passed through unquoted.

Still to do (maybe): A way to access this from Printf.

Updates #11511.

Change-Id: I3bae84b1aa0bc1b885318d3f67c5f451099a2a5a
Reviewed-on: https://go-review.googlesource.com/14184
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
9 years agocmd/compile/internal/gc: convert fields of Type to bool
Marvin Stenger [Tue, 8 Sep 2015 01:51:30 +0000 (03:51 +0200)]
cmd/compile/internal/gc: convert fields of Type to bool

Convert some fields of struct Type in go.go from uint8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

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

9 years agocmd/compile/internal/gc: convert fields of Pkg to bool
Marvin Stenger [Tue, 8 Sep 2015 03:46:31 +0000 (05:46 +0200)]
cmd/compile/internal/gc: convert fields of Pkg to bool

Convert Pkg.Imported, Pkg.Exported, Pkg.Direct from uint8/int8/int8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I67a71f1186ff9737c03eca413f7d35d8a79ebc9b
Reviewed-on: https://go-review.googlesource.com/14371
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile/internal/gc: unexport and make Hasdefer a bool
Håvard Haugen [Mon, 7 Sep 2015 20:19:30 +0000 (22:19 +0200)]
cmd/compile/internal/gc: unexport and make Hasdefer a bool

Passes go build -a -toolexec 'toolstash -cmp' std cmd.

Change-Id: I804ee4252fa9be78cb277faf7f467e6c9cfdd4a6
Reviewed-on: https://go-review.googlesource.com/14319
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/internal/gc: remove unused field Type.Siggen
Marvin Stenger [Tue, 8 Sep 2015 03:54:22 +0000 (05:54 +0200)]
cmd/compile/internal/gc: remove unused field Type.Siggen

Remove unused field Type.Siggen in go.go.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: Ia61fe65a226c913fbf4a11a71d7453c56aa46c0e
Reviewed-on: https://go-review.googlesource.com/14372
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agocmd/compile: make importlist a []*Node instead of *NodeList
Håvard Haugen [Sun, 6 Sep 2015 20:38:49 +0000 (22:38 +0200)]
cmd/compile: make importlist a []*Node instead of *NodeList

Passes go build -a -toolexec 'toolstash -cmp' std.

Change-Id: Ica62765d3c1ef052afed34da1b3ac3f80646cc55
Reviewed-on: https://go-review.googlesource.com/14318
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile/internal/gc: convert Type.Broke into a bool
Dave Cheney [Mon, 7 Sep 2015 00:37:26 +0000 (10:37 +1000)]
cmd/compile/internal/gc: convert Type.Broke into a bool

Convert Type.Broke from a uint8 to a boolean

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I44e7548c71b00467e36576bdf62933c42555a21a
Reviewed-on: https://go-review.googlesource.com/14307
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Håvard Haugen <havard.haugen@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile/internal/gc: convert Label.Used to bool
Dave Cheney [Mon, 7 Sep 2015 01:11:14 +0000 (11:11 +1000)]
cmd/compile/internal/gc: convert Label.Used to bool

Convert Label.Used to a boolean. Also move the field to the
bottom of the struct to avoid padding.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: If09ee92f9d54dce807e7b862cf771005daed810d
Reviewed-on: https://go-review.googlesource.com/14308
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: remove unused FUNCDATA_DeadValueMaps
Michael Hudson-Doyle [Mon, 7 Sep 2015 03:36:56 +0000 (15:36 +1200)]
runtime: remove unused FUNCDATA_DeadValueMaps

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

9 years agocmd/compile/internal: some janitoring
Marvin Stenger [Sun, 6 Sep 2015 14:59:57 +0000 (16:59 +0200)]
cmd/compile/internal: some janitoring

Nicer swaps, loops (removed tmp variables). Use of bool instead of int.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I541904c74b57297848decc51a8a4913a8eca4af3
Reviewed-on: https://go-review.googlesource.com/14316
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: add stub sigreturn on arm
Michael Hudson-Doyle [Wed, 2 Sep 2015 09:52:19 +0000 (21:52 +1200)]
runtime: add stub sigreturn on arm

When building a shared library, all functions that are declared must actually
be defined.

Change-Id: I1488690cecfb66e62d9fdb3b8d257a4dc31d202a
Reviewed-on: https://go-review.googlesource.com/14187
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agocmd/dist: fix mkzversion to produce gofmt'd output
Dave Cheney [Mon, 7 Sep 2015 06:04:01 +0000 (16:04 +1000)]
cmd/dist: fix mkzversion to produce gofmt'd output

Fix mkzversion to produce correctly formatted runtime/zversion.go.

Change-Id: Ie6bcd361a2f2e390b7f6c4980fcae2c41bb7e52f
Reviewed-on: https://go-review.googlesource.com/14355
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/compile: convert typecheck_stack to []*Node
Dave Cheney [Sat, 5 Sep 2015 04:43:50 +0000 (14:43 +1000)]
cmd/compile: convert typecheck_stack to []*Node

This one of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I4d041b343952f4a31f3150fd70669e08fcaa74f8
Reviewed-on: https://go-review.googlesource.com/14305
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/asm: fix another infinite loop in register list parser
Didier Spezia [Sat, 5 Sep 2015 11:28:33 +0000 (11:28 +0000)]
cmd/asm: fix another infinite loop in register list parser

The code parsing register lists involves an inner loop on
each range defined by the lo,hi bounds. The condition on
this loop (for lo<=hi) is fragile, because the bounds
are unsigned 16 bits numbers.

In some corner cases, the calculated upper bound is 2^16-1
leading to an infinite loop.

Parsing operand `[):[o-FP` results in:
- an infinite loop for non ARM architectures
- the generation of almost 2^16 errors for the ARM architecture
  (which are then ignored)

This CL improves the code in 3 ways:
- bail out early when parsing non R prefixed registers
- make sure the register index is never negative
- make sure the number of iterations is limited by the
  maximum size of the range (as a defensive measure).

Fixes #12469

Change-Id: Ib1e7e36fb8ad5a3a52c50fc6219d3cfe2b39cc34
Reviewed-on: https://go-review.googlesource.com/14314
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile: use []*Node instead of NodeList in bottomUpVisitor
Dave Cheney [Sat, 5 Sep 2015 02:30:13 +0000 (12:30 +1000)]
cmd/compile: use []*Node instead of NodeList in bottomUpVisitor

This one of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I582ff8b077eb384b84721a1edb0c1efbc0c40059
Reviewed-on: https://go-review.googlesource.com/14304
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet: Make Listen(":port") use IPv6 when IPv4 is not supported.
Paul Marks [Sat, 5 Sep 2015 01:33:35 +0000 (18:33 -0700)]
net: Make Listen(":port") use IPv6 when IPv4 is not supported.

When running an experimental kernel with IPv4 disabled, Listen(":port")
currently tries to create an AF_INET socket, and fails.  Instead, it
should see !supportsIPv4, and use an AF_INET6 socket.

This sort of environment is quite esoteric at the moment, but I can
force the tests to fail on regular Linux using the following tweaks:

- net/net.go: supportsIPv4, supportsIPv6, supportsIPv4map = false, true, false
- net/sockopt_linux.go: ipv6only=true
- net/ipsock_posix.go: Revert this fix
- ./make.bash && ../bin/go test net

Also, make the arrows in server_test.go point to the left, because
server<-client is easier to read.

Fixes #12510

Change-Id: I0cc3b6b08d5e6908d2fbf8594f652ba19815aa4b
Reviewed-on: https://go-review.googlesource.com/14334
Run-TryBot: Paul Marks <pmarks@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: use []*Node instead of NodeList in sinit
Dave Cheney [Thu, 3 Sep 2015 07:07:00 +0000 (17:07 +1000)]
cmd/compile: use []*Node instead of NodeList in sinit

This is a first of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: Iad10b75e42b5b24e1694407841282fa3bab2dc9f
Reviewed-on: https://go-review.googlesource.com/14232
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoreflect: record unsafe.Pointer, not uintptr, during DeepEqual
Russ Cox [Tue, 1 Sep 2015 03:41:27 +0000 (23:41 -0400)]
reflect: record unsafe.Pointer, not uintptr, during DeepEqual

This is more correct with respect to garbage collection.
I don't know of any specific failures it could cause today.

Change-Id: I7eed6a06d2f281051199e79e4a9913aa8360ded7
Reviewed-on: https://go-review.googlesource.com/14137
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile/internal/gc: fix go.y (rename of Fatal -> Fatalf)
Robert Griesemer [Fri, 4 Sep 2015 23:56:45 +0000 (16:56 -0700)]
cmd/compile/internal/gc: fix go.y (rename of Fatal -> Fatalf)

Also go generate to update generated files.

Change-Id: I049708db93455f0030ba5afc6f218fde6220958d
Reviewed-on: https://go-review.googlesource.com/14331
Reviewed-by: Damien Neil <dneil@google.com>
9 years agocmd/go: fix Go buildid reading on Solaris
Shawn Walker-Salas [Wed, 26 Aug 2015 22:24:41 +0000 (15:24 -0700)]
cmd/go: fix Go buildid reading on Solaris

TestNoteReading fails on Solaris with linkmode=external due to some
assumptions made about how ELF .note sections are written by some
linkers.

On current versions of Solaris and older derivatives, SHF_ALLOC is
intentionally ignored for .note sections unless the .note section is
assigned to the text segment via a mapfile.  Also, if .note sections
are assigned to the text segment, no PT_NOTE program header will be
created thwarting Go's attempts at attempting to quickly find the
.note.

Furthermore, Go assumes that the relevant note segment will be placed
early in the file while the Solaris linker currently places the note
segment last in the file, additionally thwarting Go's optimisation
attempts that read only the first 16KB of the file to find the
buildid.

The fix is to detect when the note section is outside of the first
16KB of the file and then fallback to additionally reading that
section of the file.  This way, in future versions of Solaris when
this linking behaviour is changed, the fast path will always succeed
and we'll only be slower if it fails; likewise, any other linker that
does this will also just work.

Fixes #12178

Change-Id: I61c1dc3f744ae3ad63938386d2ace8a432c0efe1
Reviewed-on: https://go-review.googlesource.com/14210
Run-TryBot: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
9 years agoRevert "cmd/internal/ld: put read-only relocated data into .data.rel.ro when making...
Dave Cheney [Fri, 4 Sep 2015 09:53:35 +0000 (09:53 +0000)]
Revert "cmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared object"

This reverts commit 2c2cbb69c8dad1325f0a4b289417da73fd90f4b0.

Broke darwin/arm64

Change-Id: Ibd2dea475d6ce6a8b4b40e2da19a83fc0514025d
Reviewed-on: https://go-review.googlesource.com/14301
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: make DNSError.Temporary return true on SERVFAIL
Dan Peterson [Wed, 2 Sep 2015 01:53:46 +0000 (22:53 -0300)]
net: make DNSError.Temporary return true on SERVFAIL

Fixes #8434

Change-Id: I323222b4160f3aba35cac1de7f6df93c524b72ec
Reviewed-on: https://go-review.googlesource.com/14169
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: optimize some io.Copy calls by reusing buffers
Artyom Pervukhin [Wed, 2 Sep 2015 22:19:51 +0000 (01:19 +0300)]
net/http: optimize some io.Copy calls by reusing buffers

Optimize two calls of io.Copy which cannot make use of neither
io.ReaderFrom nor io.WriterTo optimization tricks by replacing them with
io.CopyBuffer with reusable buffers.

First is fallback call to io.Copy when server misses the optimized case
of using sendfile to copy from a regular file to net.TCPConn; second is
use of io.Copy on piped reader/writer when handler implementation uses
http.CloseNotifier interface. One of the notable users of
http.CloseNotifier is httputil.ReverseProxy.

benchmark                    old ns/op     new ns/op     delta
BenchmarkCloseNotifier-4     309591        303388        -2.00%

benchmark                    old allocs     new allocs     delta
BenchmarkCloseNotifier-4     50             49             -2.00%

benchmark                    old bytes     new bytes     delta
BenchmarkCloseNotifier-4     36168         3140          -91.32%

Fixes #12455

Change-Id: I512e6aa2f1aeed2ed00246afb3350c819b65b87e
Reviewed-on: https://go-review.googlesource.com/14177
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http/httptest: ResponseRecorder.WriteString
Nodir Turakulov [Fri, 4 Sep 2015 17:05:31 +0000 (10:05 -0700)]
net/http/httptest: ResponseRecorder.WriteString

Fixes #11000

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

9 years agocmd/compile/internal: slice/map literals janitoring
Didier Spezia [Sun, 23 Aug 2015 11:54:21 +0000 (11:54 +0000)]
cmd/compile/internal: slice/map literals janitoring

Simplify slice/map literal expressions.
Caught with gofmt -d -s, fixed with gofmt -w -s
Checked that the result can still be compiled with Go 1.4.

Change-Id: I5c58801c20919618d2ad52b8e2380d53df2783f1
Reviewed-on: https://go-review.googlesource.com/13831
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoimage/gif: map/slice literals janitoring
Didier Spezia [Sun, 23 Aug 2015 13:09:02 +0000 (13:09 +0000)]
image/gif: map/slice literals janitoring

Simplify slice/map literal expressions.
Caught with gofmt -d -s, fixed with gofmt -w -s

Change-Id: Iefd5f263c4f89a81da9427a7b9d97f13c35ab64f
Reviewed-on: https://go-review.googlesource.com/13838
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/compile, cmd/go: generate position independent code with -buildmode=c-shared...
Michael Hudson-Doyle [Tue, 1 Sep 2015 02:03:38 +0000 (14:03 +1200)]
cmd/compile, cmd/go: generate position independent code with -buildmode=c-shared on arm

All the code was there to do this, it just wasn't hooked up.

Fixes #10914

Change-Id: Ide8f9bbe50fecb5d11cd579915ee98d4c7efe403
Reviewed-on: https://go-review.googlesource.com/14142
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: teach softfloat interpreter about "add r11, pc, r11"
Michael Hudson-Doyle [Fri, 4 Sep 2015 02:57:59 +0000 (14:57 +1200)]
runtime: teach softfloat interpreter about "add r11, pc, r11"

This is generated during fp code when -shared is active.

Change-Id: Ia1092299b9c3b63ff771ca4842158b42c34bd008
Reviewed-on: https://go-review.googlesource.com/14286
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agocmd/link/internal/ld: align PE .text section to 32-byte when external linking
Shenghou Ma [Tue, 1 Sep 2015 23:58:31 +0000 (19:58 -0400)]
cmd/link/internal/ld: align PE .text section to 32-byte when external linking

Some symbols, for example, masks requires 16-byte alignment, and
they are placed in the text section. Before this change, the text
section is only aligned to 4-byte, and it's making masks unaligned.

Fixes #12415.

Change-Id: I7767778d1b4f7d3e74c2719a02848350782a4160
Reviewed-on: https://go-review.googlesource.com/14166
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared...
Michael Hudson-Doyle [Thu, 21 May 2015 01:07:19 +0000 (13:07 +1200)]
cmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared object

Currently Go produces shared libraries that cannot be shared between processes
because they have relocations against the text segment (not text section). This
fixes this by moving some data to sections with magic names recognized by the
static linker.

Fixes #10914
Updates #9210

Change-Id: I7178daadc0ae87953d5a084aa3d580f4e3b46d47
Reviewed-on: https://go-review.googlesource.com/10300
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/asm: fix handling of nested #if[n]defs
Michael Hudson-Doyle [Thu, 3 Sep 2015 10:49:18 +0000 (22:49 +1200)]
cmd/asm: fix handling of nested #if[n]defs

The lexer needs to process all #if[n]defs, even those found when processing is
disabled by a preceding failed conditional, or the first #endif in something
like:

    #ifdef <undefined>
    #ifdef whatever
    #endif
    #endif

terminates the first #ifdef and the second causes an error. And then the
processing of the inner #ifdefs needs to ignore their argument when they are
disabled by an outer failed condition.

Change-Id: Iba259498f1e16042f5b7580b9c000bb0599733d0
Reviewed-on: https://go-review.googlesource.com/14253
Reviewed-by: Rob Pike <r@golang.org>
9 years agointernal/syscall/windows/registry: do not panic when data is large
Alex Brainman [Fri, 4 Sep 2015 04:09:56 +0000 (14:09 +1000)]
internal/syscall/windows/registry: do not panic when data is large

Allow registry blobs to be as large as 500MB

Update #12493

Change-Id: I1d0e5c10772d25f8e7e17fed6e2e7dd12ca4e7cf
Reviewed-on: https://go-review.googlesource.com/14287
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoall: remove executable bit from several files
Andrew Gerrand [Fri, 4 Sep 2015 01:34:36 +0000 (01:34 +0000)]
all: remove executable bit from several files

Change-Id: Iab669b2a9dd0510c0e54f9ec1cbe2b83b991bceb
Reviewed-on: https://go-review.googlesource.com/14283
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/link: only embed runtime.goarm in the module that contains the runtime package
Michael Hudson-Doyle [Wed, 2 Sep 2015 21:05:25 +0000 (09:05 +1200)]
cmd/link: only embed runtime.goarm in the module that contains the runtime package

And do it properly so freebsd and nacl still work.

Change-Id: I6f9f30e93ceae6dee59215ed608c6a158bdbdbb0
Reviewed-on: https://go-review.googlesource.com/14280
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile/internal/gc: allow //go:systemstack only in runtime
Shenghou Ma [Thu, 3 Sep 2015 21:39:20 +0000 (17:39 -0400)]
cmd/compile/internal/gc: allow //go:systemstack only in runtime

Fixes #12454.

Change-Id: I6406b0119bc4d6c3d1e6f1896b588b7d101448a3
Reviewed-on: https://go-review.googlesource.com/14274
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agohash: update documentation for MakeTable in crc32 and crc64
Joe Tsai [Thu, 3 Sep 2015 22:24:53 +0000 (15:24 -0700)]
hash: update documentation for MakeTable in crc32 and crc64

Explicitly say that *Table returned by MakeTable may not be
modified. Otherwise, this leads to very subtle bugs that may
or may not manifest themselves.

Same comment was made on package crc64, to keep the future
open to the caching tables that crc32 effectively does.

Fixes: #12487.
Change-Id: I2881bebb8b16f6f8564412172774c79c2593c6c1
Reviewed-on: https://go-review.googlesource.com/14258
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoRevert "cmd/link: only embed runtime.goarm in the module that contains the runtime...
Michael Hudson-Doyle [Thu, 3 Sep 2015 21:04:04 +0000 (21:04 +0000)]
Revert "cmd/link: only embed runtime.goarm in the module that contains the runtime package"

This reverts commit bf99d8f843ae3dfa7a3a4cd5c17aec79e2b9997f.

Change-Id: Id4374ed35802cfbfe11e015ccd9526d3497dc8cc
Reviewed-on: https://go-review.googlesource.com/14239
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agonet/rpc: don't exit if Accept gets an error
Rob Pike [Wed, 2 Sep 2015 23:05:04 +0000 (16:05 -0700)]
net/rpc: don't exit if Accept gets an error

The default implementation of Accept, which spins up a new server
for every new connection, calls log.Fatal if the listener is closed,
stopping any outstanding work. Change that to a non-fatal log
call so work can continue.

There is no programmatic signaling of the problem, just the log,
but that should be enough.

Fixes #11221.

Change-Id: I7c7f6164a0a0143236729eb778d7638c51c34ed1
Reviewed-on: https://go-review.googlesource.com/14185
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agosyscall: fix formatting calls in tests
Alexander Morozov [Thu, 3 Sep 2015 20:24:58 +0000 (13:24 -0700)]
syscall: fix formatting calls in tests

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

9 years agocmd/asm: handle CMPF and CMPD on ARM
Rob Pike [Wed, 2 Sep 2015 20:11:26 +0000 (13:11 -0700)]
cmd/asm: handle CMPF and CMPD on ARM

These instructions are special cases that were missed in the translation.
The second argument must go into the Reg field not the To field.

Fixes #12458

For Go 1.5.1

Change-Id: Iad57c60c7e38e3bcfafda483ed5037ce670e8816
Reviewed-on: https://go-review.googlesource.com/14183
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodatabase/sql: close bad connections in commit or rollback:
Chris Hines [Tue, 25 Aug 2015 01:48:39 +0000 (21:48 -0400)]
database/sql: close bad connections in commit or rollback:

Previously Tx.close always passed a nil error to tx.db.putConn. As a
result bad connections were reused, even if the driver returned
driver.ErrBadConn. Adding an err parameter to Tx.close allows it to
receive the driver error from Tx.Commit and Tx.Rollback and pass it
to tx.db.putConn.

Fixes #11264

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

9 years agocmd/link: only embed runtime.goarm in the module that contains the runtime package
Michael Hudson-Doyle [Wed, 2 Sep 2015 21:05:25 +0000 (09:05 +1200)]
cmd/link: only embed runtime.goarm in the module that contains the runtime package

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

9 years agocmd/internal/obj: some platform independent bits of proper toolchain support for...
Michael Hudson-Doyle [Tue, 11 Aug 2015 00:29:00 +0000 (12:29 +1200)]
cmd/internal/obj: some platform independent bits of proper toolchain support for thread local storage

Also simplifies some silliness around making the .tbss section wrt internal
vs external linking. The "make TLS make sense" project has quite a few more
steps to go.

Issue #11270

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

9 years agodoc: add Go Security Policy document
Andrew Gerrand [Thu, 27 Aug 2015 05:40:46 +0000 (15:40 +1000)]
doc: add Go Security Policy document

Bring in the text from the proposal (with minor edits):
https://github.com/golang/proposal/blob/master/design/11502-securitypolicy.md

Fixes #11502

Change-Id: I92a987be66a0df60c1fad6c6c79f89bd8e9c12a8
Reviewed-on: https://go-review.googlesource.com/13955
Reviewed-by: Jason Buberel <jbuberel@google.com>
9 years agocmd/internal/obj: remove Link.Tlsoffset
Michael Hudson-Doyle [Tue, 1 Sep 2015 23:29:57 +0000 (11:29 +1200)]
cmd/internal/obj: remove Link.Tlsoffset

Nothing uses it any more.

Change-Id: I42ee7222b06b1a79b8b44894f3071752f9166d7a
Reviewed-on: https://go-review.googlesource.com/14193
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agocompress/flate: simplify inflate logic
Joe Tsai [Wed, 2 Sep 2015 06:42:43 +0000 (23:42 -0700)]
compress/flate: simplify inflate logic

The flate library contains generator code, which is used to generate
the fixed huffman table. This is done so that fixed blocks can be
processed quicker since there is no need generate the decoder table
for fixed codes.

Instead, delete the precomputed table, and use sync.Once to generate
it at runtime when used.

Advantages:
* Reduces duplicated logic in flate package
* Reduces binary size by approximately 2KiB

Disadvantages:
* For the simplest possible program that simply decodes the fixed
block "\x03\x00" once, the modified code takes 4.7% longer for the
first decode. Compression performance for subsequent blocks afterwards
has no noticeable slow down.

Change-Id: I8f351218debf7d732118808859eda481b01011f6
Reviewed-on: https://go-review.googlesource.com/14181
Reviewed-by: Nigel Tao <nigeltao@golang.org>
9 years agoruntime: fixes for arm64 shared libraries
Michael Hudson-Doyle [Wed, 26 Aug 2015 23:20:38 +0000 (11:20 +1200)]
runtime: fixes for arm64 shared libraries

Building for shared libraries requires that all functions that are declared
have an implementation and vice versa so make that so on arm64.

It would be nicer to not require the stub sigreturn (it will never be called)
but that seems a bit awkward.

Change-Id: I3cec81697161b452af81fa35939f748bd1acf7fd
Reviewed-on: https://go-review.googlesource.com/13995
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/asm: fix several panics with erroneous input
Didier Spezia [Wed, 26 Aug 2015 14:27:19 +0000 (14:27 +0000)]
cmd/asm: fix several panics with erroneous input

The parser tries to read as much information as possible,
issuing some errors when needed. Errors generally do not
stop the parsing.

With some pathological input, it may result in various
panics when the error message itself is built, or when the
next operand is parsed. It happens while parsing
pseudo-instructions.

For instance, the following lines all generate a panic:

TEXT
TEXT%
TEXT 1,1
TEXT $"toto", 0, $1
FUNCDATA
DATA 0
DATA(0),1
FUNCDATA(SB
GLOBL 0, 1
PCDATA 1

Added corresponding tests.

Introduced a writer in the parser to capture error messages
for testing purpose. It defaults to os.Stderr.

Added an explicit check when symbol names cannot be displayed.

Interrupted parsing early when the number of operands is wrong for
pseudo-instructions.

Note that the last point is a change of behavior, because some
operands will not get parsed anymore in case of early error.

IMO, it is acceptable, because only the first error of the line
is considered anyway. If it is not acceptable, it can probably
be improved at the price of a more verbose CL.

Fixes #11765
Fixes #11760
Fixes #11759

Change-Id: I9602a848132e358a1bccad794d7555e0823970dd
Reviewed-on: https://go-review.googlesource.com/13925
Reviewed-by: Rob Pike <r@golang.org>
9 years agocompile/internal/gc: make typecheckok a bool
Håvard Haugen [Sun, 30 Aug 2015 21:56:40 +0000 (23:56 +0200)]
compile/internal/gc: make typecheckok a bool

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

9 years agocmd/doc: document that json.Decode documents encoding/json.Decoder.Decode
Rob Pike [Mon, 31 Aug 2015 20:56:23 +0000 (13:56 -0700)]
cmd/doc: document that json.Decode documents encoding/json.Decoder.Decode

Refine the documentation in cmd/doc and go help doc.

Fixes #12377.

Change-Id: I670c0a5cf18c9c9d5bb9bb222d8a3dd3722a3934
Reviewed-on: https://go-review.googlesource.com/14121
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/vet: diagnose using Printf on a function value
Rob Pike [Mon, 31 Aug 2015 21:36:36 +0000 (14:36 -0700)]
cmd/vet: diagnose using Printf on a function value

Printing a function value is nearly useless outside of debugging, but
can occur by mistake when one forgets to call it. Diagnose this.

I did this myself just the other day and it arose in cl/14031.
Easy to fix and seems worthwhile.

Fixes #12295.

Change-Id: Ice125a84559f0394f7fa7272b5d31ae602b07f83
Reviewed-on: https://go-review.googlesource.com/14122
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agodoc: only show Share button when enabled
Andrew Gerrand [Wed, 2 Sep 2015 00:46:05 +0000 (10:46 +1000)]
doc: only show Share button when enabled

Change-Id: I571965bc38a8b1060642a942b898797327f0c19c
Reviewed-on: https://go-review.googlesource.com/14195
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/compile/internal/gc: use slice instead of NodeList for Label.Use
Håvard Haugen [Sun, 30 Aug 2015 20:24:53 +0000 (22:24 +0200)]
cmd/compile/internal/gc: use slice instead of NodeList for Label.Use

Change-Id: I021c95df24edbff24ff2922769ef2b2acd47016a
Reviewed-on: https://go-review.googlesource.com/14081
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agocmd/compile/internal/gc: remove dead code found by vet
Håvard Haugen [Tue, 1 Sep 2015 19:41:58 +0000 (21:41 +0200)]
cmd/compile/internal/gc: remove dead code found by vet

See report in commit 3c9fa388df826a67cb5042513e3df079709e6b8b.

Change-Id: I74a5995a1c1ca62b8d01857e89b084502e7da928
Reviewed-on: https://go-review.googlesource.com/14170
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: make FileServer sort directory entries
Dan Peterson [Tue, 1 Sep 2015 17:44:26 +0000 (14:44 -0300)]
net/http: make FileServer sort directory entries

Fixes #11879

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

9 years agobuild: Fix bootstrap.bash for official source tarballs
Fabian Wickborn [Thu, 20 Aug 2015 08:45:51 +0000 (10:45 +0200)]
build: Fix bootstrap.bash for official source tarballs

At the moment, bootstrap.bash assumes it is called from a git working
copy. Hence, it fails to complete when running in an unpacked official
source tarball where .git and .gitignore do not exist. This fix adds a
test for existence for .git and a -f switch for the removal of
.gitignore.

Fixes #12223

Change-Id: I7f305b83b38d5115504932bd38dadb7bdeb5d487
Reviewed-on: https://go-review.googlesource.com/13770
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/link: remove some dead code
Michael Hudson-Doyle [Tue, 1 Sep 2015 00:26:42 +0000 (12:26 +1200)]
cmd/link: remove some dead code

Change-Id: I125a12a2cb7e792f357e4d841f55c0bed2971dce
Reviewed-on: https://go-review.googlesource.com/14140
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoio: add WriteString support to MultiWriter
Brad Fitzpatrick [Tue, 21 Jul 2015 19:24:33 +0000 (12:24 -0700)]
io: add WriteString support to MultiWriter

Fixes #11805

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

9 years agoio/ioutil: clarify docs for ReadDir sort order.
Nigel Tao [Tue, 1 Sep 2015 02:31:18 +0000 (12:31 +1000)]
io/ioutil: clarify docs for ReadDir sort order.

Change-Id: I6a4ab5a1f44b54cfa81a650055460587ceefb2fc
Reviewed-on: https://go-review.googlesource.com/14144
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoimage/draw: optimize out some bounds checks.
Nigel Tao [Mon, 31 Aug 2015 03:38:13 +0000 (13:38 +1000)]
image/draw: optimize out some bounds checks.

We could undoubtedly squeeze even more out of these loops, and in the
long term, a better compiler would be smarter with bounds checks, but in
the short term, this small change is an easy win.

benchmark                      old ns/op     new ns/op     delta
BenchmarkFillOver-8            1619470       1323192       -18.29%
BenchmarkCopyOver-8            1129369       1062787       -5.90%
BenchmarkGlyphOver-8           420070        378608        -9.87%

On github.com/golang/freetype/truetype's BenchmarkDrawString:
benchmark                 old ns/op     new ns/op     delta
BenchmarkDrawString-8     9561435       8807019       -7.89%

Change-Id: Ib1c6271ac18bced85e0fb5ebf250dd57d7747e75
Reviewed-on: https://go-review.googlesource.com/14093
Reviewed-by: Rob Pike <r@golang.org>
9 years agonet: Increase the acceptable delay in TestDialerDualstack
Paul Marks [Mon, 31 Aug 2015 20:30:22 +0000 (13:30 -0700)]
net: Increase the acceptable delay in TestDialerDualstack

This may fix the flakiness on Windows/x64, assuming that it's actually
due to a variance in the connection time which slightly exceeds 100ms.

150ms + 95ms = 245ms, which is still low enough to avoid triggering
Happy Eyeballs (300ms) on non-Windows platforms.

Updates #12309

Change-Id: I816a36fbc0a3e5c90e3cf1b75a134faf0d91557c
Reviewed-on: https://go-review.googlesource.com/14120
Run-TryBot: Paul Marks <pmarks@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/internal/obj/arm: remove CASE and BCASE
Dave Cheney [Mon, 31 Aug 2015 00:14:00 +0000 (10:14 +1000)]
cmd/internal/obj/arm: remove CASE and BCASE

Update #10994

CASE and BCASE were used by 5c in switch statements, cmd/compile
does not use them.

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

9 years agoruntime: soften up hash checks a bit
Keith Randall [Tue, 25 Aug 2015 04:10:36 +0000 (21:10 -0700)]
runtime: soften up hash checks a bit

The hash tests generate occasional failures, quiet them some more.

In particular we can get 1 collision when the expected number is
.001 or so. That shouldn't be a dealbreaker.

Fixes #12311

Change-Id: I784e91b5d21f4f1f166dc51bde2d1cd3a7a3bfea
Reviewed-on: https://go-review.googlesource.com/13902
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agofmt: fix scientific notation in docs
Shenghou Ma [Wed, 26 Aug 2015 21:52:13 +0000 (17:52 -0400)]
fmt: fix scientific notation in docs

Fixes #12340.

Change-Id: I17a8b3711a8593ec60882a0dcadb38f0cc138f4b
Reviewed-on: https://go-review.googlesource.com/13949
Reviewed-by: Rob Pike <r@golang.org>
9 years agoruntime: implement cmpstring and bytes.Compare in assembly for ppc64
Shenghou Ma [Sat, 29 Aug 2015 03:59:04 +0000 (23:59 -0400)]
runtime: implement cmpstring and bytes.Compare in assembly for ppc64

Change-Id: I15bf55aa5ac3588c05f0a253f583c52bab209892
Reviewed-on: https://go-review.googlesource.com/14041
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agosyscall: remove unused kernelVersion function from tests
Alexander Morozov [Mon, 31 Aug 2015 16:40:25 +0000 (09:40 -0700)]
syscall: remove unused kernelVersion function from tests

Change-Id: If0d00999c58f7421e4da06e1822ba5abccf72cac
Reviewed-on: https://go-review.googlesource.com/14111
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 agosyscall: move check of unprivileged_userns_clone to whoamiCmd
Alexander Morozov [Mon, 31 Aug 2015 15:41:43 +0000 (08:41 -0700)]
syscall: move check of unprivileged_userns_clone to whoamiCmd

This is basic validation and should be performed early

Fixes #12412

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

9 years agointernal/obj/arm64: remove CASE and BCASE
Dave Cheney [Mon, 31 Aug 2015 11:15:29 +0000 (21:15 +1000)]
internal/obj/arm64: remove CASE and BCASE

Fixes #10994

CASE and BCASE were used by 7c in switch statements, cmd/compile
does not use them, cmd/assemble couldn't assemble them, and the arm64
peephole optimiser didn't know about them.

Change-Id: Id04835fcb37e207f76d211ce54a4db9c057d6112
Reviewed-on: https://go-review.googlesource.com/14100
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Run-TryBot: Aram Hăvărneanu <aram@mgk.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoos: remove a redundant branch in File.Read.
Aaron Jacobs [Fri, 24 Jul 2015 04:21:11 +0000 (14:21 +1000)]
os: remove a redundant branch in File.Read.

All implementations of File.read ensure that n >= 0. This is usually via
fixCount, except for Windows console reads, which only ever add to n.

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

9 years agocmd/compile/internal/gc: rename Fatal to Fatalf
Håvard Haugen [Sun, 30 Aug 2015 21:10:03 +0000 (23:10 +0200)]
cmd/compile/internal/gc: rename Fatal to Fatalf

This helps vet see a real issue:

    cmd/internal/gc$ go vet
    gen.go:1223: unreachable code

Fixes #12106.

Change-Id: I720868b07ae6b6d5a4dc6b238baa8c9c889da6d8
Reviewed-on: https://go-review.googlesource.com/14083
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/link: pass value being relocated to archreloc
Michael Hudson-Doyle [Mon, 3 Aug 2015 02:08:17 +0000 (14:08 +1200)]
cmd/link: pass value being relocated to archreloc

And clean up the mess on arm64 (the mess on arm is too confusing).

See issue #10050

Change-Id: I2ce813fe8646d4e818eb660612a7e4b2bb04de4c
Reviewed-on: https://go-review.googlesource.com/13884
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: add -lsendfile to cgo LDFLAGS for solaris
Shenghou Ma [Sun, 30 Aug 2015 21:22:40 +0000 (17:22 -0400)]
net: add -lsendfile to cgo LDFLAGS for solaris

Fixes external linking of net/http tests (or anything that uses
sendfile).

Fixes #12390.

Change-Id: Iee08998cf66e7b0ce851db138a00ebae6dc2395e
Reviewed-on: https://go-review.googlesource.com/14072
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
9 years agoruntime: check that stack barrier unwind is in sync
Austin Clements [Wed, 26 Aug 2015 19:06:43 +0000 (15:06 -0400)]
runtime: check that stack barrier unwind is in sync

Currently the stack barrier stub blindly unwinds the next stack
barrier from the G's stack barrier array without checking that it's
the right stack barrier. If through some bug the stack barrier array
position gets out of sync with where we actually are on the stack,
this could return to the wrong PC, which would lead to difficult to
debug crashes. To address this, this commit adds a check to the amd64
stack barrier stub that it's unwinding the correct stack barrier.

Updates #12238.

Change-Id: If824d95191d07e2512dc5dba0d9978cfd9f54e02
Reviewed-on: https://go-review.googlesource.com/13948
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: add GODEBUG for stack barriers at every frame
Austin Clements [Wed, 26 Aug 2015 17:54:26 +0000 (13:54 -0400)]
runtime: add GODEBUG for stack barriers at every frame

Currently enabling the debugging mode where stack barriers are
installed at every frame requires recompiling the runtime. However,
this is potentially useful for field debugging and for runtime tests,
so make this mode a GODEBUG.

Updates #12238.

Change-Id: I6fb128f598b19568ae723a612e099c0ed96917f5
Reviewed-on: https://go-review.googlesource.com/13947
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: don't install a stack barrier in cgocallback_gofunc's frame
Austin Clements [Wed, 26 Aug 2015 16:16:51 +0000 (12:16 -0400)]
runtime: don't install a stack barrier in cgocallback_gofunc's frame

Currently the runtime can install stack barriers in any frame.
However, the frame of cgocallback_gofunc is special: it's the one
function that switches from a regular G stack to the system stack on
return. Hence, the return PC slot in its frame on the G stack is
actually used to save getg().sched.pc (so tracebacks appear to unwind
to the last Go function running on that G), and not as an actual
return PC for cgocallback_gofunc.

Because of this, if we install a stack barrier in cgocallback_gofunc's
return PC slot, when cgocallback_gofunc does return, it will move the
stack barrier stub PC in to getg().sched.pc and switch back to the
system stack. The rest of the runtime doesn't know how to deal with a
stack barrier stub in sched.pc: nothing knows how to match it up with
the G's stack barrier array and, when the runtime removes stack
barriers, it doesn't know to undo the one in sched.pc. Hence, if the C
code later returns back in to Go code, it will attempt to return
through the stack barrier saved in sched.pc, which may no longer have
correct unwinding information.

Fix this by blacklisting cgocallback_gofunc's frame so the runtime
won't install a stack barrier in it's return PC slot.

Fixes #12238.

Change-Id: I46aa2155df2fd050dd50de3434b62987dc4947b8
Reviewed-on: https://go-review.googlesource.com/13944
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocrypto/x509: emit PKIX names in a more standard order.
Adam Langley [Sun, 2 Aug 2015 15:55:17 +0000 (08:55 -0700)]
crypto/x509: emit PKIX names in a more standard order.

(See referenced bug for details.)

Fixes #11966.

Change-Id: I91f9c95594cf4fd6d25d9a81f155a643c7a1f8e0
Reviewed-on: https://go-review.googlesource.com/13038
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocrypto/tls: reject ServerHellos with empty ALPN protocols.
Adam Langley [Thu, 9 Jul 2015 22:42:02 +0000 (15:42 -0700)]
crypto/tls: reject ServerHellos with empty ALPN protocols.

https://tools.ietf.org/html/rfc7301#section-3.1 specifies that a
ProtocolName may not be empty. This change enforces this for ServerHello
messages—it's already enforced for ClientHello messages.

Change-Id: Ic5a5be6bebf07fba90a3cabd10b07ab7b4337f53
Reviewed-on: https://go-review.googlesource.com/12003
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocrypto/tls: note in comments that setting GetCertificate is now sufficient.
aubble [Thu, 20 Aug 2015 18:26:56 +0000 (14:26 -0400)]
crypto/tls: note in comments that setting GetCertificate is now sufficient.

In Go 1.5, Config.Certificates is no longer required if
Config.GetCertificate has been set. This change updated four comments to
reflect that.

Change-Id: Id72cc22fc79e931b2d645a7c3960c3241042762c
Reviewed-on: https://go-review.googlesource.com/13800
Reviewed-by: Adam Langley <agl@golang.org>
9 years agocrypto/aes: dedicated asm version of AES-GCM
Vlad Krasnov [Thu, 28 May 2015 20:50:23 +0000 (13:50 -0700)]
crypto/aes: dedicated asm version of AES-GCM

The existing implementation didn't use the CLMUL instructions for fast
and constant time binary-field multiplication. With this change, amd64
CPUs that support both AES and CLMUL instructions will use an optimised
asm implementation.

benchmark                 old ns/op     new ns/op     delta
BenchmarkAESGCMSeal8K     91723         3200          -96.51%
BenchmarkAESGCMOpen8K     91487         3324          -96.37%
BenchmarkAESGCMSeal1K     11873         546           -95.40%
BenchmarkAESGCMOpen1K     11833         594           -94.98%

benchmark                 old MB/s     new MB/s     speedup
BenchmarkAESGCMSeal8K     89.31        2559.62      28.66x
BenchmarkAESGCMOpen8K     89.54        2463.78      27.52x
BenchmarkAESGCMSeal1K     86.24        1872.49      21.71x
BenchmarkAESGCMOpen1K     86.53        1721.78      19.90x

Change-Id: Idd63233098356d8b353d16624747b74d0c3f193e
Reviewed-on: https://go-review.googlesource.com/10484
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
9 years agocrypto/tls: allow tls.Listen when only GetCertificate is provided.
aubble [Thu, 20 Aug 2015 18:31:15 +0000 (14:31 -0400)]
crypto/tls: allow tls.Listen when only GetCertificate is provided.

Go 1.5 allowed TLS connections where Config.Certificates was nil as long
as the GetCertificate callback was given. However, tls.Listen wasn't
updated accordingly until this change.

Change-Id: I5f67f323f63c988ff79642f3daf8a6b2a153e6b2
Reviewed-on: https://go-review.googlesource.com/13801
Reviewed-by: Adam Langley <agl@golang.org>
9 years agotesting/quick: terminate for arbitrary recursive types
Håvard Haugen [Tue, 9 Jun 2015 22:30:32 +0000 (00:30 +0200)]
testing/quick: terminate for arbitrary recursive types

Recursive types R containing slices of R's did not terminate despite the
effort in CL 10821.

For recursive types there was a competition between slice expansion by a
factor 'complexSize', and termination with probability '1/complexSize'
which lead to stack overflow as soon as a recursive struct had slices
pointing to its own type.

Fix this by shrinking the size hint as a function of recursion depth.
This has the dual effect of reducing the number of elements generated
per slice and also increasing the probability for termination.

Fixes #11148.

Change-Id: Ib61155b4f2e2de3873d508d63a1f4be759426d67
Reviewed-on: https://go-review.googlesource.com/13830
Reviewed-by: Adam Langley <agl@golang.org>