]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agoreflect: test that Call results are not addressable
Ian Lance Taylor [Tue, 12 Apr 2016 22:47:17 +0000 (15:47 -0700)]
reflect: test that Call results are not addressable

Gccgo was erroneously marking Call results as addressable, which led to
an obscure bug using text/template, as text/template calls CanAddr to
check whether to take the address of a value when looking up methods.
When a function returned a pointer, and CanAddr was true, the result was
a pointer to a pointer that had no methods.

Fixed in gccgo by https://golang.org/cl/21908.  Adding the test here so
that it doesn't regress.

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

9 years agoimage/color: optimize YCbCrToRGB
Martin Möhrmann [Tue, 12 Apr 2016 19:16:27 +0000 (21:16 +0200)]
image/color: optimize YCbCrToRGB

Use one comparison to detect underflow and overflow simultaneously.
Use a shift, bitwise complement and uint8 type conversion to handle
clamping to upper and lower bound without additional branching.

Overall the new code is faster for a mix of
common case, underflow and overflow.

name     old time/op  new time/op  delta
YCbCr-2  1.12ms ± 0%  0.64ms ± 0%  -43.01%  (p=0.000 n=48+47)

name              old time/op  new time/op  delta
YCbCrToRGB/0-2    5.52ns ± 0%  5.77ns ± 0%  +4.48%  (p=0.000 n=50+49)
YCbCrToRGB/128-2  6.05ns ± 0%  5.52ns ± 0%  -8.69%  (p=0.000 n=39+50)
YCbCrToRGB/255-2  5.80ns ± 0%  5.77ns ± 0%  -0.58%  (p=0.000 n=50+49)

Found in collaboration with Josh Bleecher Snyder and Ralph Corderoy.

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

9 years agonet: skip failing or flaky TestInterfaces on freebsd-arm
Brad Fitzpatrick [Tue, 12 Apr 2016 22:27:33 +0000 (22:27 +0000)]
net: skip failing or flaky TestInterfaces on freebsd-arm

Updates #15262

Change-Id: I3eb1f6f71d6285d039f11ba6a34b8a599a33bf49
Reviewed-on: https://go-review.googlesource.com/21909
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agonet: mirror Tom Sawyer in the net package for tests
Brad Fitzpatrick [Tue, 12 Apr 2016 21:51:19 +0000 (21:51 +0000)]
net: mirror Tom Sawyer in the net package for tests

Fixes the darwin/arm builder, which has a special test runner which
makes the assumption that tests never use testdata from another
package.

This looks large, but it's no more space in git.

Change-Id: I81921b516443d12d21b77617d323ddebedbe40f8
Reviewed-on: https://go-review.googlesource.com/21907
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: remove unused Pciter type
Matthew Dempsky [Tue, 12 Apr 2016 21:44:49 +0000 (14:44 -0700)]
cmd/internal/obj: remove unused Pciter type

Change-Id: Ie8323cfcd1193f390729d0d3dd67863aedf47d13
Reviewed-on: https://go-review.googlesource.com/21906
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet: make two tests not parallel
Josh Bleecher Snyder [Tue, 12 Apr 2016 21:04:01 +0000 (14:04 -0700)]
net: make two tests not parallel

Running

stress -p 1 go test -short std

on a heavily loaded machine causes net timeouts
every 15 or 20 runs.
Making these tests not run in parallel helps.
With this change, I haven’t seen a single failure
in over 100 runs.

Fixes #14986

Change-Id: Ibaa14869ce8d95b00266aee94d62d195927ede68
Reviewed-on: https://go-review.googlesource.com/21905
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoall: standardize RFC mention format
Dan Peterson [Tue, 12 Apr 2016 19:58:56 +0000 (16:58 -0300)]
all: standardize RFC mention format

Standardize on space between "RFC" and number. Additionally change
the couple "a RFC" instances to "an RFC."

Fixes #15258

Change-Id: I2b17ecd06be07dfbb4207c690f52a59ea9b04808
Reviewed-on: https://go-review.googlesource.com/21902
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/internal/obj: split plist flushing from object writing
Shahar Kohanim [Mon, 11 Apr 2016 14:35:55 +0000 (17:35 +0300)]
cmd/internal/obj: split plist flushing from object writing

Only splits into separate files, no other changes.

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

9 years agocmd/link, etc: store typelinks as offsets
David Crawshaw [Sun, 27 Mar 2016 14:21:48 +0000 (10:21 -0400)]
cmd/link, etc: store typelinks as offsets

This is the first in a series of CLs to replace the use of pointers
in binary read-only data with offsets.

In standard Go binaries these CLs have a small effect, shrinking
8-byte pointers to 4-bytes. In position-independent code, it also
saves the dynamic relocation for the pointer. This has a significant
effect on the binary size when building as PIE, c-archive, or
c-shared.

darwin/amd64:
cmd/go: -12KB (0.1%)
jujud:  -82KB (0.1%)

linux/amd64 PIE:
cmd/go:  -86KB (0.7%)
jujud:  -569KB (0.7%)

For #6853.

Change-Id: Iad5625bbeba58dabfd4d334dbee3fcbfe04b2dcf
Reviewed-on: https://go-review.googlesource.com/21284
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: skip TestDialCancel on linux-arm64-buildlet
Brad Fitzpatrick [Tue, 12 Apr 2016 19:48:01 +0000 (19:48 +0000)]
net: skip TestDialCancel on linux-arm64-buildlet

These builders (on Linaro) have a different network configuration
which is incompatible with this test. Or so it seems.

Updates #15191

Change-Id: Ibfeacddc98dac1da316e704b5c8491617a13e3bf
Reviewed-on: https://go-review.googlesource.com/21901
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agocmd/pprof: pass the event to pprof_toggle_asm for the weblist command
Alberto Donizetti [Sun, 10 Apr 2016 18:14:27 +0000 (20:14 +0200)]
cmd/pprof: pass the event to pprof_toggle_asm for the weblist command

Fixes #15225

Change-Id: I1f85590b2c3293463c6476beebcd3256adc1bf23
Reviewed-on: https://go-review.googlesource.com/21802
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocrypto/x509: remove broken link in ParsePKCS8PrivateKey documentation
Dan Peterson [Tue, 12 Apr 2016 16:12:54 +0000 (13:12 -0300)]
crypto/x509: remove broken link in ParsePKCS8PrivateKey documentation

Fixes #14776

Change-Id: I55423ac643f18542b9fd1386ed98dec47fb678aa
Reviewed-on: https://go-review.googlesource.com/21890
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd: replace x[i:][0] expressions with x[i]
Matthew Dempsky [Tue, 12 Apr 2016 19:16:20 +0000 (12:16 -0700)]
cmd: replace x[i:][0] expressions with x[i]

Passes toolstash -cmp.

Change-Id: Id504e71ed1f23900e24a9aed25143c94f4d7d50c
Reviewed-on: https://go-review.googlesource.com/21899
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet: broken sendfile on SmartOS/Solaris
Shawn Walker-Salas [Fri, 8 Apr 2016 22:59:04 +0000 (15:59 -0700)]
net: broken sendfile on SmartOS/Solaris

In the event of a partial write on Solaris and some BSDs, the offset
pointer passed to sendfile() will be updated even though the function
returns -1 if errno is set to EAGAIN/EINTR.  In that case, calculate the
bytes written based on the difference between the updated offset and the
original offset.  If no bytes were written, and errno is set to
EAGAIN/EINTR, ignore the errno.

Fixes #13892

Change-Id: I6334b5ef2edcbebdaa7db36fa4f7785967313c2d
Reviewed-on: https://go-review.googlesource.com/21769
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: move compiler-specific flags into compiler-spec. export data section
Robert Griesemer [Tue, 12 Apr 2016 18:31:16 +0000 (11:31 -0700)]
cmd/compile: move compiler-specific flags into compiler-spec. export data section

Also: Adjust go/importer accordingly.

Change-Id: Ia6669563793e218946af45b9fba1cf986a21c031
Reviewed-on: https://go-review.googlesource.com/21896
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agocmd/objdump: skip TestDisasm* on s390x
Michael Munday [Tue, 12 Apr 2016 17:38:24 +0000 (13:38 -0400)]
cmd/objdump: skip TestDisasm* on s390x

The disassembler is not yet implemented on s390x.

Updates #15255.

Change-Id: Ibab319c8c087b1a619baa1529398305c1e721877
Reviewed-on: https://go-review.googlesource.com/21894
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: fix TestLinuxSendfile on s390x
Michael Munday [Tue, 12 Apr 2016 16:46:54 +0000 (12:46 -0400)]
net/http: fix TestLinuxSendfile on s390x

s390x doesn't have sendfile64 so apply the same fix as MIPS
(eebf7d27) and just use sendfile.

Change-Id: If8fe2e974ed44a9883282430157c3545d5bd04bd
Reviewed-on: https://go-review.googlesource.com/21892
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile/internal/gc: add s390x support
Michael Munday [Tue, 12 Apr 2016 16:26:17 +0000 (12:26 -0400)]
cmd/compile/internal/gc: add s390x support

Allows instructions with a From3 field to be used in regopt so
long as From3 represents a constant. This is needed because the
storage-to-storage instructions on s390x place the length of the
data into From3.

Change-Id: I12cd32d4f997baf2fe97937bb7d45bbf716dfcb5
Reviewed-on: https://go-review.googlesource.com/20875
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>

9 years agocmd/compile: temporarily disable inplace append special case
Josh Bleecher Snyder [Tue, 12 Apr 2016 16:22:26 +0000 (09:22 -0700)]
cmd/compile: temporarily disable inplace append special case

Fixes #15246
Re-opens #14969

Change-Id: Ic0b41c5aa42bbb229a0d62b7f3e5888c6b29293d
Reviewed-on: https://go-review.googlesource.com/21891
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
9 years agohash/crc32: invert build tags for go implementation
Michael Munday [Fri, 8 Apr 2016 17:30:41 +0000 (13:30 -0400)]
hash/crc32: invert build tags for go implementation

It seems cleaner and more consistent with other files to list the
architectures that have assembly implementations rather than to
list those that do not.

This means we don't have to add s390x and future platforms to this
list.

Change-Id: I2ad3f66b76eb1711333c910236ca7f5151b698e5
Reviewed-on: https://go-review.googlesource.com/21770
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime/cgo: add s390x support
Michael Munday [Fri, 18 Mar 2016 23:20:34 +0000 (19:20 -0400)]
runtime/cgo: add s390x support

Change-Id: I64ada9fe34c3cfc4bd514ec5d8c8f4d4c99074fb
Reviewed-on: https://go-review.googlesource.com/20950
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agodebug/gosym: accept PC quantum of 2 (for s390x)
Michael Munday [Mon, 21 Mar 2016 17:30:50 +0000 (13:30 -0400)]
debug/gosym: accept PC quantum of 2 (for s390x)

Needed for the header check to accept the header generated for
s390x as Go 1.2 style rather than Go 1.1 style.

Change-Id: I7b3713d4cc7514cfc58f947a45702348f6d7b824
Reviewed-on: https://go-review.googlesource.com/20966
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime/internal/atomic: add s390x atomic operations
Michael Munday [Fri, 18 Mar 2016 23:13:59 +0000 (19:13 -0400)]
runtime/internal/atomic: add s390x atomic operations

Load and store instructions are atomic on the s390x.

Change-Id: I0031ed2fba43f33863bca114d0fdec2e7d1ce807
Reviewed-on: https://go-review.googlesource.com/20938
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: minor Cgen_checknil cleanup
Michael Munday [Tue, 12 Apr 2016 14:27:16 +0000 (10:27 -0400)]
cmd/compile/internal/gc: minor Cgen_checknil cleanup

Most architectures can only generate nil checks when the
the address to check is in a register. Currently only
amd64 and 386 can generate checks for addresses that
reside in memory. This is unlikely to change so the architecture
check has been inverted.

Change-Id: I73697488a183406c79a9039c62823712b510bb6a
Reviewed-on: https://go-review.googlesource.com/21861
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: add x.Uses==1 test to load combiners
Keith Randall [Tue, 12 Apr 2016 04:23:11 +0000 (21:23 -0700)]
cmd/compile: add x.Uses==1 test to load combiners

We need to make sure that when we combine loads, we only do
so if there are no other uses of the load.  We can't split
one load into two because that can then lead to inconsistent
loaded values in the presence of races.

Add some aggressive copy removal code so that phantom
"dead copy" uses of values are cleaned up promptly.  This lets
us use x.Uses==1 conditions reliably.

Change-Id: I9037311db85665f3868dbeb3adb3de5c20728b38
Reviewed-on: https://go-review.googlesource.com/21853
Reviewed-by: Todd Neal <todd@tneal.org>
9 years agocmd/pprof/internal: move to cmd/internal/pprof
Dmitry Vyukov [Tue, 12 Apr 2016 07:41:11 +0000 (09:41 +0200)]
cmd/pprof/internal: move to cmd/internal/pprof

Make internal pprof packages available to cmd/trace.
cmd/trace needs access to them to generate symbolized
svg profiles (create and serialize Profile struct).
And potentially generate svg programmatically instead
of invoking go tool pprof.

Change-Id: Iafd0c87ffdd4ddc081093be0b39761f19507907a
Reviewed-on: https://go-review.googlesource.com/21870
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: share dominator tree among many passes
Alexandru Moșoi [Mon, 11 Apr 2016 19:51:29 +0000 (21:51 +0200)]
cmd/compile: share dominator tree among many passes

These passes do not modify the dominator tree too much.

% benchstat old.txt new.txt
name       old time/op     new time/op     delta
Template       335ms ± 3%      325ms ± 8%    ~             (p=0.074 n=8+9)
GoTypes        1.05s ± 1%      1.05s ± 3%    ~            (p=0.095 n=9+10)
Compiler       5.37s ± 4%      5.29s ± 1%  -1.42%         (p=0.022 n=9+10)
MakeBash       34.9s ± 3%      34.4s ± 2%    ~            (p=0.095 n=9+10)

name       old alloc/op    new alloc/op    delta
Template      55.4MB ± 0%     54.9MB ± 0%  -0.81%        (p=0.000 n=10+10)
GoTypes        179MB ± 0%      178MB ± 0%  -0.89%        (p=0.000 n=10+10)
Compiler       807MB ± 0%      798MB ± 0%  -1.10%        (p=0.000 n=10+10)

name       old allocs/op   new allocs/op   delta
Template        498k ± 0%       496k ± 0%  -0.29%          (p=0.000 n=9+9)
GoTypes        1.42M ± 0%      1.41M ± 0%  -0.24%        (p=0.000 n=10+10)
Compiler       5.61M ± 0%      5.60M ± 0%  -0.12%        (p=0.000 n=10+10)

Change-Id: I4cd20cfba3f132ebf371e16046ab14d7e42799ec
Reviewed-on: https://go-review.googlesource.com/21806
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
9 years agocmd/compile/internal/s390x: add s390x support
Michael Munday [Tue, 12 Apr 2016 00:23:19 +0000 (20:23 -0400)]
cmd/compile/internal/s390x: add s390x support

s390x does not require duffzero/duffcopy since it has
storage-to-storage instructions that can copy/clear up to 256
bytes at a time.

peep contains several new passes to optimize instruction
sequences that match s390x instructions such as the
compare-and-branch and load/store multiple instructions.

copyprop and subprop have been extended to work with moves that
require sign/zero extension. This work could be ported to other
architectures that do not used sized math however it does add
complexity and will probably be rendered unnecessary by ssa in
the near future.

Change-Id: I1b64b281b452ed82a85655a0df69cb224d2a6941
Reviewed-on: https://go-review.googlesource.com/20873
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agointernal/trace: fix int overflow in timestamps
Dmitry Vyukov [Fri, 8 Apr 2016 09:53:23 +0000 (11:53 +0200)]
internal/trace: fix int overflow in timestamps

Fixes #15102

Change-Id: I7fdb6464afd0b7af9b6652051416f0fddd34dc9a
Reviewed-on: https://go-review.googlesource.com/21730
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/go: fix vcsFromDir returning bad root on Windows
Dmitri Shuralyov [Thu, 31 Mar 2016 09:01:48 +0000 (02:01 -0700)]
cmd/go: fix vcsFromDir returning bad root on Windows

Apply golang/tools@5804fef4c0556d3e5e7d2440740a3d7aced7d58b.

In the context of cmd/go build tool, import path is a '/'-separated path.
This can be inferred from `go help importpath` and `go help packages`.
vcsFromDir documentation says on return, root is the import path
corresponding to the root of the repository. On Windows and other
OSes where os.PathSeparator is not '/', that wasn't true since root
would contain characters other than '/', and therefore it wasn't a
valid import path corresponding to the root of the repository.
Fix that by using filepath.ToSlash.

Add test coverage for vcsFromDir, it was previously not tested.
It's taken from golang.org/x/tools/go/vcs tests, and modified to
improve style.

Additionally, remove an unneccessary statement from the documentation
"(thus root is a prefix of importPath)". There is no variable
importPath that is being referred to (it's possible p.ImportPath
was being referred to). Without it, the description of root value
matches the documentation of repoRoot.root struct field:

// root is the import path corresponding to the root of the
// repository
root string

Rename and change signature of vcsForDir(p *Package) to
vcsFromDir(dir, srcRoot string). This is more in sync with the x/tools
version. It's also simpler, since vcsFromDir only needs those two
values from Package, and nothing more. Change "for" to "from" in name
because it's more consistent and clear.

Update usage of vcsFromDir to match the new signature, and respect
that returned root is a '/'-separated path rather than a os.PathSeparator
separated path.

Fixes #15040.
Updates #7723.
Helps #11490.

Change-Id: Idf51b9239f57248739daaa200aa1c6e633cb5f7f
Reviewed-on: https://go-review.googlesource.com/21345
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: cleanup pragcgo
Martin Möhrmann [Thu, 7 Apr 2016 06:01:47 +0000 (08:01 +0200)]
cmd/compile: cleanup pragcgo

Removes dynimport, dynexport, dynlinker cases since they can not
be reached due to prefix check for "go:cgo_" in getlinepragma.

Replaces the if chains for verb distinction by a switch statement.
Replaces fmt.Sprintf by fmt.Sprintln for string concatenation.

Removes the more, getimpsym and getquoted functions by introducing a
pragmaFields function that partitions a pragma into its components.

Adds tests for cgo pragmas.

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

9 years agosrc: split nacltest.bash into naclmake.bash and keep nacltest.bash
Brad Fitzpatrick [Tue, 12 Apr 2016 00:09:05 +0000 (00:09 +0000)]
src: split nacltest.bash into naclmake.bash and keep nacltest.bash

Needed by the build system to shard tests. nacl was the last unsharded
builder.

(I considered also adding a -make-only flag to nacltest.bash, but that
wouldn't fail fast when the file didn't exist.)

Updates #15242

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

9 years agocrypto/tls: Enforce that version and cipher match on resume.
David Benjamin [Mon, 15 Feb 2016 16:51:54 +0000 (11:51 -0500)]
crypto/tls: Enforce that version and cipher match on resume.

Per RFC 5246, 7.4.1.3:

   cipher_suite
      The single cipher suite selected by the server from the list in
      ClientHello.cipher_suites.  For resumed sessions, this field is
      the value from the state of the session being resumed.

The specifications are not very clearly written about resuming sessions
at the wrong version (i.e. is the TLS 1.0 notion of "session" the same
type as the TLS 1.1 notion of "session"?). But every other
implementation enforces this check and not doing so has some odd
semantics.

Change-Id: I6234708bd02b636c25139d83b0d35381167e5cad
Reviewed-on: https://go-review.googlesource.com/21153
Reviewed-by: Adam Langley <agl@golang.org>
9 years agoio: document WriteString calls Write exactly once
Dan Peterson [Tue, 12 Apr 2016 00:47:37 +0000 (21:47 -0300)]
io: document WriteString calls Write exactly once

Fixes #13849

Change-Id: Idd7f06b547a0179fe15571807a8c48b7c3b78d7c
Reviewed-on: https://go-review.googlesource.com/21852
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet: make IP.{String,MarshalText} return helpful information on address error
Mikio Hara [Thu, 7 Apr 2016 08:19:29 +0000 (17:19 +0900)]
net: make IP.{String,MarshalText} return helpful information on address error

This change makes String and MarshalText methods of IP return a
hexadecial form of IP with no punctuation as part of error
notification. It doesn't affect the existing behavior of ParseIP.

Also fixes bad shadowing in ipToSockaddr and makes use of reserved
IP address blocks for documnetation.

Fixes #15052.
Updates #15228.

Change-Id: I9e9ecce308952ed5683066c3d1bb6a7b36458c65
Reviewed-on: https://go-review.googlesource.com/21642
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agogo/importer: make For("gccgo", nil) not panic
Alan Donovan [Mon, 11 Apr 2016 22:39:46 +0000 (18:39 -0400)]
go/importer: make For("gccgo",  nil) not panic

Apparently we forgot to test this.

Fixes #15092

Change-Id: I33d4fef0f659dfbdfc1ebf8401e96610c8215592
Reviewed-on: https://go-review.googlesource.com/21860
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agocontext: attempt to deflake timing tests
Brad Fitzpatrick [Mon, 11 Apr 2016 18:16:55 +0000 (18:16 +0000)]
context: attempt to deflake timing tests

Passes on OpenBSD now when running it with -count=500.

Presumably this will also fix the same problems seen on FreeBSD and
Windows.

Fixes #15158

Change-Id: I86451c901613dfa5ecff0c2ecc516527a3c011b3
Reviewed-on: https://go-review.googlesource.com/21840
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/vet: improve documentation for flags, slightly
Rob Pike [Mon, 4 Apr 2016 20:22:34 +0000 (13:22 -0700)]
cmd/vet: improve documentation for flags, slightly

The way that -all works was unclear from the documentation and made
worse by recent changes to the flag package. Improve matters by making
the help message say "default true" for the tests that do default to true,
and tweak some of the wording.

Before:

Usage of vet:
vet [flags] directory...
vet [flags] files... # Must be a single package
For more information run
go doc cmd/vet

Flags:
  -all
     enable all non-experimental checks (default unset)
  -asmdecl
     check assembly against Go declarations (default unset)
...

After:

Usage of vet:
vet [flags] directory...
vet [flags] files... # Must be a single package
By default, -all is set and all non-experimental checks are run.
For more information run
go doc cmd/vet

Flags:
  -all
     enable all non-experimental checks (default true)
  -asmdecl
     check assembly against Go declarations (default true)
...

Change-Id: Ie94b27381a9ad2382a10a7542a93bce1d59fa8f5
Reviewed-on: https://go-review.googlesource.com/21495
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/compile: avoid write barrier in append fast path
Josh Bleecher Snyder [Sun, 10 Apr 2016 16:44:17 +0000 (09:44 -0700)]
cmd/compile: avoid write barrier in append fast path

When we are writing the result of an append back
to the same slice, we don’t need a write barrier
on the fast path.

This re-implements an optimization that was present
in the old backend.

Updates #14921
Fixes #14969

Sample code:

var x []byte

func p() {
x = append(x, 1, 2, 3)
}

Before:

"".p t=1 size=224 args=0x0 locals=0x48
0x0000 00000 (append.go:21) TEXT "".p(SB), $72-0
0x0000 00000 (append.go:21) MOVQ (TLS), CX
0x0009 00009 (append.go:21) CMPQ SP, 16(CX)
0x000d 00013 (append.go:21) JLS 199
0x0013 00019 (append.go:21) SUBQ $72, SP
0x0017 00023 (append.go:21) FUNCDATA $0, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
0x0017 00023 (append.go:21) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
0x0017 00023 (append.go:19) MOVQ "".x+16(SB), CX
0x001e 00030 (append.go:19) MOVQ "".x(SB), DX
0x0025 00037 (append.go:19) MOVQ "".x+8(SB), BX
0x002c 00044 (append.go:19) MOVQ BX, "".autotmp_0+64(SP)
0x0031 00049 (append.go:22) LEAQ 3(BX), BP
0x0035 00053 (append.go:22) CMPQ BP, CX
0x0038 00056 (append.go:22) JGT $0, 131
0x003a 00058 (append.go:22) MOVB $1, (DX)(BX*1)
0x003e 00062 (append.go:22) MOVB $2, 1(DX)(BX*1)
0x0043 00067 (append.go:22) MOVB $3, 2(DX)(BX*1)
0x0048 00072 (append.go:22) MOVQ BP, "".x+8(SB)
0x004f 00079 (append.go:22) MOVQ CX, "".x+16(SB)
0x0056 00086 (append.go:22) MOVL runtime.writeBarrier(SB), AX
0x005c 00092 (append.go:22) TESTB AL, AL
0x005e 00094 (append.go:22) JNE $0, 108
0x0060 00096 (append.go:22) MOVQ DX, "".x(SB)
0x0067 00103 (append.go:23) ADDQ $72, SP
0x006b 00107 (append.go:23) RET
0x006c 00108 (append.go:22) LEAQ "".x(SB), CX
0x0073 00115 (append.go:22) MOVQ CX, (SP)
0x0077 00119 (append.go:22) MOVQ DX, 8(SP)
0x007c 00124 (append.go:22) PCDATA $0, $0
0x007c 00124 (append.go:22) CALL runtime.writebarrierptr(SB)
0x0081 00129 (append.go:23) JMP 103
0x0083 00131 (append.go:22) LEAQ type.[]uint8(SB), AX
0x008a 00138 (append.go:22) MOVQ AX, (SP)
0x008e 00142 (append.go:22) MOVQ DX, 8(SP)
0x0093 00147 (append.go:22) MOVQ BX, 16(SP)
0x0098 00152 (append.go:22) MOVQ CX, 24(SP)
0x009d 00157 (append.go:22) MOVQ BP, 32(SP)
0x00a2 00162 (append.go:22) PCDATA $0, $0
0x00a2 00162 (append.go:22) CALL runtime.growslice(SB)
0x00a7 00167 (append.go:22) MOVQ 40(SP), DX
0x00ac 00172 (append.go:22) MOVQ 48(SP), AX
0x00b1 00177 (append.go:22) MOVQ 56(SP), CX
0x00b6 00182 (append.go:22) ADDQ $3, AX
0x00ba 00186 (append.go:19) MOVQ "".autotmp_0+64(SP), BX
0x00bf 00191 (append.go:22) MOVQ AX, BP
0x00c2 00194 (append.go:22) JMP 58
0x00c7 00199 (append.go:22) NOP
0x00c7 00199 (append.go:21) CALL runtime.morestack_noctxt(SB)
0x00cc 00204 (append.go:21) JMP 0

After:

"".p t=1 size=208 args=0x0 locals=0x48
0x0000 00000 (append.go:21) TEXT "".p(SB), $72-0
0x0000 00000 (append.go:21) MOVQ (TLS), CX
0x0009 00009 (append.go:21) CMPQ SP, 16(CX)
0x000d 00013 (append.go:21) JLS 191
0x0013 00019 (append.go:21) SUBQ $72, SP
0x0017 00023 (append.go:21) FUNCDATA $0, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
0x0017 00023 (append.go:21) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
0x0017 00023 (append.go:19) MOVQ "".x+16(SB), CX
0x001e 00030 (append.go:19) MOVQ "".x+8(SB), DX
0x0025 00037 (append.go:19) MOVQ DX, "".autotmp_0+64(SP)
0x002a 00042 (append.go:19) MOVQ "".x(SB), BX
0x0031 00049 (append.go:22) LEAQ 3(DX), BP
0x0035 00053 (append.go:22) MOVQ BP, "".x+8(SB)
0x003c 00060 (append.go:22) CMPQ BP, CX
0x003f 00063 (append.go:22) JGT $0, 84
0x0041 00065 (append.go:22) MOVB $1, (BX)(DX*1)
0x0045 00069 (append.go:22) MOVB $2, 1(BX)(DX*1)
0x004a 00074 (append.go:22) MOVB $3, 2(BX)(DX*1)
0x004f 00079 (append.go:23) ADDQ $72, SP
0x0053 00083 (append.go:23) RET
0x0054 00084 (append.go:22) LEAQ type.[]uint8(SB), AX
0x005b 00091 (append.go:22) MOVQ AX, (SP)
0x005f 00095 (append.go:22) MOVQ BX, 8(SP)
0x0064 00100 (append.go:22) MOVQ DX, 16(SP)
0x0069 00105 (append.go:22) MOVQ CX, 24(SP)
0x006e 00110 (append.go:22) MOVQ BP, 32(SP)
0x0073 00115 (append.go:22) PCDATA $0, $0
0x0073 00115 (append.go:22) CALL runtime.growslice(SB)
0x0078 00120 (append.go:22) MOVQ 40(SP), CX
0x007d 00125 (append.go:22) MOVQ 56(SP), AX
0x0082 00130 (append.go:22) MOVQ AX, "".x+16(SB)
0x0089 00137 (append.go:22) MOVL runtime.writeBarrier(SB), AX
0x008f 00143 (append.go:22) TESTB AL, AL
0x0091 00145 (append.go:22) JNE $0, 168
0x0093 00147 (append.go:22) MOVQ CX, "".x(SB)
0x009a 00154 (append.go:22) MOVQ "".x(SB), BX
0x00a1 00161 (append.go:19) MOVQ "".autotmp_0+64(SP), DX
0x00a6 00166 (append.go:22) JMP 65
0x00a8 00168 (append.go:22) LEAQ "".x(SB), DX
0x00af 00175 (append.go:22) MOVQ DX, (SP)
0x00b3 00179 (append.go:22) MOVQ CX, 8(SP)
0x00b8 00184 (append.go:22) PCDATA $0, $0
0x00b8 00184 (append.go:22) CALL runtime.writebarrierptr(SB)
0x00bd 00189 (append.go:22) JMP 154
0x00bf 00191 (append.go:22) NOP
0x00bf 00191 (append.go:21) CALL runtime.morestack_noctxt(SB)
0x00c4 00196 (append.go:21) JMP 0

Change-Id: I77a41ad3a22557a4bb4654de7d6d24a029efe34a
Reviewed-on: https://go-review.googlesource.com/21813
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
9 years agocmd/compile: added stats printing to stackalloc
David Chase [Fri, 1 Apr 2016 18:51:29 +0000 (14:51 -0400)]
cmd/compile: added stats printing to stackalloc

This is controlled by the "regalloc" stats flag, since regalloc
calls stackalloc.  The plan is for this to allow comparison
of cheaper stack allocation algorithms with what we have now.

Change-Id: Ibf64a780344c69babfcbb328fd6d053ea2e02cfc
Reviewed-on: https://go-review.googlesource.com/21393
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
9 years agocmd/compile: zero all three argstorage slots
Keith Randall [Mon, 11 Apr 2016 20:17:52 +0000 (13:17 -0700)]
cmd/compile: zero all three argstorage slots

These changes were missed when going from 2 to 3 argstorage slots.
https://go-review.googlesource.com/20296/

Change-Id: I930a307bb0b695bf1ae088030c9bbb6d14ca31d2
Reviewed-on: https://go-review.googlesource.com/21841
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agocmd/compile: fix -N build
Keith Randall [Mon, 11 Apr 2016 19:22:26 +0000 (12:22 -0700)]
cmd/compile: fix -N build

The decomposer of builtin types is confused by having structs
still around from the user-type decomposer.  They're all dead though,
so just enabling a deadcode pass fixes things.

Change-Id: I2df6bc7e829be03eabfd24c8dda1bff96f3d7091
Reviewed-on: https://go-review.googlesource.com/21839
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
9 years agoimage/color: add YCbCrToRGB benchmark
Josh Bleecher Snyder [Mon, 11 Apr 2016 18:54:07 +0000 (11:54 -0700)]
image/color: add YCbCrToRGB benchmark

Change-Id: I9ba76d5b0861a901415fdceccaf2f5caa2facb7f
Reviewed-on: https://go-review.googlesource.com/21837
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/internal/obj/s390x: add MULHD instruction
Michael Munday [Mon, 11 Apr 2016 00:01:49 +0000 (20:01 -0400)]
cmd/internal/obj/s390x: add MULHD instruction

Emulate 64-bit signed high multiplication ((a*b)>>64). To do this
we use the 64-bit unsigned high multiplication method and then
fix the result as shown in Hacker's Delight 2nd ed., chapter 8-3.

Required to enable some division optimizations.

Change-Id: I9194f428e09d3d029cb1afb4715cd5424b5d922e
Reviewed-on: https://go-review.googlesource.com/21774
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: add ServerContextKey to let a handler access its Server
Brad Fitzpatrick [Mon, 11 Apr 2016 05:12:43 +0000 (05:12 +0000)]
net/http: add ServerContextKey to let a handler access its Server

Fixes #12438
Updates #15229 (to decide context key variable naming convention)

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

9 years agocmd/link: external linking can fail on Solaris 11.2+
Shawn Walker-Salas [Thu, 7 Apr 2016 22:26:57 +0000 (15:26 -0700)]
cmd/link: external linking can fail on Solaris 11.2+

Workaround external linking issues encountered on Solaris 11.2+ due to
the go.o object file being created with a NULL STT_FILE symtab entry by
using a placeholder name.

Fixes #14957

Change-Id: I89c501b4c548469f3c878151947d35588057982b
Reviewed-on: https://go-review.googlesource.com/21636
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agointernal/trace: support parsing of 1.5 traces
Dmitry Vyukov [Mon, 11 Apr 2016 06:57:52 +0000 (08:57 +0200)]
internal/trace: support parsing of 1.5 traces

1. Parse out version from trace header.
2. Restore handling of 1.5 traces.
3. Restore optional symbolization of traces.
4. Add some canned 1.5 traces for regression testing
   (http benchmark trace, runtime/trace stress traces,
    plus one with broken timestamps).

Change-Id: Idb18a001d03ded8e13c2730eeeb37c5836e31256
Reviewed-on: https://go-review.googlesource.com/21803
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/compile: fix naming of decomposed structs
Keith Randall [Fri, 1 Apr 2016 04:24:10 +0000 (21:24 -0700)]
cmd/compile: fix naming of decomposed structs

When a struct is SSAable, we will name its component parts
by their field names.  For example,
type T struct {
     a, b, c int
}
If we ever need to spill a variable x of type T, we will
spill its individual components to variables named x.a, x.b,
and x.c.

Change-Id: I857286ff1f2597f2c4bbd7b4c0b936386fb37131
Reviewed-on: https://go-review.googlesource.com/21389
Reviewed-by: David Chase <drchase@google.com>
9 years agocmd/compile: bce when max and limit are consts
Alexandru Moșoi [Fri, 1 Apr 2016 13:09:19 +0000 (15:09 +0200)]
cmd/compile: bce when max and limit are consts

Removes 49 more bound checks in make.bash. For example:

var a[100]int
for i := 0; i < 50; i++ {
  use a[i+25]
}

Change-Id: I85e0130ee5d07f0ece9b17044bba1a2047414ce7
Reviewed-on: https://go-review.googlesource.com/21379
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet/http: document Error does not end the request
Dan Peterson [Mon, 11 Apr 2016 14:15:00 +0000 (11:15 -0300)]
net/http: document Error does not end the request

Fixes #15205

Change-Id: Ia650806756758ca8ed2272b1696e59b809b16c61
Reviewed-on: https://go-review.googlesource.com/21836
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoall: use bytes.Equal, bytes.Contains and strings.Contains, again
Dominik Honnef [Fri, 1 Apr 2016 05:34:18 +0000 (07:34 +0200)]
all: use bytes.Equal, bytes.Contains and strings.Contains, again

The previous cleanup was done with a buggy tool, missing some potential
rewrites.

Change-Id: I333467036e355f999a6a493e8de87e084f374e26
Reviewed-on: https://go-review.googlesource.com/21378
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/link: symbol generation optimizations
Shahar Kohanim [Thu, 7 Apr 2016 15:00:57 +0000 (18:00 +0300)]
cmd/link: symbol generation optimizations

After making dwarf generation backed by LSyms there was a performance regression
of about 10%. These changes make on the fly symbol generation faster and
are meant to help mitigate that.

name       old secs    new secs    delta
LinkCmdGo   0.55 ± 9%   0.53 ± 8%  -4.42%   (p=0.000 n=100+99)

name       old MaxRSS  new MaxRSS  delta
LinkCmdGo   152k ± 6%   149k ± 3%  -1.99%    (p=0.000 n=99+97)

Change-Id: Iacca3ec924ce401aa83126bc0b10fe89bedf0ba6
Reviewed-on: https://go-review.googlesource.com/21733
Run-TryBot: Shahar Kohanim <skohanim@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agonet/http/pprof: accept fractional seconds in trace handler
Russ Cox [Sun, 3 Apr 2016 16:52:12 +0000 (12:52 -0400)]
net/http/pprof: accept fractional seconds in trace handler

For heavily loaded servers, even 1 second of trace is too large
to process with the trace viewer; using a float64 here allows
fetching /debug/pprof/trace?seconds=0.1.

Change-Id: I286c07abf04f9c1fe594b0e26799bf37f5c734db
Reviewed-on: https://go-review.googlesource.com/21455
Reviewed-by: Austin Clements <austin@google.com>
9 years agoruntime: merge lfstack_amd64.go into lfstack_64bit.go
Dave Cheney [Fri, 8 Apr 2016 07:50:40 +0000 (17:50 +1000)]
runtime: merge lfstack_amd64.go into lfstack_64bit.go

Merge the amd64 lfstack implementation into the general 64 bit
implementation.

Change-Id: Id9ed61b90d2e3bc3b0246294c03eb2c92803b6ca
Reviewed-on: https://go-review.googlesource.com/21707
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/go: document that -run=^$ skips all tests
Andrew Gerrand [Mon, 11 Apr 2016 01:04:15 +0000 (11:04 +1000)]
cmd/go: document that -run=^$ skips all tests

Change-Id: I7bbdd9600e0d9a647aeea16f1ae9e42a4e0cf44d
Reviewed-on: https://go-review.googlesource.com/21823
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile/internal/gc: refactor cgen_div
Michael Munday [Mon, 11 Apr 2016 01:58:37 +0000 (21:58 -0400)]
cmd/compile/internal/gc: refactor cgen_div

This commit adds two new functions to cgen.go: hasHMUL64 and
hasRROTC64. These are used to determine whether or not an
architecture supports the instructions needed to perform an
optimization in cgen_div.

This commit should not affect existing architectures (although it
does add s390x to the new functions). However, since most
architectures support HMUL the hasHMUL64 function could be
modified to enable most of the optimizations in cgen_div on those
platforms.

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

9 years agodoc: document Go 1.6.1 and Go 1.5.4
Andrew Gerrand [Mon, 11 Apr 2016 04:54:54 +0000 (14:54 +1000)]
doc: document Go 1.6.1 and Go 1.5.4

Change-Id: Icb9e947a43fb87fbfe0655b09e0d7e8f61825aeb
Reviewed-on: https://go-review.googlesource.com/21825
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: remove remaining references to TheChar
Jeremy Jackins [Thu, 7 Apr 2016 06:42:35 +0000 (15:42 +0900)]
runtime: remove remaining references to TheChar

After mdempsky's recent changes, these are the only references to
"TheChar" left in the Go tree. Without the context, and without
knowing the history, this is confusing.

Also rename sys.TheGoos and sys.TheGoarch to sys.GOOS
and sys.GOARCH.

Also change the heap dump format to include sys.GOARCH
rather than TheChar, which is no longer a concept.

Updates #15169 (changes heapdump format)

Change-Id: I3e99eeeae00ed55d7d01e6ed503d958c6e931dca
Reviewed-on: https://go-review.googlesource.com/21647
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agonet/http: set the Request context for incoming server requests
Brad Fitzpatrick [Wed, 6 Apr 2016 19:31:55 +0000 (12:31 -0700)]
net/http: set the Request context for incoming server requests

Updates #13021
Updates #15224

Change-Id: Ia3cd608bb887fcfd8d81b035fa57bd5eb8edf09b
Reviewed-on: https://go-review.googlesource.com/21810
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocontext: document that WithValue's key must be comparable
Brad Fitzpatrick [Sun, 10 Apr 2016 15:45:34 +0000 (15:45 +0000)]
context: document that WithValue's key must be comparable

Also, check it and explode earlier, rather than cryptic failures later.

Change-Id: I319a425f60e2bc9d005a187fbdbd153faa96411c
Reviewed-on: https://go-review.googlesource.com/21799
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/vet: refresh command for updating whitelist data.
David Symonds [Mon, 11 Apr 2016 00:26:38 +0000 (10:26 +1000)]
cmd/vet: refresh command for updating whitelist data.

This excludes internal and testdata packages, as well as func types.

No new whitelist entries were found.

Change-Id: Ie7d42ce0a235394e4bcabf09e155726a35cd2d3d
Reviewed-on: https://go-review.googlesource.com/21822
Reviewed-by: Rob Pike <r@golang.org>
9 years agoruntime: speed up makeslice by avoiding divisions
Martin Möhrmann [Sun, 10 Apr 2016 15:32:35 +0000 (17:32 +0200)]
runtime: speed up makeslice by avoiding divisions

Only compute the number of maximum allowed elements per slice once.

name         old time/op  new time/op  delta
MakeSlice-2  55.5ns ± 1%  45.6ns ± 2%  -17.88%  (p=0.000 n=99+100)

Change-Id: I951feffda5d11910a75e55d7e978d306d14da2c5
Reviewed-on: https://go-review.googlesource.com/21801
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: remove special case that puts godoc in $GOROOT/bin
Andrew Gerrand [Fri, 8 Apr 2016 04:43:35 +0000 (14:43 +1000)]
cmd/go: remove special case that puts godoc in $GOROOT/bin

Updates golang/go#15106

Change-Id: I4214b841d63bb7e9c3c5ede2abe21a8a68f06c41
Reviewed-on: https://go-review.googlesource.com/21701
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agotext/template: emit field error over nil pointer error where appropriate
Andrew Gerrand [Fri, 8 Apr 2016 05:39:32 +0000 (15:39 +1000)]
text/template: emit field error over nil pointer error where appropriate

When evaluating "{{.MissingField}}" on a nil *T, Exec returns
"can't evaluate field MissingField in type *T" instead of
"nil pointer evaluating *T.MissingField".

Fixes golang/go#15125

Change-Id: I6e73f61b8a72c694179c1f8cdc808766c90b6f57
Reviewed-on: https://go-review.googlesource.com/21705
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile: regalloc enforces 2-address instructions
Keith Randall [Sun, 10 Apr 2016 15:26:43 +0000 (08:26 -0700)]
cmd/compile: regalloc enforces 2-address instructions

Instead of being a hint, resultInArg0 is now enforced by regalloc.
This allows us to delete all the code from amd64/ssa.go which
deals with converting from a semantically three-address instruction
into some copies plus a two-address instruction.

Change-Id: Id4f39a80be4b678718bfd42a229f9094ab6ecd7c
Reviewed-on: https://go-review.googlesource.com/21816
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agocmd/compile: avoid a spill in append fast path
Josh Bleecher Snyder [Sun, 10 Apr 2016 16:08:00 +0000 (09:08 -0700)]
cmd/compile: avoid a spill in append fast path

Instead of spilling newlen, recalculate it.
This removes a spill from the fast path,
at the cost of a cheap recalculation
on the (rare) growth path.
This uses 8 bytes less of stack space.
It generates two more bytes of code,
but that is due to suboptimal register allocation;
see far below.

Runtime append microbenchmarks are all over the map,
presumably due to incidental code movement.

Sample code:

func s(b []byte) []byte {
b = append(b, 1, 2, 3)
return b
}

Before:

"".s t=1 size=160 args=0x30 locals=0x48
0x0000 00000 (append.go:8) TEXT "".s(SB), $72-48
0x0000 00000 (append.go:8) MOVQ (TLS), CX
0x0009 00009 (append.go:8) CMPQ SP, 16(CX)
0x000d 00013 (append.go:8) JLS 149
0x0013 00019 (append.go:8) SUBQ $72, SP
0x0017 00023 (append.go:8) FUNCDATA $0, gclocals·6432f8c6a0d23fa7bee6c5d96f21a92a(SB)
0x0017 00023 (append.go:8) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
0x0017 00023 (append.go:9) MOVQ "".b+88(FP), CX
0x001c 00028 (append.go:9) LEAQ 3(CX), DX
0x0020 00032 (append.go:9) MOVQ DX, "".autotmp_0+64(SP)
0x0025 00037 (append.go:9) MOVQ "".b+96(FP), BX
0x002a 00042 (append.go:9) CMPQ DX, BX
0x002d 00045 (append.go:9) JGT $0, 86
0x002f 00047 (append.go:8) MOVQ "".b+80(FP), AX
0x0034 00052 (append.go:9) MOVB $1, (AX)(CX*1)
0x0038 00056 (append.go:9) MOVB $2, 1(AX)(CX*1)
0x003d 00061 (append.go:9) MOVB $3, 2(AX)(CX*1)
0x0042 00066 (append.go:10) MOVQ AX, "".~r1+104(FP)
0x0047 00071 (append.go:10) MOVQ DX, "".~r1+112(FP)
0x004c 00076 (append.go:10) MOVQ BX, "".~r1+120(FP)
0x0051 00081 (append.go:10) ADDQ $72, SP
0x0055 00085 (append.go:10) RET
0x0056 00086 (append.go:9) LEAQ type.[]uint8(SB), AX
0x005d 00093 (append.go:9) MOVQ AX, (SP)
0x0061 00097 (append.go:9) MOVQ "".b+80(FP), BP
0x0066 00102 (append.go:9) MOVQ BP, 8(SP)
0x006b 00107 (append.go:9) MOVQ CX, 16(SP)
0x0070 00112 (append.go:9) MOVQ BX, 24(SP)
0x0075 00117 (append.go:9) MOVQ DX, 32(SP)
0x007a 00122 (append.go:9) PCDATA $0, $0
0x007a 00122 (append.go:9) CALL runtime.growslice(SB)
0x007f 00127 (append.go:9) MOVQ 40(SP), AX
0x0084 00132 (append.go:9) MOVQ 56(SP), BX
0x0089 00137 (append.go:8) MOVQ "".b+88(FP), CX
0x008e 00142 (append.go:9) MOVQ "".autotmp_0+64(SP), DX
0x0093 00147 (append.go:9) JMP 52
0x0095 00149 (append.go:9) NOP
0x0095 00149 (append.go:8) CALL runtime.morestack_noctxt(SB)
0x009a 00154 (append.go:8) JMP 0

After:

"".s t=1 size=176 args=0x30 locals=0x40
0x0000 00000 (append.go:8) TEXT "".s(SB), $64-48
0x0000 00000 (append.go:8) MOVQ (TLS), CX
0x0009 00009 (append.go:8) CMPQ SP, 16(CX)
0x000d 00013 (append.go:8) JLS 151
0x0013 00019 (append.go:8) SUBQ $64, SP
0x0017 00023 (append.go:8) FUNCDATA $0, gclocals·6432f8c6a0d23fa7bee6c5d96f21a92a(SB)
0x0017 00023 (append.go:8) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
0x0017 00023 (append.go:9) MOVQ "".b+80(FP), CX
0x001c 00028 (append.go:9) LEAQ 3(CX), DX
0x0020 00032 (append.go:9) MOVQ "".b+88(FP), BX
0x0025 00037 (append.go:9) CMPQ DX, BX
0x0028 00040 (append.go:9) JGT $0, 81
0x002a 00042 (append.go:8) MOVQ "".b+72(FP), AX
0x002f 00047 (append.go:9) MOVB $1, (AX)(CX*1)
0x0033 00051 (append.go:9) MOVB $2, 1(AX)(CX*1)
0x0038 00056 (append.go:9) MOVB $3, 2(AX)(CX*1)
0x003d 00061 (append.go:10) MOVQ AX, "".~r1+96(FP)
0x0042 00066 (append.go:10) MOVQ DX, "".~r1+104(FP)
0x0047 00071 (append.go:10) MOVQ BX, "".~r1+112(FP)
0x004c 00076 (append.go:10) ADDQ $64, SP
0x0050 00080 (append.go:10) RET
0x0051 00081 (append.go:9) LEAQ type.[]uint8(SB), AX
0x0058 00088 (append.go:9) MOVQ AX, (SP)
0x005c 00092 (append.go:9) MOVQ "".b+72(FP), BP
0x0061 00097 (append.go:9) MOVQ BP, 8(SP)
0x0066 00102 (append.go:9) MOVQ CX, 16(SP)
0x006b 00107 (append.go:9) MOVQ BX, 24(SP)
0x0070 00112 (append.go:9) MOVQ DX, 32(SP)
0x0075 00117 (append.go:9) PCDATA $0, $0
0x0075 00117 (append.go:9) CALL runtime.growslice(SB)
0x007a 00122 (append.go:9) MOVQ 40(SP), AX
0x007f 00127 (append.go:9) MOVQ 48(SP), CX
0x0084 00132 (append.go:9) MOVQ 56(SP), BX
0x0089 00137 (append.go:9) ADDQ $3, CX
0x008d 00141 (append.go:9) MOVQ CX, DX
0x0090 00144 (append.go:8) MOVQ "".b+80(FP), CX
0x0095 00149 (append.go:9) JMP 47
0x0097 00151 (append.go:9) NOP
0x0097 00151 (append.go:8) CALL runtime.morestack_noctxt(SB)
0x009c 00156 (append.go:8) JMP 0

Observe that in the following sequence,
we should use DX directly instead of using
CX as a temporary register, which would make
the new code a strict improvement on the old:

0x007f 00127 (append.go:9) MOVQ 48(SP), CX
0x0084 00132 (append.go:9) MOVQ 56(SP), BX
0x0089 00137 (append.go:9) ADDQ $3, CX
0x008d 00141 (append.go:9) MOVQ CX, DX
0x0090 00144 (append.go:8) MOVQ "".b+80(FP), CX

Change-Id: I4ee50b18fa53865901d2d7f86c2cbb54c6fa6924
Reviewed-on: https://go-review.googlesource.com/21812
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
9 years agoruntime: avoid unnecessary map iteration write barrier
Josh Bleecher Snyder [Sun, 10 Apr 2016 17:43:04 +0000 (10:43 -0700)]
runtime: avoid unnecessary map iteration write barrier

Update #14921

Change-Id: I5c5816d0193757bf7465b1e09c27ca06897df4bf
Reviewed-on: https://go-review.googlesource.com/21814
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
9 years agohtml: fix typo in UnescapeString string docs
Brad Fitzpatrick [Sun, 10 Apr 2016 14:51:07 +0000 (14:51 +0000)]
html: fix typo in UnescapeString string docs

Fixes #15221

Change-Id: I9e927a2f604213338b4572f1a32d0247c58bdc60
Reviewed-on: https://go-review.googlesource.com/21798
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocompress/flate: improve short writer error test
Klaus Post [Sun, 10 Apr 2016 15:16:07 +0000 (17:16 +0200)]
compress/flate: improve short writer error test

This improves the short version of the writer test.

First of all, it has a much quicker setup. Previously that
could take up towards 0.5 second.

Secondly, it will test all compression levels in short mode as well.

Execution time is 1.7s/0.03s for normal/short mode.

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

9 years agocompress/flate: eliminate most common bounds checks
Klaus Post [Sun, 10 Apr 2016 11:43:24 +0000 (13:43 +0200)]
compress/flate: eliminate most common bounds checks

This uses the SSA compiler to eliminate various unneeded bounds
checks in loops and various lookups.

This fixes the low hanging fruit, without any major code changes.

name                       old time/op    new time/op    delta
EncodeDigitsHuffman1e4-8     49.9µs ± 1%    48.1µs ± 1%  -3.74%   (p=0.000 n=10+9)
EncodeDigitsHuffman1e5-8      476µs ± 1%     458µs ± 1%  -3.58%  (p=0.000 n=10+10)
EncodeDigitsHuffman1e6-8     4.80ms ± 2%    4.56ms ± 1%  -5.07%   (p=0.000 n=10+9)
EncodeDigitsSpeed1e4-8        305µs ± 3%     290µs ± 2%  -5.03%   (p=0.000 n=10+9)
EncodeDigitsSpeed1e5-8       3.67ms ± 2%    3.49ms ± 2%  -4.78%   (p=0.000 n=9+10)
EncodeDigitsSpeed1e6-8       38.3ms ± 2%    35.8ms ± 1%  -6.58%   (p=0.000 n=9+10)
EncodeDigitsDefault1e4-8      361µs ± 2%     346µs ± 3%  -4.12%   (p=0.000 n=10+9)
EncodeDigitsDefault1e5-8     5.24ms ± 2%    4.96ms ± 3%  -5.38%  (p=0.000 n=10+10)
EncodeDigitsDefault1e6-8     56.5ms ± 3%    52.2ms ± 2%  -7.68%  (p=0.000 n=10+10)
EncodeDigitsCompress1e4-8     362µs ± 2%     343µs ± 1%  -5.20%   (p=0.000 n=10+9)
EncodeDigitsCompress1e5-8    5.26ms ± 3%    4.98ms ± 2%  -5.48%  (p=0.000 n=10+10)
EncodeDigitsCompress1e6-8    56.0ms ± 4%    52.1ms ± 1%  -7.01%  (p=0.000 n=10+10)
EncodeTwainHuffman1e4-8      70.9µs ± 3%    64.7µs ± 1%  -8.68%   (p=0.000 n=10+9)
EncodeTwainHuffman1e5-8       556µs ± 2%     524µs ± 2%  -5.84%  (p=0.000 n=10+10)
EncodeTwainHuffman1e6-8      5.54ms ± 3%    5.22ms ± 2%  -5.70%  (p=0.000 n=10+10)
EncodeTwainSpeed1e4-8         294µs ± 3%     284µs ± 1%  -3.71%  (p=0.000 n=10+10)
EncodeTwainSpeed1e5-8        2.59ms ± 2%    2.48ms ± 1%  -4.14%   (p=0.000 n=10+9)
EncodeTwainSpeed1e6-8        25.6ms ± 1%    24.3ms ± 1%  -5.28%   (p=0.000 n=9+10)
EncodeTwainDefault1e4-8       419µs ± 2%     396µs ± 1%  -5.59%   (p=0.000 n=10+9)
EncodeTwainDefault1e5-8      6.23ms ± 4%    5.75ms ± 1%  -7.83%   (p=0.000 n=10+9)
EncodeTwainDefault1e6-8      66.2ms ± 2%    61.4ms ± 1%  -7.22%  (p=0.000 n=10+10)
EncodeTwainCompress1e4-8      426µs ± 1%     405µs ± 1%  -4.97%   (p=0.000 n=9+10)
EncodeTwainCompress1e5-8     6.80ms ± 1%    6.32ms ± 1%  -6.97%   (p=0.000 n=9+10)
EncodeTwainCompress1e6-8     74.6ms ± 3%    68.7ms ± 1%  -7.90%   (p=0.000 n=10+9)

name                       old speed      new speed      delta
EncodeDigitsHuffman1e4-8    200MB/s ± 1%   208MB/s ± 1%  +3.88%   (p=0.000 n=10+9)
EncodeDigitsHuffman1e5-8    210MB/s ± 1%   218MB/s ± 1%  +3.71%  (p=0.000 n=10+10)
EncodeDigitsHuffman1e6-8    208MB/s ± 2%   219MB/s ± 1%  +5.32%   (p=0.000 n=10+9)
EncodeDigitsSpeed1e4-8     32.8MB/s ± 3%  34.5MB/s ± 2%  +5.29%   (p=0.000 n=10+9)
EncodeDigitsSpeed1e5-8     27.2MB/s ± 2%  28.6MB/s ± 2%  +5.29%  (p=0.000 n=10+10)
EncodeDigitsSpeed1e6-8     26.1MB/s ± 2%  27.9MB/s ± 1%  +7.02%   (p=0.000 n=9+10)
EncodeDigitsDefault1e4-8   27.7MB/s ± 2%  28.9MB/s ± 3%  +4.30%   (p=0.000 n=10+9)
EncodeDigitsDefault1e5-8   19.1MB/s ± 2%  20.2MB/s ± 3%  +5.69%  (p=0.000 n=10+10)
EncodeDigitsDefault1e6-8   17.7MB/s ± 3%  19.2MB/s ± 2%  +8.31%  (p=0.000 n=10+10)
EncodeDigitsCompress1e4-8  27.6MB/s ± 2%  29.1MB/s ± 1%  +5.47%   (p=0.000 n=10+9)
EncodeDigitsCompress1e5-8  19.0MB/s ± 3%  20.1MB/s ± 2%  +5.78%  (p=0.000 n=10+10)
EncodeDigitsCompress1e6-8  17.9MB/s ± 4%  19.2MB/s ± 1%  +7.50%  (p=0.000 n=10+10)
EncodeTwainHuffman1e4-8     141MB/s ± 3%   154MB/s ± 1%  +9.46%   (p=0.000 n=10+9)
EncodeTwainHuffman1e5-8     180MB/s ± 2%   191MB/s ± 2%  +6.19%  (p=0.000 n=10+10)
EncodeTwainHuffman1e6-8     181MB/s ± 3%   192MB/s ± 2%  +6.02%  (p=0.000 n=10+10)
EncodeTwainSpeed1e4-8      34.0MB/s ± 3%  35.3MB/s ± 1%  +3.84%  (p=0.000 n=10+10)
EncodeTwainSpeed1e5-8      38.7MB/s ± 2%  40.3MB/s ± 1%  +4.30%   (p=0.000 n=10+9)
EncodeTwainSpeed1e6-8      39.1MB/s ± 1%  41.2MB/s ± 1%  +5.57%   (p=0.000 n=9+10)
EncodeTwainDefault1e4-8    23.9MB/s ± 2%  25.3MB/s ± 1%  +5.91%   (p=0.000 n=10+9)
EncodeTwainDefault1e5-8    16.0MB/s ± 4%  17.4MB/s ± 1%  +8.47%   (p=0.000 n=10+9)
EncodeTwainDefault1e6-8    15.1MB/s ± 2%  16.3MB/s ± 1%  +7.76%  (p=0.000 n=10+10)
EncodeTwainCompress1e4-8   23.5MB/s ± 1%  24.7MB/s ± 1%  +5.24%   (p=0.000 n=9+10)
EncodeTwainCompress1e5-8   14.7MB/s ± 1%  15.8MB/s ± 1%  +7.50%   (p=0.000 n=9+10)
EncodeTwainCompress1e6-8   13.4MB/s ± 3%  14.6MB/s ± 1%  +8.57%   (p=0.000 n=10+9)

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

9 years agoall: replace magic 0x80 with named constant utf8.RuneSelf
Martin Möhrmann [Sun, 10 Apr 2016 06:48:55 +0000 (08:48 +0200)]
all: replace magic 0x80 with named constant utf8.RuneSelf

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

9 years agointernal/trace: fix a typo in error message
Dmitry Vyukov [Sun, 10 Apr 2016 10:49:40 +0000 (12:49 +0200)]
internal/trace: fix a typo in error message

Change-Id: Id79eaa6d49dae80c334c7243b0a5bbcdcb9397d3
Reviewed-on: https://go-review.googlesource.com/21758
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
9 years agocmd: remove bio.Bread
Marvin Stenger [Fri, 8 Apr 2016 16:19:10 +0000 (18:19 +0200)]
cmd: remove bio.Bread

Replace calls to bio.Bread with calls to io.ReadFull.

Change-Id: I2ee8739d01e04a4da9c20b6ce7d1d5b89914b8ad
Reviewed-on: https://go-review.googlesource.com/21750
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agoruntime: make execution error panic values implement the Error interface
Emmanuel Odeke [Mon, 28 Mar 2016 00:29:53 +0000 (17:29 -0700)]
runtime: make execution error panic values implement the Error interface

Make execution panics implement Error as
mandated by https://golang.org/ref/spec#Run_time_panics,
instead of panics with strings.

Fixes #14965

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

9 years agocmd/go: fix typo in findInternal documentation
Wisdom Omuya [Sat, 9 Apr 2016 23:23:01 +0000 (19:23 -0400)]
cmd/go: fix typo in findInternal documentation

Fixes #15217

Change-Id: Ib8f7af714197fd209e743f61f28a5b07c04a7f5c
Reviewed-on: https://go-review.googlesource.com/21793
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http/httputil: DumpRequest dumps Content-Length if set in header
Emmanuel Odeke [Sat, 9 Apr 2016 07:34:18 +0000 (00:34 -0700)]
net/http/httputil: DumpRequest dumps Content-Length if set in header

Fixes #7215

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

9 years agocmd/go: fix typo in comment
Brad Fitzpatrick [Sat, 9 Apr 2016 22:54:26 +0000 (22:54 +0000)]
cmd/go: fix typo in comment

Thanks to deafgoat.

Fixes #15215

Change-Id: I9fababc7ecd201ce86020a438e4faee95e7623a8
Reviewed-on: https://go-review.googlesource.com/21792
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: revert "do not call timeBeginPeriod on windows"
Dmitry Vyukov [Fri, 18 Mar 2016 09:56:23 +0000 (10:56 +0100)]
runtime: revert "do not call timeBeginPeriod on windows"

This reverts commit ab4c9298b8185a056ff1152f2c7bd9b38d3d06f3.

Sysmon critically depends on system timer resolution for retaking
of Ps blocked in system calls. See #14790 for an example
of a program where execution time goes from 2ms to 30ms if
timeBeginPeriod(1) is not used.

We can remove timeBeginPeriod(1) when we support UMS (#7876).

Update #14790

Change-Id: I362b56154359b2c52d47f9f2468fe012b481cf6d
Reviewed-on: https://go-review.googlesource.com/20834
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
9 years agocmd/internal/bio: move Bgetc to link/internal/ld
Dave Cheney [Fri, 8 Apr 2016 10:44:56 +0000 (20:44 +1000)]
cmd/internal/bio: move Bgetc to link/internal/ld

Also, remove bio.Brdline.

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

9 years agocmd: remove unused code
Dave Cheney [Sat, 9 Apr 2016 05:04:45 +0000 (15:04 +1000)]
cmd: remove unused code

Generated with honnef.co/go/unused

There is a large amount of unused code in cmd/internal/obj/s390x but
that can wait til the s390x port is merged.

There is some unused code in
cmd/internal/unvendor/golang.org/x/arch/arm/armasm but that should be
addressed upstream and a new revision imported.

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

9 years agocmd/internal/bio: embed bufio.{Reader,Writer} in bio.{Reader,Writer}
Dave Cheney [Fri, 8 Apr 2016 10:37:54 +0000 (20:37 +1000)]
cmd/internal/bio: embed bufio.{Reader,Writer} in bio.{Reader,Writer}

Change-Id: Ie95b0b0d4f724f4769cf2d4f8063cb5019fa9bc9
Reviewed-on: https://go-review.googlesource.com/21781
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd: remove bio.BufReader and bio.BufWriter
Dave Cheney [Fri, 8 Apr 2016 09:30:41 +0000 (19:30 +1000)]
cmd: remove bio.BufReader and bio.BufWriter

bio.BufReader was never used.

bio.BufWriter was used to wrap an existing io.Writer, but the
bio.Writer returned would not be seekable, so replace all occurences
with bufio.Reader instead.

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

9 years agocmd/link/internal: make ld.Bso a *bio.Writer
Dave Cheney [Sat, 9 Apr 2016 02:54:45 +0000 (12:54 +1000)]
cmd/link/internal: make ld.Bso a *bio.Writer

This is a pre requesite of CL 21722 and removes a lot of unidiomatic
boilerplate in the linker.

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

9 years agocmd/cgo: fix cgo with gccgo
Michael Hudson-Doyle [Fri, 8 Apr 2016 02:27:35 +0000 (14:27 +1200)]
cmd/cgo: fix cgo with gccgo

Change-Id: I1780899255e22c16d7f8e9947609a1c284d7c42e
Reviewed-on: https://go-review.googlesource.com/21690
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: insert instrumentation more carefully in racewalk
David Chase [Fri, 8 Apr 2016 17:33:43 +0000 (13:33 -0400)]
cmd/compile: insert instrumentation more carefully in racewalk

Be more careful about inserting instrumentation in racewalk.
If the node being instrumented is an OAS, and it has a non-
empty Ninit, then append instrumentation to the Ninit list
rather than letting it be inserted before the OAS (and the
compilation of its init list).  This deals with the case that
the Ninit list defines a variable used in the RHS of the OAS.

Fixes #15091.

Change-Id: Iac91696d9104d07f0bf1bd3499bbf56b2e1ef073
Reviewed-on: https://go-review.googlesource.com/21771
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: David Chase <drchase@google.com>

9 years agoruntime: emit file:line info into traces
Dmitry Vyukov [Fri, 8 Apr 2016 13:14:37 +0000 (15:14 +0200)]
runtime: emit file:line info into traces

This makes traces self-contained and simplifies trace workflow
in modern cloud environments where it is simpler to reach
a service via HTTP than to obtain the binary.

Change-Id: I6ff3ca694dc698270f1e29da37d5efaf4e843a0d
Reviewed-on: https://go-review.googlesource.com/21732
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
9 years agocmd/cgo: increase s390x int type size to 8 bytes
Michael Munday [Fri, 8 Apr 2016 17:02:49 +0000 (13:02 -0400)]
cmd/cgo: increase s390x int type size to 8 bytes

The size of the int type in Go on s390x is 8 bytes, not 4.

Change-Id: I1a71ce8c9925f3499abb61c1aa4f6fa2d2ec0d7e
Reviewed-on: https://go-review.googlesource.com/21760
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agobytes: add ContainsRune
Emmanuel Odeke [Fri, 8 Apr 2016 06:22:30 +0000 (23:22 -0700)]
bytes: add ContainsRune

Make package bytes consistent with strings
by adding missing function ContainsRune.

Fixes #15189

Change-Id: Ie09080b389e55bbe070c57aa3bd134053a805423
Reviewed-on: https://go-review.googlesource.com/21710
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agosyscall: add assembly for Linux on s390x
Michael Munday [Fri, 8 Apr 2016 15:40:51 +0000 (11:40 -0400)]
syscall: add assembly for Linux on s390x

Change-Id: I42ade65a91f3effc03dd663ee449410baa9f8ca8
Reviewed-on: https://go-review.googlesource.com/21740
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocontext: disable more flaky tests on openbsd
Brad Fitzpatrick [Fri, 8 Apr 2016 17:50:03 +0000 (17:50 +0000)]
context: disable more flaky tests on openbsd

Updates #15158

Change-Id: Icb3788152a7a5a9b0d56ea38da46d770ffdce413
Reviewed-on: https://go-review.googlesource.com/21763
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agotest: skip nilptr3 test on s390x
Michael Munday [Sun, 20 Mar 2016 23:35:59 +0000 (19:35 -0400)]
test: skip nilptr3 test on s390x

Fails for the same reason as ppc64 and mips64 (incomplete
optimization).

Change-Id: Ieb4d997fc27d4f2b756e63dd7f588abe10c0213a
Reviewed-on: https://go-review.googlesource.com/20963
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/link: add s390x to link tool main function
Michael Munday [Fri, 8 Apr 2016 15:55:05 +0000 (11:55 -0400)]
cmd/link: add s390x to link tool main function

Change-Id: I83bc2b4a00216b069f133113e4ae9ad76c98a708
Reviewed-on: https://go-review.googlesource.com/21741
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoio: change the name of ReadAtSizer to SizedReaderAt
Rob Pike [Thu, 7 Apr 2016 03:19:47 +0000 (20:19 -0700)]
io: change the name of ReadAtSizer to SizedReaderAt

This is a proposal. The old name is pretty poor. The new one describes
it better and may be easier to remember. It does not start with Read,
though I think that inconsistency is worthwhile.

Reworded the comment a bit for clarity.

Change-Id: Icb4f9c663cc68958e0363d7ff78a0b29cc521f98
Reviewed-on: https://go-review.googlesource.com/21629
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd: replace bio.Buf with bio.Reader and bio.Writer
Dave Cheney [Fri, 8 Apr 2016 09:14:03 +0000 (19:14 +1000)]
cmd: replace bio.Buf with bio.Reader and bio.Writer

Replace the bidirectional bio.Buf type with a pair of unidirectional
buffered seekable Reader and Writers.

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

9 years agocmd/compile: cleanup -dynlink/-shared support check
Michael Munday [Thu, 7 Apr 2016 19:31:49 +0000 (15:31 -0400)]
cmd/compile: cleanup -dynlink/-shared support check

Moves the list of architectures that support shared libraries into
a function. Also adds s390x to that list.

Change-Id: I99c8a9f6cd4816ce3d53abaabaf8d002e25e6b28
Reviewed-on: https://go-review.googlesource.com/21661
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Run-TryBot: Michael Munday <munday@ca.ibm.com>

9 years agocmd/compile/internal/gc: unexport Export
Dave Cheney [Fri, 8 Apr 2016 10:09:10 +0000 (20:09 +1000)]
cmd/compile/internal/gc: unexport Export

Export does not need to be exported.

Change-Id: I252f0c024732f1d056817cab13e8e3c589b54d13
Reviewed-on: https://go-review.googlesource.com/21721
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: fix failing tests since vet was moved from x/tools
Andrew Gerrand [Fri, 8 Apr 2016 05:09:45 +0000 (15:09 +1000)]
cmd/go: fix failing tests since vet was moved from x/tools

Change-Id: I3276a118ced78f3efd8f1bc5fb8b8fa2fde52496
Reviewed-on: https://go-review.googlesource.com/21704
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: fixed trivial go vet warnings
Emmanuel Odeke [Fri, 8 Apr 2016 02:59:59 +0000 (19:59 -0700)]
net/http: fixed trivial go vet warnings

Updates #15177

Change-Id: I748f025461f313b5b426821ead695f90d3011a6b
Reviewed-on: https://go-review.googlesource.com/21677
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: Fix constant-folding of unsigned shifts
Keith Randall [Thu, 7 Apr 2016 17:21:35 +0000 (10:21 -0700)]
cmd/compile: Fix constant-folding of unsigned shifts

Make sure the results of unsigned constant-folded
shifts are sign-extended into the AuxInt field.

Fixes #15175

Change-Id: I3490d1bc3d9b2e1578ed30964645508577894f58
Reviewed-on: https://go-review.googlesource.com/21586
Reviewed-by: Alexandru Moșoi <alexandru@mosoi.ro>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/go: revise importPath when ImportPath is 'command-line-arguments'
Cheng-Lung Sung [Wed, 6 Apr 2016 15:05:20 +0000 (23:05 +0800)]
cmd/go: revise importPath when ImportPath is 'command-line-arguments'

Fixes #14613

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