]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agoruntime, syscall: add calls to msan functions
Ian Lance Taylor [Wed, 21 Oct 2015 18:04:42 +0000 (11:04 -0700)]
runtime, syscall: add calls to msan functions

Add explicit memory sanitizer instrumentation to the runtime and syscall
packages.  The compiler does not instrument the runtime package.  It
does instrument the syscall package, but we need to add a couple of
cases that it can't see.

Change-Id: I2d66073f713fe67e33a6720460d2bb8f72f31394
Reviewed-on: https://go-review.googlesource.com/16164
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoruntime: change functype's in and out fields to []*_type
Matthew Dempsky [Wed, 21 Oct 2015 17:40:39 +0000 (10:40 -0700)]
runtime: change functype's in and out fields to []*_type

Allows removing a few gratuitous unsafe.Pointer conversions and
parallels the type of reflect.funcType's in and out fields ([]*rtype).

Change-Id: Ie5ca230a94407301a854dfd8782a3180d5054bc4
Reviewed-on: https://go-review.googlesource.com/16163
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agogo/build: test code cleanup: remove unnecessary func var
Hyang-Ah Hana Kim [Tue, 20 Oct 2015 21:42:21 +0000 (17:42 -0400)]
go/build: test code cleanup: remove unnecessary func var

The earlier calls to test(false) in TestDependencies were
removed by https://golang.org/cl/12576

Change-Id: If5c7994172379c2d7f633d2e9c5261e668c754fa
Reviewed-on: https://go-review.googlesource.com/16117
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agolog/syslog: disable unix/unixgram tests on android
Hyang-Ah Hana Kim [Tue, 20 Oct 2015 18:48:49 +0000 (14:48 -0400)]
log/syslog: disable unix/unixgram tests on android

unix/unixgram is not available to standard Android programs.

For golang/go#10807

Change-Id: I6062c3a25cffb86e58cbbd12a07dc90ffbf57185
Reviewed-on: https://go-review.googlesource.com/16114
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime, runtime/msan: add msan runtime support
Ian Lance Taylor [Wed, 21 Oct 2015 16:45:27 +0000 (09:45 -0700)]
runtime, runtime/msan: add msan runtime support

These are the runtime support functions for letting Go code interoperate
with the C/C++ memory sanitizer.  Calls to msanread/msanwrite are now
inserted by the compiler with the -msan option.  Calls to
msanmalloc/msanfree will be from other runtime functions in a subsequent
CL.

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

9 years agoruntime: eliminate unused _GCstw phase
Austin Clements [Mon, 19 Oct 2015 17:57:04 +0000 (13:57 -0400)]
runtime: eliminate unused _GCstw phase

Change-Id: Ie94cd17e1975fdaaa418fa6a7b2d3b164fedc135
Reviewed-on: https://go-review.googlesource.com/16057
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: eliminate unnecessary ragged barrier
Austin Clements [Sun, 18 Oct 2015 15:53:18 +0000 (11:53 -0400)]
runtime: eliminate unnecessary ragged barrier

The ragged barrier after entering the concurrent mark phase is
vestigial. This used to be the point where we enabled write barriers,
so it was necessary to synchronize all Ps to ensure write barriers
were enabled before any marking occurred. However, we've long since
switched to enabling write barriers during the concurrent scan phase,
so the start-the-world at the beginning of the concurrent scan phase
ensures that all Ps have enabled the write barrier.

Hence, we can eliminate the old "install write barrier" phase.

Fixes #11971.

Change-Id: I8cdcb84b5525cef19927d51ea11ba0a4db991ea8
Reviewed-on: https://go-review.googlesource.com/16044
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agocmd/compile: add -msan option
Ian Lance Taylor [Wed, 21 Oct 2015 14:04:10 +0000 (07:04 -0700)]
cmd/compile: add -msan option

The -msan option causes the compiler to add instrumentation for the
C/C++ memory sanitizer.  Every memory read/write will be preceded by
a call to msanread/msanwrite.

This CL passes tests but is not usable by itself.  The actual
implementation of msanread/msanwrite in the runtime package, and support
for -msan in the go tool and the linker, and tests, will follow in
subsequent CLs.

Change-Id: I3d517fb3e6e65d9bf9433db070a420fd11f57816
Reviewed-on: https://go-review.googlesource.com/16160
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/link: add -msan option
Ian Lance Taylor [Wed, 21 Oct 2015 14:11:01 +0000 (07:11 -0700)]
cmd/link: add -msan option

The -msan option causes the linker to link against the runtime/msan
package in order to use the C/C++ memory sanitizer.

This CL passes tests but is not usable by itself.  The actual
runtime/msan package, and support for -msan in the go tool and the
compiler, and tests, are in separate CLs.

Change-Id: I02c097393b98c5b80e40ee3dbc167a8b4d23efe0
Reviewed-on: https://go-review.googlesource.com/16161
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/vet: fix shadow assignment check with complex rhs
Konstantin Shaposhnikov [Tue, 20 Oct 2015 16:39:27 +0000 (00:39 +0800)]
cmd/vet: fix shadow assignment check with complex rhs

This change fixes shadow assignment check in cases when RHS is not an identifier
or a type assertion.

Fixes #12188

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

9 years agocmd/compile: generalize racewalk to instrument (naming change)
Ian Lance Taylor [Tue, 20 Oct 2015 17:00:07 +0000 (10:00 -0700)]
cmd/compile: generalize racewalk to instrument (naming change)

This is mechanical change that is a step toward reusing the racewalk
pass for a more general instrumentation pass.  The first use will be to
add support for the memory sanitizer.

Change-Id: I75b93b814ac60c1db1660e0b9a9a7d7977d86939
Reviewed-on: https://go-review.googlesource.com/16105
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/go: dedup packages in packagesAndErrors
Nodir Turakulov [Wed, 21 Oct 2015 04:33:18 +0000 (21:33 -0700)]
cmd/go: dedup packages in packagesAndErrors

packagesAndErrors function doesn't dedup packages.
As a result, `go list io ./io` prints io package twice.
Same applies to `go build` and `go test`.

* dedup packages.
* add a test for go list

Change-Id: I54d4063979b1c9359e5416e12327cb85c4823a0f
Reviewed-on: https://go-review.googlesource.com/16136
Run-TryBot: Andrew Gerrand <adg@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: remove a stray word in the go:nosplit documentation
Aaron Jacobs [Wed, 21 Oct 2015 04:51:02 +0000 (15:51 +1100)]
cmd/compile: remove a stray word in the go:nosplit documentation

Change-Id: I7a85c0ad8aba2d50032c8faa58c83fb327f360cf
Reviewed-on: https://go-review.googlesource.com/16140
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/compile: "invalid variable name x in type switch", where x is a name of a constant
acanino [Sun, 11 Oct 2015 01:35:22 +0000 (21:35 -0400)]
cmd/compile: "invalid variable name x in type switch", where x is a name of a constant

Small fix: looks like a short variable declaration with a type switch
checks to make sure the variable used had valid shape (ONAME, OTYPE, or
ONONAME) and rejects everything else. Then a new variable is declared.
If the symbol contained in the declaration was a named OLITERAL (still a
valid identifier obviously) it would be rejected, even though a new
variable would have been declared.

Fix adds this case to the check.

Added a test case from issue12413.

Fixes #12413

Change-Id: I150dadafa8ee5612c867d58031027f2dca8c6ebc
Reviewed-on: https://go-review.googlesource.com/15760
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet/http: update copy of http2
Brad Fitzpatrick [Tue, 20 Oct 2015 23:53:31 +0000 (23:53 +0000)]
net/http: update copy of http2

Updates to x/net git revision 9946ad7

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

9 years agohtml/template: include itself while cloning
Nodir Turakulov [Tue, 20 Oct 2015 16:02:28 +0000 (09:02 -0700)]
html/template: include itself while cloning

template.Clone() initialized template set incorrectly:
it didn't include itself.

* include itself in template set while cloning
* add a test

Fixes #12996

Change-Id: I932530e4f7f1bbebf833e12b000a5ce052bc9223
Reviewed-on: https://go-review.googlesource.com/16104
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agonet/http: return error from Serve if http2.ConfigureServer returns an error
Brad Fitzpatrick [Tue, 20 Oct 2015 22:57:12 +0000 (22:57 +0000)]
net/http: return error from Serve if http2.ConfigureServer returns an error

In https://golang.org/cl/15860 http2.ConfigureServer was changed to
return an error if explicit CipherSuites are listed and they're not
compliant with the HTTP/2 spec.

This is the net/http side of the change, to look at the return value
from ConfigureServer and propagate it in Server.Serve.

h2_bundle.go will be updated in a future CL. There are too many other
http2 changes pending to be worth updating it now. Instead,
h2_bundle.go is minimally updated by hand in this CL so at least the
net/http change will compile.

Updates #12895

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

9 years agoruntime: add stringStructOf helper function
Matthew Dempsky [Tue, 20 Oct 2015 07:35:12 +0000 (00:35 -0700)]
runtime: add stringStructOf helper function

Instead of open-coding conversions from *string to unsafe.Pointer then
to *stringStruct, add a helper function to add some type safety.
Bonus: This caught two **string values being converted to
*stringStruct in heapdump.go.

While here, get rid of the redundant _string type, but add in a
stringStructDWARF type used for generating DWARF debug info.

Change-Id: I8882f8cca66ac45190270f82019a5d85db023bd2
Reviewed-on: https://go-review.googlesource.com/16131
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: change odd 'print1_write' file names
Aaron Jacobs [Tue, 20 Oct 2015 22:38:27 +0000 (09:38 +1100)]
runtime: change odd 'print1_write' file names

The '1' part is left over from the C conversion, but no longer makes
sense given that print1.go no longer exists.

Change-Id: Iec171251370d740f234afdbd6fb1a4009fde6696
Reviewed-on: https://go-review.googlesource.com/16036
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 agopath/filepath: disable symlink tests on android.
Hyang-Ah Hana Kim [Tue, 20 Oct 2015 21:23:24 +0000 (17:23 -0400)]
path/filepath: disable symlink tests on android.

Same reason as https://go-review.googlesource.com/#/c/16115/

For golang/go#10807

Change-Id: Id0c404e9feb963f39a111fc317c9787692516ae1
Reviewed-on: https://go-review.googlesource.com/16116
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoos: disable symlink tests on android.
Hyang-Ah Hana Kim [Tue, 20 Oct 2015 21:10:04 +0000 (17:10 -0400)]
os: disable symlink tests on android.

Creating symlinks (/data/local/tmp/*) doesn't seem to work
on android-L (tested on nexus5). I cannot find any official
documentation yet but just guess it's a measure for security
attacks using symlinks.

The tests failed with 'permission denied' errors.

For golang/go#10807

Change-Id: I99a9c401c6ecca3c4adc7b21708adaf3dd601279
Reviewed-on: https://go-review.googlesource.com/16115
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile/internal/gc: there are no -0 floating-point constants
Robert Griesemer [Tue, 20 Oct 2015 21:45:36 +0000 (14:45 -0700)]
cmd/compile/internal/gc: there are no -0 floating-point constants

Fixes #12577.

Change-Id: Id469cd92f5f9436b0ef948ee1a252ed1842bc7aa
Reviewed-on: https://go-review.googlesource.com/16133
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
9 years agospec: remove "untyped bool" oxymorons
Matthew Dempsky [Tue, 20 Oct 2015 22:05:22 +0000 (15:05 -0700)]
spec: remove "untyped bool" oxymorons

The proper term is "untyped boolean".

Change-Id: Id871164190a03c64a8a8987b1ad5d8653a21d96e
Reviewed-on: https://go-review.googlesource.com/16135
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agocrypto/cipher: fix CTR infinite loop with large block sizes
Caleb Spare [Sun, 18 Oct 2015 22:45:36 +0000 (15:45 -0700)]
crypto/cipher: fix CTR infinite loop with large block sizes

Additionally, add a test for CTR mode to cover a range of block sizes.

Fixes #12975

Change-Id: I458aac1616228747e62f92f823768d55e874877a
Reviewed-on: https://go-review.googlesource.com/16050
Reviewed-by: Adam Langley <agl@golang.org>
9 years agospec: clarify numeric conversions where IEEE-754 produces -0.0
Robert Griesemer [Fri, 18 Sep 2015 01:10:20 +0000 (18:10 -0700)]
spec: clarify numeric conversions where IEEE-754 produces -0.0

The spec defines precise numeric constants which do not overflow.
Consequently, +/-Inf and NaN values were excluded. The case was not
clear for -0.0 but they are mostly of interest to determine the sign
of infinities which don't exist.

That said, the conversion rules explicitly say that T(x) (for a numeric
x and floating-point type T) is the value after rounding per IEEE-754.
The result is constant if x is constant. Rounding per IEEE-754 can
produce a -0.0 which we cannot represent as a constant.

Thus, the spec is inconsistent. Attempt to fix the inconsistency by
adjusting the rounding rule rather than letting -0.0 into the language.

For more details, see the issue below.

Open to discussion.

Fixes #12576.

Change-Id: Ibe3c676372ab16d9229f1f9daaf316f761e074ee
Reviewed-on: https://go-review.googlesource.com/14727
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/compile/internal/gc: remove atoi function (minor cleanup)
Robert Griesemer [Tue, 20 Oct 2015 17:52:41 +0000 (10:52 -0700)]
cmd/compile/internal/gc: remove atoi function (minor cleanup)

Change-Id: I0ad7836c0e8d70ffdc458e125d97b01e85d8a608
Reviewed-on: https://go-review.googlesource.com/16130
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: add syscalls needed for android/amd64 logging.
Hyang-Ah Hana Kim [Fri, 16 Oct 2015 18:17:25 +0000 (14:17 -0400)]
runtime: add syscalls needed for android/amd64 logging.

access, connect, socket.

In Android-L, logging is done by writing the log messages to the logd
process through a unix domain socket.

Also, changed the arg types of those syscall stubs to match linux
programming APIs.

For golang/go#10743

Change-Id: I66368a03316e253561e9e76aadd180c2cd2e48f3
Reviewed-on: https://go-review.googlesource.com/15993
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/internal/obj/x86: align functions with trap instruction
Ilya Tocar [Tue, 20 Oct 2015 11:52:08 +0000 (14:52 +0300)]
cmd/internal/obj/x86: align functions with trap instruction

Align functions with 0xCC (INT $3) - breakpoint instruction,
instead of 0x00, which can disassemble into valid instruction.

Change-Id: Ieda191886efc4aacb86f58bea1169fd1b3b57636
Reviewed-on: https://go-review.googlesource.com/16102
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
Reviewed-by: Gregory Shimansky <gregory.shimansky@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
9 years agocmd/compile, syscall: use go:norace comment for forkAndExecInChild
Ian Lance Taylor [Tue, 20 Oct 2015 00:01:37 +0000 (17:01 -0700)]
cmd/compile, syscall: use go:norace comment for forkAndExecInChild

Use a go:norace comment rather than having the compiler know the special
name syscall.forkAndExecInChild.

Change-Id: I69bc6aa6fc40feb2148d23f269ff32453696fb28
Reviewed-on: https://go-review.googlesource.com/16097
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: rename _func.frame to make it clear it's deprecated and unused.
Aaron Jacobs [Tue, 20 Oct 2015 02:15:12 +0000 (13:15 +1100)]
runtime: rename _func.frame to make it clear it's deprecated and unused.

When I saw that it was labelled "legacy", I went looking for users of it
to see how it was still used. But there aren't any. Save the next person
the trouble.

Change-Id: I921dd6c57b60331c9816542272555153ac133c02
Reviewed-on: https://go-review.googlesource.com/16035
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 agofmt: Add support for capital '%X' format verb for scanning
Thorben Krueger [Wed, 14 Oct 2015 19:18:59 +0000 (19:18 +0000)]
fmt: Add support for capital '%X' format verb for scanning

For printing, the format verb '%X' results in a capitalized
hex-representation of the formatted value. Conversely, using
'%X' in a Scanf function should scan a hex-representation
into the given interface{}. The existing implementation
however only supports '%X' for scanning hex values into
integers; strings or byte slices remain empty. On the other
hand, lower-case '%x' supports strings and byte slices just
fine. This is merely an oversight, which this commit fixes.
(Additional tests also included.)

    Fixes #12940

Change-Id: I178a7f615bae950dfc014ca8c0a038448cf0452a
Reviewed-on: https://go-review.googlesource.com/15689
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agonet/http/httptest: detect Content-Type in ResponseRecorder
Nodir Turakulov [Mon, 19 Oct 2015 21:36:25 +0000 (14:36 -0700)]
net/http/httptest: detect Content-Type in ResponseRecorder

* detect Content-Type on ReponseRecorder.Write[String] call
  if header wasn't written yet, Content-Type header is not set and
  Transfer-Encoding is not set.
* fix typos in serve_test.go

Updates #12986

Change-Id: Id2ed8b1994e64657370fed71eb3882d611f76b31
Reviewed-on: https://go-review.googlesource.com/16096
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: add Transport.TLSNextProto, ErrSkipAltProtocol
Brad Fitzpatrick [Mon, 19 Oct 2015 22:30:21 +0000 (15:30 -0700)]
net/http: add Transport.TLSNextProto, ErrSkipAltProtocol

This is the start of wiring up the HTTP/2 Transport. It is still
disabled in this commit.

This change does two main things:

1) Transport.RegisterProtocol now permits registering "http" or
   "https" (they previously paniced), and the semantics of the
   registered RoundTripper have been extended to say that the new
   sentinel error value (ErrSkipAltProtocol, added in this CL) means
   that the Transport's RoundTrip method proceeds as if the alternate
   protocol had not been registered. This gives us a place to register
   an alternate "https" RoundTripper which gets first dibs on using
   HTTP/2 if there's already a cached connection.

2) adds Transport.TLSNextProto, a map keyed by TLS NPN/ALPN protocol
   strings, similar in feel to the existing Server.TLSNextProto map.
   This map is the glue between the HTTP/1 and HTTP/2 clients, since
   we don't know which protocol we're going to speak (and thus which
   Transport type to use) until we've already made the TCP connection.

Updates #6891

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

9 years agonet/http/httptest: change Server to use http.Server.ConnState for accounting
Brad Fitzpatrick [Tue, 29 Sep 2015 21:26:48 +0000 (14:26 -0700)]
net/http/httptest: change Server to use http.Server.ConnState for accounting

With this CL, httptest.Server now uses connection-level accounting of
outstanding requests instead of ServeHTTP-level accounting. This is
more robust and results in a non-racy shutdown.

This is much easier now that net/http.Server has the ConnState hook.

Fixes #12789
Fixes #12781

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

9 years agocmd/compile: clarify where mkbuiltin.go input files are found
Ian Lance Taylor [Mon, 19 Oct 2015 21:54:50 +0000 (14:54 -0700)]
cmd/compile: clarify where mkbuiltin.go input files are found

Just a comment change reflecting that the files were moved to the
builtin directory when the compiled was converted from C to Go.

Change-Id: I65e5340c09221684e40174feadfb69f738a9044a
Reviewed-on: https://go-review.googlesource.com/16089
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/go: don't override GIT_TERMINAL_PROMPT
Burcu Dogan [Mon, 19 Oct 2015 22:27:19 +0000 (15:27 -0700)]
cmd/go: don't override GIT_TERMINAL_PROMPT

This CL keeps disallowing `go get` from falling to the prompt unless
user has set GIT_TERMINAL_PROMPT env variable. If GIT_TERMINAL_PROMPT
is set, go-get will not override its value and will prompt for
username/password in the case of GIT_TERMINAL_PROMPT=1.

Fixes #12706.

Change-Id: Ibd6b1100af6b04fb8114279cdcf608943e7765be
Reviewed-on: https://go-review.googlesource.com/16091
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agonet/http: fix typo in serve_test.go
Nodir Turakulov [Mon, 19 Oct 2015 21:30:35 +0000 (14:30 -0700)]
net/http: fix typo in serve_test.go

Change-Id: Iaf33fae7043f21df2dba0bb7e1addb0ff002c508
Reviewed-on: https://go-review.googlesource.com/16088
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: tweaks to allow -buildmode=shared to work
Michael Hudson-Doyle [Mon, 12 Oct 2015 00:20:10 +0000 (13:20 +1300)]
runtime: tweaks to allow -buildmode=shared to work

Building Go shared libraries requires that all functions that have declarations
without bodies have implementations and vice versa, so remove the
implementation of call16 and add a stub implementation of sigreturn.

Change-Id: I4d5a30c8637a5da7991054e151a536611d5bea46
Reviewed-on: https://go-review.googlesource.com/15966
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/link: centralize knowledge of size of fixed part of stack
Michael Hudson-Doyle [Sun, 11 Oct 2015 23:19:20 +0000 (12:19 +1300)]
cmd/link: centralize knowledge of size of fixed part of stack

Shared libraries on ppc64le will require a larger minimum stack frame (because
the ABI mandates that the TOC pointer is available at 24(R1)). Part 2b of
preparing for that is to have all the code in the linker that needs to know
this size of this call a function to find out.

Change-Id: I246363840096db22e44beabbe38b61d60c1f31ad
Reviewed-on: https://go-review.googlesource.com/15675
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: allow -shared/-dynlink on ppc64
Michael Hudson-Doyle [Wed, 23 Sep 2015 09:02:50 +0000 (21:02 +1200)]
cmd/compile: allow -shared/-dynlink on ppc64

Only effect is register related: do not allocate R2 or R12, put function
entrypoint in R12 before indirect call.

Change-Id: I9cdd553bab022601c9cb5bb43c9dc0c368c6fb0a
Reviewed-on: https://go-review.googlesource.com/15961
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/cgo: give __uint128_t type [16]uint8
David Crawshaw [Sun, 18 Oct 2015 17:32:11 +0000 (13:32 -0400)]
cmd/cgo: give __uint128_t type [16]uint8

The __uint128_t type appears in darwin/arm header files processed by
cgo -godefs in http://golang.org/cl/16045.

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

9 years agonet: android no longer supports unix/unixgram
David Crawshaw [Mon, 19 Oct 2015 18:41:38 +0000 (14:41 -0400)]
net: android no longer supports unix/unixgram

I cannot find any documentation for this, but these tests no longer run
on the device I have since upgrading to Android L. Presumably it still
works for root, but standard Android programs to not have root access.

Change-Id: I001c8fb5ce22f9ff8d7433f881d0dccbf6ab969d
Reviewed-on: https://go-review.googlesource.com/16056
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
9 years agoruntime: combine gcResetGState and gcResetMarkState
Austin Clements [Sun, 18 Oct 2015 03:57:53 +0000 (23:57 -0400)]
runtime: combine gcResetGState and gcResetMarkState

These functions are always called together and perform logically
related state resets, so combine them in to just gcResetMarkState.

Fixes #11427.

Change-Id: I06c17ef65f66186494887a767b3993126955b5fe
Reviewed-on: https://go-review.googlesource.com/16041
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: consolidate gcResetGState calls
Austin Clements [Sun, 18 Oct 2015 03:52:49 +0000 (23:52 -0400)]
runtime: consolidate gcResetGState calls

Currently gcResetGState is called by func gcscan_m for concurrent GC
and directly by func gc for STW GC. Simplify this by consolidating
these two calls in to one call by func gc above where it splits for
concurrent and STW GC.

As a consequence, gcResetGState and gcResetMarkState are always called
together, so the next commit will consolidate these.

Change-Id: Ib62d404c7b32b28f7d3080d26ecf3966cbc4aca0
Reviewed-on: https://go-review.googlesource.com/16040
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: remove work.partial queue
Austin Clements [Thu, 15 Oct 2015 19:44:16 +0000 (15:44 -0400)]
runtime: remove work.partial queue

This work queue is no longer used (there are many reads of
work.partial, but the only write is in putpartial, which is never
called).

Fixes #11922.

Change-Id: I08b76c0c02a0867a9cdcb94783e1f7629d44249a
Reviewed-on: https://go-review.googlesource.com/15892
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agofmt: clarify reflect.Value printing
Nodir Turakulov [Fri, 16 Oct 2015 08:33:28 +0000 (01:33 -0700)]
fmt: clarify reflect.Value printing

fmt docs say:

  If the operand is a reflect.Value, the concrete value it
  holds is printed as if it was the operand.

It implies recursive application of this rule, which is not the case.
Clarify the docs.

Change-Id: I019277c7c6439095bab83e5536aa06403638aa51
Reviewed-on: https://go-review.googlesource.com/15952
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: -buildmode=pie for android/arm
David Crawshaw [Mon, 19 Oct 2015 16:54:38 +0000 (12:54 -0400)]
cmd/go: -buildmode=pie for android/arm

Also make PIE executables the default build mode, as PIE executables
are required as of Android L.

For #10807

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

9 years agocmd/link: PIE executables for android/arm
David Crawshaw [Mon, 19 Oct 2015 16:53:36 +0000 (12:53 -0400)]
cmd/link: PIE executables for android/arm

For #10807

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

9 years agogo/types: check that typed constant shift expressions are representable
Matthew Dempsky [Thu, 15 Oct 2015 16:50:40 +0000 (09:50 -0700)]
go/types: check that typed constant shift expressions are representable

Fixes #12945.

Change-Id: I08b44795fcd7ec59371aea8111f7febead54720b
Reviewed-on: https://go-review.googlesource.com/15900
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agocmd/cgo: don't print absolute path in comment
David Crawshaw [Mon, 19 Oct 2015 13:11:46 +0000 (09:11 -0400)]
cmd/cgo: don't print absolute path in comment

Change-Id: Ib424e14cfaab35d37ebdd084d41151928bfd645e
Reviewed-on: https://go-review.googlesource.com/16051
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>

9 years agonet/http: use the correct error variable in serveFile
Brad Fitzpatrick [Mon, 19 Oct 2015 14:45:50 +0000 (14:45 +0000)]
net/http: use the correct error variable in serveFile

It was generating the wrong error message, always defaulting to "500
Internal Server Error", since the err variable used was always nil.

Fixes #12991

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

9 years agoruntime: remove a redundant nil pointer check.
Aaron Jacobs [Mon, 19 Oct 2015 09:52:55 +0000 (20:52 +1100)]
runtime: remove a redundant nil pointer check.

It appears this was made possible by commit 89f185f; before that, g was
not dereferenced above.

Change-Id: I70bc571d924b36351392fd4c13d681e938cfb573
Reviewed-on: https://go-review.googlesource.com/16033
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoruntime: merge proc1.go -> proc.go
Nodir Turakulov [Mon, 19 Oct 2015 00:04:05 +0000 (17:04 -0700)]
runtime: merge proc1.go -> proc.go

from proc1.go to proc.go:
* prepend header comment explaining "Goroutine scheduler"
* insert m0 and g0 var defs after the comment
* append the rest

Updates #12952

Change-Id: I35ee9ae3287675cde0c1b6aeaca0a460393f2354
Reviewed-on: https://go-review.googlesource.com/16024
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocompress/flate: improve inflate speed by reading more bits at a time
Joe Tsai [Fri, 9 Oct 2015 00:37:07 +0000 (17:37 -0700)]
compress/flate: improve inflate speed by reading more bits at a time

The flate library guarantees that the Reader will never read more
bytes than is necessary. This way, the underlying io.Reader will
be left exactly after the last byte of the DEFLATE stream.
Formats like gzip depend on this behavior being true.

As such, inflate conservatively reads the minimum symbol length in
huffSym leading to many individual calls to moreBits. However, if we
take advantage of the fact that every block *must* end with the EOB
symbol, we can choose to read the length of the EOB symbol.
Since the EOB symbol is also the most rare symbol (occuring exactly
once) in a block, we can hypothesize that it is almost as long as
the max symbol length, allowing huffSym to ask for more bits at the
start of every loop. This increases the probabilty that the Huffman
code is decoded on the first iteration of the outer for-loop.

benchmark                              old MB/s     new MB/s     speedup
BenchmarkDecodeDigitsSpeed1e4-4        51.05        54.31        1.06x
BenchmarkDecodeDigitsSpeed1e5-4        58.86        62.24        1.06x
BenchmarkDecodeDigitsSpeed1e6-4        59.63        63.13        1.06x
BenchmarkDecodeDigitsDefault1e4-4      51.94        54.61        1.05x
BenchmarkDecodeDigitsDefault1e5-4      63.70        69.13        1.09x
BenchmarkDecodeDigitsDefault1e6-4      66.08        71.43        1.08x
BenchmarkDecodeDigitsCompress1e4-4     52.25        54.56        1.04x
BenchmarkDecodeDigitsCompress1e5-4     63.34        68.30        1.08x
BenchmarkDecodeDigitsCompress1e6-4     66.84        70.64        1.06x
BenchmarkDecodeTwainSpeed1e4-4         50.74        53.40        1.05x
BenchmarkDecodeTwainSpeed1e5-4         60.77        67.03        1.10x
BenchmarkDecodeTwainSpeed1e6-4         62.08        69.78        1.12x
BenchmarkDecodeTwainDefault1e4-4       53.45        56.40        1.06x
BenchmarkDecodeTwainDefault1e5-4       73.54        79.05        1.07x
BenchmarkDecodeTwainDefault1e6-4       77.68        83.65        1.08x
BenchmarkDecodeTwainCompress1e4-4      53.21        56.15        1.06x
BenchmarkDecodeTwainCompress1e5-4      73.82        77.76        1.05x
BenchmarkDecodeTwainCompress1e6-4      79.23        83.30        1.05x

Change-Id: Ie194925c827988a380b8c2fdd13b13c4faa5d397
Reviewed-on: https://go-review.googlesource.com/15651
Reviewed-by: Nigel Tao <nigeltao@golang.org>
9 years agoruntime: merge race1.go -> race.go
Nodir Turakulov [Fri, 16 Oct 2015 21:01:45 +0000 (14:01 -0700)]
runtime: merge race1.go -> race.go

* append contents of race1.go to race.go
* delete "Implementation of the race detector API." comment
  from race1.go

Updates #12952

Change-Id: Ibdd9c4dc79a63c3bef69eade9525578063c86c1c
Reviewed-on: https://go-review.googlesource.com/16023
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime, runtime/cgo: conform to PIC register use rules in ppc64 asm
Michael Hudson-Doyle [Thu, 8 Oct 2015 09:49:39 +0000 (22:49 +1300)]
runtime, runtime/cgo: conform to PIC register use rules in ppc64 asm

PIC code on ppc64le uses R2 as a TOC pointer and when calling a function
through a function pointer must ensure the function pointer is in R12.  These
rules are easy enough to follow unconditionally in our assembly, so do that.

Change-Id: Icfc4e47ae5dfbe15f581cbdd785cdeed6e40bc32
Reviewed-on: https://go-review.googlesource.com/15526
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoreflect, runtime, runtime/cgo: use ppc64 asm constant for fixed frame size
Michael Hudson-Doyle [Thu, 8 Oct 2015 09:34:29 +0000 (22:34 +1300)]
reflect, runtime, runtime/cgo: use ppc64 asm constant for fixed frame size

Shared libraries on ppc64le will require a larger minimum stack frame (because
the ABI mandates that the TOC pointer is available at 24(R1)). Part 3 of that
is using a #define in the ppc64 assembly to refer to the size of the fixed
part of the stack (finding all these took me about a week!).

Change-Id: I50f22fe1c47af1ec59da1bd7ea8f84a4750df9b7
Reviewed-on: https://go-review.googlesource.com/15525
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile, cmd/internal/obj: centralize knowledge of size of fixed part of stack
Michael Hudson-Doyle [Thu, 8 Oct 2015 09:13:44 +0000 (22:13 +1300)]
cmd/compile, cmd/internal/obj: centralize knowledge of size of fixed part of stack

Shared libraries on ppc64le will require a larger minimum stack frame (because
the ABI mandates that the TOC pointer is available at 24(R1)). Part 2a of
preparing for that is to have all bits of arch-independent and ppc64-specific
codegen that need to know call a function to find out.

Change-Id: I55899f73037e92227813c491049a3bd6f30bd41f
Reviewed-on: https://go-review.googlesource.com/15524
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: add a constant for the smallest possible stack frame
Michael Hudson-Doyle [Thu, 8 Oct 2015 08:52:03 +0000 (21:52 +1300)]
runtime: add a constant for the smallest possible stack frame

Shared libraries on ppc64le will require a larger minimum stack frame (because
the ABI mandates that the TOC pointer is available at 24(R1)). So to prepare
for this, make a constant for the fixed part of a stack and use that where
necessary.

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

9 years agocmd/internal/obj, runtime: add NOFRAME flag to suppress stack frame set up on ppc64x
Michael Hudson-Doyle [Thu, 8 Oct 2015 23:44:27 +0000 (12:44 +1300)]
cmd/internal/obj, runtime: add NOFRAME flag to suppress stack frame set up on ppc64x

Replace the confusing game where a frame size of $-8 would suppress the
implicit setting up of a stack frame with a nice explicit flag.

The code to set up the function prologue is still a little confusing but better
than it was.

Change-Id: I1d49278ff42c6bc734ebfb079998b32bc53f8d9a
Reviewed-on: https://go-review.googlesource.com/15670
Reviewed-by: Minux Ma <minux@golang.org>
9 years agomime: Remove an allocation in word decoding.
Justin Nuß [Wed, 9 Sep 2015 19:10:43 +0000 (21:10 +0200)]
mime: Remove an allocation in word decoding.

This fixes a TODO in (*WordDecoder).Decode by replacing a call to strings.Split with
simple prefix/suffix checking and some custom slicing.

Benchmark results:

benchmark                    old ns/op     new ns/op     delta
BenchmarkQEncodeWord-8       740           693           -6.35%
BenchmarkQDecodeWord-8       1291          727           -43.69%
BenchmarkQDecodeHeader-8     1194          767           -35.76%

benchmark                    old allocs     new allocs     delta
BenchmarkQEncodeWord-8       1              1              +0.00%
BenchmarkQDecodeWord-8       3              2              -33.33%
BenchmarkQDecodeHeader-8     3              2              -33.33%

benchmark                    old bytes     new bytes     delta
BenchmarkQEncodeWord-8       48            48            +0.00%
BenchmarkQDecodeWord-8       128           48            -62.50%
BenchmarkQDecodeHeader-8     128           48            -62.50%

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

9 years agoruntime: merge stack{1,2}.go -> stack.go
Nodir Turakulov [Sat, 17 Oct 2015 01:45:30 +0000 (18:45 -0700)]
runtime: merge stack{1,2}.go -> stack.go

* rename stack1.go -> stack.go
* prepend contents of stack2.go to stack.go

Updates #12952

Change-Id: I60d409af37162a5a7596c678dfebc2cea89564ff
Reviewed-on: https://go-review.googlesource.com/16008
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/link: always disable lazy PLT resolution when dynamically linking Go
Michael Hudson-Doyle [Thu, 15 Oct 2015 08:48:11 +0000 (21:48 +1300)]
cmd/link: always disable lazy PLT resolution when dynamically linking Go

Go cannot allow lazy PLT resolution when calling between Go functions because
the lazy resolution can use more stack than is available. Lazy resolution is
disabled by passing -z now to the system linker, but unfortunately was only
passed when linking to a Go shared library. That sounds fine, but the shared
library containing the runtime is not linked to any other Go shared library but
calls main.init and main.main via a PLT, and before this fix this did use lazy
resolution. (For some reason this never caused a problem on intel, but it
breaks on ppc64le). Fortunately the fix is very simple: always pass -z now to
the system linker when dynamically linking Go.

Change-Id: I7806d40aac80dcd1e56b95864d1cfeb1c42614e2
Reviewed-on: https://go-review.googlesource.com/15870
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet/http: Client support for Expect: 100-continue
Yasuharu Goto [Thu, 14 May 2015 15:44:34 +0000 (00:44 +0900)]
net/http: Client support for Expect: 100-continue

Current http client doesn't support Expect: 100-continue request
header(RFC2616-8/RFC7231-5.1.1). So even if the client have the header,
the head of the request body is consumed prematurely.

Those are my intentions to avoid premature consuming body in this change.
- If http.Request header contains body and Expect: 100-continue
  header, it blocks sending body until it gets the first response.
- If the first status code to the request were 100, the request
  starts sending body. Otherwise, sending body will be cancelled.
- Tranport.ExpectContinueTimeout specifies the amount of the time to
  wait for the first response.

Fixes #3665

Change-Id: I4c04f7d88573b08cabd146c4e822061764a7cd1f
Reviewed-on: https://go-review.googlesource.com/10091
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: remove some unnecessary unsafe code in mfixalloc
Matthew Dempsky [Fri, 16 Oct 2015 23:21:26 +0000 (16:21 -0700)]
runtime: remove some unnecessary unsafe code in mfixalloc

Change-Id: Ie9ea4af4315a4d0eb69d0569726bb3eca2b397af
Reviewed-on: https://go-review.googlesource.com/16005
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet: unblock plan9 TCP Read calls after socket close
Brad Fitzpatrick [Fri, 16 Oct 2015 16:28:42 +0000 (16:28 +0000)]
net: unblock plan9 TCP Read calls after socket close

Fixes #7782
Fixes #9554
Updates #7237 (original metabug, before we switched to specific bugs)
Updates #11932 (plan9 still doesn't have net I/O deadline support)

Change-Id: I96f311b88b1501d884ebc008fd31ad2cf1e16d75
Reviewed-on: https://go-review.googlesource.com/15941
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet: use IndexByte implementation from runtime package
Ilya Tocar [Thu, 15 Oct 2015 15:59:01 +0000 (18:59 +0300)]
net: use IndexByte implementation from runtime package

In net/parse.go we reimplement bytes.IndexByte and strings.IndexByte,
However those are implemented in runtime/$GOARCH_asm.s.
Using versions from runtime should provide performance advantage,
and keep the same code together.

Change-Id: I6212184bdf6aa1f2c03ce26d4b63f5b379d8ed0c
Reviewed-on: https://go-review.googlesource.com/15953
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: merge panic1.go into panic.go
Nodir Turakulov [Fri, 16 Oct 2015 02:00:12 +0000 (19:00 -0700)]
runtime: merge panic1.go into panic.go

A TODO to merge is removed from panic1.go.
The rest is appended to panic.go

Updates #12952

Change-Id: Ied4382a455abc20bc2938e34d031802e6b4baf8b
Reviewed-on: https://go-review.googlesource.com/15905
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agoruntime: rename print1.go -> print.go
Nodir Turakulov [Fri, 16 Oct 2015 02:30:02 +0000 (19:30 -0700)]
runtime: rename print1.go -> print.go

It seems that it was called print1.go mistakenly: print.go was deleted
in the same commit:
https://go.googlesource.com/go/+/597b266eafe7d63e9be8da1c1b4813bd2998a11c

Updates #12952

Change-Id: I371e59d6cebc8824857df3f3ee89101147dfffc0
Reviewed-on: https://go-review.googlesource.com/15950
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agoruntime: merge string1.go into string.go
Nodir Turakulov [Fri, 16 Oct 2015 06:34:56 +0000 (23:34 -0700)]
runtime: merge string1.go into string.go

string1.go contents are appended to string.go as is

Updates #12952

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

9 years agodatabase/sql: avoid deadlock waiting for connections
Chris Hines [Mon, 14 Sep 2015 07:44:56 +0000 (03:44 -0400)]
database/sql: avoid deadlock waiting for connections

Previously with db.maxOpen > 0, db.maxOpen+n failed connection attempts
started concurrently could result in a deadlock. DB.conn and
DB.openNewConnection did not trigger the DB.connectionOpener go routine
after a failed connection attempt. This omission could leave go routines
waiting for DB.connectionOpener forever.

In addition the logic to track the state of the pool was inconsistent.
db.numOpen was sometimes incremented optimistically and sometimes not.
This change harmonizes the logic and eliminates the db.pendingOpens
variable, making the logic easier to understand and maintain.

Fixes #10886

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

9 years agosyscall: fix nacl listener to not accept connections once closed
Brad Fitzpatrick [Fri, 16 Oct 2015 04:41:34 +0000 (04:41 +0000)]
syscall: fix nacl listener to not accept connections once closed

Change-Id: I3ba6e97089ef6e69ba31dfb632df465859906a74
Reviewed-on: https://go-review.googlesource.com/15940
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime, runtime/debug: access unexported runtime functions with //go:linkname, not...
Michael Hudson-Doyle [Fri, 16 Oct 2015 07:19:14 +0000 (20:19 +1300)]
runtime, runtime/debug: access unexported runtime functions with //go:linkname, not assembly stubs

Change-Id: I88f80f5914d6e4c179f3d28aa59fc29b7ef0cc66
Reviewed-on: https://go-review.googlesource.com/15960
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime, os/signal: use //go:linkname instead of assembly stubs to get access to...
Michael Hudson-Doyle [Thu, 15 Oct 2015 20:56:07 +0000 (09:56 +1300)]
runtime, os/signal: use //go:linkname instead of assembly stubs to get access to runtime functions

os/signal depends on a few unexported runtime functions. This removes the
assembly stubs it used to get access to these in favour of using
//go:linkname in runtime to make the functions accessible to os/signal.

This is motivated by ppc64le shared libraries, where you cannot BR to a symbol
defined in a shared library (only BL), but it seems like an improvment anyway.

Change-Id: I09361203ce38070bd3f132f6dc5ac212f2dc6f58
Reviewed-on: https://go-review.googlesource.com/15871
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agoruntime: use unsafe.Pointer(x) instead of (unsafe.Pointer)(x)
Matthew Dempsky [Thu, 15 Oct 2015 21:33:50 +0000 (14:33 -0700)]
runtime: use unsafe.Pointer(x) instead of (unsafe.Pointer)(x)

This isn't C anymore.  No binary change to pkg/linux_amd64/runtime.a.

Change-Id: I24d66b0f5ac888f432b874aac684b1395e7c8345
Reviewed-on: https://go-review.googlesource.com/15903
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile/internal/gc: reject invalid unsafe.Sizeof([0]byte{}[0])
Matthew Dempsky [Thu, 15 Oct 2015 18:29:06 +0000 (11:29 -0700)]
cmd/compile/internal/gc: reject invalid unsafe.Sizeof([0]byte{}[0])

Apply static bounds checking logic during type checking even to
zero-element arrays, but skip synthesized OINDEX nodes that the
compiler has asserted are within bounds (such as the ones generated
while desugaring ORANGE nodes).  This matches the logic in walkexpr
that also skips static bounds checking when Bounded is true.

Passes toolstash/buildall.

Fixes #12944.

Change-Id: I14ba03d71c002bf969d69783bec8d1a8e10e7d75
Reviewed-on: https://go-review.googlesource.com/15902
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile/internal/gc: refactor range/memclr optimization
Matthew Dempsky [Thu, 15 Oct 2015 18:08:09 +0000 (11:08 -0700)]
cmd/compile/internal/gc: refactor range/memclr optimization

No functional change and passes toolstash/buildall, but eliminates a
13-deep nesting of if statements.

Change-Id: I32e63dcf358c6eb521935f4ee07fbe749278e5ef
Reviewed-on: https://go-review.googlesource.com/15901
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http/cgi: optimize internal function removeLeadingDuplicates a bit
Brad Fitzpatrick [Wed, 14 Oct 2015 15:12:40 +0000 (15:12 +0000)]
net/http/cgi: optimize internal function removeLeadingDuplicates a bit

Change-Id: I0255f24f5c5925ea4daa28a28d23606df35d4373
Reviewed-on: https://go-review.googlesource.com/15824
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agotext/template: resolve non-empty interface
Nodir Turakulov [Wed, 14 Oct 2015 02:09:32 +0000 (19:09 -0700)]
text/template: resolve non-empty interface

Read what a non-empty interface points to.

The deleted lines were added in https://codereview.appspot.com/4810060/,
which attempted to break an infinite loop. That was a long time ago.
If I just delete these lines with current codebase, the test "bug1"
(added in that CL) does not fail.

All new tests fail without this fix.

Fixes #12924

Change-Id: I9370ca44facd6af3019850aa065b936e5a482d37
Reviewed-on: https://go-review.googlesource.com/15809
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agomime: limit UTF-8 encoded-word length to 75 characters
Alexandre Cesaro [Thu, 24 Sep 2015 21:45:13 +0000 (23:45 +0200)]
mime: limit UTF-8 encoded-word length to 75 characters

As specified by RFC 2047 section 2, encoded-words may not be more than
75 characters long.

We only enforce this rule when the charset is UTF-8, since multi-bytes
characters must not be split accross encoded-words (see section 5.3).

Fixes #12300

Change-Id: I72a43fc3fe6ddeb3dab54dcdce0837d7ebf658f0
Reviewed-on: https://go-review.googlesource.com/14957
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/httputil: clarify where DumpRequest(Out)? can be used.
Aaron Jacobs [Wed, 14 Oct 2015 23:25:56 +0000 (10:25 +1100)]
net/http/httputil: clarify where DumpRequest(Out)? can be used.

The clues to this were already there, but as a user I was still unsure.
Make this more explicit.

Change-Id: I68564f3498dcd4897772a303588f03a6b65f111d
Reviewed-on: https://go-review.googlesource.com/15172
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoencoding/json: simplify encodeState.{string, stringBytes}
Nodir Turakulov [Wed, 14 Oct 2015 22:18:10 +0000 (15:18 -0700)]
encoding/json: simplify encodeState.{string, stringBytes}

As correctly mentioned in #11883, encodeState.string and
encodeState.stringBytes never return an error.
This CL removes the error from the function signatures and somewhat
simplifies call sites.

Fixes #11883

Change-Id: I1d1853d09631c545b68b5eea86ff7daa2e0ca10b
Reviewed-on: https://go-review.googlesource.com/15836
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: enable automatic HTTP/2 if TLSNextProto is nil
Brad Fitzpatrick [Wed, 14 Oct 2015 20:41:36 +0000 (20:41 +0000)]
net/http: enable automatic HTTP/2 if TLSNextProto is nil

This enables HTTP/2 by default (for https only) if the user didn't
configure anything in their NPN/ALPN map. If they're using SPDY or an
alternate http2 or a newer http2 from x/net/http2, we do nothing
and don't use the standard library's vendored copy of x/net/http2.

Upstream remains golang.org/x/net/http2.

Update #6891

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

9 years agovendor: import golang.org/x/net/http2
Brad Fitzpatrick [Wed, 14 Oct 2015 03:37:10 +0000 (03:37 +0000)]
vendor: import golang.org/x/net/http2

golang.org/x/net/http2 becomes net/http/h2_bundle.go (using adonovan's
x/tools/cmd/bundle tool), becoming a hidden part of the net/http package.

golang.org/x/net/http2/hpack becomes vendor/golang.org/x/net/http2/hpack.

At git rev 7331ef52 (https://go-review.googlesource.com/15821)

Change-Id: Ia6683e6f91a481b11a778638bf65b6a338744eea
Reviewed-on: https://go-review.googlesource.com/15822
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agonet/http: don't hang if RemoteAddr() blocks
David Glasser [Wed, 14 Oct 2015 21:25:00 +0000 (14:25 -0700)]
net/http: don't hang if RemoteAddr() blocks

The PROXY protocol is supported by several proxy servers such as haproxy
and Amazon ELB.  This protocol allows services running behind a proxy to
learn the remote address of the actual client connecting to the proxy,
by including a single textual line at the beginning of the TCP
connection.
http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt

There are several Go libraries for this protocol (such as
https://github.com/armon/go-proxyproto), which operate by wrapping a
net.Conn with an implementation whose RemoteAddr method reads the
protocol line before returning. This means that RemoteAddr is a blocking
call.

Before this change, http.Serve called RemoteAddr from the main Accepting
goroutine, not from the per-connection goroutine. This meant that it
would not Accept another connection until RemoteAddr returned, which is
not appropriate if RemoteAddr needs to do a blocking read from the
socket first.

Fixes #12943.

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

9 years agocompress/gzip: fix go vet warning
Joe Tsai [Tue, 13 Oct 2015 20:19:09 +0000 (13:19 -0700)]
compress/gzip: fix go vet warning

Change-Id: I2ac6b178e666e34e028001078faf62ce71e12e9d
Reviewed-on: https://go-review.googlesource.com/15834
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http/cgi: make provided Env override even system env vars
Steven Hartland [Fri, 25 Sep 2015 08:51:50 +0000 (08:51 +0000)]
net/http/cgi: make provided Env override even system env vars

Allow all CGI environment settings from the inherited set and default
inherited set to be overridden including PATH by Env.

Change-Id: Ief8d33247b879fa87a8bfd6416d4813116db98de
Reviewed-on: https://go-review.googlesource.com/14959
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agoruntime: Reduce testing for fastlog2 implementation
Raul Silvera [Wed, 14 Oct 2015 02:49:40 +0000 (19:49 -0700)]
runtime: Reduce testing for fastlog2 implementation

The current fastlog2 testing checks all 64M values in the domain of
interest, which is too much for platforms with no native floating point.

Reduce testing under testing.Short() to speed up builds for those platforms.

Related to #12620

Change-Id: Ie5dcd408724ba91c3b3fcf9ba0dddedb34706cd1
Reviewed-on: https://go-review.googlesource.com/15830
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Joel Sing <jsing@google.com>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoencoding/csv: indicate package of EOF in docs
Katrina Owen [Tue, 13 Oct 2015 22:42:20 +0000 (16:42 -0600)]
encoding/csv: indicate package of EOF in docs

The documentation listing err == EOF can be confusing to newcomers
to the language who are looking for the relevant documentation for
that error.

Change-Id: I301885950d0e1d0fbdf3a1892fca86eac7a0c616
Reviewed-on: https://go-review.googlesource.com/15806
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/internal/obj: move empty field to the top
Shenghou Ma [Fri, 9 Oct 2015 00:24:17 +0000 (20:24 -0400)]
cmd/internal/obj: move empty field to the top

Due to #9401, trailing empty fields will occupy at least 1 byte
of space.

Fixes #12884.

Change-Id: I838d3f1a73637e526f5a6dbc348981227d5bb2fd
Reviewed-on: https://go-review.googlesource.com/15660
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agomisc/cgo/testcshared: use -pie for android-L.
Hyang-Ah Hana Kim [Tue, 13 Oct 2015 17:58:11 +0000 (13:58 -0400)]
misc/cgo/testcshared: use -pie for android-L.

Also, handle the case where 'read' returns EINVAL instead of EBADF
when the descriptor is not ready. (android 4.4.4/cyanogenmod, nexus7)

Change-Id: I56c5949d27303d44a4fd0de38951b85e20cef167
Reviewed-on: https://go-review.googlesource.com/15810
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agomisc/cgo/test: fix go vet warnings
Ian Lance Taylor [Tue, 13 Oct 2015 17:05:13 +0000 (10:05 -0700)]
misc/cgo/test: fix go vet warnings

Fixes these warnings from go vet:
buildid_linux.go:25: no formatting directive in Fatalf call
callback.go:180: arg pc[i] for printf verb %p of wrong type: uintptr
env.go:34: possible misuse of unsafe.Pointer
issue7665.go:22: possible misuse of unsafe.Pointer

Change-Id: I83811b9c10c617139713a626b4a34ab05564d4fe
Reviewed-on: https://go-review.googlesource.com/15802
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agonet/http: ignore Transfer-Encoding for HTTP/1.0 responses
Brad Fitzpatrick [Tue, 13 Oct 2015 00:29:44 +0000 (00:29 +0000)]
net/http: ignore Transfer-Encoding for HTTP/1.0 responses

Fixes #12785

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

9 years agoruntime: remove _Kind constants
Ian Lance Taylor [Mon, 12 Oct 2015 23:01:51 +0000 (16:01 -0700)]
runtime: remove _Kind constants

The duplication of _Kind and kind constants is a legacy of the
conversion from C.

Change-Id: I368b35a41f215cf91ac4b09dac59699edb414a0e
Reviewed-on: https://go-review.googlesource.com/15800
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: always log dynamic import errors
Burcu Dogan [Mon, 12 Oct 2015 08:02:51 +0000 (01:02 -0700)]
cmd/go: always log dynamic import errors

There is no easy way to understand what user intent was and whether
they wanted to use a dynamic import or not.

If we skip logging such errors, it breaks common use cases such as
https://golang.org/issue/12810.

It's a better approach to expose the underlying mechanism and
be more verbose with the error messages.

Fixes #12810.

Change-Id: I7e922c9e848382690d9d9b006d7046e6cf93223b
Reviewed-on: https://go-review.googlesource.com/15756
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/go: don't accept a relative path as GOBIN
Burcu Dogan [Mon, 12 Oct 2015 15:56:05 +0000 (08:56 -0700)]
cmd/go: don't accept a relative path as GOBIN

Fixes #12907.

Change-Id: I5925852fe6962d4ec7dbb3ea5323e8ddfaf9d576
Reviewed-on: https://go-review.googlesource.com/15755
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoapi: update next.txt
Brad Fitzpatrick [Mon, 12 Oct 2015 22:40:10 +0000 (22:40 +0000)]
api: update next.txt

Change-Id: I536d55f784bb042a2dee94b2878aff42bc182eed
Reviewed-on: https://go-review.googlesource.com/15734
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: export the "new" error codes from RFC 6585
Brad Fitzpatrick [Mon, 12 Oct 2015 20:41:40 +0000 (20:41 +0000)]
net/http: export the "new" error codes from RFC 6585

These were proposed in the RFC over three years ago, then proposed to
be added to Go in https://codereview.appspot.com/7678043/ 2 years and
7 months ago, and the spec hasn't been updated or retracted the whole
time.

Time to export them.

Of note, HTTP/2 uses code 431 (Request Header Fields Too Large).

Updates #12843

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

9 years agonet/textproto: properly trim continued lines in MIME headers
Didier Spezia [Sat, 10 Oct 2015 16:53:09 +0000 (16:53 +0000)]
net/textproto: properly trim continued lines in MIME headers

A MIME header can include values defined on several lines.
Only the first line of each value was trimmed.

Make sure all the lines are trimmed before being aggregated.

Fixes #11204

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

9 years agoimage: add NYCbCrA types.
Nigel Tao [Sat, 10 Oct 2015 00:25:47 +0000 (11:25 +1100)]
image: add NYCbCrA types.

Fixes #12722

Change-Id: I6a630d8b072ef2b1c63de941743148f8c96b8e5f
Reviewed-on: https://go-review.googlesource.com/15671
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>