]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agocmd/compile: convert cgen/gen/pgen and friends to nodeListSeq
Ian Lance Taylor [Thu, 3 Mar 2016 23:08:25 +0000 (15:08 -0800)]
cmd/compile: convert cgen/gen/pgen and friends to nodeListSeq

Added Seq method to nodeListIterator. Added new functions nodeSeqLen,
nodeSeqFirst, nodeSeqSecond. Allow nil as source argument to setNodeSeq.

Change-Id: Ifc1cd4d7207b7a125b3830c92c4d6d6f00eedd54
Reviewed-on: https://go-review.googlesource.com/20195
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: add setNodeSeq, and use it in bimport.go
Ian Lance Taylor [Thu, 3 Mar 2016 22:11:17 +0000 (14:11 -0800)]
cmd/compile: add setNodeSeq, and use it in bimport.go

Also rewrite bexport.go to use nodeSeqIterate.

The new setNodeSeq is a transitional generic function to set either a
NodeList or a slice to either a NodeList or a slice.  This should permit
us to flip fields from *NodeList to []*Node, or Nodes, without changing
other code.

Passes toolstash -cmp.

Change-Id: I872cbfe45bc5f432595737c1f6da641c502b1ab6
Reviewed-on: https://go-review.googlesource.com/20194
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: don't use duffcopy and duffzero on Plan 9
David du Colombier [Thu, 3 Mar 2016 18:45:24 +0000 (19:45 +0100)]
cmd/compile: don't use duffcopy and duffzero on Plan 9

The ssa compiler uses the duffcopy and duffzero functions,
which rely on the MOVUPS instructions.

However, this doesn't work on Plan 9, since floating point
operations are not allowed in the note handler.

This change disables the use of duffcopy and duffzero
on Plan 9 in the ssa compiler.

Updates #14605.

Change-Id: I017f8ff83de00eabaf7e146b4344a863db1dfddc
Reviewed-on: https://go-review.googlesource.com/20171
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: add nodeSeqIterator interface
Ian Lance Taylor [Thu, 3 Mar 2016 19:30:17 +0000 (11:30 -0800)]
cmd/compile: add nodeSeqIterator interface

I tried to write a program to convert *NodeList to Node, but ran into
too many problem cases.  I'm backing off and trying a more iterative
approach using interfaces.

This CL adds an interface for iteration over either a *NodeList or a
Nodes.  I changed typechecklist to use it, to show how it works.  After
NodeList is eliminated, we can change the typechecklist parameter type
to Nodes.

Passes toolstash -cmp.

Change-Id: I5c7593714b020d20868b99151b1e7cadbbdbc397
Reviewed-on: https://go-review.googlesource.com/20190
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/link: combine all string data into one symbol
David Crawshaw [Thu, 3 Mar 2016 15:51:30 +0000 (10:51 -0500)]
cmd/link: combine all string data into one symbol

This CL introduces a mergestrings pass after the reachability
analysis to combine all reachable go.string."..." character data
symbols into a single symbol.

Shrinks juju by 1.2mb (1.5%).
Shrinks cmd/go by 0.5% when building without DWARF.
No noticable effect on linker speed.

Change-Id: I2ba3e60bf418f65766bda257f6ca9eea26d895b6
Reviewed-on: https://go-review.googlesource.com/20165
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: remove listsort
Ian Lance Taylor [Fri, 26 Feb 2016 21:03:11 +0000 (13:03 -0800)]
cmd/compile: remove listsort

The listsort function is no longer used, except in a test.  Change the
test to use sort.Sort instead.

Change-Id: Ib634705cc1bc3b1d8fc3795bd4ed2894e6abc284
Reviewed-on: https://go-review.googlesource.com/19964
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: make compilation deterministic, fixes toolstash
Keith Randall [Thu, 3 Mar 2016 17:53:03 +0000 (09:53 -0800)]
cmd/compile: make compilation deterministic, fixes toolstash

Make sure we don't depend on map iterator order.

Fixes #14600

Change-Id: Iac0e0c8689f3ace7a4dc8e2127e2fd3c8545bd29
Reviewed-on: https://go-review.googlesource.com/20158
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: load some live values into registers before loop
Keith Randall [Wed, 2 Mar 2016 23:18:40 +0000 (15:18 -0800)]
cmd/compile: load some live values into registers before loop

If we're about to enter a loop, load values which are live
and will soon be used in the loop into registers.

name                     old time/op    new time/op    delta
BinaryTree17-8              2.80s ± 4%     2.62s ± 2%   -6.43%          (p=0.008 n=5+5)
Fannkuch11-8                2.45s ± 2%     2.14s ± 1%  -12.43%          (p=0.008 n=5+5)
FmtFprintfEmpty-8          49.0ns ± 1%    48.4ns ± 1%   -1.35%          (p=0.032 n=5+5)
FmtFprintfString-8          160ns ± 1%     153ns ± 0%   -4.63%          (p=0.008 n=5+5)
FmtFprintfInt-8             152ns ± 0%     150ns ± 0%   -1.57%          (p=0.000 n=5+4)
FmtFprintfIntInt-8          252ns ± 2%     244ns ± 1%   -3.02%          (p=0.008 n=5+5)
FmtFprintfPrefixedInt-8     223ns ± 0%     223ns ± 0%     ~     (all samples are equal)
FmtFprintfFloat-8           293ns ± 2%     291ns ± 2%     ~             (p=0.389 n=5+5)
FmtManyArgs-8               956ns ± 0%     936ns ± 0%   -2.05%          (p=0.008 n=5+5)
GobDecode-8                7.18ms ± 0%    7.11ms ± 0%   -1.02%          (p=0.008 n=5+5)
GobEncode-8                6.12ms ± 3%    6.07ms ± 1%     ~             (p=0.690 n=5+5)
Gzip-8                      284ms ± 1%     284ms ± 0%     ~             (p=1.000 n=5+5)
Gunzip-8                   40.8ms ± 1%    40.6ms ± 1%     ~             (p=0.310 n=5+5)
HTTPClientServer-8         69.8µs ± 1%    72.2µs ± 4%     ~             (p=0.056 n=5+5)
JSONEncode-8               16.1ms ± 2%    16.2ms ± 1%     ~             (p=0.151 n=5+5)
JSONDecode-8               54.9ms ± 0%    57.0ms ± 1%   +3.79%          (p=0.008 n=5+5)
Mandelbrot200-8            4.35ms ± 0%    4.39ms ± 0%   +0.85%          (p=0.008 n=5+5)
GoParse-8                  3.56ms ± 1%    3.42ms ± 1%   -4.03%          (p=0.008 n=5+5)
RegexpMatchEasy0_32-8      75.6ns ± 1%    75.0ns ± 0%   -0.83%          (p=0.016 n=5+4)
RegexpMatchEasy0_1K-8       250ns ± 0%     252ns ± 1%   +0.80%          (p=0.016 n=4+5)
RegexpMatchEasy1_32-8      75.0ns ± 0%    75.4ns ± 2%     ~             (p=0.206 n=5+5)
RegexpMatchEasy1_1K-8       401ns ± 0%     398ns ± 1%     ~             (p=0.056 n=5+5)
RegexpMatchMedium_32-8      119ns ± 0%     118ns ± 0%   -0.84%          (p=0.008 n=5+5)
RegexpMatchMedium_1K-8     36.6µs ± 0%    36.9µs ± 0%   +0.91%          (p=0.008 n=5+5)
RegexpMatchHard_32-8       1.95µs ± 1%    1.92µs ± 0%   -1.23%          (p=0.032 n=5+5)
RegexpMatchHard_1K-8       58.3µs ± 1%    58.1µs ± 1%     ~             (p=0.548 n=5+5)
Revcomp-8                   425ms ± 1%     389ms ± 1%   -8.39%          (p=0.008 n=5+5)
Template-8                 65.5ms ± 1%    63.6ms ± 1%   -2.86%          (p=0.008 n=5+5)
TimeParse-8                 363ns ± 0%     354ns ± 1%   -2.59%          (p=0.008 n=5+5)
TimeFormat-8                363ns ± 0%     364ns ± 1%     ~             (p=0.159 n=5+5)

Fixes #14511

Change-Id: I1b79d2545271fa90d5b04712cc25573bdc94f2ce
Reviewed-on: https://go-review.googlesource.com/20151
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
9 years agocmd/link: replace Autom linked list with slice
David Crawshaw [Thu, 3 Mar 2016 03:38:42 +0000 (22:38 -0500)]
cmd/link: replace Autom linked list with slice

Change-Id: I939129da0e71a7ccc61bec79515a34f0b1e59502
Reviewed-on: https://go-review.googlesource.com/20162
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/link: replace LSym.Queue with a slice
David Crawshaw [Thu, 3 Mar 2016 03:28:05 +0000 (22:28 -0500)]
cmd/link: replace LSym.Queue with a slice

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

9 years agocmd/go: set GOPATH in list's Context
Caleb Spare [Sun, 28 Feb 2016 09:11:23 +0000 (01:11 -0800)]
cmd/go: set GOPATH in list's Context

Fixes #14547.

Change-Id: Ic175ee8f7e65b9b99f1f47fbf267a2aba7c8fec7
Reviewed-on: https://go-review.googlesource.com/20010
Run-TryBot: Caleb Spare <cespare@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

9 years agofmt: optimize %x and %X formatting for byte slices and strings
Martin Möhrmann [Sat, 27 Feb 2016 18:47:43 +0000 (19:47 +0100)]
fmt: optimize %x and %X formatting for byte slices and strings

No extra buffering is needed to save the encoding
since the left padding can be computed and written out
before the encoding is generated.

Add extra tests to both string and byte slice formatting.

name                old time/op  new time/op  delta
SprintfHexString-2   410ns ± 3%   194ns ± 3%  -52.60%  (p=0.000 n=20+19)
SprintfHexBytes-2    431ns ± 3%   202ns ± 2%  -53.13%  (p=0.000 n=18+20)

Change-Id: Ibca4316427c89f834e4faee61614493c7eedb42b
Reviewed-on: https://go-review.googlesource.com/20097
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile: fix fieldtrack experiment
Keith Randall [Thu, 3 Mar 2016 04:54:41 +0000 (20:54 -0800)]
cmd/compile: fix fieldtrack experiment

The ODOTPTRs introduced in CL #19814 don't have field names,
just offsets.  The fieldtrack experiment crashes when
examining them.  Instead, just ignore them.  We'll never track
these fields anyway.

It would be nice to have the runtime type struct build in the
compiler (like we do sudog, for example) so we could use its
fieldnames.  Doesn't seem worth it just for this CL.

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

9 years agocmd/compile: more lineno type conversions
Matthew Dempsky [Thu, 3 Mar 2016 04:32:40 +0000 (20:32 -0800)]
cmd/compile: more lineno type conversions

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

9 years agocmd/link: add Minalign field to ld.Arch
Michael Munday [Thu, 3 Mar 2016 02:24:04 +0000 (21:24 -0500)]
cmd/link: add Minalign field to ld.Arch

The new Minalign field sets the minimum alignment for all symbols.
This is required for the upcoming s390x port which requires symbols
be 2-byte aligned for efficient relative addressing.

All preexisting architectures have Minalign set to 1 which means
that this commit should have no effect.

I tested values of 2, 4 and 8 on linux amd64 and the tests appear to
pass. Increasing Minalign to 16 appears to break the runtime. I
think this is due to assumptions made about the layout of module
data.

toolstash -cmp on linux amd64 shows no changes due to this commit.

Resolves #14604

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

9 years agonet: deduplicate TCP socket code
Mikio Hara [Wed, 2 Mar 2016 11:08:18 +0000 (20:08 +0900)]
net: deduplicate TCP socket code

This change consolidates functions and methods related to TCPAddr,
TCPConn and TCPListener for maintenance purpose, especially for
documentation. Also refactors Dial error code paths.

The followup changes will update comments and examples.

Updates #10624.

Change-Id: I3333ee218ebcd08928f9e2826cd1984d15ea153e
Reviewed-on: https://go-review.googlesource.com/20009
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: exit early if oldname doesn't find a name
Robert Griesemer [Thu, 3 Mar 2016 01:40:18 +0000 (17:40 -0800)]
cmd/compile: exit early if oldname doesn't find a name

Change-Id: I59ce1b40bc3472cc92a9a0a9fbd32342e0b945ad
Reviewed-on: https://go-review.googlesource.com/20152
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agocmd/compile: remove more superfluous int(lineno) conversions
Robert Griesemer [Thu, 3 Mar 2016 01:34:42 +0000 (17:34 -0800)]
cmd/compile: remove more superfluous int(lineno) conversions

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

9 years agocompress/bzip2: refactor unit tests
Joe Tsai [Wed, 2 Mar 2016 20:21:53 +0000 (12:21 -0800)]
compress/bzip2: refactor unit tests

Over the years as more bugs were discovered with the bzip2 library,
new Tests were appended the unit tests and the tests became gnarly.

Clean up the tests to be more consistent with modern Go style in
addition to coalescing common tests into a general version that
iterates over a list of input/output pairs. This has the advantage that
the input, output, and test code are all in the same area, rather than
being sprawled around the test file.

There is no loss of test coverage.

Change-Id: I377ed89378f0b89763d4a56ffc37b22d9c2a369e
Reviewed-on: https://go-review.googlesource.com/20133
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agonet: skip TestLookupPort on android with netgo
Burcu Dogan [Thu, 3 Mar 2016 02:12:30 +0000 (18:12 -0800)]
net: skip TestLookupPort on android with netgo

/etc/services is not available on Android. The pure Go implementation
of LookupPort will never succeed on Android. Skipping the test.

Updates #14576.

Change-Id: I707ac24aea3f988656b95b1816ee5c9690106985
Reviewed-on: https://go-review.googlesource.com/20154
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agomath: delete unused function sqrtC
Rob Pike [Thu, 3 Mar 2016 02:01:09 +0000 (13:01 +1100)]
math: delete unused function sqrtC

It appears to be a trivial dreg. Unreferenced. Gone.

Change-Id: I4a5ceed48e84254bc8a07fdb04487a18a0edf965
Reviewed-on: https://go-review.googlesource.com/20122
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agocmd/compile: eliminate arch-specific typedefs
Matthew Dempsky [Thu, 3 Mar 2016 02:03:50 +0000 (18:03 -0800)]
cmd/compile: eliminate arch-specific typedefs

Arch backends already provide us Widthint and Widthptr, which is ample
information to figure out how to define the universal "int", "uint",
and "uintptr" types.  No need for providing a generic typedef
mechanism beyond that.

Change-Id: I35c0c17a67c80605a9208b93d77d6960b2cbb17d
Reviewed-on: https://go-review.googlesource.com/20153
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agodoc: add link to 1.6 release notes on golang.org/project page
Chris Broadfoot [Thu, 3 Mar 2016 00:16:29 +0000 (16:16 -0800)]
doc: add link to 1.6 release notes on golang.org/project page

Fixes #14378.

Change-Id: I680b523c01576e42f1dbda9131d1f6bb99b3668b
Reviewed-on: https://go-review.googlesource.com/20138
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/link: pack LSym boolean attributes
David Crawshaw [Wed, 2 Mar 2016 12:59:49 +0000 (07:59 -0500)]
cmd/link: pack LSym boolean attributes

No performance improvement, but possibly more readable.

Linking juju:
tip:  real 0m5.470s user 0m6.131s
this: real 0m5.392s user 0m6.087s

Change-Id: I578e94fbe6c11b19d79034c33b3db31d9689d439
Reviewed-on: https://go-review.googlesource.com/20108
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: David Crawshaw <crawshaw@golang.org>

9 years agocmd/link: stop generating garbage in elfhash
Brad Fitzpatrick [Wed, 2 Mar 2016 22:29:44 +0000 (14:29 -0800)]
cmd/link: stop generating garbage in elfhash

All callers already had strings. No need to generate byte slice copies
to work on bytes.

Performance not measured, but probably helps at least a bit.

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

9 years agomisc/cgo/test: rewrite windows version of mysleep
Alex Brainman [Wed, 2 Mar 2016 05:58:40 +0000 (16:58 +1100)]
misc/cgo/test: rewrite windows version of mysleep

Latest version of gcc (tdm-1) 5.1.0 refuses to compile our code
on windows/386 (see issue for details). Rewrite the code.

Fixes #14328

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

9 years agocmd/link: make Allsym a slice
David Crawshaw [Wed, 2 Mar 2016 20:59:38 +0000 (15:59 -0500)]
cmd/link: make Allsym a slice

Looks a tiny bit faster, which is a surprise. Probably noise.
Motivation is making the LSym structure a little easier to understand.

Linking juju, best of 10:

before: real 0m4.811s user 0m5.582s
after:  real 0m4.611s user 0m5.267s

Change-Id: Idbedaf4a6e6e199036a1bbb6760e98c94ed2c282
Reviewed-on: https://go-review.googlesource.com/20142
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile/internal/gc: export & import function bodies, but don't hook up
Robert Griesemer [Fri, 23 Oct 2015 01:56:45 +0000 (18:56 -0700)]
cmd/compile/internal/gc: export & import function bodies, but don't hook up

Function bodies are not yet hooked up because the node structure is not
100% correct. This commit establishes that we can correctly write bodies
out and read them in again.

- export and import all exported inlined function bodies:
  (export GO_GCFLAGS="-newexport"; sh all.bash) working
- inlined functions are not yet hooked up (just dropped on the floor)
- improved tracing output and error messages
- make mkbuiltin.go work for both textual and binary export data
  so we can run tests with the new format

Change-Id: I70dc4de419df1b604389c3747041d6dba8730b0b
Reviewed-on: https://go-review.googlesource.com/16284
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agocmd/link: replace custom hashmap in DWARF writer
David Crawshaw [Wed, 2 Mar 2016 20:14:02 +0000 (15:14 -0500)]
cmd/link: replace custom hashmap in DWARF writer

Also stop creating a map for each symbol, as it does not seem to help.

Linking juju:
tip:  real 0m5.470s user 0m6.131s
this: real 0m4.811s user 0m5.582s

Change-Id: Ib3d931c996396a00942581770ff32df1eb8d6615
Reviewed-on: https://go-review.googlesource.com/20140
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: trunc(and(x,K)) rewrite to trunc(x) for some K
David Chase [Wed, 2 Mar 2016 20:49:55 +0000 (15:49 -0500)]
cmd/compile: trunc(and(x,K)) rewrite to trunc(x) for some K

uint8(s.b & 0xff) ought to produce same code as uint8(s.b)
but it did not.  RLH found this one looking for moles to
whack in the GC code.

Change-Id: I883d68ec7a5746d652712be84a274a11256b3b33
Reviewed-on: https://go-review.googlesource.com/20141
Reviewed-by: Keith Randall <khr@golang.org>
9 years agocmd/compile: remove missed int(lineno) conversions
Robert Griesemer [Wed, 2 Mar 2016 20:49:37 +0000 (12:49 -0800)]
cmd/compile: remove missed int(lineno) conversions

Follow-up to https://go-review.googlesource.com/20131 .

Change-Id: Id8351fa39f24e6ea488cdbfcb855b69a31ffff31
Reviewed-on: https://go-review.googlesource.com/20134
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agofmt: optimize string truncation
Martin Möhrmann [Wed, 2 Mar 2016 19:31:20 +0000 (20:31 +0100)]
fmt: optimize string truncation

Count only the runes up to the requested precision
to decide where to truncate a string.

Change the loop within truncate to need fewer jumps.

name                     old time/op  new time/op  delta
SprintfTruncateString-2   188ns ± 3%   155ns ± 3%  -17.43%  (p=0.000 n=20+20)

Change-Id: I17ca9fc0bb8bf7648599df48e4785251bbc31e99
Reviewed-on: https://go-review.googlesource.com/20098
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile: introduce linestr helper to simplify line reporting
Robert Griesemer [Wed, 2 Mar 2016 19:30:29 +0000 (11:30 -0800)]
cmd/compile: introduce linestr helper to simplify line reporting

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

9 years agoruntime/pprof: sort counted profiles by count
Russ Cox [Wed, 2 Mar 2016 17:32:38 +0000 (12:32 -0500)]
runtime/pprof: sort counted profiles by count

This is especially helpful in programs with very large numbers of goroutines:
the bulk of the goroutines will show up at the top.

Before:
1 @ 0x86ab8 0x86893 0x82164 0x8e7ce 0x7b798 0x5b871
# 0x86ab8 runtime/pprof.writeRuntimeProfile+0xb8 /Users/rsc/go/src/runtime/pprof/pprof.go:545
# 0x86893 runtime/pprof.writeGoroutine+0x93 /Users/rsc/go/src/runtime/pprof/pprof.go:507
# 0x82164 runtime/pprof.(*Profile).WriteTo+0xd4 /Users/rsc/go/src/runtime/pprof/pprof.go:236
# 0x8e7ce runtime/pprof_test.TestGoroutineCounts+0x15e /Users/rsc/go/src/runtime/pprof/pprof_test.go:603
# 0x7b798 testing.tRunner+0x98 /Users/rsc/go/src/testing/testing.go:473

1 @ 0x2d373 0x2d434 0x560f 0x516b 0x7cd42 0x7b861 0x2297 0x2cf90 0x5b871
# 0x7cd42 testing.RunTests+0x8d2 /Users/rsc/go/src/testing/testing.go:583
# 0x7b861 testing.(*M).Run+0x81 /Users/rsc/go/src/testing/testing.go:515
# 0x2297 main.main+0x117 runtime/pprof/_test/_testmain.go:72
# 0x2cf90 runtime.main+0x2b0 /Users/rsc/go/src/runtime/proc.go:188

10 @ 0x2d373 0x2d434 0x560f 0x516b 0x8e5b6 0x5b871
# 0x8e5b6 runtime/pprof_test.func1+0x36 /Users/rsc/go/src/runtime/pprof/pprof_test.go:582

50 @ 0x2d373 0x2d434 0x560f 0x516b 0x8e656 0x5b871
# 0x8e656 runtime/pprof_test.func3+0x36 /Users/rsc/go/src/runtime/pprof/pprof_test.go:584

40 @ 0x2d373 0x2d434 0x560f 0x516b 0x8e606 0x5b871
# 0x8e606 runtime/pprof_test.func2+0x36 /Users/rsc/go/src/runtime/pprof/pprof_test.go:583

After:

50 @ 0x2d373 0x2d434 0x560f 0x516b 0x8ecc6 0x5b871
# 0x8ecc6 runtime/pprof_test.func3+0x36 /Users/rsc/go/src/runtime/pprof/pprof_test.go:584

40 @ 0x2d373 0x2d434 0x560f 0x516b 0x8ec76 0x5b871
# 0x8ec76 runtime/pprof_test.func2+0x36 /Users/rsc/go/src/runtime/pprof/pprof_test.go:583

10 @ 0x2d373 0x2d434 0x560f 0x516b 0x8ec26 0x5b871
# 0x8ec26 runtime/pprof_test.func1+0x36 /Users/rsc/go/src/runtime/pprof/pprof_test.go:582

1 @ 0x2d373 0x2d434 0x560f 0x516b 0x7cd42 0x7b861 0x2297 0x2cf90 0x5b871
# 0x7cd42 testing.RunTests+0x8d2 /Users/rsc/go/src/testing/testing.go:583
# 0x7b861 testing.(*M).Run+0x81 /Users/rsc/go/src/testing/testing.go:515
# 0x2297 main.main+0x117 runtime/pprof/_test/_testmain.go:72
# 0x2cf90 runtime.main+0x2b0 /Users/rsc/go/src/runtime/proc.go:188

1 @ 0x87128 0x86f03 0x82164 0x8ee30 0x7b798 0x5b871
# 0x87128 runtime/pprof.writeRuntimeProfile+0xb8 /Users/rsc/go/src/runtime/pprof/pprof.go:566
# 0x86f03 runtime/pprof.writeGoroutine+0x93 /Users/rsc/go/src/runtime/pprof/pprof.go:528
# 0x82164 runtime/pprof.(*Profile).WriteTo+0xd4 /Users/rsc/go/src/runtime/pprof/pprof.go:236
# 0x8ee30 runtime/pprof_test.TestGoroutineCounts+0x150 /Users/rsc/go/src/runtime/pprof/pprof_test.go:603
# 0x7b798 testing.tRunner+0x98 /Users/rsc/go/src/testing/testing.go:473

Change-Id: I43de9eee2d96f9c46f7b0fbe099a0571164324f5
Reviewed-on: https://go-review.googlesource.com/20107
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: use int32 for line numbers consistently
Robert Griesemer [Wed, 2 Mar 2016 19:01:25 +0000 (11:01 -0800)]
cmd/compile: use int32 for line numbers consistently

- removed lots of unnecessary int(x) casts
- removed parserline() - was inconsistently used anyway
- minor simplifications in dcl.go

Change-Id: Ibf7de679eea528a31c9692ef1c76a1d9b3239211
Reviewed-on: https://go-review.googlesource.com/20131
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agogo/ast: fix typo in comment
Ian Lance Taylor [Wed, 2 Mar 2016 17:20:38 +0000 (09:20 -0800)]
go/ast: fix typo in comment

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

9 years agocrypto/tls: check errors from (*Conn).writeRecord
Tamir Duberstein [Fri, 26 Feb 2016 19:17:29 +0000 (14:17 -0500)]
crypto/tls: check errors from (*Conn).writeRecord

This promotes a connection hang during TLS handshake to a proper error.
This doesn't fully address #14539 because the error reported in that
case is a write-on-socket-not-connected error, which implies that an
earlier error during connection setup is not being checked, but it is
an improvement over the current behaviour.

Updates #14539.

Change-Id: I0571a752d32d5303db48149ab448226868b19495
Reviewed-on: https://go-review.googlesource.com/19990
Reviewed-by: Adam Langley <agl@golang.org>
9 years agocmd/link: C is gone, remove check for Go calling C
David Crawshaw [Wed, 2 Mar 2016 15:01:01 +0000 (10:01 -0500)]
cmd/link: C is gone, remove check for Go calling C

It looks like the compiler still uses the Cfunc flag for functions
marked as //go:systemstack, but if I'm reading this right, that
doesn't apply here and the linker no longer needs Cfunc.

Change-Id: I63b9192c2f52f41401263c29dc8dfd8be8a901a1
Reviewed-on: https://go-review.googlesource.com/20105
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocompress/bzip2: prevent zero-length Huffman codes
Joe Tsai [Wed, 2 Mar 2016 11:22:00 +0000 (03:22 -0800)]
compress/bzip2: prevent zero-length Huffman codes

Unlike RFC 1951 (DEFLATE), bzip2 does not use zero-length Huffman codes
to indicate that the symbol is missing. Instead, bzip2 uses a sparse
bitmap to indicate which symbols are present. Thus, it is undefined what
happens when a length of zero is used. Thus, fix the parsing logic so that
the length cannot ever go below 1-bit similar to how the C logic does things.

To confirm that the C bzip2 utility chokes on this data:
$ echo "425a6836314159265359b1f7404b000000400040002000217d184682ee48
a70a12163ee80960" | xxd -r -p | bzip2 -d

bzip2: Data integrity error when decompressing

For reference see:
bzip2-1.0.6/decompress.c:320

Change-Id: Ic1568f8e7f80cdea51d887b4d712cc239c2fe85e
Reviewed-on: https://go-review.googlesource.com/20119
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agonet: fix vet warnings
Mohit Agarwal [Tue, 1 Mar 2016 07:11:52 +0000 (12:41 +0530)]
net: fix vet warnings

Updates #11041

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

9 years agocmd/link: rename Hide to Hidden and make a bool
David Crawshaw [Tue, 1 Mar 2016 02:50:00 +0000 (17:50 -0900)]
cmd/link: rename Hide to Hidden and make a bool

Change-Id: Ic99bd63c96b1eba5cc2b5cd2be3a575890a02996
Reviewed-on: https://go-review.googlesource.com/20103
Run-TryBot: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/link: write DWARF PC table without seeking
David Crawshaw [Mon, 29 Feb 2016 22:07:50 +0000 (13:07 -0900)]
cmd/link: write DWARF PC table without seeking

This per-symbol table was written with the strategy:

1. record offset and write fake header
2. write body
3. seek back to fake header
4. write real header

This CL collects the per-symbol body into a []byte, then writes the
real header followed by the body to the output file. This saves two
seeks per-symbol and overwriting the fake header.

Small performance improvement (3.5%) in best-of-ten links of godoc:

tip:  real 0m1.132s user 0m1.256s
this: real 0m1.090s user 0m1.210s

I'm not sure if the performance measured here alone justifies it,
but I think this is an easier to read style of code.

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

9 years agocmd/link: add array append version of methods
David Crawshaw [Mon, 29 Feb 2016 21:40:23 +0000 (12:40 -0900)]
cmd/link: add array append version of methods

Used by DWARF writer changes in a followup CL.

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

9 years agocmd/compile: some SSA cleanup
Keith Randall [Tue, 1 Mar 2016 23:59:15 +0000 (15:59 -0800)]
cmd/compile: some SSA cleanup

Do some easy TODOs.
Move a bunch of other TODOs into bugs.

Change-Id: Iaba9dad6221a2af11b3cbcc512875f4a85842873
Reviewed-on: https://go-review.googlesource.com/20114
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
9 years agonet/url: fix parsing of URLs ending in question mark
Brad Fitzpatrick [Wed, 2 Mar 2016 00:46:36 +0000 (00:46 +0000)]
net/url: fix parsing of URLs ending in question mark

Fixes parsing regression from https://golang.org/cl/19931 which
added the URL.ForceQuery field.

Fixes #14573

Change-Id: I89575cab3f778b1bf78b2389623c866450b26943
Reviewed-on: https://go-review.googlesource.com/20116
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/compile: give SymFlags type to Sym flags
Robert Griesemer [Wed, 2 Mar 2016 00:37:20 +0000 (16:37 -0800)]
cmd/compile: give SymFlags type to Sym flags

Change-Id: Ifa65a35418c2b5a2c517c0d9bbe37f472091e759
Reviewed-on: https://go-review.googlesource.com/20115
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agocmd/vet: polish output of shadow test
Marvin Stenger [Tue, 1 Mar 2016 20:18:56 +0000 (21:18 +0100)]
cmd/vet: polish output of shadow test

This commit modifies the style of a error message in case of -shadow.

Previously such a message would look like:
foo.go:42: declaration of err shadows declaration at shadow.go:13:

Changes of the commit include highlighting the variable name and
removing the ": "(space intended) at the end of the line:
foo.go:42: declaration of "err" shadows declaration at shadow.go:13

Fixes #14585.

Change-Id: Ia6a6bf396668dcba9a24f025a08d8826db31f434
Reviewed-on: https://go-review.googlesource.com/20093
Reviewed-by: Rob Pike <r@golang.org>
9 years agoall: single space after period.
Brad Fitzpatrick [Tue, 1 Mar 2016 23:21:55 +0000 (23:21 +0000)]
all: single space after period.

The tree's pretty inconsistent about single space vs double space
after a period in documentation. Make it consistently a single space,
per earlier decisions. This means contributors won't be confused by
misleading precedence.

This CL doesn't use go/doc to parse. It only addresses // comments.
It was generated with:

$ perl -i -npe 's,^(\s*// .+[a-z]\.)  +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.)  +([A-Z])')
$ go test go/doc -update

Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7
Reviewed-on: https://go-review.googlesource.com/20022
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dave Day <djd@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: fix OADDSTR buffer size calculation
Ian Lance Taylor [Tue, 1 Mar 2016 22:52:18 +0000 (14:52 -0800)]
cmd/compile: fix OADDSTR buffer size calculation

The size calculation has been wrong since this code was first committed
in https://golang.org/cl/3120.  The effect was that the compiler always
allocated a temporary buffer on the stack for a non-escaping string
concatenation.  This turns out to make no practical difference, as the
compiler always allocates a buffer of the same size (32 bytes) and the
runtime only uses the temporary buffer if the concatenated strings
fit (check is in rawstringtmp in runtime/string.go).

The effect of this change is to avoid generating a temporary buffer on
the stack that will not be used.

Change-Id: Id632bfe3d6c113c9934c018a2dd4bcbf1784a63d
Reviewed-on: https://go-review.googlesource.com/20112
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: s/flag_race/instrumenting/ in OCONVNOP check
Ian Lance Taylor [Tue, 1 Mar 2016 23:17:34 +0000 (15:17 -0800)]
cmd/compile: s/flag_race/instrumenting/ in OCONVNOP check

This check seems to apply to all code instrumentation, not just -race.

Fixes #14589.

Change-Id: I16ae07749ede7c1e6ed06f472711638d195034ac
Reviewed-on: https://go-review.googlesource.com/20113
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Marvin Stenger <marvin.stenger94@gmail.com>
9 years agoall: make copyright headers consistent with one space after period
Brad Fitzpatrick [Tue, 1 Mar 2016 22:57:46 +0000 (22:57 +0000)]
all: make copyright headers consistent with one space after period

This is a subset of https://golang.org/cl/20022 with only the copyright
header lines, so the next CL will be smaller and more reviewable.

Go policy has been single space after periods in comments for some time.

The copyright header template at:

    https://golang.org/doc/contribute.html#copyright

also uses a single space.

Make them all consistent.

Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0
Reviewed-on: https://go-review.googlesource.com/20111
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: delete unused lexer tokens, replace with LOPER
Robert Griesemer [Tue, 1 Mar 2016 22:47:26 +0000 (14:47 -0800)]
cmd/compile: delete unused lexer tokens, replace with LOPER

Also: Use same ordering of tokens in the various tables/maps.

Change-Id: Ief84c6ca3da36213ace6b2c10b513e2ca16318ab
Reviewed-on: https://go-review.googlesource.com/20110
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
9 years agocmd/compile: remove _ssa print trigger
Keith Randall [Tue, 1 Mar 2016 21:47:48 +0000 (13:47 -0800)]
cmd/compile: remove _ssa print trigger

SSA is a real compiler now, don't trigger on function names.

Change-Id: Iaf6dd78248c1b6ca2630275bd59f7ea7b7576497
Reviewed-on: https://go-review.googlesource.com/20088
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoMerge "Merge branch 'dev.ssa' into mergebranch"
Gerrit Code Review [Tue, 1 Mar 2016 21:36:45 +0000 (21:36 +0000)]
Merge "Merge branch 'dev.ssa' into mergebranch"

9 years agoMerge branch 'dev.ssa' into mergebranch
Keith Randall [Tue, 1 Mar 2016 20:50:17 +0000 (12:50 -0800)]
Merge branch 'dev.ssa' into mergebranch

Merge dev.ssa branch back into master.

Change-Id: Ie6fac3f8d355ab164f934415fe4fc7fcb8c3db16

9 years agocmd/vet: add a README explaining the criteria for new checks
Rob Pike [Tue, 1 Mar 2016 09:54:58 +0000 (20:54 +1100)]
cmd/vet: add a README explaining the criteria for new checks

Correctness, Frequency, Precision.

Change-Id: I7f202c220aef8512d611dc04a4370b4a237f217c
Reviewed-on: https://go-review.googlesource.com/20003
Reviewed-by: Russ Cox <rsc@golang.org>
9 years ago[dev.ssa] cmd/compile: adjust branch likeliness for calls/loops
David Chase [Sat, 27 Feb 2016 16:54:52 +0000 (11:54 -0500)]
[dev.ssa] cmd/compile: adjust branch likeliness for calls/loops

Static branch predictions (which guide block ordering) are
adjusted based on:

loop/not-loop     (favor looping)
abnormal-exit/not (avoid panic)
call/not-call     (avoid call)
ret/default       (treat returns as rare)

This appears to make no difference in performance of real
code, meaning the compiler itself.  The earlier version of
this has been stripped down to help make the cost of this
only-aesthetic-on-Intel phase be as cheap as possible (we
probably want information about inner loops for improving
register allocation, but because register allocation follows
close behind this pass, conceivably the information could be
reused -- so we might do this anyway just to normalize
output).

For a ./make.bash that takes 200 user seconds, about .75
second is reported in likelyadjust (summing nanoseconds
reported with -d=ssa/likelyadjust/time ).

Upstream predictions are respected.
Includes test, limited to build on amd64 only.
Did several iterations on the debugging output to allow
some rough checks on behavior.
Debug=1 logging notes agree/disagree with earlier passes,
allowing analysis like the following:

Run on make.bash:
GO_GCFLAGS=-d=ssa/likelyadjust/debug \
   ./make.bash >& lkly5.log

grep 'ranch prediction' lkly5.log | wc -l
   78242 // 78k predictions

grep 'ranch predi' lkly5.log | egrep -v 'agrees with' | wc -l
   29633 // 29k NEW predictions

grep 'disagrees' lkly5.log | wc -l
     444 // contradicted 444 times

grep '< exit' lkly5.log | wc -l
   10212 // 10k exit predictions

grep '< exit' lkly5.log | egrep 'disagrees' | wc -l
       5 // 5 contradicted by previous prediction

grep '< exit' lkly5.log | egrep -v 'agrees' | wc -l
     702 // 702-5 redundant with previous prediction

grep '< call' lkly5.log | egrep -v 'agrees' | wc -l
   16699 // 16k new call predictions

grep 'stay in loop' lkly5.log | egrep -v 'agrees' | wc -l
    3951 // 4k new "remain in loop" predictions

Fixes #11451.

Change-Id: Iafb0504f7030d304ef4b6dc1aba9a5789151a593
Reviewed-on: https://go-review.googlesource.com/19995
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
9 years agocmd/compile/internal/ssa: cleanup godocs
Matthew Dempsky [Tue, 1 Mar 2016 18:58:06 +0000 (10:58 -0800)]
cmd/compile/internal/ssa: cleanup godocs

Add a blank line before the "package ssa" lines so the "autogenerated
don't edit" comments don't end up in godoc output.

Change-Id: I82bf90d52d426ce1a8e21483fc8f47b3689259c7
Reviewed-on: https://go-review.googlesource.com/20086
Reviewed-by: Keith Randall <khr@golang.org>
9 years agocmd/link: make rddataBufMax a const
David Crawshaw [Mon, 29 Feb 2016 19:41:45 +0000 (10:41 -0900)]
cmd/link: make rddataBufMax a const

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

9 years ago[dev.ssa] cmd/compile/internal/ssa: simplify boolean phis
Alexandru Moșoi [Mon, 29 Feb 2016 18:29:04 +0000 (19:29 +0100)]
[dev.ssa] cmd/compile/internal/ssa: simplify boolean phis

* Decreases the generated code slightly.
* Similar to phiopt pass from gcc, except it only handles
booleans. Handling Eq/Neq had no impact on the generated code.

name       old time/op     new time/op     delta
Template       453ms ± 4%      451ms ± 4%    ~           (p=0.468 n=24+24)
GoTypes        1.55s ± 1%      1.55s ± 2%    ~           (p=0.287 n=24+25)
Compiler       6.53s ± 2%      6.56s ± 1%  +0.46%        (p=0.050 n=23+23)
MakeBash       45.8s ± 2%      45.7s ± 2%    ~           (p=0.866 n=24+25)

name       old text-bytes  new text-bytes  delta
HelloSize       676k ± 0%       676k ± 0%    ~     (all samples are equal)
CmdGoSize      8.07M ± 0%      8.07M ± 0%  -0.03%        (p=0.000 n=25+25)

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

9 years ago[dev.ssa] cmd/compile/internal/ssa: distribute multiplication into addition
Alexandru Moșoi [Tue, 1 Mar 2016 12:39:47 +0000 (13:39 +0100)]
[dev.ssa] cmd/compile/internal/ssa: distribute multiplication into addition

* This is a very basic form of straight line strength reduction.
* Removes one multiplication from a[b].c++; a[b+1].c++
* It increases pressure on the register allocator because
CSE creates more copies of the multiplication sizeof(a[0])*b.

Change-Id: I686a18e9c24cc6f8bdfa925713afed034f7d36d0
Reviewed-on: https://go-review.googlesource.com/20091
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] cmd/compile: promote byte/word operation
Ilya Tocar [Mon, 15 Feb 2016 14:01:26 +0000 (17:01 +0300)]
[dev.ssa] cmd/compile: promote byte/word operation

Writing to low 8/16 bits of register creates false dependency
Generate 32-bit operations when possible.

Change-Id: I8eb6c1c43a66424eec6baa91a660bceb6b80d1d3
Reviewed-on: https://go-review.googlesource.com/19506
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: change defaultlit2's force param to bool
Matthew Dempsky [Tue, 1 Mar 2016 08:15:27 +0000 (00:15 -0800)]
cmd/compile: change defaultlit2's force param to bool

Change-Id: I5546c4e8092ef61648cdae9c04288bb7d6f32476
Reviewed-on: https://go-review.googlesource.com/20084
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agofmt: make identification of string arguments consistent
Martin Möhrmann [Sat, 27 Feb 2016 19:55:50 +0000 (20:55 +0100)]
fmt: make identification of string arguments consistent

Use only reflect.TypeOf to detect if argument is a string.

The wasString return is only needed in doPrint with the 'v' verb.
This type of string detection is handled correctly by reflect.TypeOf
which is used already in doPrint for identifying a string argument.

Remove now obsolete wasString computations and return values.

Change-Id: Iea2de7ac0f5c536a53eec63f7e679d628f5af8dc
Reviewed-on: https://go-review.googlesource.com/19976
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agogo/types: nicer shift error message
Matthew Dempsky [Tue, 1 Mar 2016 05:48:15 +0000 (21:48 -0800)]
go/types: nicer shift error message

Updates #13940.

Change-Id: I41974c292dd981d82ac03b9b8b406713445362c3
Reviewed-on: https://go-review.googlesource.com/20081
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agogo/constant: fix typos in MakeFromLiteral docs
Matthew Dempsky [Tue, 1 Mar 2016 06:01:38 +0000 (22:01 -0800)]
go/constant: fix typos in MakeFromLiteral docs

Change-Id: I99c737415a082df883a9c12cdb43bdd5a1b9a8ad
Reviewed-on: https://go-review.googlesource.com/20082
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: give mparith{2,3}.go files more meaningful names
Matthew Dempsky [Tue, 1 Mar 2016 04:20:13 +0000 (20:20 -0800)]
cmd/compile: give mparith{2,3}.go files more meaningful names

Also, relocate related const and type definitions from go.go.

Change-Id: Ieb9b672da8dd510ca67022b4f7ae49a778a56579
Reviewed-on: https://go-review.googlesource.com/20080
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Keith Randall <khr@golang.org>
9 years agocmd/compile: remove some unnecessary EType/int conversions
Matthew Dempsky [Tue, 1 Mar 2016 04:07:09 +0000 (20:07 -0800)]
cmd/compile: remove some unnecessary EType/int conversions

Change-Id: I2d8efef333f2441da6742e125e23ff57c9853ebd
Reviewed-on: https://go-review.googlesource.com/20078
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agocmd/compile: remove some unused consts from the old yacc parser
Matthew Dempsky [Tue, 1 Mar 2016 04:11:33 +0000 (20:11 -0800)]
cmd/compile: remove some unused consts from the old yacc parser

Change-Id: I42f370b987fcc85201f7aaa055b9e58ee9b9a99e
Reviewed-on: https://go-review.googlesource.com/20079
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agodoc: update release tag in source directions to go1.6
nwidger [Sun, 28 Feb 2016 13:51:06 +0000 (08:51 -0500)]
doc: update release tag in source directions to go1.6

Fixes #14371

Change-Id: I8e9e4b2b89083f5a947e791c011912fdf365a11e
Reviewed-on: https://go-review.googlesource.com/19996
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years ago[dev.ssa] cmd/compile: Make PPARAMOUT variables SSAable
Keith Randall [Sun, 28 Feb 2016 01:49:31 +0000 (17:49 -0800)]
[dev.ssa] cmd/compile: Make PPARAMOUT variables SSAable

Add writeback code to each return location which copies
the final result back to the correct stack location.

Cgo plays tricky games by taking the address of a
in f(a int) (b int) and then using that address to
modify b.  So for cgo-generated Go code, disable the
SSAing of output args.

Update #14511

Change-Id: I95cba727d53699d31124eef41db0e03935862be9
Reviewed-on: https://go-review.googlesource.com/19988
Reviewed-by: Todd Neal <todd@tneal.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agomisc/cgo/testsanitizers: don't run tsan tests on old clang
Ian Lance Taylor [Mon, 29 Feb 2016 18:05:46 +0000 (10:05 -0800)]
misc/cgo/testsanitizers: don't run tsan tests on old clang

Fixes #14570.

Change-Id: Ief84a14585bfc209e38cdf15702c2f54ba759714
Reviewed-on: https://go-review.googlesource.com/20057
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
9 years agocmd/link: batch writing of bytes
Shahar Kohanim [Mon, 29 Feb 2016 09:49:49 +0000 (11:49 +0200)]
cmd/link: batch writing of bytes

In best of 10, linking cmd/go shows a ~10% improvement.

tip:              real  0m1.152s user  0m1.005s
this:             real  0m1.065s user  0m0.924s

Change-Id: I303a20b94332feaedc1033c453247a0e4c05c843
Reviewed-on: https://go-review.googlesource.com/19978
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoMerge "[dev.ssa] Merge remote-tracking branch 'origin/master' into ssamerge" into...
Gerrit Code Review [Mon, 29 Feb 2016 23:19:17 +0000 (23:19 +0000)]
Merge "[dev.ssa] Merge remote-tracking branch 'origin/master' into ssamerge" into dev.ssa

9 years ago[dev.ssa] cmd/compile: add constant cache
Josh Bleecher Snyder [Sun, 28 Feb 2016 23:51:11 +0000 (15:51 -0800)]
[dev.ssa] cmd/compile: add constant cache

The cache gets a 62% hit rate while compiling
the standard library.

name      old time/op    new time/op    delta
Template     449ms ± 2%     443ms ± 4%  -1.40%  (p=0.006 n=23+25)
GoTypes      1.54s ± 1%     1.50s ± 2%  -2.53%  (p=0.000 n=22+22)
Compiler     5.51s ± 1%     5.39s ± 1%  -2.29%  (p=0.000 n=23+25)

name      old alloc/op   new alloc/op   delta
Template    90.4MB ± 0%    90.0MB ± 0%  -0.45%  (p=0.000 n=25+25)
GoTypes      334MB ± 0%     331MB ± 0%  -1.05%  (p=0.000 n=25+25)
Compiler    1.12GB ± 0%    1.10GB ± 0%  -1.57%  (p=0.000 n=25+24)

name      old allocs/op  new allocs/op  delta
Template      681k ± 0%      682k ± 0%  +0.26%  (p=0.000 n=25+25)
GoTypes      2.23M ± 0%     2.23M ± 0%  +0.05%  (p=0.000 n=23+24)
Compiler     6.46M ± 0%     6.46M ± 0%  +0.02%  (p=0.000 n=24+25)

Change-Id: I2629c291892827493d7b55ec4d83f6973a2ab133
Reviewed-on: https://go-review.googlesource.com/20026
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years ago[dev.ssa] Merge remote-tracking branch 'origin/master' into ssamerge
Keith Randall [Mon, 29 Feb 2016 21:31:48 +0000 (13:31 -0800)]
[dev.ssa] Merge remote-tracking branch 'origin/master' into ssamerge

(Last?) Semi-regular merge from tip to dev.ssa.

Conflicts:
src/cmd/compile/internal/gc/closure.go
src/cmd/compile/internal/gc/gsubr.go
src/cmd/compile/internal/gc/lex.go
src/cmd/compile/internal/gc/pgen.go
src/cmd/compile/internal/gc/syntax.go
src/cmd/compile/internal/gc/walk.go
src/cmd/internal/obj/pass.go

Change-Id: Ib5ea8bf74d420f4902a9c6208761be9f22371ae7

9 years ago[dev.ssa] cmd/compile: MOVBconst might also clobber flags
Keith Randall [Mon, 29 Feb 2016 19:10:08 +0000 (11:10 -0800)]
[dev.ssa] cmd/compile: MOVBconst might also clobber flags

It gets rewritten to an xor by the linker also.

Change-Id: Iae35130325d41bd1a09b7e971190cae6f4e17fac
Reviewed-on: https://go-review.googlesource.com/20058
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/link: skip allocation when reading symbol name
David Crawshaw [Mon, 29 Feb 2016 00:59:33 +0000 (15:59 -0900)]
cmd/link: skip allocation when reading symbol name

The object file reader in cmd/link reads the symbol name into a scratch
[]byte, converts it to a string, and then does a substring replacement.
Instead, this CL does the replacement on the []byte into the scratch
space and then creates the final string.

Linking godoc without DWARF, best of ten, shows a ~10% improvement.

tip:           real 0m1.099s user 0m1.541s
this:          real 0m0.990s user 0m1.280s

This is part of an attempt to make suffixarray string deduping
come out as a wash, but it's not there yet:

cl/19987:      real 0m1.335s user 0m1.794s
cl/19987+this: real 0m1.225s user 0m1.540s

Change-Id: Idf061fdfbd7f08aa3a1f5933d3f111fdd1659210
Reviewed-on: https://go-review.googlesource.com/20025
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/link: track offset instead of using seek
David Crawshaw [Mon, 29 Feb 2016 17:00:46 +0000 (08:00 -0900)]
cmd/link: track offset instead of using seek

The Cpos function is used frequently (at least once per symbol) and
it is implemented with the seek syscall. Instead, track current
output offset and use it.

Building the godoc binary with DWARF, best of ten:

tip:  real 0m1.287s user 0m1.573s
this: real 0m1.208s user 0m1.555s

Change-Id: I068148695cd6b4d32cd145db25e59e6f6bae6945
Reviewed-on: https://go-review.googlesource.com/20055
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: cleanup number lexing
Robert Griesemer [Wed, 24 Feb 2016 20:53:28 +0000 (12:53 -0800)]
cmd/compile: cleanup number lexing

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

9 years agocmd/link: allocate small []byte reads together
David Crawshaw [Mon, 29 Feb 2016 02:58:57 +0000 (17:58 -0900)]
cmd/link: allocate small []byte reads together

Reduces number of memory allocations by 12%:

Before: 1816664
After:  1581591

Small speed improvement.

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

9 years agomisc/cgo/testsanitizers: test that tsan links
Ian Lance Taylor [Mon, 29 Feb 2016 17:31:12 +0000 (09:31 -0800)]
misc/cgo/testsanitizers: test that tsan links

Update #14559.

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

9 years agocmd/link: batch allocations of Lsym
Shahar Kohanim [Mon, 29 Feb 2016 14:46:18 +0000 (16:46 +0200)]
cmd/link: batch allocations of Lsym

Reduces best of 10 linking of cmd/go by ~5%

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

9 years agocmd/link: Preallocate Lsym map
Shahar Kohanim [Mon, 29 Feb 2016 10:19:26 +0000 (12:19 +0200)]
cmd/link: Preallocate Lsym map

Preallocate ~2MB for Lsym map (size calculation from http://play.golang.org/p/9L7F5naXRr).
Reduces best of 10 link time of cmd/go by ~4%.
On cmd/go max resident size unaffected, on println hello world max resident size grows by 4mb from 18mb->22mb. Performance improves in both cases.

tip:  real  0m1.283s user  0m1.502s sys 0m0.144s
this: real  0m1.341s user  0m1.598s sys 0m0.136s

Change-Id: I4a95e45fe552f1f64f53e868421b9f45a34f8b96
Reviewed-on: https://go-review.googlesource.com/19979
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agosyscall: Fix generator for Linux syscalls.
Benoit Sigoure [Mon, 29 Feb 2016 05:30:32 +0000 (21:30 -0800)]
syscall: Fix generator for Linux syscalls.

In golang.org/cl/14449 the `getdents' system call got changed to use
_SYS_getdents as a layer of indirection instead of SYS_GETDENTS64 for
compatibility with mips64, but this broke mksyscall.pl, which then
died with with:
  syscall_linux.go:840: malformed //sys declaration

Change-Id: Icb61965d8730f6e81f9fb0fa28c7bab635470f09
Reviewed-on: https://go-review.googlesource.com/20051
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agomisc/cgo/testsanitizers: report stderr if go run tsan*.go fails
Ian Lance Taylor [Mon, 29 Feb 2016 06:06:11 +0000 (22:06 -0800)]
misc/cgo/testsanitizers: report stderr if go run tsan*.go fails

Update #14559.

Change-Id: I8894f8e16902685f55a21d902199fbe0905f0558
Reviewed-on: https://go-review.googlesource.com/20050
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years ago[dev.ssa] cmd/compile/internal/ssa: replace load of store with a copy
Ilya Tocar [Fri, 26 Feb 2016 14:23:44 +0000 (17:23 +0300)]
[dev.ssa] cmd/compile/internal/ssa: replace load of store with a copy

This is a AMD64 version of CL19743.
Saves additional 1574 bytes in go binary.
This also speeds up bzip2 by 1-4%

Change-Id: I031ba423663c4e83fdefe44e5296f24143e303da
Reviewed-on: https://go-review.googlesource.com/19939
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
9 years ago[dev.ssa] cmd/compile: Use movups for xmm->xmm mov
Ilya Tocar [Fri, 26 Feb 2016 13:48:16 +0000 (16:48 +0300)]
[dev.ssa] cmd/compile: Use movups for xmm->xmm mov

Movups is 1 byte smaller than movapd that we currently use.

Change-Id: I22f771f066529352722a28543535ec43497cb9c5
Reviewed-on: https://go-review.googlesource.com/19938
Reviewed-by: David Chase <drchase@google.com>
9 years agoall: remove public named return values when useless
Brad Fitzpatrick [Sun, 28 Feb 2016 23:52:49 +0000 (15:52 -0800)]
all: remove public named return values when useless

Named returned values should only be used on public funcs and methods
when it contributes to the documentation.

Named return values should not be used if they're only saving the
programmer a few lines of code inside the body of the function,
especially if that means there's stutter in the documentation or it
was only there so the programmer could use a naked return
statement. (Naked returns should not be used except in very small
functions)

This change is a manual audit & cleanup of public func signatures.

Signatures were not changed if:

* the func was private (wouldn't be in public godoc)
* the documentation referenced it
* the named return value was an interesting name. (i.e. it wasn't
  simply stutter, repeating the name of the type)

There should be no changes in behavior. (At least: none intended)

Change-Id: I3472ef49619678fe786e5e0994bdf2d9de76d109
Reviewed-on: https://go-review.googlesource.com/20024
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agotime: document Tick will return nil if d <= 0
Shenghou Ma [Mon, 29 Feb 2016 00:32:29 +0000 (19:32 -0500)]
time: document Tick will return nil if d <= 0

Fixes #14557.

Change-Id: I9610b79aafe9c15f9c998739b586fd0b41b90d70
Reviewed-on: https://go-review.googlesource.com/20031
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: superficial cleanup in maplit
Josh Bleecher Snyder [Sun, 28 Feb 2016 22:39:38 +0000 (14:39 -0800)]
cmd/compile: superficial cleanup in maplit

Mostly renaming variables for clarity.

Passes toolstash -cmp.

Change-Id: I9867137c34c14985cbbbdb2d34fbbe4cc65cb6fb
Reviewed-on: https://go-review.googlesource.com/20023
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: change Node.Nbody, Func.Inl from *NodeList to Nodes
Ian Lance Taylor [Sat, 27 Feb 2016 22:31:33 +0000 (14:31 -0800)]
cmd/compile: change Node.Nbody, Func.Inl from *NodeList to Nodes

Passes toolstash -cmp.

Casual timings show about a 3% improvement in compile times.

Update #14473.

Change-Id: I584add2e8f1a52486ba418b25ba6122b7347b643
Reviewed-on: https://go-review.googlesource.com/19989
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agofmt: fix formatting of numbers with f.space and f.plus specified
Martin Möhrmann [Sat, 27 Feb 2016 11:19:49 +0000 (12:19 +0100)]
fmt: fix formatting of numbers with f.space and f.plus specified

Do not replace the sign in front of a number with a space if both
f.space and f.plus are both specified for number formatting.
This was already the case for integers but not for floats
and complex numbers.

Updates: #14543.

Change-Id: I07ddeb505003db84a8a7d2c743dc19fc427a00bd
Reviewed-on: https://go-review.googlesource.com/19974
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: only check SWIG intsize once per build
Ian Lance Taylor [Tue, 9 Feb 2016 14:18:43 +0000 (06:18 -0800)]
cmd/go: only check SWIG intsize once per build

Besides being more efficient in a large build, this avoids a possible
race when creating the input file.

Change-Id: Ifc2cb055925a76be9c90eac56d84ebd9e14f2bbc
Reviewed-on: https://go-review.googlesource.com/19392
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
9 years ago[dev.ssa] cmd/compile: use 32-bit load to read writebarrier
David Chase [Sun, 28 Feb 2016 16:15:22 +0000 (11:15 -0500)]
[dev.ssa] cmd/compile: use 32-bit load to read writebarrier

Avoid targeting a partial register with load;
ensure source of load (writebarrier) is aligned.

Better yet would be "CMPB $1,writebarrier" but that requires
wrestling with flagalloc (mem operand complicates moving
instruction around).

Didn't see a change in time for
   benchcmd -n 10 Build go build net/http

Verified that we clean the code up properly:
   0x20a8 <main.main+104>: mov    0xc30a2(%rip),%eax
                            # 0xc5150 <runtime.writeBarrier>
   0x20ae <main.main+110>: test   %al,%al

Change-Id: Id5fb8c260eaec27bd727cb0ae1476c60343b0986
Reviewed-on: https://go-review.googlesource.com/19998
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] cmd/compile: small optimization to prove using sdom tweak
David Chase [Sun, 28 Feb 2016 20:58:17 +0000 (15:58 -0500)]
[dev.ssa] cmd/compile: small optimization to prove using sdom tweak

Exposed data already in sdom to avoid recreating it in prove.

Change-Id: I834c9c03ed8faeaee013e5a1b3f955908f0e0915
Reviewed-on: https://go-review.googlesource.com/19999
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexandru Moșoi <alexandru@mosoi.ro>
9 years agocrypto/tls: don't log expected errors in test
Tamir Duberstein [Fri, 26 Feb 2016 23:26:04 +0000 (18:26 -0500)]
crypto/tls: don't log expected errors in test

This is minor cleanup that reduces test output noise.

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

9 years ago[dev.ssa] cmd/compile/internal/ssa: remove proven redundant controls.
Alexandru Moșoi [Fri, 19 Feb 2016 11:14:42 +0000 (12:14 +0100)]
[dev.ssa] cmd/compile/internal/ssa: remove proven redundant controls.

* It does very simple bounds checking elimination. E.g.
removes the second check in for i := range a { a[i]++; a[i++]; }
* Improves on the following redundant expression:
return a6 || (a6 || (a6 || a4)) || (a6 || (a4 || a6 || (false || a6)))
* Linear in the number of block edges.

I patched in CL 12960 that does bounds, nil and constant propagation
to make sure this CL is not just redundant. Size of pkg/tool/linux_amd64/*
(excluding compile which is affected by this change):

With IsInBounds and IsSliceInBounds
-this -12960 92285080
+this -12960 91947416
-this +12960 91978976
+this +12960 91923088

Gain is ~110% of 12960.

Without IsInBounds and IsSliceInBounds (older run)
-this -12960 95515512
+this -12960 95492536
-this +12960 95216920
+this +12960 95204440

Shaves 22k on its own.

* Can we handle IsInBounds better with this? In
for i := range a { a[i]++; } the bounds checking at a[i]
is not eliminated.

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

9 years agocrypto/tls: tests prefer constants to opaque literals
Tamir Duberstein [Fri, 26 Feb 2016 23:26:04 +0000 (18:26 -0500)]
crypto/tls: tests prefer constants to opaque literals

This is minor cleanup that makes the tests more readable.

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

9 years agomime: Fix BenchmarkQDecodeHeader to call DecodeHeader
Justin Nuß [Sun, 28 Feb 2016 16:48:49 +0000 (17:48 +0100)]
mime: Fix BenchmarkQDecodeHeader to call DecodeHeader

Found this while reading through the code. The benchmark
accidently called the wrong function.

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