]> Cypherpunks repositories - gostls13.git/log
gostls13.git
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>

9 years agobytes, string: add Reset method to Reader
Joe Tsai [Thu, 31 Mar 2016 23:05:23 +0000 (16:05 -0700)]
bytes, string: add Reset method to Reader

Currently, there is no easy allocation-free way to turn a
[]byte or string into an io.Reader. Thus, we add a Reset method
to bytes.Reader and strings.Reader to allow the reuse of these
Readers with another []byte or string.

This is consistent with the fact that many standard library io.Readers
already support a Reset method of some type:
bufio.Reader
flate.Reader
gzip.Reader
zlib.Reader
debug/dwarf.LineReader
bytes.Buffer
crypto/rc4.Cipher

Fixes #15033

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

9 years agoruntime: add s390x support (new files and lfstack_64bit.go modifications)
Michael Munday [Fri, 18 Mar 2016 23:09:39 +0000 (19:09 -0400)]
runtime: add s390x support (new files and lfstack_64bit.go modifications)

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

9 years agocmd/link: hide go.dwarf symbols
David Crawshaw [Thu, 7 Apr 2016 18:27:15 +0000 (14:27 -0400)]
cmd/link: hide go.dwarf symbols

Fixes #15179

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

9 years agocmd/link: disable DWARF when not generating symtab
David Crawshaw [Thu, 7 Apr 2016 18:00:00 +0000 (14:00 -0400)]
cmd/link: disable DWARF when not generating symtab

Fixes #15166

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

9 years agoC: fix jbd's identity
Burcu Dogan [Thu, 7 Apr 2016 17:50:47 +0000 (10:50 -0700)]
C: fix jbd's identity

Change-Id: Ib4353710a742b1067723c7c6186e8639559668a3
Reviewed-on: https://go-review.googlesource.com/21655
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocontext: mark more tests as flaky on OpenBSD
Brad Fitzpatrick [Thu, 7 Apr 2016 16:00:32 +0000 (09:00 -0700)]
context: mark more tests as flaky on OpenBSD

Updates #15158

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

9 years agomath/big: re-use memory in Int.GCD
Aliaksandr Valialkin [Mon, 4 Apr 2016 16:28:15 +0000 (19:28 +0300)]
math/big: re-use memory in Int.GCD

This improves TLS handshake performance.

benchmark                                 old ns/op     new ns/op     delta
BenchmarkGCD10x10/WithoutXY-4             965           968           +0.31%
BenchmarkGCD10x10/WithXY-4                1813          1391          -23.28%
BenchmarkGCD10x100/WithoutXY-4            1093          1075          -1.65%
BenchmarkGCD10x100/WithXY-4               2348          1676          -28.62%
BenchmarkGCD10x1000/WithoutXY-4           1569          1565          -0.25%
BenchmarkGCD10x1000/WithXY-4              4262          3242          -23.93%
BenchmarkGCD10x10000/WithoutXY-4          6069          6066          -0.05%
BenchmarkGCD10x10000/WithXY-4             12123         11331         -6.53%
BenchmarkGCD10x100000/WithoutXY-4         52664         52610         -0.10%
BenchmarkGCD10x100000/WithXY-4            97494         95649         -1.89%
BenchmarkGCD100x100/WithoutXY-4           5244          5228          -0.31%
BenchmarkGCD100x100/WithXY-4              22572         18630         -17.46%
BenchmarkGCD100x1000/WithoutXY-4          6143          6233          +1.47%
BenchmarkGCD100x1000/WithXY-4             24652         19357         -21.48%
BenchmarkGCD100x10000/WithoutXY-4         15725         15804         +0.50%
BenchmarkGCD100x10000/WithXY-4            60552         55973         -7.56%
BenchmarkGCD100x100000/WithoutXY-4        107008        107853        +0.79%
BenchmarkGCD100x100000/WithXY-4           349597        340994        -2.46%
BenchmarkGCD1000x1000/WithoutXY-4         63785         64434         +1.02%
BenchmarkGCD1000x1000/WithXY-4            373186        334035        -10.49%
BenchmarkGCD1000x10000/WithoutXY-4        78038         78241         +0.26%
BenchmarkGCD1000x10000/WithXY-4           543692        507034        -6.74%
BenchmarkGCD1000x100000/WithoutXY-4       205607        207727        +1.03%
BenchmarkGCD1000x100000/WithXY-4          2488113       2415323       -2.93%
BenchmarkGCD10000x10000/WithoutXY-4       1731340       1714992       -0.94%
BenchmarkGCD10000x10000/WithXY-4          10601046      7111329       -32.92%
BenchmarkGCD10000x100000/WithoutXY-4      2239155       2212173       -1.21%
BenchmarkGCD10000x100000/WithXY-4         30097040      26538887      -11.82%
BenchmarkGCD100000x100000/WithoutXY-4     119845326     119863916     +0.02%
BenchmarkGCD100000x100000/WithXY-4        768006543     426795966     -44.43%

benchmark                                 old allocs     new allocs     delta
BenchmarkGCD10x10/WithoutXY-4             5              5              +0.00%
BenchmarkGCD10x10/WithXY-4                17             9              -47.06%
BenchmarkGCD10x100/WithoutXY-4            6              6              +0.00%
BenchmarkGCD10x100/WithXY-4               21             9              -57.14%
BenchmarkGCD10x1000/WithoutXY-4           6              6              +0.00%
BenchmarkGCD10x1000/WithXY-4              30             12             -60.00%
BenchmarkGCD10x10000/WithoutXY-4          6              6              +0.00%
BenchmarkGCD10x10000/WithXY-4             26             12             -53.85%
BenchmarkGCD10x100000/WithoutXY-4         6              6              +0.00%
BenchmarkGCD10x100000/WithXY-4            28             12             -57.14%
BenchmarkGCD100x100/WithoutXY-4           5              5              +0.00%
BenchmarkGCD100x100/WithXY-4              183            61             -66.67%
BenchmarkGCD100x1000/WithoutXY-4          8              8              +0.00%
BenchmarkGCD100x1000/WithXY-4             170            47             -72.35%
BenchmarkGCD100x10000/WithoutXY-4         8              8              +0.00%
BenchmarkGCD100x10000/WithXY-4            200            67             -66.50%
BenchmarkGCD100x100000/WithoutXY-4        8              8              +0.00%
BenchmarkGCD100x100000/WithXY-4           188            65             -65.43%
BenchmarkGCD1000x1000/WithoutXY-4         5              5              +0.00%
BenchmarkGCD1000x1000/WithXY-4            2435           1193           -51.01%
BenchmarkGCD1000x10000/WithoutXY-4        8              8              +0.00%
BenchmarkGCD1000x10000/WithXY-4           2211           1076           -51.33%
BenchmarkGCD1000x100000/WithoutXY-4       8              8              +0.00%
BenchmarkGCD1000x100000/WithXY-4          2271           1108           -51.21%
BenchmarkGCD10000x10000/WithoutXY-4       5              5              +0.00%
BenchmarkGCD10000x10000/WithXY-4          23183          11605          -49.94%
BenchmarkGCD10000x100000/WithoutXY-4      8              8              +0.00%
BenchmarkGCD10000x100000/WithXY-4         23421          11717          -49.97%
BenchmarkGCD100000x100000/WithoutXY-4     5              5              +0.00%
BenchmarkGCD100000x100000/WithXY-4        232976         116815         -49.86%

benchmark                                 old bytes      new bytes     delta
BenchmarkGCD10x10/WithoutXY-4             208            208           +0.00%
BenchmarkGCD10x10/WithXY-4                736            432           -41.30%
BenchmarkGCD10x100/WithoutXY-4            256            256           +0.00%
BenchmarkGCD10x100/WithXY-4               896            432           -51.79%
BenchmarkGCD10x1000/WithoutXY-4           368            368           +0.00%
BenchmarkGCD10x1000/WithXY-4              1856           1152          -37.93%
BenchmarkGCD10x10000/WithoutXY-4          1616           1616          +0.00%
BenchmarkGCD10x10000/WithXY-4             7920           7376          -6.87%
BenchmarkGCD10x100000/WithoutXY-4         13776          13776         +0.00%
BenchmarkGCD10x100000/WithXY-4            68800          68176         -0.91%
BenchmarkGCD100x100/WithoutXY-4           208            208           +0.00%
BenchmarkGCD100x100/WithXY-4              6960           2112          -69.66%
BenchmarkGCD100x1000/WithoutXY-4          544            560           +2.94%
BenchmarkGCD100x1000/WithXY-4             7280           2400          -67.03%
BenchmarkGCD100x10000/WithoutXY-4         2896           2912          +0.55%
BenchmarkGCD100x10000/WithXY-4            15280          10002         -34.54%
BenchmarkGCD100x100000/WithoutXY-4        27344          27365         +0.08%
BenchmarkGCD100x100000/WithXY-4           88288          83427         -5.51%
BenchmarkGCD1000x1000/WithoutXY-4         544            544           +0.00%
BenchmarkGCD1000x1000/WithXY-4            178288         40043         -77.54%
BenchmarkGCD1000x10000/WithoutXY-4        3344           3136          -6.22%
BenchmarkGCD1000x10000/WithXY-4           188720         54432         -71.16%
BenchmarkGCD1000x100000/WithoutXY-4       27792          27592         -0.72%
BenchmarkGCD1000x100000/WithXY-4          373872         239447        -35.95%
BenchmarkGCD10000x10000/WithoutXY-4       4288           4288          +0.00%
BenchmarkGCD10000x10000/WithXY-4          11935584       481875        -95.96%
BenchmarkGCD10000x100000/WithoutXY-4      31296          28834         -7.87%
BenchmarkGCD10000x100000/WithXY-4         13237088       1662620       -87.44%
BenchmarkGCD100000x100000/WithoutXY-4     40768          40768         +0.00%
BenchmarkGCD100000x100000/WithXY-4        1165518864     14256010      -98.78%

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

9 years agomath/big: add s390x function implementations
Michael Munday [Mon, 21 Mar 2016 01:49:52 +0000 (21:49 -0400)]
math/big: add s390x function implementations

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

9 years agosync/atomic: add s390x implementations of atomic functions
Michael Munday [Mon, 21 Mar 2016 01:34:48 +0000 (21:34 -0400)]
sync/atomic: add s390x implementations of atomic functions

Load and store instructions are atomic on s390x.

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

9 years agogo/types: make Identical(nil, T) == Identical(T, nil)
Alan Donovan [Thu, 7 Apr 2016 14:07:10 +0000 (10:07 -0400)]
go/types: make Identical(nil, T) == Identical(T, nil)

Fixes #15173

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

9 years agoRevert "runtime: merge lfstack{Pack,Unpack} into one file"
Dave Cheney [Thu, 7 Apr 2016 14:05:06 +0000 (14:05 +0000)]
Revert "runtime: merge lfstack{Pack,Unpack} into one file"

This broke solaris, which apparently does use the upper 17 bits of the address space.

This reverts commit 3b02c5b1b66df9cdb23d5a3243bb37b2c312ea1b.

Change-Id: Iedfe54abd0384960845468205f20191a97751c0b
Reviewed-on: https://go-review.googlesource.com/21652
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agocmd/compile: fold CMPconst and SHR
Alexandru Moșoi [Tue, 5 Apr 2016 21:32:49 +0000 (23:32 +0200)]
cmd/compile: fold CMPconst and SHR

Fold the comparison when the SHR result is small.

Useful for:
- murmur mix like hashing where higher bits are desirable, i.e. hash = uint32(i * C) >> 18
- integer log2 via DeBruijn sequence: http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn

Change-Id: If70ae18cb86f4cc83ab6213f88ced03cc4986156
Reviewed-on: https://go-review.googlesource.com/21514
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
9 years agoruntime/pprof: make TestBlockProfile less timing dependent
Richard Miller [Wed, 6 Apr 2016 17:58:22 +0000 (18:58 +0100)]
runtime/pprof: make TestBlockProfile less timing dependent

The test for profiling of channel blocking is timing dependent,
and in particular the blockSelectRecvAsync case can fail on a
slow builder (plan9_arm) when many tests are run in parallel.
The child goroutine sleeps for a fixed period so the parent
can be observed to block in a select call reading from the
child; but if the OS process running the parent goroutine is
delayed long enough, the child may wake again before the
parent has reached the blocking point.  By repeating the test
three times, the likelihood of a blocking event is increased.

Fixes #15096

Change-Id: I2ddb9576a83408d06b51ded682bf8e71e53ce59e
Reviewed-on: https://go-review.googlesource.com/21604
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime: merge lfstack{Pack,Unpack} into one file
Dave Cheney [Wed, 6 Apr 2016 21:29:22 +0000 (07:29 +1000)]
runtime: merge lfstack{Pack,Unpack} into one file

Merge the remaining lfstack{Pack,Unpack} implemetations into one file.

unsafe.Sizeof(uintptr(0)) == 4 is a constant comparison so this branch
folds away at compile time.

Dmitry confirmed that the upper 17 bits of an address will be zero for a
user mode pointer, so there is no need to sign extend on amd64 during
unpack, so we can reuse the same implementation as all othe 64 bit
archs.

Change-Id: I99f589416d8b181ccde5364c9c2e78e4a5efc7f1
Reviewed-on: https://go-review.googlesource.com/21597
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/link/internal/amd64: remove empty source file
Matthew Dempsky [Thu, 7 Apr 2016 06:34:32 +0000 (23:34 -0700)]
cmd/link/internal/amd64: remove empty source file

Change-Id: I2da012ed996c669db513a462f014c6f3ffa396ee
Reviewed-on: https://go-review.googlesource.com/21646
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
9 years agocmd: extract obj's Biobuf code into new bio package
Matthew Dempsky [Thu, 7 Apr 2016 04:45:29 +0000 (21:45 -0700)]
cmd: extract obj's Biobuf code into new bio package

API could still be made more Go-ey.

Updates #15165.

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

9 years agocmd/internal/sys: change ArchFamily constants to iotas
Matthew Dempsky [Thu, 7 Apr 2016 03:06:41 +0000 (20:06 -0700)]
cmd/internal/sys: change ArchFamily constants to iotas

RIP architecture characters.

Change-Id: I36f53afdc311b14b9459ff3821bd6df54a057ded
Reviewed-on: https://go-review.googlesource.com/21628
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agocmd/link: remove dependency on sys.ArchFamily values
Matthew Dempsky [Thu, 7 Apr 2016 03:06:12 +0000 (20:06 -0700)]
cmd/link: remove dependency on sys.ArchFamily values

Change-Id: I858054b72847f4f27a1ebbdaff82820a28c03743
Reviewed-on: https://go-review.googlesource.com/21627
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile, cmd/link: eliminate uses of ArchFamily in error messages
Matthew Dempsky [Thu, 7 Apr 2016 01:54:17 +0000 (18:54 -0700)]
cmd/compile, cmd/link: eliminate uses of ArchFamily in error messages

Two of these error messages are already dead code: cmd/compile.main
and cmd/link.main already switch on $GOARCH, ensuring it must be a
prefix of the sys.Arch.Family.

The error message about uncompiled Go source files can be just be
simplified: anyone who's manually constructing Go object file archives
probably knows what tool to use to compile Go source files.

Change-Id: Ia4a67c0a1d1158379c127c91e909226d3367f3c2
Reviewed-on: https://go-review.googlesource.com/21626
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd: add new common architecture representation
Matthew Dempsky [Wed, 6 Apr 2016 19:01:40 +0000 (12:01 -0700)]
cmd: add new common architecture representation

Information about CPU architectures (e.g., name, family, byte
ordering, pointer and register size) is currently redundantly
scattered around the source tree. Instead consolidate the basic
information into a single new package cmd/internal/sys.

Also, introduce new sys.I386, sys.AMD64, etc. names for the constants
'8', '6', etc. and replace most uses of the latter. The notable
exceptions are a couple of error messages that still refer to the old
char-based toolchain names and function reltype in cmd/link.

Passes toolstash/buildall.

Change-Id: I8a6f0cbd49577ec1672a98addebc45f767e36461
Reviewed-on: https://go-review.googlesource.com/21623
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime: clamp OS-reported number of processors to _MaxGomaxprocs
Michael Hudson-Doyle [Wed, 6 Apr 2016 23:47:32 +0000 (11:47 +1200)]
runtime: clamp OS-reported number of processors to _MaxGomaxprocs

So that all Go processes do not die on startup on a system with >256 CPUs.

I tested this by hacking osinit to set ncpu to 1000.

Updates #15131

Change-Id: I52e061a0de97be41d684dd8b748fa9087d6f1aef
Reviewed-on: https://go-review.googlesource.com/21599
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/link: generate DWARF info using symbols
Ryan Brown [Mon, 14 Mar 2016 16:23:04 +0000 (09:23 -0700)]
cmd/link: generate DWARF info using symbols

This updates dwarf.go to generate debug information as symbols
instead of directly writing to the output file. This should make
it easier to move generation of some of the debug info into the compiler.

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

9 years agomath: add functions and stubs for s390x
Michael Munday [Mon, 21 Mar 2016 01:44:31 +0000 (21:44 -0400)]
math: add functions and stubs for s390x

Includes assembly implementations of Sqrt and Dim.

Change-Id: I57472e8d31e2ee74bcebf9f8e818f765eb9b8abf
Reviewed-on: https://go-review.googlesource.com/20936
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, go/importer: minor cleanups
Robert Griesemer [Wed, 6 Apr 2016 22:27:30 +0000 (15:27 -0700)]
cmd/compile, go/importer: minor cleanups

Change-Id: I4ffb79d8cb08b0b44f59757fb7f0ec3ed1e4479f
Reviewed-on: https://go-review.googlesource.com/21624
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agocmd/compile: move Type.Maplineno to separate data structure
Josh Bleecher Snyder [Wed, 6 Apr 2016 21:12:48 +0000 (14:12 -0700)]
cmd/compile: move Type.Maplineno to separate data structure

Relatively few types are ever used as map keys,
so tracking this separately is a net win.

Passes toolstash -cmp.

name       old alloc/op     new alloc/op     delta
Template       55.9MB ± 0%      55.5MB ± 0%  -0.71%        (p=0.000 n=10+10)
Unicode        37.8MB ± 0%      37.7MB ± 0%  -0.27%        (p=0.000 n=10+10)
GoTypes         180MB ± 0%       179MB ± 0%  -0.52%         (p=0.000 n=7+10)
Compiler        806MB ± 0%       803MB ± 0%  -0.41%        (p=0.000 n=10+10)

CPU and number of allocs are unchanged.

Change-Id: I6d60d74a4866995a231dfed3dd5792d75d904292
Reviewed-on: https://go-review.googlesource.com/21622
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agobytes: add ContainsAny
Rob Pike [Tue, 5 Apr 2016 22:43:07 +0000 (15:43 -0700)]
bytes: add ContainsAny

This function is present in the strings package but missing from bytes,
and we would like to keep the two packages consistent.

Add it to bytes, and copy the test over as well.

Fixes #15140

Change-Id: I5dbd28da83a9fe741885794ed15f2af2f826cb3c
Reviewed-on: https://go-review.googlesource.com/21562
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: remove unused return value from lfstackUnpack
Dave Cheney [Wed, 6 Apr 2016 08:43:23 +0000 (18:43 +1000)]
runtime: remove unused return value from lfstackUnpack

None of the two places that call lfstackUnpack use the second argument.
This simplifies a followup CL that merges the lfstack{Pack,Unpack}
implementations.

Change-Id: I3c93f6259da99e113d94f8c8027584da79c1ac2c
Reviewed-on: https://go-review.googlesource.com/21595
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: replaces ANDQ with MOV?ZX
Alexandru Moșoi [Mon, 4 Apr 2016 17:23:41 +0000 (19:23 +0200)]
cmd/compile: replaces ANDQ with MOV?ZX

Where possible replace ANDQ with MOV?ZX.
Takes care that we don't regress wrt bounds checking,
for example [1000]int{}[i&255].

According to "Intel 64 and IA-32 Architectures Optimization Reference
Manual" Section: "3.5.1.13 Zero-Latency MOV Instructions"
MOV?ZX instructions have zero latency on newer processors.

Updates #15105

Change-Id: I63539fdbc5812d5563aa1ebc49eca035bd307997
Reviewed-on: https://go-review.googlesource.com/21508
Reviewed-by: Айнар Гарипов <gugl.zadolbal@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
9 years agoencoding/json: respect json.Marshaler when encoding byte kind slices
Håvard Haugen [Wed, 3 Feb 2016 22:41:55 +0000 (23:41 +0100)]
encoding/json: respect json.Marshaler when encoding byte kind slices

Fixes #13783.

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

9 years agonet, runtime: skip flaky tests on OpenBSD
Brad Fitzpatrick [Wed, 6 Apr 2016 19:02:27 +0000 (19:02 +0000)]
net, runtime: skip flaky tests on OpenBSD

Flaky tests are a distraction and cover up real problems.

File bugs instead and mark them as flaky.

This moves the net/http flaky test flagging mechanism to internal/testenv.

Updates #15156
Updates #15157
Updates #15158

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

9 years agocmd/compile: shrink gc.Type in half
Josh Bleecher Snyder [Sat, 2 Apr 2016 03:11:30 +0000 (20:11 -0700)]
cmd/compile: shrink gc.Type in half

Many of Type's fields are etype-specific.
This CL organizes them into their own auxiliary types,
duplicating a few fields as necessary,
and adds an Extra field to hold them.
It also sorts the remaining fields for better struct packing.
It also improves documentation for most fields.

This reduces the size of Type at the cost of some extra allocations.
There's no CPU impact; memory impact below.
It also makes the natural structure of Type clearer.

Passes toolstash -cmp on all architectures.

Ideas for future work in this vein:

(1) Width and Align probably only need to be
stored for Struct and Array types.
The refactoring to accomplish this would hopefully
also eliminate TFUNCARGS and TCHANARGS entirely.

(2) Maplineno is sparsely used and could probably better be
stored in a separate map[*Type]int32, with mapqueue updated
to store both a Node and a line number.

(3) The Printed field may be removable once the old (non-binary)
importer/exported has been removed.

(4) StructType's fields field could be changed from *[]*Field to []*Field,
which would remove a common allocation.

(5) I believe that Type.Nod can be moved to ForwardType. Separate CL.

name       old alloc/op     new alloc/op     delta
Template       57.9MB ± 0%      55.9MB ± 0%  -3.43%        (p=0.000 n=50+50)
Unicode        38.3MB ± 0%      37.8MB ± 0%  -1.39%        (p=0.000 n=50+50)
GoTypes         185MB ± 0%       180MB ± 0%  -2.56%        (p=0.000 n=50+50)
Compiler        824MB ± 0%       806MB ± 0%  -2.19%        (p=0.000 n=50+50)

name       old allocs/op    new allocs/op    delta
Template         486k ± 0%        497k ± 0%  +2.25%        (p=0.000 n=50+50)
Unicode          377k ± 0%        379k ± 0%  +0.55%        (p=0.000 n=50+50)
GoTypes         1.39M ± 0%       1.42M ± 0%  +1.63%        (p=0.000 n=50+50)
Compiler        5.52M ± 0%       5.57M ± 0%  +0.84%        (p=0.000 n=47+50)

Change-Id: I828488eeb74902b013d5ae4cf844de0b6c0dfc87
Reviewed-on: https://go-review.googlesource.com/21611
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agotest: make goprint.go wait for goroutine termination
Richard Miller [Wed, 6 Apr 2016 17:42:14 +0000 (18:42 +0100)]
test: make goprint.go wait for goroutine termination

Test goprint.go sometimes failed on a slow builder (plan9_arm)
because of timing dependency.  Instead of sleeping for a fixed
time to allow the child goroutine to finish, wait explicitly for
child termination by calling runtime.NumGoroutine until the
returned value is 1.

Fixes #15097

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

9 years agotesting: fix flakey test on plan9
Marcel van Lohuizen [Wed, 6 Apr 2016 13:01:50 +0000 (15:01 +0200)]
testing: fix flakey test on plan9

allow for more than 0.00s.

Fixes #15149

Change-Id: I1d428a9b3c9bb3d1db8682c53b86e44cecc1dde1
Reviewed-on: https://go-review.googlesource.com/21602
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/gofmt: make gofmt -s simplify slices in presence of dot-imports
Robert Griesemer [Wed, 6 Apr 2016 17:49:12 +0000 (10:49 -0700)]
cmd/gofmt: make gofmt -s simplify slices in presence of dot-imports

A dot-import cannot possibly introduce a `len` function since that
function would not be exported (it's lowercase). Furthermore, the
existing code already (incorrectly) assumed that there was no other
`len` function in another file of the package. Since this has been
an ok assumption for years, let's leave it, but remove the dot-import
restriction.

Fixes #15153.

Change-Id: I18fbb27acc5a5668833b4b4aead0cca540862b52
Reviewed-on: https://go-review.googlesource.com/21613
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoicmd/vet: improved checking for variadic Println-like functions
Aliaksandr Valialkin [Tue, 5 Apr 2016 15:42:07 +0000 (18:42 +0300)]
icmd/vet: improved checking for variadic Println-like functions

- Automatically determine the first argument to check.
- Skip checking matching non-variadic functions.
- Skip checking matching functions accepting non-interface{}
  variadic arguments.
- Removed fragile 'magic' code for special cases such as math.Log
  and error interface.

Fixes #15067
Fixes #15099

Change-Id: Ib313557f18b12b36daa493f4b02c598b9503b55b
Reviewed-on: https://go-review.googlesource.com/21513
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/link: eliminate a bunch of open coded elf64/rela switches
Matthew Dempsky [Wed, 6 Apr 2016 06:01:10 +0000 (23:01 -0700)]
cmd/link: eliminate a bunch of open coded elf64/rela switches

We already have variables to track whether the target platform is
64-bit vs 32-bit or RELA vs REL, so no point in repeating the list of
obscure architecture characters everywhere.

Passes toolstash/buildall.

Change-Id: I6a07f74188ac592ef229a7c65848a9ba93013cdb
Reviewed-on: https://go-review.googlesource.com/21569
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agotesting: fixed bug introduced by CL 21504
Marcel van Lohuizen [Wed, 6 Apr 2016 07:59:32 +0000 (09:59 +0200)]
testing: fixed bug introduced by CL 21504

This broke T.Run

Change-Id: I12c8fe3612f3fa2caa83049c1c7003056daf2b0c
Reviewed-on: https://go-review.googlesource.com/21600
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: use windows.NewLazySystemDLL in mksyscall_windows.go
Alex Brainman [Wed, 6 Apr 2016 06:11:22 +0000 (16:11 +1000)]
runtime: use windows.NewLazySystemDLL in mksyscall_windows.go

Change-Id: Ie4c4ff4167ee45ae93a8b764fb6197f402e7994d
Reviewed-on: https://go-review.googlesource.com/21593
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/vet: do not treat declaration as asignment in atomic check
Konstantin Shaposhnikov [Tue, 5 Apr 2016 15:54:50 +0000 (23:54 +0800)]
cmd/vet: do not treat declaration as asignment in atomic check

Fixes #15118

Change-Id: Iad56ed412535c8ac0a01c4bd7769fd3d37688ac9
Reviewed-on: https://go-review.googlesource.com/21526
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agoos/user: wrap getgrnam_r to fix type issues
Ross Light [Thu, 31 Mar 2016 21:57:49 +0000 (14:57 -0700)]
os/user: wrap getgrnam_r to fix type issues

Even with -D_POSIX_PTHREAD_SEMANTICS, Solaris seems to not define
getgrnam_r in a POSIX compatible way.

Fixes #14967

Change-Id: I78cb7e5b30b2d8b860e336060a0a06f4720c0475
Reviewed-on: https://go-review.googlesource.com/21385
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/pprof: note calling runtime.SetBlockProfileRate is required for block profile
Dan Peterson [Wed, 6 Apr 2016 14:18:55 +0000 (11:18 -0300)]
net/http/pprof: note calling runtime.SetBlockProfileRate is required for block profile

Fixes #15076

Change-Id: I5ce8f6253245d8cc1f862a1bf618775f557f955d
Reviewed-on: https://go-review.googlesource.com/21610
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: fix x=x assignments
Keith Randall [Fri, 1 Apr 2016 18:05:30 +0000 (11:05 -0700)]
cmd/compile: fix x=x assignments

No point in doing anything for x=x assignments.
In addition, skipping these assignments prevents generating:
    VARDEF x
    COPY x -> x
which is bad because x is incorrectly considered
dead before the vardef.

Fixes #14904

Change-Id: I6817055ec20bcc34a9648617e0439505ee355f82
Reviewed-on: https://go-review.googlesource.com/21470
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agoruntime: merge 64bit lfstack impls
Dave Cheney [Wed, 6 Apr 2016 05:19:12 +0000 (15:19 +1000)]
runtime: merge 64bit lfstack impls

Merge all the 64bit lfstack impls into one file, adjust build tags to
match.

Merge all the comments on the various lfstack implementations for
posterity.

lfstack_amd64.go can probably be merged, but it is slightly different so
that will happen in a followup.

Change-Id: I5362d5e127daa81c9cb9d4fa8a0cc5c5e5c2707c
Reviewed-on: https://go-review.googlesource.com/21591
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoos: consolidate os{1,2}_*.go files
Brad Fitzpatrick [Wed, 6 Apr 2016 04:38:00 +0000 (04:38 +0000)]
os: consolidate os{1,2}_*.go files

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

9 years agoruntime: rename os1_windows.go to os_windows.go
Brad Fitzpatrick [Wed, 6 Apr 2016 02:39:47 +0000 (02:39 +0000)]
runtime: rename os1_windows.go to os_windows.go

Change-Id: I11172f3d0e28f17b812e67a4db9cfe513b8e1974
Reviewed-on: https://go-review.googlesource.com/21565
Reviewed-by: Minux Ma <minux@golang.org>