1
0
mirror of https://github.com/golang/go synced 2024-10-01 12:38:31 -06:00
Commit Graph

22311 Commits

Author SHA1 Message Date
Keith Randall
b81f2f106f cmd/compile: place combined loads at the location of the last byte load
We need to make sure all the bounds checks pass before issuing
a load which combines several others.  We do this by issuing the
combined load at the last load's block, where "last" = closest to
the leaf of the dominator tree.

Fixes #15002

Change-Id: I7358116db1e039a072c12c0a73d861f3815d72af
Reviewed-on: https://go-review.googlesource.com/21246
Reviewed-by: Todd Neal <todd@tneal.org>
2016-03-31 17:21:33 +00:00
Josh Bleecher Snyder
b83618f964 cmd/compile: encapsulate Type.Nname
Generated by eg, manually fixed up.

I’m not thrilled about having a setter,
but given the variety of contexts in which this
gets fiddled with, it is the cleanest
available alternative.

Change-Id: Ibdf23e638fe0bdabded014c9e59d557fab8c955f
Reviewed-on: https://go-review.googlesource.com/21341
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-31 15:38:34 +00:00
Brad Fitzpatrick
139891e815 net/http/httptest: clean up unnecessary goroutine
Finishes cleanup which was too late to do when discovered during the
Go 1.6 cycle.

Fixes #14291

Change-Id: Idc69fadbba10baf246318a22b366709eff088a75
Reviewed-on: https://go-review.googlesource.com/21360
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-03-31 10:48:47 +00:00
Matthew Dempsky
e6066711a0 cmd/compile, runtime: fix pedantic int->string conversions
Previously, cmd/compile rejected constant int->string conversions if
the integer value did not fit into an "int" value. Also, runtime
incorrectly truncated 64-bit values to 32-bit before checking if
they're a valid Unicode code point. According to the Go spec, both of
these cases should instead yield "\uFFFD".

Fixes #15039.

Change-Id: I3c8a3ad9a0780c0a8dc1911386a523800fec9764
Reviewed-on: https://go-review.googlesource.com/21344
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-31 10:28:23 +00:00
Hiroshi Ioka
e7538df701 net/mail: throw error when multiple addresses are given to ParseAddress
Fixes #14610

Change-Id: I3e57dd60b531c1495ea3bc37ef707a1e4e644baa
Reviewed-on: https://go-review.googlesource.com/20180
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-31 10:09:55 +00:00
Brad Fitzpatrick
a62ae9f62f crypto/x509: add SystemCertPool, refactor system cert pool loading
This exports the system cert pool.

The system cert loading was refactored to let it be run multiple times
(so callers get a copy, and can't mutate global state), and also to
not discard errors.

SystemCertPool returns an error on Windows. Maybe it's fixable later,
but so far we haven't used it, since the system verifies TLS.

Fixes #13335

Change-Id: I3dfb4656a373f241bae8529076d24c5f532f113c
Reviewed-on: https://go-review.googlesource.com/21293
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-03-31 07:52:10 +00:00
Matthew Dempsky
71ab3c1ccf cmd/link: remove -H elf flag
We create appropriate ELF files automatically based on GOOS. There's
no point in supporting -H elf flag, particularly since we need to emit
different flavors of ELF depending on GOOS anyway.

If that weren't reason enough, -H elf appears to be broken since at
least Go 1.4. At least I wasn't able to find a way to make use of it.

As best I can tell digging through commit history, -H elf is just an
artifact leftover from Plan 9's 6l linker.

Change-Id: I7393caaadbc60107bbd6bc99b976a4f4fe6b5451
Reviewed-on: https://go-review.googlesource.com/21343
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-31 06:33:01 +00:00
Brad Fitzpatrick
a6557a05a0 net/http: allow Handlers to handle http2 upgrade PRI requests
The http2 spec defines a magic string which initates an http2 session:

    "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"

It was intentionally chosen to kinda look like an HTTP request, but
just different enough to break things not ready for it. This change
makes Go ready for it.

Notably: Go now accepts the request header (the prefix "PRI *
HTTP/2.0\r\n\r\n") as a valid request, even though it doesn't have a
Host header. But we now mark it as "Connection: close" and teach the
Server to never read a second request from the connection once that's
seen. If the http.Handler wants to deal with the upgrade, it has to
hijack the request, read out the "body", compare it against
"SM\r\n\r\n", and then speak http2. One of the new tests demonstrates
that hijacking.

Fixes #14451
Updates #14141 (h2c)

Change-Id: Ib46142f31c55be7d00c56fa2624ec8a232e00c43
Reviewed-on: https://go-review.googlesource.com/21327
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-31 06:12:36 +00:00
Brad Fitzpatrick
0026cb788b net/http: validate transmitted header fields
This makes sure the net/http package never attempts to transmit a
bogus header field key or value and instead fails fast with an error
to the user, rather than relying on the server to maybe return an
error.

It's still possible to use x/net/http2.Transport directly to send
bogus stuff. This change only stops h1 & h2 usage via the net/http
package. A future change will update x/net/http2.

This change also moves some code from request.go to lex.go, which in a
separate future change should be moved so it can be shared with http2
to reduce code bloat.

Updates #14048

Change-Id: I0a44ae1ab357fbfcbe037aa4b5d50669a87f2856
Reviewed-on: https://go-review.googlesource.com/21326
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-31 04:55:58 +00:00
Ian Lance Taylor
b4117995e3 cmd/pprof: use DWARF info to lookup unknown PC addresses
Test to follow in a separate CL that arranges for the runtime package to
store non-Go addresses in a CPU profile.

Change-Id: I33ce1d66b77340b1e62b54505fc9b1abcec108a9
Reviewed-on: https://go-review.googlesource.com/21055
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2016-03-31 04:05:06 +00:00
Keith Randall
4b209dbf0b runtime: don't use REP;MOVSB if CPUID doesn't say it is fast
Only use REP;MOVSB if:
 1) The CPUID flag says it is fast, and
 2) The pointers are unaligned
Otherwise, use REP;MOVSQ.

Update #14630

Change-Id: I946b28b87880c08e5eed1ce2945016466c89db66
Reviewed-on: https://go-review.googlesource.com/21300
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-03-31 02:54:10 +00:00
Dave Cheney
1a9373bc57 cmd/compile/internal/gc: avoid append when building Type fields
As a followup to CL 21296, avoid append operations when constructing the
fields of a Type if the length is known beforehand

This also includes some small scoping driveby cleanups, and a change to
tointerface0 to avoid iterating over the field list twice.

compilebench shows a very small reduction in allocations.

 name      old time/op    new time/op    delta
Template     364ms ± 5%     363ms ± 4%    ~     (p=0.945 n=20+19)
Unicode      182ms ±11%     185ms ±12%    ~     (p=0.445 n=20+20)
GoTypes      1.14s ± 2%     1.14s ± 3%    ~     (p=0.221 n=20+20)
Compiler     5.85s ± 2%     5.84s ± 2%    ~     (p=0.369 n=20+20)

name      old alloc/op   new alloc/op   delta
Template    56.7MB ± 0%    56.7MB ± 0%  -0.04%  (p=0.000 n=20+20)
Unicode     38.3MB ± 0%    38.3MB ± 0%    ~     (p=0.728 n=20+19)
GoTypes      180MB ± 0%     180MB ± 0%  -0.02%  (p=0.000 n=20+20)
Compiler     812MB ± 0%     812MB ± 0%  -0.02%  (p=0.000 n=19+20)

name      old allocs/op  new allocs/op  delta
Template      482k ± 0%      480k ± 0%  -0.34%  (p=0.000 n=20+20)
Unicode       377k ± 0%      377k ± 0%  -0.04%  (p=0.010 n=20+20)
GoTypes      1.36M ± 0%     1.35M ± 0%  -0.24%  (p=0.000 n=20+20)
Compiler     5.47M ± 0%     5.46M ± 0%  -0.11%  (p=0.000 n=20+18)

Change-Id: Ibb4c40229fa3816acd8de98ba41d1571a2aabacf
Reviewed-on: https://go-review.googlesource.com/21352
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
2016-03-31 02:22:18 +00:00
Dave Cheney
ea5091fcd7 cmd/compile/internal/gc: don't let the argument to Fields.Set escape
Apply Robert's optimisation from CL 21241 to Type.Fields. The results
are less impressive, possibly because of the makeup of the test data.

name      old time/op    new time/op    delta
Template     365ms ± 5%     365ms ± 3%    ~     (p=0.888 n=20+16)
Unicode      182ms ±10%     180ms ± 9%    ~     (p=0.883 n=20+20)
GoTypes      1.14s ± 2%     1.13s ± 3%    ~     (p=0.096 n=20+20)
Compiler     5.74s ± 1%     5.76s ± 2%    ~     (p=0.369 n=20+20)

name      old alloc/op   new alloc/op   delta
Template    56.8MB ± 0%    56.7MB ± 0%  -0.15%  (p=0.000 n=19+20)
Unicode     38.3MB ± 0%    38.3MB ± 0%  -0.02%  (p=0.006 n=20+19)
GoTypes      180MB ± 0%     180MB ± 0%  -0.13%  (p=0.000 n=20+20)
Compiler     805MB ± 0%     804MB ± 0%  -0.05%  (p=0.000 n=20+20)

name      old allocs/op  new allocs/op  delta
Template      485k ± 0%      482k ± 0%  -0.54%  (p=0.000 n=19+20)
Unicode       377k ± 0%      377k ± 0%  -0.05%  (p=0.005 n=20+20)
GoTypes      1.37M ± 0%     1.36M ± 0%  -0.53%  (p=0.000 n=20+19)
Compiler     5.42M ± 0%     5.41M ± 0%  -0.21%  (p=0.000 n=20+20)

Change-Id: I6782659fadd605ce9931bf5c737c7058b96a29eb
Reviewed-on: https://go-review.googlesource.com/21296
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-31 00:40:11 +00:00
Nigel Tao
225b223e47 image/jpeg: reconstruct progressive images even if incomplete.
Fixes #14522.

As I said on that issue:

----
This is a progressive JPEG image. There are two dimensions of
progressivity: spectral selection (variables zs and ze in scan.go,
ranging in [0, 63]) and successive approximation (variables ah and al in
scan.go, ranging in [0, 8), from LSB to MSB, although ah=0 implicitly
means ah=8).

For this particular image, there are three components, and the SOS
markers contain this progression:

zs, ze, ah, al:  0  0 0 0	components: 0, 1, 2
zs, ze, ah, al:  1 63 0 0	components: 1
zs, ze, ah, al:  1 63 0 0	components: 2
zs, ze, ah, al:  1 63 0 2	components: 0
zs, ze, ah, al:  1 10 2 1	components: 0
zs, ze, ah, al: 11 63 2 1	components: 0
zs, ze, ah, al:  1 10 1 0	components: 0

The combination of all of these is complete (i.e. spectra 0 to 63 and
bits 8 exclusive to 0) for components 1 and 2, but it is incomplete for
component 0 (the luma component). In particular, there is no data for
component 0, spectra 11 to 63 and bits 1 exclusive to 0.

The image/jpeg code, as of Go 1.6, waits until both dimensions are
complete before performing the de-quantization, IDCT and copy to an
*image.YCbCr. This is the "if zigEnd != blockSize-1 || al != 0 { ...
continue }" code and associated commentary in scan.go.

Almost all progressive JPEG images end up complete in both dimensions
for all components, but this particular image is incomplete for
component 0, so the Go code never writes anything to the Y values of the
resultant *image.YCbCr, which is why the broken output is so dark (but
still looks recognizable in terms of red and blue hues).

My reading of the ITU T.81 JPEG specification (Annex G) doesn't
explicitly say that this is a valid image, but it also doesn't rule it
out.

In any case, the fix is, for progressive JPEG images, to always
reconstruct the decoded blocks (by performing the de-quantization, IDCT
and copy to an *image.YCbCr), regardless of whether or not they end up
complete. Note that, in Go, the jpeg.Decode function does not return
until the entire image is decoded, so we still only want to reconstruct
each block once, not once per SOS (Start Of Scan) marker.
----

A test image was also added, based on video-001.progressive.jpeg. When
decoding that image, inserting a

println("nComp, zs, ze, ah, al:", nComp, zigStart, zigEnd, ah, al)

into decoder.processSOS in scan.go prints:

nComp, zs, ze, ah, al: 3 0 0 0 1
nComp, zs, ze, ah, al: 1 1 5 0 2
nComp, zs, ze, ah, al: 1 1 63 0 1
nComp, zs, ze, ah, al: 1 1 63 0 1
nComp, zs, ze, ah, al: 1 6 63 0 2
nComp, zs, ze, ah, al: 1 1 63 2 1
nComp, zs, ze, ah, al: 3 0 0 1 0
nComp, zs, ze, ah, al: 1 1 63 1 0
nComp, zs, ze, ah, al: 1 1 63 1 0
nComp, zs, ze, ah, al: 1 1 63 1 0

In other words, video-001.progressive.jpeg contains 10 different scans.
This little program below drops half of them (remembering to keep the
"\xff\xd9" End of Image marker):

----
package main

import (
	"bytes"
	"io/ioutil"
	"log"
)

func main() {
	sos := []byte{0xff, 0xda}
	eoi := []byte{0xff, 0xd9}

	src, err := ioutil.ReadFile("video-001.progressive.jpeg")
	if err != nil {
		log.Fatal(err)
	}
	b := bytes.Split(src, sos)
	println(len(b)) // Prints 11.
	dst := bytes.Join(b[:5], sos)
	dst = append(dst, eoi...)
	if err := ioutil.WriteFile("video-001.progressive.truncated.jpeg", dst, 0666); err != nil {
		log.Fatal(err)
	}
}
----

The video-001.progressive.truncated.jpeg was converted to png via
libjpeg and ImageMagick:

djpeg -nosmooth video-001.progressive.truncated.jpeg > tmp.tga
convert tmp.tga video-001.progressive.truncated.png
rm tmp.tga

Change-Id: I72b20cd4fb6746d36d8d4d587f891fb3bc641f84
Reviewed-on: https://go-review.googlesource.com/21062
Reviewed-by: Rob Pike <r@golang.org>
2016-03-31 00:33:24 +00:00
Dave Cheney
0373128318 cmd/compile/internal/gc: don't iterate over field list twice
In tostruct0 and tofunargs we take a list of nodes, transform them into
a slice of Fields, set the fields on a type, then use the IterFields
iterator to iterate over the list again to see if any of them are
broken.

As we know the slice of fielde-we just created it-we can combine these two
interations into one pass over the fields.

Change-Id: I8b04c90fb32fd6c3b1752cfc607128a634ee06c5
Reviewed-on: https://go-review.googlesource.com/21350
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-31 00:21:37 +00:00
Matthew Dempsky
e76fc1b921 cmd/compile: use t.IsFoo() instead of Isfoo[t.Etype]
This allows us to get rid of Isptr and Issigned. Still some code to
clean up for Isint, Isfloat, and Iscomplex.

CL produced mechanically using gofmt -w -r.

Passes toolstash -cmp.

Change-Id: If4f807bb7f2b357288d2547be2380eb511875786
Reviewed-on: https://go-review.googlesource.com/21339
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-03-30 22:48:34 +00:00
Matthew Dempsky
3efefd9395 cmd/compile: use t.IsFoo() instead of t.Etype == TFOO
CL produced mechanically using gofmt -w -r.

Passes toolstash -cmp.

Change-Id: Ib2e8710ebd844e2149125b41c335b71a02fcab53
Reviewed-on: https://go-review.googlesource.com/21338
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-30 22:31:07 +00:00
Alexandru Moșoi
d8f1f8d856 cmd/compile: generalize strength reduction of mulq
* This is an improved version of an earlier patch.
* Verified with gcc up to 100.
* Limited to two instructions based on costs from
https://gmplib.org/~tege/x86-timing.pdf

Change-Id: Ib7c37de6fd8e0ba554459b15c7409508cbcf6728
Reviewed-on: https://go-review.googlesource.com/21103
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-30 22:27:13 +00:00
Matthew Dempsky
1624a9c9e7 cmd/compile: get rid of redundant Type helper functions
Replace Isfixedarray, Isslice, and Isinter with the IsArray, IsSlice,
and IsInterface methods added for SSA. Rewrite performed mechanically
using gofmt -w -r "Isfoo(t) -> t.IsFoo()".

Because the IsFoo methods panic when given a nil pointer, a handful of
call sites had to be modified to check for nil Type values. These
aren't strictly necessary, because nil Type values should only occur
in invalid Go source programs, so it would be okay if we panicked on
them and gave up type checking the rest of the package. However, there
are a couple regress tests that expect we continue, so add checks to
keep those tests passing. (See #15029.)

Passes toolstash -cmp.

Change-Id: I511c6ac4cfdf3f9cbdb3e52a5fa91b6d09d82f80
Reviewed-on: https://go-review.googlesource.com/21336
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-30 21:58:18 +00:00
Josh Bleecher Snyder
2592e0999e cmd/compile: s/typeX/typX/
Apparently I’m having a hard time following my
own naming scheme.

Change-Id: I99c801bef09fa65c1f0e8ecc2fba154a495e9c17
Reviewed-on: https://go-review.googlesource.com/21332
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
2016-03-30 21:22:09 +00:00
Josh Bleecher Snyder
8640b51df8 cmd/compile: add Type.Elem
This removes almost all direct access to
Type’s heavily overloaded Type field.

Mostly generated by eg, manually checked.

Significant manual changes:

* reflect.go's typPkg used Type indiscriminately.
  Use it only for specific etypes.
* gen.go's visitComponents contained a usage of Type
  with structs. Using Type for structs no longer
  occurs, and the Fatal contained therein has not triggered,
  so it has been axed.
* Scary code in cgen.go's cgen_slice is now explicitly scary.

Passes toolstash -cmp.

Change-Id: I2dbfb3c959da7ae239f964d83898c204affcabc6
Reviewed-on: https://go-review.googlesource.com/21331
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-30 21:21:55 +00:00
Josh Bleecher Snyder
76e72691a0 cmd/compile: add typMap
Also, add two uses of Key and Val that I missed earlier.
As before, direct writes to Down and Type remain in bimport.

Change-Id: I487aa975926b30092db1ad74ace17994697117c1
Reviewed-on: https://go-review.googlesource.com/21330
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-30 21:05:29 +00:00
Alexandru Moșoi
dc5a7682f0 cmd/compile: use inc/dec for bytes, too
Change-Id: Ib2890ab1983cbef7c1c1ee5a10204ba3ace19b53
Reviewed-on: https://go-review.googlesource.com/21312
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-30 20:18:16 +00:00
Brad Fitzpatrick
ca72f5f5df internal/testenv: prefer to find go binary in GOROOT
Partial revert of https://golang.org/cl/20967 which
I can't reproduce and actually breaks me more.

Fixes #14901

Change-Id: I8cce443fbd95f5f6f2a5b6a4b9f2faab36167a12
Reviewed-on: https://go-review.googlesource.com/21292
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-30 19:12:50 +00:00
Matthew Dempsky
788f11263a cmd/compile: rename Type.IsPtr to Type.IsPtrShaped
Previously, t.IsPtr() reported whether t was represented with a
pointer, but some of its callers expected it to report whether t is an
actual Go pointer. Resolve this by renaming t.IsPtr to t.IsPtrShaped
and adding a new t.IsPtr method to report Go pointer types.

Updated a couple callers in gc/ssa.go to use IsPtr instead of
IsPtrShaped.

Passes toolstash -cmp.

Updates #15028.

Change-Id: I0a8154b5822ad8a6ad296419126ad01a3d2a5dc5
Reviewed-on: https://go-review.googlesource.com/21232
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-03-30 19:11:16 +00:00
Josh Bleecher Snyder
fdf6761e01 cmd/compile: add typPtr
Passes toolstash -cmp.

Change-Id: I721348ed2122b6a9cd87ad2041b6ee3bf6b2bbb5
Reviewed-on: https://go-review.googlesource.com/21306
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-30 17:19:59 +00:00
Josh Bleecher Snyder
e3c7497327 cmd/compile: add typWrapper and Type.Wrapped
Passes toolstash -cmp.

Change-Id: I7dffd9bc5bab323590df6fb591bf1e73edf2e465
Reviewed-on: https://go-review.googlesource.com/21305
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-30 17:19:50 +00:00
Josh Bleecher Snyder
09c672d50a cmd/compile: add typChan
Passes toolstash -cmp.

Change-Id: I2c71882f957c44047c7ac83c78236dcc3dfa15a1
Reviewed-on: https://go-review.googlesource.com/21304
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-30 17:19:42 +00:00
Josh Bleecher Snyder
331f962508 cmd/compile: use IsSlice and IsArray instead of checking Bound
Changes generated by eg and manually checked.

Isfixedarray, Isslice, and many other
Type-related functions in subr.go should
either be deleted or moved to type.go.
Later, though; the game now is cleanup via encapsulation.

Passes toolstash -cmp.

Change-Id: I83dd8816f6263b74367d23c2719a08c362e330f9
Reviewed-on: https://go-review.googlesource.com/21303
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-30 17:18:29 +00:00
Alexandru Moșoi
d7f7ea6ea8 cmd/compile: ignore dead phis in fuse
Happens occasionally for boolean phis was used as a control.

Change-Id: Ie0f2483e9004c1706751d8dfb25ee2e5106d917e
Reviewed-on: https://go-review.googlesource.com/21310
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-30 15:37:18 +00:00
Joe Tsai
152a08c531 compress/gzip: fix error handling in Read
The Read logic should not assume that only (0, io.EOF) is returned
instead of (n, io.EOF) where n is positive.

The fix done here is very similar to the fix to compress/zlib
in CL/20292.

Change-Id: Icb76258cdcf8cfa386a60bab330fefde46fc071d
Reviewed-on: https://go-review.googlesource.com/21308
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-30 11:37:20 +00:00
kortschak
6b97dbf848 cmd/dist: make fortran test conditional on bash existence
Fixes #14929.

Change-Id: I0391acf9f5f65389f73637533306a7c4240320b8
Reviewed-on: https://go-review.googlesource.com/21295
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-30 11:35:40 +00:00
Joe Tsai
897dcdb5ec debug/elf: deflake file_test.go
It is valid for io.Reader to return (n, io.EOF) where n is positive.
The unit test should not fail if io.EOF is returned when read until
the end.

Change-Id: I7b918e3cc03db8b90c8aa58f4c0f7806a1d4af7e
Reviewed-on: https://go-review.googlesource.com/21307
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-30 06:56:25 +00:00
Michael Munday
354e9778a3 cmd/asm: add s390x support
s390x doesn't introduce any new assembly syntax. There are a few
instructions which require the operands to be reordered, notably
the storage-storage instructions that put the length into From3 so
that the memory operands can be put into From and To.

The assembly test currently covers a subset of instructions but
tries to hit edge cases as much as possible. Unlike the other ports
it can be linked as an executable to make disassembling it easy.
It would be nice to autogenerate it at some point in the future.

Change-Id: I8dd542c34b9e450b8129d46693a5acb0ded791ce
Reviewed-on: https://go-review.googlesource.com/21253
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-30 05:25:49 +00:00
Josh Bleecher Snyder
268c31870a cmd/compile: move substAny to type.go
substAny needs access to many internal details
of gc.Type. substArgTypes comes along for the ride.

Change-Id: I430a4edfd54a1266522f7a9818e5e7b5da72479c
Reviewed-on: https://go-review.googlesource.com/21250
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-30 05:23:11 +00:00
Michael Munday
0a85be573c cmd/internal/obj: add copyright header to files
Change-Id: I4ed33f3fdb9ad5f0f8984d3ef282c34e26eb2cde
Reviewed-on: https://go-review.googlesource.com/21301
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-30 05:01:49 +00:00
Michael Munday
13f97ea456 cmd/internal/obj/s390x: add s390x support
Based on the ppc64 port.

s390x supports 2, 4 and 6 byte instructions and Go assembly
instructions sometimes map to several s390x instructions. The
assembler loops until a fixed point is reached in order to use
branch instructions that can only handle a short offset in a
similar way to other ports.

Change-Id: I4278bf46aca35a96ca9cea0857e6229643c9c1e3
Reviewed-on: https://go-review.googlesource.com/20942
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-30 04:57:30 +00:00
Keith Randall
7fc5621991 cmd/compile: define high bits of AuxInt
Previously if we were only using the low bits of AuxInt,
the high bits were ignored and could be junk.  This CL
changes that behavior to define the high bits to be the
sign-extended version of the low bits for all cases.

There are 2 main benefits:
- Deterministic representation.  This helps with CSE.
  (Const8 [0x1]) and (Const8 [0x101]) used to be the same "value"
  but CSE couldn't see them as such.
- Testability.  We can check that all ops leave AuxInt in a state
  consistent with the new rule.  In the old scheme, it was hard
  to check whether a rule correctly used only the low-order bits.
Side benefits:
- ==0 and !=0 tests are easier.

Drawbacks:
- This differs from the runtime representation in registers,
  where it is important that we allow upper bits to be undefined
  (so we're not sign/zero-extending all the time).
- Ops that treat AuxInt as unsigned (shifts, mostly) need to be
  a bit more careful.

Change-Id: I9a685ff27e36dc03287c9ab1cecd6c0b4045c819
Reviewed-on: https://go-review.googlesource.com/21256
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-03-30 04:48:28 +00:00
Brad Fitzpatrick
18072adbca net/http: reuse HTTP/1 Transport conns more for gzipped responses
Flip around the composition order of the http.Response.Body's
gzip.Reader vs. the reader which keeps track of waiting to see the end
of the HTTP/1 response framing (whether that's a Content-Length or
HTTP/1.1 chunking).

Previously:

user -> http.Response.Body
     -> bodyEOFSignal
     -> gzipReader
     -> gzip.Reader
     -> bufio.Reader
   [ -> http/1.1 de-chunking reader ]   optional
     -> http1 framing *body

But because bodyEOFSignal was waiting to see an EOF from the
underlying gzip.Reader before reusing the connection, and gzip.Reader
(or more specifically: the flate.Reader) wasn't returning an early
io.EOF with the final chunk, the bodyEOfSignal was never releasing the
connection, because the EOF from the http1 framing was read by a party
who didn't care about it yet: the helper bufio.Reader created to do
byte-at-a-time reading in the flate.Reader.

Flip the read composition around to:

user -> http.Response.Body
     -> gzipReader
     -> gzip.Reader
     -> bufio.Reader
     -> bodyEOFSignal
   [ -> http/1.1 de-chunking reader ]   optional
     -> http1 framing *body

Now when gzip.Reader does its byte-at-a-time reading via the
bufio.Reader, the bufio.Reader will do its big reads against the
bodyEOFSignal reader instead, which will then see the underlying http1
framing EOF, and be able to reuse the connection.

Updates google/go-github#317
Updates #14867
And related abandoned fix to flate.Reader: https://golang.org/cl/21290

Change-Id: I3729dfdffe832ad943b84f4734b0f59b0e834749
Reviewed-on: https://go-review.googlesource.com/21291
Reviewed-by: David Symonds <dsymonds@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-30 04:31:13 +00:00
Shahar Kohanim
7f067c87d8 cmd/compile, cmd/link: record lengths in object file
Record total number of relocations, pcdata, automatics, funcdata and files in
object file and use these numbers in the linker to allocate contiguous
slices to later be filled by the defined symbols.

name       old secs    new secs    delta
LinkCmdGo   0.52 ± 3%   0.49 ± 3%  -4.21%   (p=0.000 n=91+92)
LinkJuju    4.48 ± 4%   4.21 ± 7%  -6.08%  (p=0.000 n=96+100)

name       old MaxRSS  new MaxRSS  delta
LinkCmdGo   122k ± 2%   120k ± 4%  -1.66%   (p=0.000 n=98+93)
LinkJuju    799k ± 5%   865k ± 8%  +8.29%   (p=0.000 n=89+99)

GOGC=off

name       old secs    new secs    delta
LinkCmdGo   0.42 ± 2%   0.41 ± 0%  -2.98%    (p=0.000 n=89+70)
LinkJuju    3.61 ± 0%   3.52 ± 1%  -2.46%    (p=0.000 n=80+89)

name       old MaxRSS  new MaxRSS  delta
LinkCmdGo   130k ± 1%   128k ± 1%  -1.33%  (p=0.000 n=100+100)
LinkJuju   1.00M ± 0%  0.99M ± 0%  -1.70%  (p=0.000 n=100+100)

Change-Id: Ie08f6ccd4311bb78d8950548c678230a58635c73
Reviewed-on: https://go-review.googlesource.com/21026
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-30 03:44:41 +00:00
Ian Lance Taylor
777a77b4d2 cmd/compile: don't skip PPARAMOUT in esccall after varargs
Fixes bug I introduced in CL 21202.

Fixes #15013.

Change-Id: I2344d7e22b8273425a0a56f4a77588b5c6e4d8c6
Reviewed-on: https://go-review.googlesource.com/21270
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-30 02:43:08 +00:00
Austin Clements
17f6e5396b runtime: print sweep ratio if gcpacertrace>0
Change-Id: I5217bf4b75e110ca2946e1abecac6310ed84dad5
Reviewed-on: https://go-review.googlesource.com/21205
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
2016-03-30 02:27:58 +00:00
Alex Brainman
9cc22a7f1f net: skip TestInterfacesWithNetsh if "netsh help" contains no English words
Fixes #14859

Change-Id: I262d634ee22498ec9855d273afdd409149765294
Reviewed-on: https://go-review.googlesource.com/21195
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-30 01:51:23 +00:00
Philip Hofer
c12a0e645a cmp/compile: rewrite CMP $0 with TEST
The CMP* family of instructions are longer than their TEST counterparts by one byte.

After this change, my go tool has 13 cmp.*$0x0 instructions, compared to 5612 before.

Change-Id: Ieb87d65657917e494c0e4b711a7ba2918ae27610
Reviewed-on: https://go-review.googlesource.com/21255
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-30 00:50:53 +00:00
Martin Möhrmann
aec8e14589 fmt: fix padding for 0 precision 0 integer value formatting
Fixes #14924

Change-Id: I098ef973e2cad76a121704492758c2971a9b55f3
Reviewed-on: https://go-review.googlesource.com/20920
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-30 00:44:01 +00:00
Martin Möhrmann
d175a85c5c fmt: improve handling of zero padding
Simplify the handling of zero padding in fmt_integer and
fmt_float to not require any adjustment of the format flags.

Note that f.zero can only be true when padding to the left
and f.wid is always greater than or equal to 0.

Change-Id: I204b57d103c0eac13d86995992f2b26209196925
Reviewed-on: https://go-review.googlesource.com/21185
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-30 00:40:01 +00:00
Aliaksandr Valialkin
72a1b53b67 cmd/vet: allow lock types inside built-in new()
Updates #14839
Fixes #14994

Change-Id: I9bb51bad19105a17c80d690c5486e5dd007ac84a
Reviewed-on: https://go-review.googlesource.com/21222
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-30 00:16:48 +00:00
Josh Bleecher Snyder
eb98e51563 cmd/compile: add typArray, typSlice, and typDDDArray
These are the first of several convenience
constructors for types.

They are part of type field encapsulation.
This removes most external writes to TARRAY Type and Bound fields.

substAny still directly fiddles with the .Type field.
substAny generally needs access to Type internals.
It will be moved to type.go in a future CL.

bimport still directly writes the .Type field.
This is hard to change.

Also of note:

* inl.go contains an (apparently irrelevant) bug fix:
  as.Right was given the wrong type.
  vararrtype was previously unused.
* I believe that aindex (subr.go) never creates slices,
  but it is safer to keep existing behavior.
  The removal of -1 as a constant there is part
  of hiding that implementation detail.
  Future CLs will finish that job.

Passes toolstash -cmp.

Change-Id: If09bf001a874d7dba08e9ad0bcd6722860af4b91
Reviewed-on: https://go-review.googlesource.com/21249
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-29 23:48:24 +00:00
Josh Bleecher Snyder
f32161daf8 cmd/compile: make only one new Node in defaultlit
defaultlit and friends sometimes create a new
OLITERAL node, only to have replace it.
Thread hints when that is unnecessary.

name       old time/op     new time/op     delta
Template       318ms ± 6%      322ms ± 4%     ~           (p=0.154 n=24+25)
Unicode        162ms ± 6%      151ms ± 7%   -6.94%        (p=0.000 n=22+23)
GoTypes        1.04s ± 1%      1.04s ± 3%     ~           (p=0.136 n=20+25)
Compiler       5.08s ± 2%      5.10s ± 4%     ~           (p=0.788 n=25+25)
MakeBash       41.4s ± 1%      41.5s ± 1%     ~           (p=0.084 n=25+25)

name       old user-ns/op  new user-ns/op  delta
Template        438M ±10%       441M ± 9%     ~           (p=0.418 n=25+25)
Unicode         272M ± 5%       219M ± 5%  -19.33%        (p=0.000 n=24+21)
GoTypes        1.51G ± 3%      1.51G ± 3%     ~           (p=0.500 n=25+25)
Compiler       7.31G ± 3%      7.32G ± 3%     ~           (p=0.572 n=25+24)

name       old alloc/op    new alloc/op    delta
Template      57.3MB ± 0%     57.2MB ± 0%   -0.16%        (p=0.000 n=25+25)
Unicode       41.1MB ± 0%     38.7MB ± 0%   -5.81%        (p=0.000 n=25+25)
GoTypes        191MB ± 0%      191MB ± 0%   -0.06%        (p=0.000 n=25+25)
Compiler       840MB ± 0%      839MB ± 0%   -0.12%        (p=0.000 n=25+25)

name       old allocs/op   new allocs/op   delta
Template        500k ± 0%       500k ± 0%   -0.12%        (p=0.000 n=24+25)
Unicode         400k ± 0%       384k ± 0%   -4.16%        (p=0.000 n=25+25)
GoTypes        1.50M ± 0%      1.49M ± 0%   -0.05%        (p=0.000 n=25+25)
Compiler       6.04M ± 0%      6.03M ± 0%   -0.11%        (p=0.000 n=25+25)

Change-Id: I2fda5e072db67ba239848bde827c7deb2ad4abae
Reviewed-on: https://go-review.googlesource.com/20813
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-29 23:47:48 +00:00
Aliaksandr Valialkin
ee1b90ad2c cmd/vet: improve detecting printf-like format argument
Previously format argument was detected via scanning func type args.
This didn't work when func type couldn't be determined if the func
is declared in the external package. Fall back to scanning for
the first string call argument in this case.

Fixes #14754

Change-Id: I571cc29684cc641bc87882002ef474cf1481e9e2
Reviewed-on: https://go-review.googlesource.com/21023
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-29 23:40:52 +00:00
Michael Munday
12fb62a57d debug/elf: add s390x relocations
Change-Id: I8440f69c7f99d65b2f69035c26b4a62104f22bd3
Reviewed-on: https://go-review.googlesource.com/20874
Reviewed-by: Minux Ma <minux@golang.org>
2016-03-29 16:48:09 +00:00
Marvin Stenger
d0fb649713 all: use &^ operator if possible
This is a change improving consistency in the source tree.
The pattern foo &= ^bar, was only used six times in src/ directory.
The usage of the supported &^ (bit clear / AND NOT) operator is way more
common, about factor 10x.

Change-Id: If26a2994fd81d23d42189bee00245eb84e672cf3
Reviewed-on: https://go-review.googlesource.com/21224
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-29 14:28:41 +00:00
Alexandre Cesaro
d733cef728 mime: fix maximum length of encoded-words
RFC 2047 recommends a maximum length of 75 characters for
encoded-words. Due to a bug, encoded-words were limited to 77
characters instead of 75.

Change-Id: I2ff9d013ab922df6fd542464ace70b1c46dc7ae7
Reviewed-on: https://go-review.googlesource.com/20918
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-29 11:19:31 +00:00
Shahar Kohanim
1b6402ea9d cmd/link: remove some more dead fields from Pcln
Change-Id: Ibb98de29d84a605fb1588c7dc11ad66e3965a137
Reviewed-on: https://go-review.googlesource.com/21223
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
2016-03-29 11:12:45 +00:00
Klaus Post
42ad1dc01e compress/flate: add pure huffman deflater
Add a "HuffmanOnly" compression level, where the input is
only entropy encoded.

The output is fully inflate compatible. Typical compression
is reduction is about 50% of typical level 1 compression, however
the compression time is very stable, and does not vary as much as
nearly as much level 1 compression (or Snappy).

This mode is useful for:
 * HTTP compression in a CPU limited environment.
 * Entropy encoding Snappy compressed data, for archiving, etc.
 * Compression where compression time needs to be predictable.
 * Fast network transfer.

Snappy "usually" performs inbetween this and level 1 compression-wise,
but at the same speed as "Huffman", so this is not a replacement,
but a good supplement for Snappy, since it usually can compress
Snappy output further.

This is implemented as level -2, since this would be too much of a
compression reduction to replace level 1.

>go test -bench=Encode -cpu=1
BenchmarkEncodeDigitsHuffman1e4            30000             52334 ns/op         191.08 MB/s
BenchmarkEncodeDigitsHuffman1e5             3000            518343 ns/op         192.92 MB/s
BenchmarkEncodeDigitsHuffman1e6              300           5356884 ns/op         186.68 MB/s
BenchmarkEncodeDigitsSpeed1e4               5000            324214 ns/op          30.84 MB/s
BenchmarkEncodeDigitsSpeed1e5                500           3952614 ns/op          25.30 MB/s
BenchmarkEncodeDigitsSpeed1e6                 30          40760350 ns/op          24.53 MB/s
BenchmarkEncodeDigitsDefault1e4             5000            387056 ns/op          25.84 MB/s
BenchmarkEncodeDigitsDefault1e5              300           5950614 ns/op          16.80 MB/s
BenchmarkEncodeDigitsDefault1e6               20          63842195 ns/op          15.66 MB/s
BenchmarkEncodeDigitsCompress1e4            5000            391859 ns/op          25.52 MB/s
BenchmarkEncodeDigitsCompress1e5             300           5707112 ns/op          17.52 MB/s
BenchmarkEncodeDigitsCompress1e6              20          59839465 ns/op          16.71 MB/s
BenchmarkEncodeTwainHuffman1e4             20000             73498 ns/op         136.06 MB/s
BenchmarkEncodeTwainHuffman1e5              2000            595892 ns/op         167.82 MB/s
BenchmarkEncodeTwainHuffman1e6               200           6059016 ns/op         165.04 MB/s
BenchmarkEncodeTwainSpeed1e4                5000            321212 ns/op          31.13 MB/s
BenchmarkEncodeTwainSpeed1e5                 500           2823873 ns/op          35.41 MB/s
BenchmarkEncodeTwainSpeed1e6                  50          27237864 ns/op          36.71 MB/s
BenchmarkEncodeTwainDefault1e4              3000            454634 ns/op          22.00 MB/s
BenchmarkEncodeTwainDefault1e5               200           6859537 ns/op          14.58 MB/s
BenchmarkEncodeTwainDefault1e6                20          71547405 ns/op          13.98 MB/s
BenchmarkEncodeTwainCompress1e4             3000            462307 ns/op          21.63 MB/s
BenchmarkEncodeTwainCompress1e5              200           7534992 ns/op          13.27 MB/s
BenchmarkEncodeTwainCompress1e6               20          80353365 ns/op          12.45 MB/s
PASS
ok      compress/flate  55.333s

Change-Id: I8e12ad13220e50d4cf7ddba6f292333efad61b0c
Reviewed-on: https://go-review.googlesource.com/20982
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-03-29 09:34:52 +00:00
Brad Fitzpatrick
45d334ecf1 net/http/cgi: allow CGI host to configure where child's stderr goes
Patch originally from Steven Hartland. Tweaked a bit & added a test.

Fixes #7197

Change-Id: I09012b4674e7c641dba31a24e9758cedb898d3ee
Reviewed-on: https://go-review.googlesource.com/21196
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-29 06:57:05 +00:00
Josh Bleecher Snyder
093a9a1f56 cmd/compile: encapsulate map value type
Passes toolstash -cmp.

Change-Id: I83af544974e1e91e0810e13321afb3e665dcdf12
Reviewed-on: https://go-review.googlesource.com/21248
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-29 05:26:32 +00:00
Josh Bleecher Snyder
bf5f24b98e cmd/compile: use t.Key() instead of t.Down
This was the only unconverted instance.

Change-Id: Ic0ba75824614fcd1e055316e62e26acd06801dd1
Reviewed-on: https://go-review.googlesource.com/21247
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-29 05:08:43 +00:00
Alex Brainman
98047376fb path/filepath: use fsutil with TestEvalSymlinksCanonicalNames
TestEvalSymlinksCanonicalNames fails on system where 8dot3 name creation
is disabled. Add new test that temporarily changes 8dot3 name creation
file system setting and runs TestEvalSymlinksCanonicalNames under that
setting. New test requires administrator access and modifies important
file system setting, so don't run the test unless explicitly requested
by specifying new test flag.

Updates #13980

Change-Id: I598b5b956e6bd0ed556e79d350cb244808c89c0b
Reviewed-on: https://go-review.googlesource.com/20863
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-29 05:02:40 +00:00
Matthew Dempsky
da19a0cff4 cmd/compile: fix plan9-amd64 build
The previous rules to combine indexed loads produced addresses like:

    From: obj.Addr{
        Type:   TYPE_MEM,
        Reg:    REG_CX,
        Name:   NAME_AUTO,
        Offset: 121,
        ...
    }

which are erroneous because NAME_AUTO implies a base register of
REG_SP, and cmd/internal/obj/x86 makes many assumptions to this
effect.  Note that previously we were also producing an extra "ADDQ
SP, CX" instruction, so indexing off of SP was already handled.

The approach taken by this CL to address the problem is to instead
produce addresses like:

    From: obj.Addr{
        Type:   TYPE_MEM,
        Reg:    REG_SP,
        Name:   NAME_AUTO,
        Offset: 121,
        Index:  REG_CX,
        Scale:  1,
    }

and to omit the "ADDQ SP, CX" instruction.

Downside to this approach is it requires adding a lot of new
MOV[WLQ]loadidx1 instructions that nearly duplicate functionality of
the existing MOV[WLQ]loadidx[248] instructions, but with a different
Scale.

Fixes #15001.

Change-Id: Iad9a1a41e5e2552f8d22e3ba975e4ea0862dffd2
Reviewed-on: https://go-review.googlesource.com/21245
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-29 03:22:06 +00:00
Michel Lespinasse
859b63cc09 cmd/compile: optimize remaining convT2I calls
See #14874
Updates #6853

This change adds a compiler optimization for non pointer shaped convT2I.
Since itab symbols are now emitted by the compiler, the itab address can
be passed directly to convT2I instead of passing the iface type and a
cache pointer argument.

Compilebench results for the 5-commits series ending here:

name       old time/op     new time/op     delta
Template       336ms ± 4%      344ms ± 4%   +2.61%          (p=0.027 n=9+8)
Unicode        165ms ± 6%      173ms ± 7%   +5.11%          (p=0.014 n=9+9)
GoTypes        1.09s ± 1%      1.06s ± 2%   -3.29%          (p=0.000 n=9+9)
Compiler       5.09s ±10%      4.75s ±10%   -6.64%        (p=0.011 n=10+10)
MakeBash       31.1s ± 5%      30.3s ± 3%     ~           (p=0.089 n=10+10)

name       old text-bytes  new text-bytes  delta
HelloSize       558k ± 0%       558k ± 0%   +0.02%        (p=0.000 n=10+10)
CmdGoSize      6.24M ± 0%      6.11M ± 0%   -2.11%        (p=0.000 n=10+10)

name       old data-bytes  new data-bytes  delta
HelloSize      3.66k ± 0%      3.74k ± 0%   +2.41%        (p=0.000 n=10+10)
CmdGoSize       134k ± 0%       162k ± 0%  +20.76%        (p=0.000 n=10+10)

name       old bss-bytes   new bss-bytes   delta
HelloSize       126k ± 0%       126k ± 0%     ~     (all samples are equal)
CmdGoSize       149k ± 0%       146k ± 0%   -2.17%        (p=0.000 n=10+10)

name       old exe-bytes   new exe-bytes   delta
HelloSize       924k ± 0%       924k ± 0%   +0.05%        (p=0.000 n=10+10)
CmdGoSize      9.77M ± 0%      9.62M ± 0%   -1.47%        (p=0.000 n=10+10)

Change-Id: Ib230ddc04988824035c32287ae544a965fedd344
Reviewed-on: https://go-review.googlesource.com/20902
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Michel Lespinasse <walken@google.com>
2016-03-29 02:21:50 +00:00
Michel Lespinasse
7427f2c4bd cmd/compile: optimize convT2I as a two-word copy when T is pointer-shaped
See #14874

This change adds a compiler optimization for pointer shaped convT2I.
Since itab symbols are now emitted by the compiler, the itab address can
be directly moved into the iface structure.

Change-Id: I311483af544519ca682c5f872960717ead772f26
Reviewed-on: https://go-review.googlesource.com/20901
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-29 02:21:41 +00:00
Michel Lespinasse
79688ca58f cmd/link: collect itablinks as a slice in moduledata
See #14874

This change tells the linker to collect all the itablink symbols and
collect them so that moduledata can have a slice of all compiler
generated itabs.

The logic is shamelessly adapted from what is done with typelink symbols.

Change-Id: Ie93b59acf0fcba908a876d506afbf796f222dbac
Reviewed-on: https://go-review.googlesource.com/20889
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-29 02:18:56 +00:00
Michel Lespinasse
f00bbd5f81 cmd/compile: emit itabs and itablinks
See #14874

This change tells the compiler to emit itab and itablink symbols in
situations where they could be useful; however the compiled code does
not actually make use of the new symbols yet.

Change-Id: I0db3e6ec0cb1f3b7cebd4c60229e4a48372fe586
Reviewed-on: https://go-review.googlesource.com/20888
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Michel Lespinasse <walken@google.com>
2016-03-29 02:18:03 +00:00
Michel Lespinasse
7043d2bb5e runtime: insert itabs into hash table during init
See #14874

This change makes the runtime register all compiler generated itabs
(as obtained from the moduledata) during init.

Change-Id: I9969a0985b99b8bda820a631f7fe4c78f1174cdf
Reviewed-on: https://go-review.googlesource.com/20900
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Michel Lespinasse <walken@google.com>
2016-03-29 02:14:49 +00:00
Matthew Dempsky
deb83d0639 cmd/compile: remove unused write barrier helpers
These have been unused since CL 10316.

Passes toolstash -cmp.

Change-Id: Icc19f3fcc7275fbee1c665f704e10a110ecce2a5
Reviewed-on: https://go-review.googlesource.com/21242
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2016-03-29 00:16:55 +00:00
Josh Bleecher Snyder
361b334cbd cmd/compile: encapsulate Type.Argwid
Passes toolstash -cmp.

Change-Id: I72fb271052e449a83adfa9bd3b923d40781d6341
Reviewed-on: https://go-review.googlesource.com/21243
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-29 00:08:56 +00:00
Richard Miller
1f0bebcc72 syscall: fix accidental close of exec status pipe in StartProcess
In syscall.forkAndExecInChild, blocks of code labelled Pass 1
and Pass 2 permute the file descriptors (if necessary) which are
passed to the child process.  If Pass 1 begins with fds = {0,2,1},
nextfd = 4 and pipe = 4, then the statement labelled "don't stomp
on pipe" is too late -- the pipe (which will be needed to pass
exec status back to the parent) will have been closed by the
preceding DUP call.

Moving the "don't stomp" test earlier ensures that the pipe is
protected.

Fixes #14979

Change-Id: I890c311527f6aa255be48b3277c1e84e2049ee22
Reviewed-on: https://go-review.googlesource.com/21184
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-29 00:03:14 +00:00
Josh Bleecher Snyder
272df158ac cmd/compile: clean up ... Bound marker
This mostly a mechanical change.
However, the change in assignop (subr.go) is a bug fix.
The code didn’t match the comment,
and the comment was correct.
Nevertheless, this CL passes toolstash -cmp.

The last direct reference to dddBound outside
type.go (in typecheck.go) will go away
in a future CL.

Change-Id: Ifb1691e0a07f906712c18c4a4cd23060807a5da5
Reviewed-on: https://go-review.googlesource.com/21235
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-28 23:33:30 +00:00
Raul Silvera
fcd2a06ab6 cmd/pprof/internal: use and accept packed encoding for repeated fields
Packed encoding is the default on the proto3 format. Profiles generated
in the profile.proto format by third parties cannot be decoded by the
Go pprof tool, since its proto decoder does not recognize packed
encoding for repeated fields.

In particular this issue prevents go tool pprof from reading profiles
generated by the version of pprof in github.com/google/pprof

Profiles generated by go tool pprof after this change will use packed
repeating fields, so older versions of pprof will not be able to read
them. pprof will continue to be able to read profiles generated before
this change.

Change-Id: Ife0b353a535ae1e495515b9bcec588dd967e171b
Reviewed-on: https://go-review.googlesource.com/21240
Reviewed-by: David Symonds <dsymonds@golang.org>
Run-TryBot: David Symonds <dsymonds@golang.org>
2016-03-28 22:55:20 +00:00
Robert Griesemer
621aa713d4 cmd/compile: avoid allocation in Nodes.Set in common case
When building make.bash, calling Nodes.Set(s) where len(s) == 0 occurs
4738678 times vs 1465415 calls where len(s) > 0; i.e., it is over 3x
more common to set Nodes.slice to nil rather than to s.

Make a copy of slice (header) and take address of that copy instead
to avoid allocating the argument slice on the heap always even when
not needed.

Saves 4738678 slice header allocations and slice header value copies.

Change-Id: I88e8e919ea9868ceb2df46173d187af4109bd947
Reviewed-on: https://go-review.googlesource.com/21241
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-28 21:41:11 +00:00
Matthew Dempsky
390d1ce686 cmd/compile: simplify substAny's TSTRUCT case
Now that structs use a slice to store their fields, this code can be
simplified somewhat.

Passes toolstash -cmp.

Change-Id: If17b1c89871fa06f34938fa67df0f8c6bcf1a86b
Reviewed-on: https://go-review.googlesource.com/21219
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-28 21:07:05 +00:00
Keith Randall
7294ccb54e cmd/compile: join indexed byte loads into larger loads
Fixes #14920

Change-Id: I1535dc529779e26141d92d9e2b6ba7b016590c1a
Reviewed-on: https://go-review.googlesource.com/21005
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
Reviewed-by: Ahmed Waheed <oneofone@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
2016-03-28 20:27:58 +00:00
Matthew Dempsky
810799a16d Revert "cmd/asm: add s390x support"
This reverts commit 85bbabd9c4.

The reverted CL broke all builds, because it depends on other CLs
that haven't been reviewed or landed yet.

Change-Id: I936f969431e0ac77133e43de2bf63042cef6b777
Reviewed-on: https://go-review.googlesource.com/21238
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
2016-03-28 20:22:08 +00:00
Matthew Dempsky
1b2fbb49c8 cmd/compile: cleanup alg.go for Field slices
Passes toolstash -cmp.

Change-Id: Ie41d7e74847c44a8fd174731374339c6c32b1460
Reviewed-on: https://go-review.googlesource.com/21231
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-28 20:13:59 +00:00
Matthew Dempsky
62dddd4770 cmd/compile: rename Field's Width field to Offset
gorename -from '"cmd/compile/internal/gc".Field.Width' -to Offset

Passes toolstash -cmp.

Change-Id: I310538a1f60bbab470a6375e813e9d5eb52c5bbf
Reviewed-on: https://go-review.googlesource.com/21230
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-28 20:13:51 +00:00
Michael Munday
85bbabd9c4 cmd/asm: add s390x support
s390x doesn't introduce any new assembly syntax. There are a few
instructions which require the operands to be reordered, notably
the storage-storage instructions that put the length into From3 so
that the memory operands can be put into From and To.

The assembly test currently covers a subset of instructions but
tries to hit edge cases as much as possible. Unlike the other ports
it can be linked as an executable to make disassembling it easy.
It would be nice to autogenerate it at some point in the future.

Change-Id: I7615ac6ecf239e3f347fad9ae1f8eede91742859
Reviewed-on: https://go-review.googlesource.com/20934
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-28 20:13:17 +00:00
Josh Bleecher Snyder
cabf73ffb8 cmd/compile: add EType.String and missing EType names
Passes toolstash -cmp.

Change-Id: Icc387eb557d5029e903923a051b565812fd2246b
Reviewed-on: https://go-review.googlesource.com/21234
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-28 18:44:07 +00:00
Shinji Tanaka
0f86d1edfb runtime: use set_thread_area instead of modify_ldt on linux/386
linux/386 depends on modify_ldt system call, but recent Linux kernels
can disable this system call. Any Go programs built as linux/386
crash with the message 'Trace/breakpoint trap'.

The kernel config CONFIG_MODIFY_LDT_SYSCALL, which control
enable/disable modify_ldt, is disabled on Amazon Linux 2016.03.

This fixes this problem by using set_thread_area instead of modify_ldt
on linux/386.

Fixes #14795.

Change-Id: I0cc5139e40e9e5591945164156a77b6bdff2c7f1
Reviewed-on: https://go-review.googlesource.com/21190
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Minux Ma <minux@golang.org>
2016-03-28 16:56:38 +00:00
Marvin Stenger
2326c24cc7 cmd/internal/obj: convert fields of LSym from uint8 to bool
No performance regression measurable:

name      old time/op    new time/op    delta
Template     432ms ± 3%     422ms ± 2%  -2.34%   (p=0.010 n=10+9)
GoTypes      1.46s ± 1%     1.46s ± 1%    ~     (p=0.796 n=10+10)
Compiler     7.15s ± 1%     7.14s ± 1%    ~      (p=0.447 n=10+9)

Change-Id: I21b93cb989017b6fec2215de2423d87f25cf538c
Reviewed-on: https://go-review.googlesource.com/21220
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-28 16:32:59 +00:00
David Chase
8eec2bbfbc cmd/compile: added some intrinsics to SSA back end
One intrinsic was needed to help get the very best
performance out of a future GC; as long as that one was
being added, I also added Bswap since that is sometimes
a handy thing to have.  I had intended to fill out the
bit-scan intrinsic family, but the mismatch between the
"scan forward" instruction and "count leading zeroes"
was large enough to cause me to leave it out -- it poses
a dilemma that I'd rather dodge right now.

These intrinsics are not exposed for general use.
That's a separate issue requiring an API proposal change
( https://github.com/golang/proposal )

All intrinsics are tested, both that they are substituted
on the appropriate architecture, and that they produce the
expected result.

Change-Id: I5848037cfd97de4f75bdc33bdd89bba00af4a8ee
Reviewed-on: https://go-review.googlesource.com/20564
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-28 16:29:59 +00:00
Shahar Kohanim
2e90192b0e cmd/link: refactor symbol lookup
Calling the read only Linkrlookup will now not cause the name
string to escape. So a lookup can be performed on a []byte
casted to a string without allocating. This will help a followup
cl and it is also much simpler and cleaner.
Performance not impacted by this.

name       old s/op   new s/op   delta
LinkCmdGo  0.51 ± 6%  0.51 ± 5%   ~     (p=0.192 n=98+98)

Change-Id: I7846ba3160eb845a3a29cbf0be703c47369ece16
Reviewed-on: https://go-review.googlesource.com/21187
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-28 16:09:54 +00:00
Ian Lance Taylor
7e88826a69 cmd/compile: clear OTFUNC info when converting to OTYPE
I want to get rid of OTFUNC, which serves no useful purpose.  However,
it turns out that the escape analysis pass looks at the node slices set
up for OTFUNC, even though by the time escape analysis runs the OTFUNC
has been converted to OTYPE.  This CL converts the escape analysis code
to look at the function decls instead, and clears the OTFUNC info when
converting to OTYPE to ensure that nothing else looks at it.

Change-Id: I3f2f5997ea8ea7a127a858e94b20aabfab84a5bf
Reviewed-on: https://go-review.googlesource.com/21202
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-28 14:10:21 +00:00
Dominik Honnef
aa482f9715 cmd/go: remove code specific to Google Code
Remove all special handling of Google Code, which has shut down.

Commit 4ec2fd3e6a suggested that maybe the
shutdown warning should remain. However, it has been missing from Go 1.6
already, and by Go 1.7 people will most likely have realised that Google
Code has shut down.

Updates #10193.

Change-Id: I5749bbbe2fe3b07cff4edd20303bbedaeaa8d77b
Reviewed-on: https://go-review.googlesource.com/21189
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-28 05:37:04 +00:00
Martin Möhrmann
9149aa10cc fmt: unify array and slice formatting for bytes and other types
Make verbs b,c,o and U work for any array and slice of integer
type including byte and uint8.

Fix a bug that triggers badverb for []uint8 and []byte type
on the slice/array level instead of on each element like for
any other slice or array type.

Add tests that make sure we do not accidentally alter the
behavior of printing []byte for []byte and []uint8 type
if they are used at the top level when formatting with %#v.

name               old time/op  new time/op  delta
SprintfHexBytes-2   177ns ± 2%   176ns ± 2%   ~     (p=0.066 n=48+49)
SprintfBytes-2      330ns ± 1%   329ns ± 1%   ~     (p=0.118 n=45+47)

Fixes #13478

Change-Id: I99328a184973ae219bcc0f69c3978cb1ff462888
Reviewed-on: https://go-review.googlesource.com/20686
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-27 21:34:20 +00:00
Josh Bleecher Snyder
a637717e7d cmd/compile: rename T_old_DARRAY and update comments
Change-Id: Ifa3b1b1e5458e4f109828a476d37f1caf96fe14b
Reviewed-on: https://go-review.googlesource.com/21211
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-27 20:38:56 +00:00
Josh Bleecher Snyder
fcca9d265c cmd/compile: remove pointless conversions in copytype
Passes toolstash -cmp.

Change-Id: I8b000d4e90e6aa1a0e60bd46fb7cba2ddc1774b5
Reviewed-on: https://go-review.googlesource.com/21210
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-27 19:52:36 +00:00
Matthew Dempsky
995fb0319e cmd/compile: fix stringtoslicebytetmp optimization
Fixes #14973.

Change-Id: Iea68c9deca9429bde465c9ae05639209fe0ccf72
Reviewed-on: https://go-review.googlesource.com/21175
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-27 19:12:37 +00:00
Dominik Honnef
4ffa5eb876 cmd/vet: don't treat fields like variables in rangeloop check
Fixes #13236

Change-Id: If902ac66718e0a0790fab9835921ce4ef980965b
Reviewed-on: https://go-review.googlesource.com/21183
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-27 05:31:54 +00:00
Martin Möhrmann
d170d3edd7 fmt: cleanup reflect value handling
Merge printReflectValue into printValue. Determine if handleMethods
was already called in printArg by checking if depth is 0. Do not
call handleMethods on depth 0 again in printValue to not introduce
a performance regression. handleMethods is called already in printArg
to not introduce a performance penalty for top-level Stringer,
GoStringer, Errors and Formatters by using reflect.ValueOf on them
just to retrieve them again as interface{} values in printValue.

Clear p.arg in printValue after handleMethods to print the type
of the value inside the reflect.Value when a bad verb is encountered
on the top level instead of printing "reflect.Value=" as the type of
the argument. This also fixes a bug that incorrectly prints the
whole map instead of just the value for a key if the returned value
by the map for the key is an invalid reflect value.

name                     old time/op  new time/op  delta
SprintfPadding-2          229ns ± 2%   227ns ± 1%  -0.50%  (p=0.013 n=20+20)
SprintfEmpty-2           36.4ns ± 6%  37.2ns ±14%    ~     (p=0.091 n=18+20)
SprintfString-2           102ns ± 1%   102ns ± 0%    ~     (p=0.751 n=20+20)
SprintfTruncateString-2   142ns ± 0%   141ns ± 1%  -0.95%  (p=0.000 n=16+20)
SprintfQuoteString-2      389ns ± 0%   388ns ± 0%  -0.12%  (p=0.019 n=20+20)
SprintfInt-2              100ns ± 2%   100ns ± 1%    ~     (p=0.188 n=20+15)
SprintfIntInt-2           155ns ± 3%   154ns ± 2%    ~     (p=0.092 n=20+20)
SprintfPrefixedInt-2      250ns ± 2%   251ns ± 3%    ~     (p=0.559 n=20+20)
SprintfFloat-2            177ns ± 2%   175ns ± 1%  -1.30%  (p=0.000 n=20+20)
SprintfComplex-2          516ns ± 1%   510ns ± 1%  -1.13%  (p=0.000 n=19+16)
SprintfBoolean-2         90.9ns ± 3%  90.6ns ± 1%    ~     (p=0.193 n=19+19)
SprintfHexString-2        171ns ± 1%   169ns ± 1%  -1.44%  (p=0.000 n=19+20)
SprintfHexBytes-2         180ns ± 1%   180ns ± 1%    ~     (p=0.060 n=19+18)
SprintfBytes-2            330ns ± 1%   329ns ± 1%  -0.42%  (p=0.003 n=20+20)
SprintfStringer-2         354ns ± 3%   352ns ± 3%    ~     (p=0.525 n=20+19)
SprintfStructure-2        804ns ± 3%   776ns ± 2%  -3.56%  (p=0.000 n=20+20)
FprintInt-2               155ns ± 0%   151ns ± 1%  -2.35%  (p=0.000 n=19+20)
FprintfBytes-2            169ns ± 0%   170ns ± 1%  +0.81%  (p=0.000 n=18+19)
FprintIntNoAlloc-2        112ns ± 0%   109ns ± 1%  -2.28%  (p=0.000 n=20+20)

Change-Id: Ib9a39082ed1be0f1f7499ee6fb6c9530f043e43a
Reviewed-on: https://go-review.googlesource.com/20923
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-27 00:50:31 +00:00
Josh Bleecher Snyder
688840593b cmd/compile: don’t generate a new Node for convas
This removes about 3% of the Nodes allocated
while compiling std+cmd.

Passes toolstash -cmp.

name       old time/op     new time/op     delta
Template       320ms ± 3%      316ms ± 5%    ~           (p=0.063 n=21+23)
Unicode        162ms ± 9%      161ms ± 6%    ~           (p=0.788 n=25+25)
GoTypes        1.03s ± 4%      1.03s ± 4%    ~           (p=0.929 n=24+25)
Compiler       4.99s ± 3%      4.95s ± 2%  -0.84%        (p=0.011 n=25+23)
MakeBash       40.3s ± 1%      40.3s ± 1%    ~           (p=0.468 n=24+24)

name       old alloc/op    new alloc/op    delta
Template      57.3MB ± 0%     57.0MB ± 0%  -0.51%        (p=0.000 n=25+23)
Unicode       41.1MB ± 0%     41.0MB ± 0%  -0.27%        (p=0.000 n=25+24)
GoTypes        191MB ± 0%      190MB ± 0%  -0.46%        (p=0.000 n=25+25)
Compiler       839MB ± 0%      834MB ± 0%  -0.62%        (p=0.000 n=24+24)

name       old allocs/op   new allocs/op   delta
Template        500k ± 0%       498k ± 0%  -0.42%        (p=0.000 n=25+25)
Unicode         400k ± 0%       399k ± 0%  -0.22%        (p=0.000 n=24+25)
GoTypes        1.50M ± 0%      1.49M ± 0%  -0.41%        (p=0.000 n=23+25)
Compiler       6.04M ± 0%      6.00M ± 0%  -0.59%        (p=0.000 n=25+25)

Change-Id: I7d3f177d1ab4a75a4c047fa465f2eee38747603f
Reviewed-on: https://go-review.googlesource.com/21178
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-26 23:13:32 +00:00
Alberto Donizetti
0cd9edf6e8 cmd/go: fix proc-count accumulation in benchmark name
Fixes #14964

Change-Id: I5f772426081efaa9315c4ecaf60de850af324f1d
Reviewed-on: https://go-review.googlesource.com/21139
Reviewed-by: Ahmed Waheed <oneofone@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-26 16:44:01 +00:00
Martin Möhrmann
ad391c908b fmt: split doPrint into two specialized functions
Remove format flag reset from doPrint. Flags will not be set in
doPrint and printArg will not return with flags modified.

Remove the extra arguments addspace and addnewline and split up
doPrint into two simpler and specialized functions.

Change-Id: Ib884d027abfbb31c6f01b008f51d6d76fc0c1a17
Reviewed-on: https://go-review.googlesource.com/21181
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-26 12:12:04 +00:00
Emmanuel Odeke
b9daf0a408 net/http: add more audio/video mime sniffing
Following the spec at
  https://mimesniff.spec.whatwg.org/#matching-an-audio-or-video-type-pattern

Adds signatures for:
+ audio/aiff
+ audio/basic
+ audio/midi
+ audio/mpeg
+ video/avi

Updates the signature for:
+ application/ogg

Also updates the pattern matching algorithm in
  https://mimesniff.spec.whatwg.org/#matching-a-mime-type-pattern
by implementing clause 4 that dictates that the number of bytes in
the pattern must match the number of bytes in the mask.

Fixes #13383

Change-Id: Ie321f392e6570299c17176adf1c75f62f357e1e8
Reviewed-on: https://go-review.googlesource.com/17132
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-26 08:58:57 +00:00
Matthew Dempsky
d53287d0c3 cmd/compile: simplify keydup
Use a type switch instead of calling Val.Ctype (which in turn just
uses a type switch anyway).

Use continue statements to simplify the control flow.

Change-Id: I65c139d706d4d78e5b4ce09d1b1505a3e424496b
Reviewed-on: https://go-review.googlesource.com/21173
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-26 05:15:50 +00:00
Josh Bleecher Snyder
080e2d4320 cmd/compile: don’t generate Nodes for PCDATA
We were allocating two Nodes just to help Naddr
fill in Type and Offset.
Fill them in directly instead.

Passes toolstash -cmp.

name       old time/op     new time/op     delta
Template       324ms ± 5%      320ms ± 5%  -1.34%        (p=0.033 n=25+22)
Unicode        164ms ± 6%      162ms ± 5%    ~           (p=0.152 n=24+23)
GoTypes        1.05s ± 5%      1.05s ± 6%    ~           (p=0.653 n=23+25)
Compiler       5.12s ± 4%      5.06s ± 3%  -1.13%        (p=0.006 n=25+23)
MakeBash       41.8s ± 2%      41.6s ± 3%  -0.65%        (p=0.024 n=24+24)

name       old alloc/op    new alloc/op    delta
Template      57.8MB ± 0%     57.3MB ± 0%  -0.87%        (p=0.000 n=25+25)
Unicode       41.2MB ± 0%     41.1MB ± 0%  -0.29%        (p=0.000 n=24+22)
GoTypes        193MB ± 0%      191MB ± 0%  -0.97%        (p=0.000 n=22+25)
Compiler       850MB ± 0%      840MB ± 0%  -1.28%        (p=0.000 n=25+25)

name       old allocs/op   new allocs/op   delta
Template        506k ± 0%       500k ± 0%  -1.15%        (p=0.000 n=25+25)
Unicode         402k ± 0%       400k ± 0%  -0.37%        (p=0.000 n=24+25)
GoTypes        1.52M ± 0%      1.50M ± 0%  -1.42%        (p=0.000 n=25+25)
Compiler       6.16M ± 0%      6.04M ± 0%  -2.05%        (p=0.000 n=24+25)

Change-Id: Ia80d28b32023a620d9ddf99c1252c16fa6477b3c
Reviewed-on: https://go-review.googlesource.com/21174
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-26 01:36:03 +00:00
Robert Griesemer
135109d241 cmd/compile: reduce slice header allocation when parsing := assignments
The colas function allocates 2 slice headers in each call (via Nodes.Set)
only to throw away those slice headers in the common case where both the
lhs and rhs in "lhs := rhs" have length 1.

Avoid the Nodes.Set calls in those cases. For make.bash, this eliminates
~63,000 slice header allocations.

Also: Minor cleanups in colasdefn.

Change-Id: Ib114a67c3adeb8821868bd71a5e0f5e2e19fcd4f
Reviewed-on: https://go-review.googlesource.com/21170
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-25 23:09:19 +00:00
Shenghou Ma
a7f7a9cca7 runtime, runtime/cgo: save callee-saved FP registers on arm64
For #14876.

Change-Id: I0992859264cbaf9c9b691fad53345bbb01b4cf3b
Reviewed-on: https://go-review.googlesource.com/21085
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-25 23:04:44 +00:00
Shenghou Ma
71916437fb runtime/cgo: save callee-saved xmm registers on windows/amd64
For #14876.

Change-Id: I33947f74e8058437a784862f1f064974afc99250
Reviewed-on: https://go-review.googlesource.com/21084
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-25 23:04:33 +00:00
Caleb Spare
eb033b1d22 compress/gzip: clean up zero-mtimes test
- Fix a typo.
- Skip this test on -short on non-builders.

Change-Id: Id102eceb59451694bf92b618e02ccee6603b6852
Reviewed-on: https://go-review.googlesource.com/21113
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-25 22:22:11 +00:00
David Benjamin
b88147c303 crypto/tls: Update references to draft-ietf-tls-downgrade-scsv-00.
It's RFC 7507 now.

Change-Id: Iccd6c65f9d4b1f4d17ee068dee4576a512ba8405
Reviewed-on: https://go-review.googlesource.com/21154
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-25 22:10:37 +00:00
David Benjamin
d0801f70b2 encoding/asn1: tags should be encoded in minimal form.
High tag number form may not be used for tag numbers that fit in low tag number
form.

Change-Id: I93edde0e1f86087047e0b3f2e55d6180b01e78bf
Reviewed-on: https://go-review.googlesource.com/18224
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2016-03-25 22:07:54 +00:00
Joe Sylve
562e38c0af runtime: fix signal handling on Solaris
This fixes the problems with signal handling that were inadvertently
introduced in https://go-review.googlesource.com/21006.

Fixes #14899

Change-Id: Ia746914dcb3146a52413d32c57b089af763f0810
Reviewed-on: https://go-review.googlesource.com/21145
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-25 21:38:47 +00:00
David Crawshaw
640164bc1c reflect: test name data is aligned
For #14962.

Change-Id: I3539d882487c99dee99ac953e039b79c6b963cf9
Reviewed-on: https://go-review.googlesource.com/21150
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-25 20:37:08 +00:00
Mohit Agarwal
edb19aa1cd cmd/go: stat the archive file only when executing the commands
Fixes #14944

Change-Id: I73e0997cb6ebaeced1045b0ddadac893319bd78f
Reviewed-on: https://go-review.googlesource.com/21065
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2016-03-25 18:35:15 +00:00
David Crawshaw
8cb74e1d18 reflect: name interface type that pins method info
I recently added TestUnexportedMethods which uses an interface type
to pin type information for an unexported method. But as written,
the interface type is not accessible to the reflect package.

You can imagine a future compiler optimization realizing that and
removing the type information for f. In fact, cl/20901 happens to
do that.

Change-Id: I1ddb67f50cb9b5737253b58f10545f3de652c29d
Reviewed-on: https://go-review.googlesource.com/21112
Reviewed-by: Michel Lespinasse <walken@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-25 17:19:03 +00:00
Marvin Stenger
6b0688f742 runtime: speed up growslice by avoiding divisions 2
This is a follow-up of https://go-review.googlesource.com/#/c/20653/

Special case computation for slices with elements of byte size or
pointer size.

name                      old time/op  new time/op  delta
GrowSliceBytes-4          86.2ns ± 3%  75.4ns ± 2%  -12.50%  (p=0.000 n=20+20)
GrowSliceInts-4            161ns ± 3%   136ns ± 3%  -15.59%  (p=0.000 n=19+19)
GrowSlicePtr-4             239ns ± 2%   233ns ± 2%   -2.52%  (p=0.000 n=20+20)
GrowSliceStruct24Bytes-4   258ns ± 3%   256ns ± 3%     ~     (p=0.134 n=20+20)

Change-Id: Ice5fa648058fe9d7fa89dee97ca359966f671128
Reviewed-on: https://go-review.googlesource.com/21101
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-25 16:47:56 +00:00
David Crawshaw
4d920410d2 cmd/compile: avoid pointers in go.string.* symbols
When creating binaries for dynamic linking, the linker moves
read-only data symbols that contain pointers into relro sections.
It is not setup for handling a go.string symbol moving to relro.

Instead of teaching it how (because go.string symbols with pointers
are unusual anyhow), put the data in a type.. section.

Fixes the android builder.

Change-Id: Ica4722d32241643c060923517b90276ff8ac6b07
Reviewed-on: https://go-review.googlesource.com/21110
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-25 16:38:46 +00:00
Josh Bleecher Snyder
41e176fbe0 cmd/compile/ssa: generate less garbage in schedule
Passes toolstash -cmp.

name       old alloc/op    new alloc/op    delta
Template      58.5MB ± 0%     57.8MB ± 0%  -1.15%        (p=0.000 n=10+10)
Unicode       41.3MB ± 0%     41.2MB ± 0%  -0.17%        (p=0.000 n=10+10)
GoTypes        196MB ± 0%      193MB ± 0%  -1.26%        (p=0.000 n=10+10)
Compiler       863MB ± 0%      850MB ± 0%  -1.49%        (p=0.000 n=10+10)

name       old allocs/op   new allocs/op   delta
Template        522k ± 0%       507k ± 0%  -2.99%        (p=0.000 n=10+10)
Unicode         403k ± 0%       401k ± 0%  -0.42%        (p=0.000 n=10+10)
GoTypes        1.58M ± 0%      1.52M ± 0%  -3.61%        (p=0.000 n=10+10)
Compiler       6.47M ± 0%      6.17M ± 0%  -4.62%        (p=0.000 n=10+10)

Change-Id: Ia7a6242e8d226b41966c344d253814dcce6424a8
Reviewed-on: https://go-review.googlesource.com/21141
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-03-25 15:41:10 +00:00
Richard Miller
967b9940b4 runtime: avoid fork/exit race in plan9
There's a race between runtime.goexitsall killing all OS processes
of a go program in order to exit, and runtime.newosproc forking a
new one.  If the new process has been created but not yet stored
its pid in m.procid, it will not be killed by goexitsall and
deadlock results.

This CL prevents the race by making the newly forked process
check whether the program is exiting.  It also prevents a
potential "shoot-out" if multiple goroutines call Exit at
the same time, which could possibly lead to two processes
killing each other and leaving the rest deadlocked.

Change-Id: I3170b4a62d2461f6b029b3d6aad70373714ed53e
Reviewed-on: https://go-review.googlesource.com/21135
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Marvin Stenger <marvin.stenger94@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
2016-03-25 15:04:45 +00:00
Dmitry Vyukov
ea0386f85f runtime: improve randomized stealing logic
During random stealing we steal 4*GOMAXPROCS times from random procs.
One would expect that most of the time we check all procs this way,
but due to low quality PRNG we actually miss procs with frightening
probability. Below are modelling experiment results for 1e6 tries:

GOMAXPROCS = 2 : missed 1 procs 7944 times

GOMAXPROCS = 3 : missed 1 procs 101620 times
GOMAXPROCS = 3 : missed 2 procs 3571 times

GOMAXPROCS = 4 : missed 1 procs 63916 times
GOMAXPROCS = 4 : missed 2 procs 61 times
GOMAXPROCS = 4 : missed 3 procs 16 times

GOMAXPROCS = 5 : missed 1 procs 133136 times
GOMAXPROCS = 5 : missed 2 procs 1025 times
GOMAXPROCS = 5 : missed 3 procs 101 times
GOMAXPROCS = 5 : missed 4 procs 15 times

GOMAXPROCS = 8 : missed 1 procs 151765 times
GOMAXPROCS = 8 : missed 2 procs 5057 times
GOMAXPROCS = 8 : missed 3 procs 1726 times
GOMAXPROCS = 8 : missed 4 procs 68 times

GOMAXPROCS = 12 : missed 1 procs 199081 times
GOMAXPROCS = 12 : missed 2 procs 27489 times
GOMAXPROCS = 12 : missed 3 procs 3113 times
GOMAXPROCS = 12 : missed 4 procs 233 times
GOMAXPROCS = 12 : missed 5 procs 9 times

GOMAXPROCS = 16 : missed 1 procs 237477 times
GOMAXPROCS = 16 : missed 2 procs 30037 times
GOMAXPROCS = 16 : missed 3 procs 9466 times
GOMAXPROCS = 16 : missed 4 procs 1334 times
GOMAXPROCS = 16 : missed 5 procs 192 times
GOMAXPROCS = 16 : missed 6 procs 5 times
GOMAXPROCS = 16 : missed 7 procs 1 times
GOMAXPROCS = 16 : missed 8 procs 1 times

A missed proc won't lead to underutilization because we check all procs
again after dropping P. But it can lead to an unpleasant situation
when we miss a proc, drop P, check all procs, discover work, acquire P,
miss the proc again, repeat.

Improve stealing logic to cover all procs.
Also don't enter spinning mode and try to steal when there is nobody around.

Change-Id: Ibb6b122cc7fb836991bad7d0639b77c807aab4c2
Reviewed-on: https://go-review.googlesource.com/20836
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Marvin Stenger <marvin.stenger94@gmail.com>
2016-03-25 11:00:48 +00:00
Elias Naur
44189299bf compress/gzip: skip mtime test when GOROOT doesn't exist
Fixes the iOS builders

Change-Id: I5097ca19048381ffb5a4c5ea038b7c4aa18ee4b7
Reviewed-on: https://go-review.googlesource.com/21132
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-25 11:00:05 +00:00
Marcel van Lohuizen
4e31221bd1 cmd/go: remove double space in template
Change-Id: I6113145baa727b9fd103765f74dc5d7af86dfdf8
Reviewed-on: https://go-review.googlesource.com/21131
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-25 09:33:26 +00:00
Marcel van Lohuizen
31e5d83525 testing: probe with N=1
Change control flow to probe with N=1. This calls benchFunc
the same number of times as the old implementation in the
absence of subbenchmarks.

To be compatible with existing tools, benchmarking only
prints a line for "leaf" benchmarks. This means, though, that
the name of a benchmark can only be printed after the first
iteration.

Issue #14863

Change-Id: Ic7b9b89b058f8ebb5287755f24f9e47df8c9537c
Reviewed-on: https://go-review.googlesource.com/21043
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-25 09:29:36 +00:00
Marcel van Lohuizen
2e79d7fbee cmd/go: update alldocs.go
Also added go:generate directive.

Change-Id: Ib1f0eddc75e3c47a4d904786a29b964a35b18456
Reviewed-on: https://go-review.googlesource.com/21042
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
2016-03-25 08:49:59 +00:00
Dominik Honnef
fdba5a7544 all: delete dead non-test code
This change removes a lot of dead code. Some of the code has never been
used, not even when it was first commited. The rest shouldn't have
survived refactors.

This change doesn't remove unused routines helpful for debugging, nor
does it remove code that's used in commented out blocks of code that are
only unused temporarily. Furthermore, unused constants weren't removed
when they were part of a set of constants from specifications.

One noteworthy omission from this CL are about 1000 lines of unused code
in cmd/fix, 700 lines of which are the typechecker, which hasn't been
used ever since the pre-Go 1 fixes have been removed. I wasn't sure if
this code should stick around for future uses of cmd/fix or be culled as
well.

Change-Id: Ib714bc7e487edc11ad23ba1c3222d1fd02e4a549
Reviewed-on: https://go-review.googlesource.com/20926
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-25 06:28:13 +00:00
Dmitry Chestnykh
6a6a073416 crypto/hmac: simplify implementation
Store already padded keys instead of storing key and padding it during
Reset and Sum. This simplifies code and makes Reset-Write-Sum sequences
faster, which helps /x/crypto/pbkdf2.

HMAC benchmark:

benchmark                    old ns/op     new ns/op     delta
BenchmarkHMACSHA256_1K-4     7669          7613          -0.73%
BenchmarkHMACSHA256_32-4     1880          1737          -7.61%

benchmark                    old MB/s     new MB/s     speedup
BenchmarkHMACSHA256_1K-4     133.52       134.50       1.01x
BenchmarkHMACSHA256_32-4     17.02        18.41        1.08x

PBKDF2 benchmark:

benchmark                       old ns/op     new ns/op     delta
BenchmarkPBKDF2HMACSHA256-4     1943196       1807699       -6.97%

Change-Id: I6697028370c226715ab477b0844951a83eb3488c
Reviewed-on: https://go-review.googlesource.com/21024
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2016-03-25 06:24:00 +00:00
John Jeffery
5c8674a497 reflect: add method StructTag.Lookup
The Lookup method provides a way to extract a tag value, while
determining whether the tag key exists in the struct field's tag.

Fixes #14883

Change-Id: I7460cb68f0ca1aaa025935050b9e182efcb64db3
Reviewed-on: https://go-review.googlesource.com/20864
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-25 04:54:19 +00:00
Caleb Spare
139fad21b9 all: zero mtimes in testdata gz files
Fixes #14937.

Change-Id: Iea11a32230d44d5a43f8aec812d25f13bce85895
Reviewed-on: https://go-review.googlesource.com/21038
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-25 04:02:36 +00:00
Caleb Spare
098b62644f encoding/json: add (*Encoder).Indent
Fixes #6492.

Change-Id: Ibc633c43a6d134bb140addb59780a5758b35a5c5
Reviewed-on: https://go-review.googlesource.com/21057
Run-TryBot: Caleb Spare <cespare@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-25 03:56:47 +00:00
Elias Naur
ba333a3061 cmd/go: remove limits on parallel tasks in the Go command for iOS
Ther darwin/arm{,64} exec wrapper now limits the number of concurrent
executions to 1, so remove the higher level parallel task limit from
the Go command.

Change-Id: Id84f65c3908305bde0452b3c8db6df8c5a8881bb
Reviewed-on: https://go-review.googlesource.com/21100
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-25 01:09:28 +00:00
Elias Naur
95add73abf misc/cgo/testcarchive: fix build
I failed to rebase (and re-test) CL 21102 before submit, which meant
that two extra tests sneaked into testcarchive that still referenced
runtime.GOOS and runtime.GOARCH.

Convert the new tests.

While we're here, make sure pending tasks are flushed before running
the host tests. If not, the "##### misc/cgo/testcarchive" banner
and "PASS" won't show up in the all.bash output.

Change-Id: I41fc4ec9515f9a193fa052f7c31fac452153c897
Reviewed-on: https://go-review.googlesource.com/21106
Run-TryBot: Elias Naur <elias.naur@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-25 00:55:07 +00:00
David Crawshaw
24ce64d1a9 cmd/compile, runtime: new static name encoding
Create a byte encoding designed for static Go names.

It is intended to be a compact representation of a name
and optional tag data that can be turned into a Go string
without allocating, and describes whether or not it is
exported without unicode table.

The encoding is described in reflect/type.go:

// The first byte is a bit field containing:
//
//	1<<0 the name is exported
//	1<<1 tag data follows the name
//	1<<2 pkgPath *string follow the name and tag
//
// The next two bytes are the data length:
//
//	 l := uint16(data[1])<<8 | uint16(data[2])
//
// Bytes [3:3+l] are the string data.
//
// If tag data follows then bytes 3+l and 3+l+1 are the tag length,
// with the data following.
//
// If the import path follows, then ptrSize bytes at the end of
// the data form a *string. The import path is only set for concrete
// methods that are defined in a different package than their type.

Shrinks binary sizes:

	cmd/go: 164KB (1.6%)
	jujud:  1.0MB (1.5%)

For #6853.

Change-Id: I46b6591015b17936a443c9efb5009de8dfe8b609
Reviewed-on: https://go-review.googlesource.com/20968
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-25 00:13:49 +00:00
Elias Naur
0a82ed5d7c misc/cgo/testcarchive: re-enable c-archive test on iOS and Android
The c-archive test were recently converted from shell script to Go.
Unfortunately, it also lost the ability to target iOS and Android
that lack C compilers and require exec wrappers.

Compile the c-archive test for the host and run it with the target
GOOS/GOARCH environment. Change the test to rely on go env GOOS
and go env GOARCH instead of runtime.GOOS and runtime.GOARCH.

Fixes #8345

Change-Id: I290ace2f7e96b87c55d99492feb7d660140dcb32
Reviewed-on: https://go-review.googlesource.com/21102
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-24 23:43:27 +00:00
Brad Fitzpatrick
0104a31b8f vendor: move golang.org/x/net/http2/hpack back to vendor
Updates #14047

Change-Id: I7e314e2c7e3e8da18ab023729740fbc9ea3f661e
Reviewed-on: https://go-review.googlesource.com/21063
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-24 20:26:51 +00:00
Alexandru Moșoi
afafab3b97 cmd/compile: simplify shifts when the counter fits 6 bits.
In f the extra & 63 is redundant because SHRQ already
looks at the bottom 6 bits only. This is a trick on AMD64
to get rid of CMPQ/SBBQ/ANDQ if one knows that the shift
counter is small.

func f(x uint64, s uint) uint64 {
        return x >> (s & 63)
}

Change-Id: I4861c902168dabec9a6a14a85750246dde94fc08
Reviewed-on: https://go-review.googlesource.com/21073
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-24 20:06:34 +00:00
Alexandru Moșoi
d8ee180ab2 cmd/compile: fold more of CMPQ and ANDQ
g used to produce CMPQ/SBBQ/ANDQ, but f didn't even though
s&15 is at most s&63.

func f(x uint64, s uint) uint64 {
        return x >> (s & 63)
}
func g(x uint64, s uint) uint64 {
        return x >> (s & 15)
}

Change-Id: Iab4a1a6e10b471dead9f1203e9d894677cf07bb2
Reviewed-on: https://go-review.googlesource.com/21048
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-24 19:38:21 +00:00
Joe Sylve
df2b2eb63d runtime: improve last ditch signal forwarding for Unix libraries
The current runtime attempts to forward signals generated by non-Go
code to the original signal handler.  If it can't call the original
handler directly, it currently attempts to re-raise the signal after
resetting the handler.  In this case, the original context is lost.

This fix prevents that problem by simply returning from the go signal
handler after resetting the original handler.  It only does this when
the original handler is the system default handler, which in all cases
is known to not recover.  The signal is not reset, so it is retriggered
and the original handler takes over with the proper context.

Fixes #14899

Change-Id: Ib1c19dfa4b50d9732d7a453de3784c8141e1cbb3
Reviewed-on: https://go-review.googlesource.com/21006
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-24 19:34:17 +00:00
Elias Naur
fb49655d7b os: skip TestStatStdin on Android
Android doesn't (generally) have /bin/sh.

Change-Id: I343817c342e3473d09c85155761682b5ddb043e4
Reviewed-on: https://go-review.googlesource.com/21075
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-24 19:07:11 +00:00
Marvin Stenger
44532f1a9d runtime: fix inconsistency in slice.go
Fixes #14938.

Additionally some simplifications along the way.

Change-Id: I2c5fb7e32dcc6fab68fff36a49cb72e715756abe
Reviewed-on: https://go-review.googlesource.com/21046
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2016-03-24 18:17:28 +00:00
Josh Bleecher Snyder
fc4358951a cmd/compile: avoid allocating a Nodes for readonly method receivers
We were allocating a Nodes for common method calls
that did not modify the Nodes.
Though there is no clear wall time impact,
this significantly reduces the number of allocations,
so it seems worth doing.

Passes toolstash -cmp.

name       old alloc/op    new alloc/op    delta
Template      59.0MB ± 0%     58.6MB ± 0%   -0.81%        (p=0.000 n=25+25)
Unicode       41.4MB ± 0%     41.3MB ± 0%   -0.18%        (p=0.000 n=25+25)
GoTypes        198MB ± 0%      197MB ± 0%   -0.80%        (p=0.000 n=24+25)
Compiler       875MB ± 0%      865MB ± 0%   -1.09%        (p=0.000 n=25+25)

name       old allocs/op   new allocs/op   delta
Template        581k ± 0%       520k ± 0%  -10.42%        (p=0.000 n=25+25)
Unicode         413k ± 0%       403k ± 0%   -2.30%        (p=0.000 n=25+25)
GoTypes        1.78M ± 0%      1.58M ± 0%  -11.18%        (p=0.000 n=25+25)
Compiler       7.66M ± 0%      6.47M ± 0%  -15.51%        (p=0.000 n=25+25)

Change-Id: I012a9f4b333821bdf61b4f2bdff4ce5c3b5d3057
Reviewed-on: https://go-review.googlesource.com/21056
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-24 16:52:19 +00:00
Elias Naur
570a2b0eec cmd/dist: skip testcarchive test in Android and iOS
CL 20892 converted the misc/cgo/testcarchive test to Go.
Unfortunately, dist does not (yet) support tests running off the host
so the testcarchive is disabled for now.

For #14318

Change-Id: Iab3d0a7b5309187a603b48f22a7fa736f089f89d
Reviewed-on: https://go-review.googlesource.com/21070
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-24 14:15:17 +00:00
Elias Naur
be10c51500 runtime/cgo: block signals to the iOS mach exception handler
For darwin/arm{,64} a non-Go thread is created to convert
EXC_BAD_ACCESS to panics. However, the Go signal handler refuse to
handle signals that would otherwise be ignored if they arrive at
non-Go threads.

Block all (posix) signals to that thread, making sure that
no unexpected signals arrive to it. At least one test, TestStop in
os/signal, depends on signals not arriving on any non-Go threads.

For #14318

Change-Id: I901467fb53bdadb0d03b0f1a537116c7f4754423
Reviewed-on: https://go-review.googlesource.com/21047
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-24 14:12:12 +00:00
Dave Cheney
b9feb91f32 cmd/compile: minor cleanups
Some minor scoping cleanups found by a very old version of grind.

Change-Id: I1d373817586445fc87e38305929097b652696fdd
Reviewed-on: https://go-review.googlesource.com/21064
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-24 11:18:04 +00:00
Tilman Dilo
633e41432c image/png: ignore trailing IDAT chunks
Ignore superfluous trailing IDAT chunks which were not consumed when decoding
the image. This change fixes decoding of valid images in which a zero-length
IDAT chunk appears after the actual image data. It also prevents decoding of
trailing garbage IDAT chunks or maliciously embedded additional images.

Fixes #14936

Change-Id: I8c76cfa9a03496d9576f72bed2db109271f97c5e
Reviewed-on: https://go-review.googlesource.com/21045
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-03-24 10:57:01 +00:00
Yasuhiro Matsumoto
ebd67ba588 os: fix Stdin.Stat() on windows
If name is /dev/{stdin,stdout,stderr}, return fileInfo.

Fixes #14853.

Change-Id: Ibf7d1ae7b9f3dc43f6ed7c905ea2c5102e1971cc
Reviewed-on: https://go-review.googlesource.com/20845
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-03-24 09:22:33 +00:00
Mohit Agarwal
ddcf8d402a net/http: redirect if the URL path is a dir & doesn't end in a slash
Fixes #13996

Change-Id: I9b2c7fba0705900aca9a70bc6a2687667a9a976c
Reviewed-on: https://go-review.googlesource.com/20128
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-24 02:30:19 +00:00
Dave Cheney
edca4cda88 cmd/compile/internal/gc: remove remaining Nod(OXXX, ...)
Remove almost all the remaining Nod(OXXX, ... ) uses. The performance
change is due entirely to the changes to func temp(*Type). The other
cleanups have no effect, as expected.

I'll address the remaining Nod(OXXX, ...) uses in a followup CL as they
are very sensitive to change.

lucky(~/go/src/cmd/compile) % benchstat /tmp/{old,new}.txt
name      old time/op    new time/op    delta
Template     391ms ± 6%     385ms ± 6%    ~     (p=0.127 n=19+20)
GoTypes      1.27s ± 2%     1.27s ± 2%    ~     (p=0.172 n=19+19)
Compiler     6.17s ± 2%     6.15s ± 2%    ~     (p=0.647 n=19+20)

name      old alloc/op   new alloc/op   delta
Template    63.7MB ± 0%    63.4MB ± 0%  -0.35%  (p=0.000 n=16+20)
GoTypes      219MB ± 0%     218MB ± 0%  -0.38%  (p=0.000 n=20+20)
Compiler     980MB ± 0%     976MB ± 0%  -0.38%  (p=0.000 n=20+20)

name      old allocs/op  new allocs/op  delta
Template      586k ± 0%      584k ± 0%  -0.30%  (p=0.000 n=20+20)
GoTypes      1.80M ± 0%     1.79M ± 0%  -0.31%  (p=0.000 n=20+20)
Compiler     7.74M ± 0%     7.71M ± 0%  -0.34%  (p=0.000 n=20+20)

Change-Id: Ie21a5443c33a23ce30f987bdddec9fe350365d35
Reviewed-on: https://go-review.googlesource.com/21017
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-24 01:21:51 +00:00
Josh Bleecher Snyder
babc73547e cmd/compile: remove redundant parameter from finishcompare
This is follow-up 3 of 3 to CL 20959.

Passes toolstash -cmp.

Change-Id: I06efded21bbc970cbefa10e8f2cac1ebc6942e1b
Reviewed-on: https://go-review.googlesource.com/21054
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-24 01:17:47 +00:00
Josh Bleecher Snyder
7e8e9abe0a cmd/compile: reduce stutter
This is follow-up 1 of 3 to CL 20959.

Passes toolstash -cmp.

Change-Id: I9bddf7d88333fa4755e03ff8a034a35bd01b7855
Reviewed-on: https://go-review.googlesource.com/21052
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-24 01:17:23 +00:00
Brad Fitzpatrick
694eadcce7 net/http/httptest: add NewRequest helper for ease of testing handlers
Fixes #14199

Change-Id: Ic9284023b663de3db1ca7b7b1e96eeab82ec0944
Reviewed-on: https://go-review.googlesource.com/21016
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-03-23 23:22:22 +00:00
Marvin Stenger
bd83cc6dae cmd/compile: prettify loop iterations
This commit replaces some of

for i := len(x) - 1; i >= 0; i-- {...}

style loops, which do not rely on reverse iteration order.

Change-Id: I5542834286562da058200c06e7a173b13760e54d
Reviewed-on: https://go-review.googlesource.com/21044
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-23 22:49:49 +00:00
Brad Fitzpatrick
ca5417b8e0 cmd/compile: reduce some SSA garbage
It's pretty hard to get reliable CPU numbers, even with 50 runs on an
otherwise-idle physical Linux machine, but the garbage reduction
numbers are nice. To get useful time/op numbers, I modified
compilebench to report user CPU time instead of wall time:

name       old time/op     new time/op     delta
Template       547ms ± 6%      557ms ± 5%   +1.80%        (p=0.001 n=49+49)
Unicode        360ms ± 9%      365ms ± 6%     ~           (p=0.094 n=50+45)
GoTypes        1.84s ± 3%      1.82s ± 3%   -1.50%        (p=0.000 n=50+49)
Compiler       9.19s ± 2%      9.02s ± 2%   -1.87%        (p=0.000 n=45+50)

name       old alloc/op    new alloc/op    delta
Template      63.3MB ± 0%     59.1MB ± 0%   -6.72%        (p=0.000 n=50+50)
Unicode       43.1MB ± 0%     42.9MB ± 0%   -0.47%        (p=0.000 n=50+49)
GoTypes        220MB ± 0%      200MB ± 0%   -9.00%        (p=0.000 n=50+50)
Compiler      1.00GB ± 0%     0.89GB ± 0%  -10.09%        (p=0.000 n=50+49)

name       old allocs/op   new allocs/op   delta
Template        681k ± 0%       680k ± 0%   -0.16%        (p=0.000 n=50+48)
Unicode         541k ± 0%       541k ± 0%   -0.02%        (p=0.011 n=48+50)
GoTypes        2.08M ± 0%      2.08M ± 0%   -0.19%        (p=0.000 n=48+50)
Compiler       9.24M ± 0%      9.23M ± 0%   -0.11%        (p=0.000 n=50+50)

Change-Id: I1fac4ebf85a1783e3289c3ffb1ed365442837643
Reviewed-on: https://go-review.googlesource.com/20995
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-23 19:50:02 +00:00
Matthew Dempsky
0659cf6911 cmd/compile: small Mpint method simplifications
Get rid of (*Mpint).Add's "quiet" parameter: it's always set to 0.

Inline (*Mpint).shift into (*Mpint).Lsh and (*Mpint).Rsh. There's no
need for a common shift method that can handle both left or right
shifts based on sign when the higher level abstractions only ever do
one or the other.

Change-Id: Icd3b082413f9193961b6835279e0bd4b6a6a6621
Reviewed-on: https://go-review.googlesource.com/21050
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-23 19:22:53 +00:00
Keith Randall
4c9a470d46 cmd/compile: start on ARM port
Start working on arm port.  Gets close to correct
code for fibonacci:
    func fib(n int) int {
        if n < 2 {
            return n
        }
        return fib(n-1) + fib(n-2)
    }

Still a lot to do, but this is a good starting point.

Cleaned up some arch-specific dependencies in regalloc.

Change-Id: I4301c6c31a8402168e50dcfee8bcf7aee73ea9d5
Reviewed-on: https://go-review.googlesource.com/21000
Reviewed-by: David Chase <drchase@google.com>
2016-03-23 17:46:05 +00:00
David Crawshaw
44d3f89e99 cmd/link, reflect: remove some method type data
Remove reflect type information for unexported methods that do not
satisfy any interface in the program.

Ideally the unexported method would not appear in the method list at
all, but that is tricky because the slice is built by the compiler.

Reduces binary size:

	cmd/go: 81KB (0.8%)
	jujud: 258KB (0.4%)

For #6853.

Change-Id: I25ef8df6907e9ac03b18689d584ea46e7d773043
Reviewed-on: https://go-review.googlesource.com/21033
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-23 17:00:43 +00:00
Alexandru Moșoi
c1892b9c4b cmd/compile: don't simplify nilchecks in loops
khr: Lifting the nil check out of the loop altogether is an admirable
goal, and this rewrite is one step on the way. But without lifting it
out of the loop, the rewrite is just hurting us.

Fixes #14917

Change-Id: Idb917f37d89f50f8e046d5ebd7c092b1e0eb0633
Reviewed-on: https://go-review.googlesource.com/21040
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-23 15:51:55 +00:00
Lynn Boger
baec148767 bytes: Equal perf improvements on ppc64le/ppc64
The existing implementation for Equal and similar
functions in the bytes package operate on one byte at
at time.  This performs poorly on ppc64/ppc64le especially
when the byte buffers are large.  This change improves
those functions by loading and comparing double words where
possible.  The common code has been moved to a function
that can be shared by the other functions in this
file which perform the same type of comparison.
Further optimizations are done for the case where
>= 32 bytes are being compared.  The new function
memeqbody is used by memeq_varlen, Equal, and eqstring.

When running the bytes test with -test.bench=Equal

benchmark                     old MB/s     new MB/s     speedup
BenchmarkEqual1               164.83       129.49       0.79x
BenchmarkEqual6               563.51       445.47       0.79x
BenchmarkEqual9               656.15       1099.00      1.67x
BenchmarkEqual15              591.93       1024.30      1.73x
BenchmarkEqual16              613.25       1914.12      3.12x
BenchmarkEqual20              682.37       1687.04      2.47x
BenchmarkEqual32              807.96       3843.29      4.76x
BenchmarkEqual4K              1076.25      23280.51     21.63x
BenchmarkEqual4M              1079.30      13120.14     12.16x
BenchmarkEqual64M             1073.28      10876.92     10.13x

It was determined that the degradation in the smaller byte tests
were due to unfavorable code alignment of the single byte loop.

Fixes #14368

Change-Id: I0dd87382c28887c70f4fbe80877a8ba03c31d7cd
Reviewed-on: https://go-review.googlesource.com/20249
Reviewed-by: Minux Ma <minux@golang.org>
2016-03-23 14:21:15 +00:00
Shahar Kohanim
516c6b4085 cmd/link: Clean up Pcln struct
Removes unnecessary fields from Pcln.

Change-Id: I175049ca749b510eedaf65162355bc4d7a93315e
Reviewed-on: https://go-review.googlesource.com/21041
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-23 13:02:01 +00:00
Klaus Post
53efe1e121 compress/flate: rework matching algorithm
This changes how matching is done in deflate algorithm.

The major change is that we do not look for matches that are only
3 bytes in length, matches must be 4 bytes at least.
Contrary to what you would expect this actually improves the
compresion ratio, since 3 literal bytes will often be shorter
than a match after huffman encoding.
This varies a bit by source, but is most often the case when the
source is "easy" to compress.

Second of all, a "stronger" hash is used. The hash is similar to
the hashing function used by Snappy.

Overall, the speed impact is biggest on higher compression levels.
I intend to replace the "speed" compression level, which can be
seen in CL 21021.

The built-in benchmark using "digits" is slower at level 1.
I see this as an exception, since "digits" is a special type
of data, where you have low entropy (numbers 0->9), but no
significant matches. Again, CL 20021 fixes that case.

NewWriterDict is also made considerably faster, by not running data
through the entire encoder. This is not reflected by the benchmark.

Overall, the speed impact is biggest on higher compression levels.
I intend to replace the "speed" compression level.

COMPARED to tip/master:
name                       old time/op    new time/op     delta
EncodeDigitsSpeed1e4-4        401µs ± 1%      345µs ± 2%   -13.95%
EncodeDigitsSpeed1e5-4       3.19ms ± 1%     4.27ms ± 3%   +33.96%
EncodeDigitsSpeed1e6-4       27.7ms ± 4%     43.8ms ± 3%   +58.00%
EncodeDigitsDefault1e4-4      641µs ± 0%      403µs ± 1%   -37.15%
EncodeDigitsDefault1e5-4     13.8ms ± 1%      6.4ms ± 3%   -53.73%
EncodeDigitsDefault1e6-4      162ms ± 1%       64ms ± 2%   -60.51%
EncodeDigitsCompress1e4-4     627µs ± 1%      405µs ± 2%   -35.45%
EncodeDigitsCompress1e5-4    13.9ms ± 0%      6.3ms ± 2%   -54.46%
EncodeDigitsCompress1e6-4     159ms ± 1%       64ms ± 0%   -59.91%
EncodeTwainSpeed1e4-4         433µs ± 4%      331µs ± 1%   -23.53%
EncodeTwainSpeed1e5-4        2.82ms ± 1%     3.08ms ± 0%    +9.10%
EncodeTwainSpeed1e6-4        28.1ms ± 2%     28.8ms ± 0%    +2.82%
EncodeTwainDefault1e4-4       695µs ± 4%      474µs ± 1%   -31.78%
EncodeTwainDefault1e5-4      11.8ms ± 0%      7.4ms ± 0%   -37.31%
EncodeTwainDefault1e6-4       128ms ± 0%       75ms ± 0%   -40.93%
EncodeTwainCompress1e4-4      719µs ± 3%      480µs ± 0%   -33.27%
EncodeTwainCompress1e5-4     15.0ms ± 3%      8.2ms ± 2%   -45.55%
EncodeTwainCompress1e6-4      170ms ± 0%       85ms ± 1%   -49.99%

name                       old speed      new speed       delta
EncodeDigitsSpeed1e4-4     25.0MB/s ± 1%   29.0MB/s ± 2%   +16.24%
EncodeDigitsSpeed1e5-4     31.4MB/s ± 1%   23.4MB/s ± 3%   -25.34%
EncodeDigitsSpeed1e6-4     36.1MB/s ± 4%   22.8MB/s ± 3%   -36.74%
EncodeDigitsDefault1e4-4   15.6MB/s ± 0%   24.8MB/s ± 1%   +59.11%
EncodeDigitsDefault1e5-4   7.27MB/s ± 1%  15.72MB/s ± 3%  +116.23%
EncodeDigitsDefault1e6-4   6.16MB/s ± 0%  15.60MB/s ± 2%  +153.25%
EncodeDigitsCompress1e4-4  15.9MB/s ± 1%   24.7MB/s ± 2%   +54.97%
EncodeDigitsCompress1e5-4  7.19MB/s ± 0%  15.78MB/s ± 2%  +119.62%
EncodeDigitsCompress1e6-4  6.27MB/s ± 1%  15.65MB/s ± 0%  +149.52%
EncodeTwainSpeed1e4-4      23.1MB/s ± 4%   30.2MB/s ± 1%   +30.68%
EncodeTwainSpeed1e5-4      35.4MB/s ± 1%   32.5MB/s ± 0%    -8.34%
EncodeTwainSpeed1e6-4      35.6MB/s ± 2%   34.7MB/s ± 0%    -2.77%
EncodeTwainDefault1e4-4    14.4MB/s ± 4%   21.1MB/s ± 1%   +46.48%
EncodeTwainDefault1e5-4    8.49MB/s ± 0%  13.55MB/s ± 0%   +59.50%
EncodeTwainDefault1e6-4    7.83MB/s ± 0%  13.25MB/s ± 0%   +69.19%
EncodeTwainCompress1e4-4   13.9MB/s ± 3%   20.8MB/s ± 0%   +49.83%
EncodeTwainCompress1e5-4   6.65MB/s ± 3%  12.20MB/s ± 2%   +83.51%
EncodeTwainCompress1e6-4   5.88MB/s ± 0%  11.76MB/s ± 1%  +100.06%

Change-Id: I724e33c1dd3e3a6a1b0a68e094baa959352baf32
Reviewed-on: https://go-review.googlesource.com/20929
Run-TryBot: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-03-23 11:33:29 +00:00
Dave Cheney
e6beec1fc8 cmd/compile/internal/ssa: avoid string conversion in zcse
Some ssa.Type implementations fell through to gc.Tconv which generated
garbage to produce a string form of the Type.

name      old time/op    new time/op    delta
Template     405ms ± 7%     401ms ± 6%    ~     (p=0.478 n=20+20)
GoTypes      1.32s ± 1%     1.30s ± 2%  -1.27%  (p=0.000 n=19+20)
Compiler     6.07s ± 2%     6.03s ± 2%    ~     (p=0.121 n=20+20)

name      old alloc/op   new alloc/op   delta
Template    63.9MB ± 0%    63.7MB ± 0%  -0.21%  (p=0.000 n=19+20)
GoTypes      220MB ± 0%     219MB ± 0%  -0.21%  (p=0.000 n=20+20)
Compiler     966MB ± 0%     965MB ± 0%  -0.11%  (p=0.000 n=20+20)

name      old allocs/op  new allocs/op  delta
Template      708k ± 0%      701k ± 0%  -0.99%  (p=0.000 n=20+20)
GoTypes      2.20M ± 0%     2.17M ± 0%  -1.43%  (p=0.000 n=17+20)
Compiler     9.45M ± 0%     9.36M ± 0%  -0.91%  (p=0.000 n=20+20)

Change-Id: I5fcc30e0f76a823d1c301d4980b583d716a75ce3
Reviewed-on: https://go-review.googlesource.com/20844
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-23 11:02:26 +00:00
Dave Cheney
a4be24cbe6 cmd/compile/internal/gc: remove redundant Nod(OXXX, ...) pattern
The pattern

    n := Nod(OXXX, nil, nil)
    Nodconst(n, ...)

was a leftover from the C days where n must be heap allocated.

No change in benchmarks, none expected as n escapes anyway.

name      old time/op    new time/op    delta
Template     391ms ± 6%     388ms ± 5%    ~     (p=0.659 n=20+20)
GoTypes      1.27s ± 1%     1.27s ± 2%    ~     (p=0.828 n=18+20)
Compiler     6.16s ± 2%     6.15s ± 1%    ~     (p=0.947 n=20+20)

name      old alloc/op   new alloc/op   delta
Template    63.7MB ± 0%    63.7MB ± 0%    ~     (p=0.414 n=20+20)
GoTypes      219MB ± 0%     219MB ± 0%    ~     (p=0.904 n=20+20)
Compiler     980MB ± 0%     980MB ± 0%  +0.00%  (p=0.007 n=20+19)

name      old allocs/op  new allocs/op  delta
Template      586k ± 0%      586k ± 0%    ~     (p=0.564 n=19+20)
GoTypes      1.80M ± 0%     1.80M ± 0%    ~     (p=0.718 n=20+20)
Compiler     7.74M ± 0%     7.74M ± 0%    ~     (p=0.358 n=20+20)

The reuse of nc in multiple overlapping scopes in walk.go is the worst.

Change-Id: I4ed6a63f7ffbfff68124ad609f6e3a68d95cbbba
Reviewed-on: https://go-review.googlesource.com/21015
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-23 10:59:55 +00:00
Aliaksandr Valialkin
1374515a1c cmd/vet: check lock copy in function calls and return statements
Fixes #14529

Change-Id: I6ed059d279ba0fe12d76416859659f28d61781d2
Reviewed-on: https://go-review.googlesource.com/20832
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-23 07:14:26 +00:00
Martin Möhrmann
49da931268 fmt: cleanup and optimize doPrintf for simple formats
Make a fast path for format strings that do not use
precision or width specifications or argument indices.

Only check and enforce the restriction to not pad left with zeros
in code paths that change either f.minus or f.zero.

Consolidate the if chains at the end of the main doPrintf loop
into a switch statement. Move error printing into extra
functions to reduce size of this switch statement.

name                             old time/op  new time/op  delta
SprintfPadding-2                  234ns ± 1%   233ns ± 1%   -0.54%  (p=0.010 n=19+19)
SprintfEmpty-2                   37.0ns ± 3%  39.1ns ±14%     ~     (p=0.501 n=17+20)
SprintfString-2                   112ns ± 1%   101ns ± 1%   -9.21%  (p=0.000 n=19+20)
SprintfTruncateString-2           139ns ± 1%   139ns ± 0%   +0.57%  (p=0.000 n=19+19)
SprintfQuoteString-2              402ns ± 0%   392ns ± 0%   -2.35%  (p=0.000 n=19+20)
SprintfInt-2                      114ns ± 1%   102ns ± 2%  -10.92%  (p=0.000 n=20+20)
SprintfIntInt-2                   177ns ± 2%   155ns ± 2%  -12.67%  (p=0.000 n=18+18)
SprintfPrefixedInt-2              260ns ± 3%   249ns ± 3%   -4.55%  (p=0.000 n=20+20)
SprintfFloat-2                    190ns ± 1%   178ns ± 2%   -6.54%  (p=0.000 n=20+20)
SprintfComplex-2                  533ns ± 1%   517ns ± 3%   -2.95%  (p=0.000 n=20+20)
SprintfBoolean-2                  102ns ± 1%    93ns ± 2%   -9.30%  (p=0.000 n=20+20)
SprintfHexString-2                176ns ± 0%   168ns ± 2%   -4.49%  (p=0.000 n=16+19)
SprintfHexBytes-2                 181ns ± 1%   174ns ± 2%   -4.27%  (p=0.000 n=20+20)
SprintfBytes-2                    326ns ± 1%   311ns ± 1%   -4.51%  (p=0.000 n=20+20)
ManyArgs-2                        540ns ± 2%   497ns ± 1%   -8.08%  (p=0.000 n=18+16)
FprintInt-2                       150ns ± 0%   149ns ± 0%   -0.33%  (p=0.000 n=20+18)
FprintfBytes-2                    185ns ± 0%   165ns ± 0%  -10.98%  (p=0.000 n=20+18)
FprintIntNoAlloc-2                113ns ± 0%   112ns ± 0%   -0.88%  (p=0.000 n=20+20)

Change-Id: I9ada8faa1f46aa67ea116a94ab3f4ad3e405c8fe
Reviewed-on: https://go-review.googlesource.com/20919
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-23 06:31:12 +00:00
Tamir Duberstein
7162c4d05c database/sql/driver: remove string exclusion
The exclusion of string from IsScanValue prevents driver authors from
writing their drivers in such a way that would allow users to
distinguish between strings and byte arrays returned from a database.
Such drivers are possible today, but require their authors to deviate
from the guidance provided by the standard library.

This exclusion has been in place since the birth of this package in
https://github.com/golang/go/commit/357f2cb1a385f4d1418e48856f9abe0cce,
but the fakedb implementation shipped in the same commit violates the
exclusion!

Strictly speaking this is a breaking change, but it increases the set
of permissible Scan types, and should not cause breakage in practice.

No test changes are necessary because fakedb already exercises this.

Fixes #6497.

Change-Id: I69dbd3a59d90464bcae8c852d7ec6c97bfd120f8
Reviewed-on: https://go-review.googlesource.com/19439
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-23 02:42:31 +00:00
Ian Lance Taylor
bac0005ec7 misc/cgo/testcarchive: rewrite test from bash to Go
This is to support https://golang.org/cl/18057, which is going to add
Windows support to this directory.  Better to write the test in Go then
to have both test.bash and test.bat.

Update #13494.

Change-Id: I4af7004416309e885049ee60b9470926282f210d
Reviewed-on: https://go-review.googlesource.com/20892
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-23 02:08:49 +00:00
Mikio Hara
bafa0275db cmd/dist: disable misc/cgo/fortran test on dragonfly
Updates #14544.

Change-Id: I24ab8e6f9ad9d290a672216fc2f50f78c3ed8812
Reviewed-on: https://go-review.googlesource.com/21014
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-23 00:43:30 +00:00
Keith Randall
68e86e6dfa cmd/compile: MOVBload and MOVBQZXload are the same op
No need to have both ops when they do the same thing.
Just declare MOVBload to zero extend and we can get rid
of MOVBQZXload.  Same for W and L.

Kind of a followon cleanup for https://go-review.googlesource.com/c/19506/
Should enable an easier fix for #14920

Change-Id: I7cfac909a8ba387f433a6ae75c050740ebb34d42
Reviewed-on: https://go-review.googlesource.com/21004
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-23 00:28:01 +00:00
Michael Munday
5cdb3d0321 syscall: correct spelling/typos in comment
Change-Id: Ib44c6b1ce07aa8fb67033cf21e177a90fd4005dc
Reviewed-on: https://go-review.googlesource.com/21002
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-22 20:35:53 +00:00
Shahar Kohanim
90a59d448e cmd/link: use stdlib sort in dodata
Speeds up linking cmd/go by 1.7%

name       old s/op   new s/op   delta
LinkCmdGo  0.58 ± 4%  0.57 ± 5%  -1.74%  (p=0.000 n=96+97)

Change-Id: I7844cf4e2eeac260318de2b6ddf52ce07a6e00f5
Reviewed-on: https://go-review.googlesource.com/20915
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-22 20:14:49 +00:00
Keith Randall
7177cb9fa4 cmd/compile: remove dots from register names
They are kind of useless and are cluttering up
https://go-review.googlesource.com/c/21000/

Change-Id: Iafdec75ada11c7ebdc40540d251fdc514bb00d3d
Reviewed-on: https://go-review.googlesource.com/21001
Reviewed-by: Minux Ma <minux@golang.org>
2016-03-22 17:30:30 +00:00
Robert Griesemer
c12e1b0b2e cmd/compile: update vendored math/big to latest version
This makes the rounding bug fix in math/big for issue 14651 available
to the compiler.

- changes to cmd/compile/internal/big fully automatic via script
- added test case for issue
- updated old test case with correct test data

Fixes #14651.

Change-Id: Iea37a2cd8d3a75f8c96193748b66156a987bbe40
Reviewed-on: https://go-review.googlesource.com/20818
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-22 17:09:29 +00:00
Robert Griesemer
7c86263be2 math/big: much simplified and faster Float rounding
Change-Id: Iab0add7aee51a8c72a81f51d980d22d2fd612f5c
Reviewed-on: https://go-review.googlesource.com/20817
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-22 17:07:34 +00:00
Alexandru Moșoi
e61db3119c cmd/compile: simplify SliceCap when it equals SliceLen
Shows up occassionally, especially after p = p[:8:len(p)]

Updates #14905

Change-Id: Iab35ef2eac57817e6a10c6aaeeb84709e8021641
Reviewed-on: https://go-review.googlesource.com/21025
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-22 16:56:03 +00:00
Marcel van Lohuizen
23a756d856 testing: expose subtest and subbenchmark functionality
Fixes #12166

Change-Id: Ie62cba2c39beb5732447ba3688c93c08ef12abb5
Reviewed-on: https://go-review.googlesource.com/18898
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
2016-03-22 14:56:15 +00:00
Marcel van Lohuizen
00a2a94c1e testing: added name matcher and sanitizer
The matcher is responsible for sanitizing and uniquing the
test and benchmark names and thus needs to be included before the
API can be exposed.

Matching currently uses the regexp to only match the top-level
tests/benchmarks.

Support for subtest matching is for another CL.

Change-Id: I7c8464068faef7ebc179b03a7fe3d01122cc4f0b
Reviewed-on: https://go-review.googlesource.com/18897
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-22 14:47:39 +00:00
Josh Bleecher Snyder
34699bc7a8 cmd/compile: reduce use of **Node parameters
Escape analysis has a hard time with tree-like
structures (see #13493 and #14858).
This is unlikely to change.
As a result, when invoking a function that accepts
a **Node parameter, we usually allocate a *Node
on the heap. This happens a whole lot.

This CL changes functions from taking a **Node
to acting more like append: It both modifies
the input and returns a replacement for it.

Because of the cascading nature of escape analysis,
in order to get the benefits, I had to modify
almost all such functions. The remaining functions
are in racewalk and the backend. I would be happy
to update them as well in a separate CL.

This CL was created by manually updating the
function signatures and the directly impacted
bits of code. The callsites were then automatically
updated using a bespoke script:
https://gist.github.com/josharian/046b1be7aceae244de39

For ease of reviewing and future understanding,
this CL is also broken down into four CLs,
mailed separately, which show the manual
and the automated changes separately.
They are CLs 20990, 20991, 20992, and 20993.

Passes toolstash -cmp.

name       old time/op     new time/op     delta
Template       335ms ± 5%      324ms ± 5%   -3.35%        (p=0.000 n=23+24)
Unicode        176ms ± 9%      165ms ± 6%   -6.12%        (p=0.000 n=23+24)
GoTypes        1.10s ± 4%      1.07s ± 2%   -2.77%        (p=0.000 n=24+24)
Compiler       5.31s ± 3%      5.15s ± 3%   -2.95%        (p=0.000 n=24+24)
MakeBash       41.6s ± 1%      41.7s ± 2%     ~           (p=0.586 n=23+23)

name       old alloc/op    new alloc/op    delta
Template      63.3MB ± 0%     62.4MB ± 0%   -1.36%        (p=0.000 n=25+23)
Unicode       42.4MB ± 0%     41.6MB ± 0%   -1.99%        (p=0.000 n=24+25)
GoTypes        220MB ± 0%      217MB ± 0%   -1.11%        (p=0.000 n=25+25)
Compiler       994MB ± 0%      973MB ± 0%   -2.08%        (p=0.000 n=24+25)

name       old allocs/op   new allocs/op   delta
Template        681k ± 0%       574k ± 0%  -15.71%        (p=0.000 n=24+25)
Unicode         518k ± 0%       413k ± 0%  -20.34%        (p=0.000 n=25+24)
GoTypes        2.08M ± 0%      1.78M ± 0%  -14.62%        (p=0.000 n=25+25)
Compiler       9.26M ± 0%      7.64M ± 0%  -17.48%        (p=0.000 n=25+25)

name       old text-bytes  new text-bytes  delta
HelloSize       578k ± 0%       578k ± 0%     ~     (all samples are equal)
CmdGoSize      6.46M ± 0%      6.46M ± 0%     ~     (all samples are equal)

name       old data-bytes  new data-bytes  delta
HelloSize       128k ± 0%       128k ± 0%     ~     (all samples are equal)
CmdGoSize       281k ± 0%       281k ± 0%     ~     (all samples are equal)

name       old exe-bytes   new exe-bytes   delta
HelloSize       921k ± 0%       921k ± 0%     ~     (all samples are equal)
CmdGoSize      9.86M ± 0%      9.86M ± 0%     ~     (all samples are equal)

Change-Id: I277d95bd56d51c166ef7f560647aeaa092f3f475
Reviewed-on: https://go-review.googlesource.com/20959
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-22 14:11:36 +00:00
Ian Lance Taylor
d1b8871f13 debug/dwarf: add Reader.SeekPC and Data.Ranges
These new methods help find the compilation unit to pass to the
LineReader method in order to find the line information for a PC.
The Ranges method also helps identify the specific function for a PC,
needed to determine the function name.

This uses the .debug.ranges section if necessary, and changes the object
file format packages to pass in the section contents if available.

Change-Id: I5ebc3d27faaf1a126ffb17a1e6027efdf64af836
Reviewed-on: https://go-review.googlesource.com/20769
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-22 14:06:09 +00:00
Dominik Honnef
77f4b773e7 encoding/json, internal/testenv: use Fatalf
Change-Id: I64dd09e76d811000a914776fdad47808e3895690
Reviewed-on: https://go-review.googlesource.com/20989
Reviewed-by: Dave Cheney <dave@cheney.net>
2016-03-22 05:58:27 +00:00
Michael Munday
5f0935b7d4 internal/syscall/unix: add randomTrap const for s390x
Change-Id: I81376f524e76db25fd52cc5bec2c80fbf618a0c5
Reviewed-on: https://go-review.googlesource.com/20877
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-22 04:25:34 +00:00
Michael Munday
2a7e85f162 cmd/internal/obj: add support for s390x
Adds a new R_PCRELDBL relocation for 2-byte aligned relative
relocations on s390x. Should be removed once #14218 is
implemented.

Change-Id: I79dd2d8e746ba8cbc26c570faccfdd691e8161e8
Reviewed-on: https://go-review.googlesource.com/20941
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-22 04:15:44 +00:00
Keith Randall
69a7c152a7 cmd/compile: change the way SSA does slice zero-cap detection
There is a special case for slicing s[i:j] when the resulting
slice has zero capacity, to prevent pointing to the next object
in memory.

Change this special case code from:
  rptr := rcap == 0 ? ptr : ptr+i*elemsize
to
  rptr := ptr + (rcap == 0 ? 0 : i) * elemsize

This change leads to slightly smaller generated code, replacing
a load with a register zero.

old:
	0x002e 00046 (slice.go:8)	CMPQ	BX, $0
	0x0032 00050 (slice.go:8)	JEQ	$0, 78
	0x0034 00052 (slice.go:8)	MOVQ	"".a+8(FP), BP
	0x0039 00057 (slice.go:8)	LEAQ	(BP)(CX*8), AX
	0x003e 00062 ... rest of function ...

	0x004e 00078 (slice.go:7)	MOVQ	"".a+8(FP), AX
	0x0053 00083 (slice.go:8)	JMP	62

new:
	0x002e 00046 (slice.go:8)	CMPQ	BX, $0
	0x0032 00050 (slice.go:8)	JEQ	$0, 78
	0x0034 00052 (slice.go:8)	MOVQ	"".a+8(FP), BP
	0x0039 00057 (slice.go:8)	LEAQ	(BP)(CX*8), AX
	0x003e 00062 ... rest of function...

	0x004e 00078 (slice.go:8)	MOVQ	$0, CX
	0x0050 00080 (slice.go:8)	JMP	52

Change-Id: I2a396616b0d7b090c226a47c92a7ba14b128401f
Reviewed-on: https://go-review.googlesource.com/20994
Reviewed-by: David Chase <drchase@google.com>
2016-03-22 02:21:20 +00:00
David Crawshaw
d37d3bdcfc net/http, internal/testenv: find go binary in PATH
Fixes #14901

Change-Id: Ia32e09767374a341c9a36c5d977d47d7d1a82315
Reviewed-on: https://go-review.googlesource.com/20967
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
2016-03-22 02:02:23 +00:00
Michael Munday
596949c18a cmd/dist: allow gohostarch to be s390x
Should let the s390x builder progress a little further.

Change-Id: I5eab5f384b0b039f8e246ba69ecfb24de08625d2
Reviewed-on: https://go-review.googlesource.com/20965
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-22 01:04:26 +00:00
Keith Randall
259b7edf5c cmd/compile: allow naming of subexpressions
Allow names to be used for subexpressions of match rules.
For example:

(OpA x:(OpB y)) -> ..use x here to refer to the OpB value..

This gets rid of the .Args[0].Args[0]... way of naming we
used to use.

While we're here, give all subexpression matches names instead
of recomputing them with .Args[i] sequences each time they
are referenced.  Makes the generated rule code a bit smaller.

Change-Id: Ie42139f6f208933b75bd2ae8bd34e95419bc0e4e
Reviewed-on: https://go-review.googlesource.com/20997
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
2016-03-22 00:18:31 +00:00
Keith Randall
d4663e1353 cmd/compile: don't write back unchanged slice results
Don't write back parts of a slicing operation if they
are unchanged from the source of the slice.  For example:

x.s = x.s[0:5]         // don't write back pointer or cap
x.s = x.s[:5]          // don't write back pointer or cap
x.s = x.s[:5:7]        // don't write back pointer

There is more to be done here, for example:

x.s = x.s[:len(x.s):7] // don't write back ptr or len

This CL can't handle that one yet.

Fixes #14855

Change-Id: Id1e1a4fa7f3076dc1a76924a7f1cd791b81909bb
Reviewed-on: https://go-review.googlesource.com/20954
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
2016-03-21 23:40:18 +00:00
Alexandru Moșoi
9549c06ce6 cmd/compile: fold IsInBounds with small index
For the following example, but there are a few more in the stdlib:
func histogram(b []byte, h *[256]int32) {
        for _, t := range b {
                h[t]++
        }
}

Change-Id: I56615f341ae52e02ef34025588dc6d1c52122295
Reviewed-on: https://go-review.googlesource.com/20924
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-21 23:15:25 +00:00
Todd Neal
e41f527f4d cmd/compile: allow inlining of functions with switch statements
Allow inlining of functions with switch statements as long as they don't
contain a break or type switch.

Fixes #13071

Change-Id: I057be351ea4584def1a744ee87eafa5df47a7f6d
Reviewed-on: https://go-review.googlesource.com/20824
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-21 23:05:10 +00:00
Robert Griesemer
a14537816e math/big: fix rounding to smallest denormal for Float.Float32/64
Converting a big.Float value x to a float32/64 value did not correctly
round x up to the smallest denormal float32/64 if x was smaller than the
smallest denormal float32/64, but larger than 0.5 of a smallest denormal
float32/64.

Handle this case explicitly and simplify some code in the turn.

For #14651.

Change-Id: I025e24bf8f0e671581a7de0abf7c1cd7e6403a6c
Reviewed-on: https://go-review.googlesource.com/20816
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-21 20:24:06 +00:00
Alexandru Moșoi
478b594d51 encoding/binary: fix bound check
The inserted early bound checks cause the slice
to expand beyond the original length of the slice.

Change-Id: Ib38891605f4a9a12d3b9e2071a5f77640b083d2d
Reviewed-on: https://go-review.googlesource.com/20981
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2016-03-21 19:22:22 +00:00
Keith Randall
6a33f7765f runtime: use MOVSB instead of MOVSQ for unaligned moves
MOVSB is quite a bit faster for unaligned moves.
Possibly we should use MOVSB all of the time, but Intel folks
say it might be a bit faster to use MOVSQ on some processors
(but not any I have access to at the moment).

benchmark                              old ns/op     new ns/op     delta
BenchmarkMemmove4096-8                 93.9          93.2          -0.75%
BenchmarkMemmoveUnalignedDst4096-8     256           151           -41.02%
BenchmarkMemmoveUnalignedSrc4096-8     175           90.5          -48.29%

Fixes #14630

Change-Id: I568e6d6590eb3615e6a699fb474020596be665ff
Reviewed-on: https://go-review.googlesource.com/20293
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-21 19:10:24 +00:00
Josh Bleecher Snyder
b07a214d39 cmd/internal/obj: change linkgetline from C to Go func style
Passes toolstash -cmp.

Change-Id: I8725dee490778be9c1fd31990a6b27df9713c3c9
Reviewed-on: https://go-review.googlesource.com/20957
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-21 18:45:20 +00:00
Josh Bleecher Snyder
075d66646c cmd/compile: remove formatting dreg
Left over from CL 20931.

Change-Id: I3b8dd9ef748bcbf70b5118da28135aaa1e5ba3a8
Reviewed-on: https://go-review.googlesource.com/20955
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Minux Ma <minux@golang.org>
2016-03-21 18:44:46 +00:00
Robert Griesemer
07749aef98 cmd/compile: special-case const comparisons against zero
Constant comparisons against 0 are reasonably common.
Special-case and avoid allocating a new zero value each time.

Change-Id: I6c526c8ab30ef7f0fef59110133c764b7b90ba05
Reviewed-on: https://go-review.googlesource.com/20956
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-21 17:58:21 +00:00
Matthew Dempsky
d3253876f2 cmd/compile: change Mp{int,flt} functions into methods
Also give them more idiomatic Go names. Adding godocs is outside the
scope of this CL. (Besides, the method names almost all directly
parallel an underlying math/big.Int or math/big.Float method.)

CL prepared mechanically with sed (for rewriting mpint.go/mpfloat.go)
and gofmt (for rewriting call sites).

Passes toolstash -cmp.

Change-Id: Id76f4aee476ba740f48db33162463e7978c2083d
Reviewed-on: https://go-review.googlesource.com/20909
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-21 17:25:50 +00:00
Marcel van Lohuizen
5fb6aa3e09 testing: add test for not exceeding maximum parallism
Fixed bug that slipped probably slipped in after rebasing and
explain why it failed on nacl/netbsd/plan9, which set default
maxparallelism to 1.

Change-Id: I4d59682fb2843d138b320334189f53fcdda5b2f6
Reviewed-on: https://go-review.googlesource.com/20980
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-21 16:52:04 +00:00
Robert Griesemer
bea2008b83 math/cmplx: added clarifying comment
Fixes #14890.

Change-Id: Ie790276b0e2ef94c92db3a777042d750269f876a
Reviewed-on: https://go-review.googlesource.com/20953
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-21 16:18:38 +00:00
Michael Munday
cd187e9102 syscall: change clone argument order on s390x
The Linux ABI takes arguments in a different order on s390x.

Change-Id: Ic9cfcc22a5ea3d8ef77d4dd0b915fc266ff3e5f7
Reviewed-on: https://go-review.googlesource.com/20960
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-21 08:59:18 +00:00
Michael Munday
254d63baa7 cmd/go: add s390x support
Minimum architecture of z196 required so that GCC can assemble
gcc_s390x.S in runtime/cgo.

Change-Id: I603ed2edd39f826fb8193740ece5bd11d18c3dc5
Reviewed-on: https://go-review.googlesource.com/20876
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-21 08:51:21 +00:00
Brad Fitzpatrick
f226e886c2 internal/syscall/unix: document randomTrap
Updates #10848

Change-Id: I8353100ed01cb0e8fc19225157f5709bae388612
Reviewed-on: https://go-review.googlesource.com/20975
Reviewed-by: Rob Pike <r@golang.org>
2016-03-21 08:36:38 +00:00
Michael Munday
cc17d1ba76 runtime/internal/sys: add s390x support
Change-Id: I928532b406a3457d2c5f75f4de7d46a3f795192e
Reviewed-on: https://go-review.googlesource.com/20939
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-21 08:04:38 +00:00
Michael Hudson-Doyle
74a3b205eb cmd/link: remove Link.Nsymbol
It was just a funny way of saying len(Ctxt.Allsym) by now.

Change-Id: Iff75e73c9f7ec4ba26cfef479bbd05d7dcd172f5
Reviewed-on: https://go-review.googlesource.com/20973
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-21 07:57:25 +00:00
Michael Hudson-Doyle
b6fe2c2c20 cmd/link: re-use duplicate symbol object
Nothing cares about it.

I did this after looking at the memprof output, but it helps performance a bit:

name       old s/op    new s/op    delta
LinkCmdGo   0.44 ± 3%   0.43 ± 3%  -2.20%   (p=0.000 n=94+90)
LinkJuju    3.98 ± 5%   3.94 ± 5%  -1.19%  (p=0.000 n=100+91)

As well as MaxRSS (i.e. what /usr/bin/time -f '%M' prints):

name       old MaxRSS  new MaxRSS  delta
LinkCmdGo   130k ± 0%   120k ± 3%  -7.79%   (p=0.000 n=79+90)
LinkJuju    862k ± 6%   827k ± 8%  -4.01%  (p=0.000 n=100+99)

Change-Id: I6306b7b3369576a688659e2ecdb0815b4152ae96
Reviewed-on: https://go-review.googlesource.com/20972
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-21 07:48:30 +00:00
Michael Munday
8bfb3045db cmd/dist: enable -shared and external linking tests on s390x
Change-Id: Iedd01ef3a9d2831cb55c53b7a1984e7e932f4249
Reviewed-on: https://go-review.googlesource.com/20932
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-21 07:45:38 +00:00
Brad Fitzpatrick
060a6915d4 cmd/compile: remove most of the Lookupf users and garbage
Introduce garbage-free LookupN to replace most users of Lookupf.

Also, remove the string interning from LookupBytes which was hurting
more than helping.

name       old alloc/op    new alloc/op    delta
Template      63.0MB ± 0%     62.7MB ± 0%  -0.48%         (p=0.000 n=10+9)
Unicode       43.0MB ± 0%     43.0MB ± 0%  -0.17%         (p=0.000 n=10+7)
GoTypes        219MB ± 0%      218MB ± 0%  -0.14%        (p=0.000 n=10+10)
Compiler       992MB ± 0%      991MB ± 0%  -0.12%        (p=0.000 n=10+10)

name       old allocs/op   new allocs/op   delta
Template        683k ± 0%       681k ± 0%  -0.38%         (p=0.000 n=10+8)
Unicode         541k ± 0%       541k ± 0%  -0.11%        (p=0.000 n=10+10)
GoTypes        2.09M ± 0%      2.08M ± 0%  -0.40%        (p=0.000 n=10+10)
Compiler       9.28M ± 0%      9.24M ± 0%  -0.36%        (p=0.000 n=10+10)

Size of $GOROOT/pkg/darwin_amd64 drops from 40124 KB to 40100 KB too,
removing the zero padding as suggested by josharian.

Updates #6853

Change-Id: I3c557266e9325fe29c459cef8e5b8954913e7abb
Reviewed-on: https://go-review.googlesource.com/20931
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-21 07:40:15 +00:00
Michael Munday
4fbe96adc3 cmd/dist: add "s390x" to okgoarch and cgoEnabled
Allows the compiler to recognise s390x specific files and s390x
build tags.

Change-Id: I7c62ab7361cf708181b1d9cfbe9b1fcb01be31e0
Reviewed-on: https://go-review.googlesource.com/20872
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-21 07:31:00 +00:00
Dominik Honnef
b2cf571040 all: delete dead test code
This deletes unused code and helpers from tests.

Change-Id: Ie31d46115f558ceb8da6efbf90c3c204e03b0d7e
Reviewed-on: https://go-review.googlesource.com/20927
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-21 07:10:08 +00:00
Michael Munday
992320aaa8 cmd/internal/objfile: add s390x support
Change-Id: I39aa6569c9a6f327f7aaa01f8b4ace814fd5b766
Reviewed-on: https://go-review.googlesource.com/20943
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-21 07:09:26 +00:00
Michael Hudson-Doyle
49be1ebab4 cmd/link: delete more unreachable code
Debugasm can never be set in cmd/link, so delete it and the code it enables.

Change-Id: If828db0b09f1a9e512dc660ac2750657a769094c
Reviewed-on: https://go-review.googlesource.com/20971
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-21 06:56:51 +00:00
Michael Hudson-Doyle
70ef564e79 cmd/link: delete unreachable hash collision check
This expression in readsym:

    dup != nil && len(dup.P) > 0 && strings.HasPrefix(s.Name, "gclocals·")

can never be true: if dup != nil, then s.Name is ".dup" (and this is not new:
the same broken logic is present in 1.4, at least). Delete the whole block.

Change-Id: I33b14d9a82b292116d6fd79d22b38e3842501317
Reviewed-on: https://go-review.googlesource.com/20970
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-21 06:53:27 +00:00
Dave Cheney
ca0f5c9740 cmd/internal/obj: move Nocache helper to arm back end
The obj.Nocache helper was only used by the arm back end, move it there.

Change-Id: I5c9faf995499991ead1f3d8c8ffc3b6af7346876
Reviewed-on: https://go-review.googlesource.com/20868
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-21 04:27:24 +00:00
Josh Bleecher Snyder
a4dce12803 cmd/compile: unexport convlit
Add a special helper for its one external use.

This is in preparation for an upcoming CL.

Passes toolstash -cmp / buildall.

Change-Id: I9d3463792afe220cc4bc89269bdecf0279abd281
Reviewed-on: https://go-review.googlesource.com/20933
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-21 04:11:11 +00:00
Dave Cheney
39af1eb96f cmd/internal/obj: remove Link.Windows field
This CL addresses a long standing CL by rsc by pushing the use of
Link.Windows down to its two users.

Link.Window was always initalised with the value of runtime.GOOS so
this does not affect cross compilation.

Change-Id: Ibbae068f8b5aad06336909691f094384caf12352
Reviewed-on: https://go-review.googlesource.com/20869
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-21 04:07:09 +00:00
Matthew Dempsky
e28a3929ef math/big: cleanup documentation for Format methods
'b' is a standard verb for floating point values. The runes like '+'
and '#' are called "flags" by package fmt's documentation. The flag
'-' controls left/right justification, not anything related to signs.

Change-Id: Ia9cf81b002df373f274ce635fe09b5bd0066aa1c
Reviewed-on: https://go-review.googlesource.com/20930
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-21 02:49:32 +00:00
Michael Hudson-Doyle
36d5650a1c cmd/internal/obj, cmd/link: put all symbol data in one contiguous section
Another object file change, gives a reasonable improvement:

name       old s/op   new s/op   delta
LinkCmdGo  0.46 ± 3%  0.44 ± 9%  -3.34%  (p=0.000 n=98+82)
LinkJuju   4.09 ± 4%  3.92 ± 5%  -4.30%  (p=0.000 n=98+99)

I guess the data section could be mmap-ed instead of read, I haven't tried
that.

Change-Id: I959eee470a05526ab1579e3f5d3ede41c16c954f
Reviewed-on: https://go-review.googlesource.com/20928
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-21 01:36:00 +00:00
Richard Miller
34f0c0b3de net/http: adaptive wait time in PersistConnLeak tests
In tests TransportPersistConnLeak and TransportPersistConnLeakShortBody,
there's a fixed wait time (100ms and 400ms respectively) to allow
goroutines to exit after CloseIdleConnections is called. This
is sometimes too short on a slow host running many simultaneous
tests.

This CL replaces the fixed sleep in each test with a sequence of
shorter sleeps, testing the number of remaining goroutines until
it reaches the threshold or an overall time limit of 500ms expires.
This prevents some failures in the plan9_arm builder, while reducing
the test time on faster machines.

Fixes #14887

Change-Id: Ia5c871062df139e2667cdfb2ce8283e135435318
Reviewed-on: https://go-review.googlesource.com/20922
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-20 22:53:45 +00:00
Alexandru Moșoi
a7a199947a cmd/compile: add rules to simplify AddPtr
Fixes #14849

Change-Id: I86e2dc27ca73bb6b24261a68cbf0094a63167414
Reviewed-on: https://go-review.googlesource.com/20833
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-20 20:57:28 +00:00
Ian Lance Taylor
a9407b5797 cmd/compile: fix varexpr handling of ODOT
For a long time varexpr has handled ODOT incorrectly: it has always
returned false.  Before https://golang.org/cl/20890 this has been
because an ODOT had a Right field with an ONAME with no Class, for which
varexpr returns false.  CL 20890 preserved the behavior of varexpr for
ODOT, so that the change would pass toolstash -cmp.

This CL fixes varexpr so that ODOT can return true in some cases.  This
breaks toolstash -cmp.  While the changed compiler allocates temporary
variables in a different order, I have not been able to find any
examples where the generated code is different, other than using
different stack offsets and, in some cases, registers.  It seems that
other parts of the compiler will force the ODOT into a temporary anyhow.

Still, this change is clearly correct, and is a minor compiler cleanup.

Change-Id: I71506877aa3c13966bb03c281aa16271ee7fe80a
Reviewed-on: https://go-review.googlesource.com/20907
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-20 18:28:09 +00:00
Shahar Kohanim
93098de0cc cmd/link: patch up symbols only once per object file
name       old s/op   new s/op   delta
LinkCmdGo  0.57 ± 5%  0.55 ± 6%  -2.37%  (p=0.000 n=97+98)

GOGC=off:

name       old s/op   new s/op   delta
LinkCmdGo  0.48 ± 3%  0.47 ± 3%  -2.90%  (p=0.000 n=100+100)

Change-Id: I1a36dbf84914cacb79842bc0ddb1e26b4c5a5828
Reviewed-on: https://go-review.googlesource.com/20917
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-20 17:36:30 +00:00
Ian Lance Taylor
060038bdd0 cmd/compile: don't penalize ODOT and friends when inlining
Historically ODOT and friends have been considered to cost an extra
budget point when deciding whether they should be inlined, because they
had an ONAME node that represented the name to the right of the dot.
This doesn't really make sense, as in general that symbol does not add
any extra instructions; it just affects the offset of the load or store
instruction.  And the ONAME node is gone now.  So, remove the extra
cost.

This does not pass toolstash -cmp, as it changes inlining decisions.
For example, mspan.init in runtime/mheap.go is now considered to be an
inlining candidate.

Change-Id: I5ad27f08c66fd5daa4c8472dd0795df989183f5e
Reviewed-on: https://go-review.googlesource.com/20891
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-20 17:25:02 +00:00
Shahar Kohanim
d6d33f678d cmd/link: use encbuf when writing integers
name       old s/op   new s/op   delta
LinkCmdGo  0.59 ± 6%  0.58 ± 5%  -1.61%  (p=0.000 n=99+99)

GOGC=off:
name       old s/op   new s/op   delta
LinkCmdGo  0.50 ± 3%  0.49 ± 3%  -1.28%  (p=0.000 n=98+99)

Change-Id: I737ae056214999441a210c69ec0cf4febc39a715
Reviewed-on: https://go-review.googlesource.com/20914
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-20 14:34:33 +00:00
Shahar Kohanim
78fc59ef42 cmd/compile, cmd/link: remove unused fields from relocations
Reduces size of archives in pkg/linux_amd64 by 3% from 41.5MB to 40.2MB

Change-Id: Id64ca7995de8dd84c9e7ce1985730927cf4bfd66
Reviewed-on: https://go-review.googlesource.com/20912
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-20 13:44:31 +00:00
Shahar Kohanim
3504945081 cmd/link: optimize int parsing
Speeds up linking cmd/go by ~1.5%:

name       old s/op   new s/op   delta
LinkCmdGo  0.58 ± 6%  0.57 ± 5%  -1.21%  (p=0.000 n=98+99)

Less noisy benchmark, with garbage collection off:

name       old s/op   new s/op   delta
LinkCmdGo  0.49 ± 2%  0.49 ± 2%  -1.79%  (p=0.000 n=98+99)

Change-Id: I0123bcb66a87cbc4d703356e4c5a4035032012ec
Reviewed-on: https://go-review.googlesource.com/20916
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-20 13:10:33 +00:00
Martin Möhrmann
8d9ece9dde fmt: unify integer formatting
Deduplicate the verb switch for signed and unsigned integer formatting.

Make names of integer related functions consistent
with names of other fmt functions.

Consolidate basic integer tests.

Change-Id: I0c19c24f1c2c06a3b1a4d7d377dcdac3b36bb0f5
Reviewed-on: https://go-review.googlesource.com/20831
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-20 12:08:03 +00:00
Matthew Dempsky
3eaa304629 cmd/compile: ignore receiver name when checking duplicate methods
In golang.org/cl/20602, I changed the semantics of Eqtype to stop
checking the receiver parameters for type equality, and pushed this
responsibility to addmethod (the only Eqtype caller that cared).
However, I accidentally made the check stricter by making it start
requiring that receiver names were identical.

In general, this is a non-problem because the receiver names in export
data will always match the original source. But running
GO_GCFLAGS=-newexport ./all.bash at one point tries to load both old
and new format export data for package sync, which reveals the
problem. (See golang.org/issue/14877 for details.)

Easy fix: just check the receiver type for type equality in addmethod,
instead of the entire receiver parameter list.

Fixes #14877.

Change-Id: If10b79f66ba58a1b7774622b4fbad1916aba32f1
Reviewed-on: https://go-review.googlesource.com/20906
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-20 04:37:04 +00:00
Josh Bleecher Snyder
ec7c494535 cmd/compile: remove typechecklist
Convert remaining uses to typecheckslice.

Passes toolstash -cmp.

Change-Id: I6ed0877386fb6c0b036e8ee5a228433343855abd
Reviewed-on: https://go-review.googlesource.com/20905
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-20 00:34:42 +00:00
Josh Bleecher Snyder
ad4c55c076 cmd/compile: convert fmt.Sprintf to concatenation
There are plenty more, but these cover most of
the trivial cases, and all the cases that
showed up in profiling.

name       old time/op     new time/op     delta
Template       331ms ± 3%      327ms ± 6%    ~           (p=0.143 n=10+10)
Unicode        183ms ± 4%      180ms ± 2%    ~             (p=0.114 n=9+8)
GoTypes        1.12s ± 4%      1.07s ± 1%  -4.34%         (p=0.000 n=10+9)
Compiler       5.16s ± 2%      5.04s ± 2%  -2.24%         (p=0.001 n=10+9)
MakeBash       41.7s ± 2%      42.3s ± 1%  +1.51%        (p=0.000 n=10+10)

name       old alloc/op    new alloc/op    delta
Template      63.4MB ± 0%     63.1MB ± 0%  -0.42%        (p=0.000 n=10+10)
Unicode       43.2MB ± 0%     43.1MB ± 0%  -0.22%         (p=0.000 n=9+10)
GoTypes        220MB ± 0%      219MB ± 0%  -0.57%         (p=0.000 n=8+10)
Compiler       978MB ± 0%      975MB ± 0%  -0.30%        (p=0.000 n=10+10)

name       old allocs/op   new allocs/op   delta
Template        702k ± 0%       686k ± 0%  -2.35%        (p=0.000 n=10+10)
Unicode         548k ± 0%       542k ± 0%  -1.09%        (p=0.000 n=10+10)
GoTypes        2.17M ± 0%      2.09M ± 0%  -3.61%        (p=0.000 n=10+10)
Compiler       9.33M ± 0%      9.15M ± 0%  -1.93%        (p=0.000 n=10+10)

Change-Id: I3a3d7f2d56876427b04cfedc7302d7f496d5bb65
Reviewed-on: https://go-review.googlesource.com/20904
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-20 00:17:30 +00:00
Keith Randall
8dc04cbedc cmd/compile: enforce 32-bit restrictions on ops
Most 64-bit x86 ops can only take a signed 32-bit constant.
Clean up our rewrite rules to enforce this restriction.

Modify the assembler to fail if the offset does not fit
in the instruction.

That last check triggers a few times on weird testing code.
Suppress those errors if the compiler itself generated errors.

Fixes #14862

Change-Id: I76559af035b38483b1e59621a8029fc66b3a5d1e
Reviewed-on: https://go-review.googlesource.com/20815
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-03-20 00:12:47 +00:00
Martin Möhrmann
d246eedcaa fmt: integer formatting should not permanently change padding
Changes the integer function to restore the original f.zero value
and therefore padding type before returning.

Change-Id: I456449259a3d39bd6d62e110553120c31ec63f23
Reviewed-on: https://go-review.googlesource.com/20512
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-19 23:49:18 +00:00
Martin Möhrmann
2f4d420683 fmt: remove depth argument from handleMethods and printArg
handleMethods can format Error() and String() directly as its known
these return strings that can be directly printed using fmtString.
Remove the obsolete depth argument from handleMethods.

Remove the depth argument from printArg since it is only ever
called with depth set to 0. Recursion for formatting complex
arguments is handled only by printValue which keeps track of depth.

Change-Id: I4c4be588751de12ed999e7561a51bc168eb9eb2d
Reviewed-on: https://go-review.googlesource.com/20911
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-19 21:45:13 +00:00
Ian Lance Taylor
5f525ca60d cmd/compile: change ODOT and friends to use Sym, not Right
The Node type ODOT and its variants all represent a selector, with a
simple name to the right of the dot.  Before this change this was
represented by using an ONAME Node in the Right field.  This ONAME node
served no useful purpose.  This CL changes these Node types to store the
symbol in the Sym field instead, thus not requiring allocating a Node
for each selector.

When compiling x/tools/go/types this CL eliminates nearly 5000 calls to
newname and reduces the total number of Nodes allocated by about 6.6%.
It seems to cut compilation time by 1 to 2 percent.

Getting this right was somewhat subtle, and I added two dubious changes
to produce the exact same output as before.  One is to ishairy in
inl.go: the ONAME node increased the cost of ODOT and friends by 1, and
I retained that, although really ODOT is not more expensive than any
other node.  The other is to varexpr in walk.go: because the ONAME in
the Right field of an ODOT has no class, varexpr would always return
false for an ODOT, although in fact for some ODOT's it seemingly ought
to return true; I added an && false for now.  I will send separate CLs,
that will break toolstash -cmp, to clean these up.

This CL passes toolstash -cmp.

Change-Id: I4af8a10cc59078c436130ce472f25abc3a9b2f80
Reviewed-on: https://go-review.googlesource.com/20890
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-19 00:45:09 +00:00
Todd Neal
fc6bcdee79 cmd/compile: allow inlining of functions that declare a const
Consider functions with an ODCLCONST for inlining and modify exprfmt to
ignore those nodes when exporting. Don't add symbols to the export list
if there is no definition.  This occurs when OLITERAL symbols are looked
up via Pkglookup for non-exported symbols.

Fixes #7655

Change-Id: I1de827850f4c69e58107447314fe7433e378e069
Reviewed-on: https://go-review.googlesource.com/20773
Run-TryBot: Todd Neal <todd@tneal.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-18 23:26:36 +00:00
Keith Randall
3dd4f74e06 cmd/compile: merge shifts into LEAs
Change-Id: I5a43c354f36184ae64a52268023c3222da3026d8
Reviewed-on: https://go-review.googlesource.com/20880
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
2016-03-18 23:08:24 +00:00
Keith Randall
377eaa7494 runtime: add space
Missed this in review of 20812

Change-Id: I01e220499dcd58e1a7205e2a577dd9630a8b7174
Reviewed-on: https://go-review.googlesource.com/20819
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-18 21:31:49 +00:00
Martin Möhrmann
e97789f7d9 fmt: simplify handling of reporting flags to formatters
Remove rewriting of flags before calling formatters.
Change Flag method to directly take plusV and sharpV flags
into account when reporting if plus or sharp flag is set.

Change-Id: Ic3423881ad89e5a5f9fff5ab59e842062394ef6d
Reviewed-on: https://go-review.googlesource.com/20859
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-18 21:28:06 +00:00
Keith Randall
15ea61146e runtime: use unaligned loads on ppc64
benchmark                      old ns/op     new ns/op     delta
BenchmarkAlignedLoad-160       8.67          7.42          -14.42%
BenchmarkUnalignedLoad-160     8.63          7.37          -14.60%

Change-Id: Id4609d7b4038c4d2ec332efc4fe6f1adfb61b82b
Reviewed-on: https://go-review.googlesource.com/20812
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-18 19:21:53 +00:00
David Chase
982322769c cmd/dist: redo flag-passing for bootstrap
This ought to revert the bad effects of
https://go-review.googlesource.com/#/c/20775/
If you don't pass BOOT_GO_GCFLAGS, you get the
old behavior.

Tweaked to allow multiple space-separated flags in
BOOT_GO_GCFLAGS.

Change-Id: I2a22a04211b4535d1c5a8ec7a8a78cb051161c31
Reviewed-on: https://go-review.googlesource.com/20871
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-18 19:00:03 +00:00
Martin Möhrmann
40bd28f0c7 fmt: remove unused field from printer struct
Change-Id: I0ec775c51f461c6f0cbff88e796a7af55b736fcb
Reviewed-on: https://go-review.googlesource.com/20838
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-18 17:02:51 +00:00
Marcel van Lohuizen
f693015be6 sync: don't assume b.N > 0
Change-Id: I6eb91ea73ef887b025e5a8de1dd55f30618e1aa6
Reviewed-on: https://go-review.googlesource.com/20857
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-18 16:37:39 +00:00
Alan Donovan
a5cd53a9fd cmd/compile/internal/gc: support invalid types/constants in binary export data
(Corresponding x/tools/go/gcimporter change is https://go-review.googlesource.com/#/c/20827/)

Change-Id: I64e7fee2e273d387f1c51b87986294489978d250
Reviewed-on: https://go-review.googlesource.com/20828
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-18 16:33:38 +00:00
Marcel van Lohuizen
2d4c3d2489 testing: disable tests that cause a hang on some platforms
plan9, nacl, and netbsd to be precise.

Only the first test causes a hang, but just to be sure.

Change-Id: I400bb356ee2a0cf12c8666c95af79c924d1629aa
Reviewed-on: https://go-review.googlesource.com/20839
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-18 16:24:27 +00:00
Marcel van Lohuizen
f39d6d9613 testing: always ignore RunParallel in probe phase
Change-Id: If45410a2d7e48d1c9e6800cd98f81dd89024832c
Reviewed-on: https://go-review.googlesource.com/20852
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-18 16:23:51 +00:00
Marcel van Lohuizen
872ca73cad runtime: don't assume b.N > 0
Change-Id: I2e26717f2563d7633ffd15f4adf63c3d0ee3403f
Reviewed-on: https://go-review.googlesource.com/20856
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-18 15:55:02 +00:00
Marcel van Lohuizen
3e2e80599e net/url: don't assume b.N > 0
Change-Id: Ie79c16d6e61b3baa274069528cf883b22fd255fe
Reviewed-on: https://go-review.googlesource.com/20855
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-18 15:54:59 +00:00
Marcel van Lohuizen
d3ce412fa5 net/rpc: don't assume b.N > 0
Change-Id: I58c4a75168fd1f797a25735c4151f501f0475332
Reviewed-on: https://go-review.googlesource.com/20854
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-18 15:54:55 +00:00
Marcel van Lohuizen
6e2deaa1e1 encoding/binary: don't assume b.N > 0
Change-Id: I9e887a0b32baf0adc85fa9e4b85b319e8ef333e9
Reviewed-on: https://go-review.googlesource.com/20853
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-18 15:54:51 +00:00
Marcel van Lohuizen
705be76b6f encoding/binary: improve error messages for benchmarks
Change-Id: I0f4b6752ecc8b4945ecfde627cdec13fc4bb6a69
Reviewed-on: https://go-review.googlesource.com/20850
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-18 15:38:58 +00:00
Todd Neal
b2dc1f82a5 cmd/compile: perform minimal phi elimination during critical
Phi splitting sometimes leads to a phi with only a single predecessor.
This must be replaced with a copy to maintain a valid SSA form.

Fixes #14857

Change-Id: I5ab2423fb6c85a061928e3206b02185ea8c79cd7
Reviewed-on: https://go-review.googlesource.com/20826
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-18 15:35:49 +00:00
Marcel van Lohuizen
2330ae8cf8 testing: finish implementation of subtests
API not exposed yet.

Change-Id: Iaba0adc0fa1ae8075e6b56796f99ee8db9177a78
Reviewed-on: https://go-review.googlesource.com/18896
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-18 12:30:39 +00:00
Marcel van Lohuizen
1857bfca13 testing: implementation of subbenchmarks
API is not exposed yet.

Change-Id: I729360ef2be1d8ea683ca93cdb1763897cc8657c
Reviewed-on: https://go-review.googlesource.com/18895
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-18 12:05:55 +00:00
Marcel van Lohuizen
89cda2db00 testing: hoisted chunks of code to prepare for Run method
testing.go:
- run method will evolve into the Run method.
- added level field in common

benchmark.go:
- benchContext will be central to distinguish handling of benchmarks
  between normal Run methods and ones called from within Benchmark
  function.
- expandCPU will evolve into the processing hook for Run methods
  called within normal processing.
- runBench will evolve into the Run method.

Change-Id: I1816f9985d5ba94deb0ad062302ea9aee0bb5338
Reviewed-on: https://go-review.googlesource.com/18894
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-18 11:35:16 +00:00
Marcel van Lohuizen
5c83e651ad testing: prepare for the introduction of Run methods
The biggest change is that each test is now responsible for managing
the starting and stopping of its parallel subtests.

The "Main" test could be run as a tRunner as well. This shows that
the introduction of subtests is merely a generalization of and
consistent with the current semantics.

Change-Id: Ibf8388c08f85d4b2c0df69c069326762ed36a72e
Reviewed-on: https://go-review.googlesource.com/18893
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-18 11:25:54 +00:00
David Symonds
248c3a3c7b regexp: avoid copying mutex in (*Regexp).Copy.
There's nothing guaranteeing that the *Regexp isn't in active use,
and so copying the sync.Mutex value is invalid.

Updates #14839.

Change-Id: Iddf52bf69df1b563377922399f64a571f76b95dd
Reviewed-on: https://go-review.googlesource.com/20841
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-03-18 03:56:28 +00:00
David Chase
815c9a7f28 cmd/compile: use loop information in regalloc
This seems to help the problem reported in #14606; this
change seems to produce about a 4% improvement (mostly
for the 128-8192 shards).

Fixes #14789.

Change-Id: I1bd52c82d4ca81d9d5e9ab371fdfc860d7e8af50
Reviewed-on: https://go-review.googlesource.com/20660
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-18 01:23:29 +00:00
Christopher Nelson
e4d489a85f cmd/go: fix TestShadowingLogic fails when GOROOT path has spaces
Improve the test by also translating " " to "_".

Fixes #14671.

Change-Id: Ie5997934b93c7663d7b8432244fad47bb5d3ffbe
Reviewed-on: https://go-review.googlesource.com/20714
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-18 01:12:06 +00:00
David Chase
09a9ce60c7 cmd/compile: get gcflags to bootstrap; ssa debug opts for "all"
This is intended to help debug compiler problems that pop
up in the bootstrap phase of make.bash.  GO_GCFLAGS does not
normally apply there.  Options-for-all phases is intended
to allow crude tracing (and full timing) by turning on timing
for all phases, not just one.

Phase names can also be specified using a regular expression,
for example
BOOT_GO_GCFLAGS=-d='ssa/~^.*scc$/off' \
GO_GCFLAGS='-d=ssa/~^.*scc$/off' ./make.bash

I just added this because it was the fastest way to get
me to a place where I could easily debug the compiler.

Change-Id: I0781f3e7c19651ae7452fa25c2d54c9a245ef62d
Reviewed-on: https://go-review.googlesource.com/20775
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-18 01:04:47 +00:00
Todd Neal
2cc42cf2a8 cmd/compile/test: replace switch{} with go:noinline
Change-Id: Ic40449b2e4b4f18cbe5b5d4c3d51ea7b05ac674d
Reviewed-on: https://go-review.googlesource.com/20823
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-17 23:49:35 +00:00
Mikio Hara
ac2f84d524 net: make unexposed methods start with lowercase letters
This change makes unexposed methods start with lowercase letters for
avoiding unnecessary confusion because the net package uses many
embedding structures and intrefaces for controlling exposure of APIs.

Note that this change leaves DNS-related methods as they are.

Change-Id: I253758d1659175c5d0af6b2efcd30ce83f46543d
Reviewed-on: https://go-review.googlesource.com/20784
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-17 21:43:41 +00:00
Hyang-Ah Hana Kim
50487b2c8d cmd/pack,vet: use go doc instead of godoc in doc
Change-Id: Ic5f62a7d0a5c090da69213d1d0187af0ea48e358
Reviewed-on: https://go-review.googlesource.com/20820
Reviewed-by: Rob Pike <r@golang.org>
2016-03-17 21:06:40 +00:00
David Chase
3a17fdaba0 cmd/compile: correct maintain use count when phi args merge
The critical phase did not correctly maintain the use count
when two predecessors of a new critical block transmit the
same value.

Change-Id: Iba802c98ebb84e36a410721ec32c867140efb6d4
Reviewed-on: https://go-review.googlesource.com/20822
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
2016-03-17 20:55:13 +00:00