1
0
mirror of https://github.com/golang/go synced 2024-10-05 03:21:23 -06:00
Commit Graph

7932 Commits

Author SHA1 Message Date
Josh Bleecher Snyder
dd2ba0c7a7 cmd/internal/obj: remove LSym.Next
Instead, use a slice.

Passes toolstash -cmp.

Change-Id: I889fdb4ae997416f907522f549b96506be13bec7
Reviewed-on: https://go-review.googlesource.com/20699
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-16 20:40:58 +00:00
Josh Bleecher Snyder
61b9315d37 cmd/internal/obj: remove LSym.Value
It is unused.

Passes toolstash -cmp.

Change-Id: I22ae2bb432ce6be377dea43cf018ffccb6e95f37
Reviewed-on: https://go-review.googlesource.com/20698
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-16 20:40:50 +00:00
Austin Clements
26594c3dfd runtime: use indexes for select lock order
Currently the select lock order is a []*hchan. We're going to need to
refer to things other than the channel itself in lock order shortly,
so switch this to a []uint16 of indexes into the select cases. This
parallels the existing representation for the poll order.

Change-Id: I89262223fe20b4ddf5321592655ba9eac489cda1
Reviewed-on: https://go-review.googlesource.com/20036
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-16 20:13:05 +00:00
Austin Clements
e4a95b6343 runtime: record channel in sudog
Given a G, there's currently no way to find the channel it's blocking
on. We'll need this information to fix a (probably theoretical) bug in
select and to implement concurrent stack shrinking, so record the
channel in the sudog.

For #12967.

Change-Id: If8fb63a140f1d07175818824d08c0ebeec2bdf66
Reviewed-on: https://go-review.googlesource.com/20035
Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-16 20:13:02 +00:00
Robert Griesemer
bb3b10214d cmd/compile: faster parameter parsing with no OKEY nodes
Step 2 of stream-lining parameter parsing

- do parameter validity checks in parser
- two passes instead of multiple (and theoretically quadratic) passes
  when checking parameters
- removes the need for OKEY and some ONONAME nodes in those passes

This removes allocation of ~123K OKEY (incl. some ONONAME) nodes
out of a total of ~10M allocated nodes when running make.bash, or
a reduction of the number of alloacted nodes by ~1.2%.

Change-Id: I4a8ec578d0ee2a7b99892ac6b92e56f8e0415f03
Reviewed-on: https://go-review.googlesource.com/20748
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
2016-03-16 18:54:31 +00:00
Robert Griesemer
9f301643bd cmd/compile: factor parameter parsing
Step 1 of streamlining parameter parsing.

Change-Id: If9fd38295ccc08aafc7f1d26188d0926dd73058b
Reviewed-on: https://go-review.googlesource.com/20747
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-16 15:56:36 +00:00
Todd Neal
c8b148e7a5 cmd/compile: fold constants from lsh/rsh/lsh and rsh/lsh/rsh
Fixes #14825

Change-Id: Ib44d80579a55c15d75ea2ad1ef54efa6ca66a9a6
Reviewed-on: https://go-review.googlesource.com/20745
Run-TryBot: Todd Neal <todd@tneal.org>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-16 11:40:20 +00:00
Aliaksandr Valialkin
fee86e4aa8 cmd/vet: added some missing copylock checks
Fixes #14664

Change-Id: I8bda2435857772f590859808904c48d768b87d46
Reviewed-on: https://go-review.googlesource.com/20254
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-16 05:12:48 +00:00
Todd Neal
763afe13b9 cmd/compile: change logging of spills for regalloc to Warnl format
Change-Id: I01c000ff3f6dc6b0ed691e289eeef0fa61500337
Reviewed-on: https://go-review.googlesource.com/20744
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-16 02:50:13 +00:00
Todd Neal
8edb72587f cmd/compile: add logging to critical and phielim
Change-Id: Ieefeceea40bd29657fd519368b0920dad8443844
Reviewed-on: https://go-review.googlesource.com/20712
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-15 22:53:12 +00:00
Keith Randall
5305a329d8 cmd/compile: turn off SSA internal consistency checks
They've been on for a few weeks of general use and nothing
has tripped up on them yet.

Makes the compiler ~18% faster.

Change-Id: I42d7bbc0581597f9cf4fb28989847814c81b08a2
Reviewed-on: https://go-review.googlesource.com/20741
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-15 22:25:48 +00:00
Matthew Dempsky
63142027de cmd: collapse internal/obj/fmt.go into compile/internal/gc/fmt.go
The obj.Fmt* values are only used by gc/fmt.go, so just move them
there. Also, add comments documenting the correspondance between
FmtFoo names and their flag characters to make understanding the
existing documentation slightly less confusing.

While here, add a new FmtFlag named type to represent these values.

Change-Id: I9631214b892557d094823f1ac575d0c43a84007b
Reviewed-on: https://go-review.googlesource.com/20717
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-15 22:08:05 +00:00
Wedson Almeida Filho
8e7072ca83 sync: new Cond implementation
Change Cond implementation to use a notification list such that waiters
can first register for a notification, release the lock, then actually
wait. Signalers never have to park anymore.

This is intended to address an issue in the previous implementation
where Broadcast could fail to signal all waiters.

Results of the existing benchmark are below.

                                          Original          New  Diff
BenchmarkCond1-48        2000000               745 ns/op    755 +1.3%
BenchmarkCond2-48        1000000              1545 ns/op   1532 -0.8%
BenchmarkCond4-48         300000              3833 ns/op   3896 +1.6%
BenchmarkCond8-48         200000             10049 ns/op  10257 +2.1%
BenchmarkCond16-48        100000             21123 ns/op  21236 +0.5%
BenchmarkCond32-48         30000             40393 ns/op  41097 +1.7%

Fixes #14064

Change-Id: I083466d61593a791a034df61f5305adfb8f1c7f9
Reviewed-on: https://go-review.googlesource.com/18892
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Caleb Spare <cespare@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-15 22:01:20 +00:00
David Crawshaw
f2772a4935 cmd/compile: compute second method type at runtime
The type information for a method includes two variants: a func
without the receiver, and a func with the receiver as the first
parameter. The former is used as part of the dynamic interface
checks, but the latter is only returned as a type in the
reflect.Method struct.

Instead of computing it at compile time, construct it at run time
with reflect.FuncOf.

Using cl/20701 as a baseline,

	cmd/go: -480KB, (4.4%)
	jujud:  -5.6MB, (7.8%)

For #6853.

Change-Id: I1b8c73f3ab894735f53d00cb9c0b506d84d54e92
Reviewed-on: https://go-review.googlesource.com/20709
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-15 19:57:40 +00:00
Matthew Dempsky
1b9f168f73 cmd/compile: use int for field index
All of a struct's fields have to fit into memory anyway, so index them
with int instead of int64.  This also makes it nicer for
cmd/compile/internal/gc to reuse the same NumFields function.

Change-Id: I210be804a0c33370ec9977414918c02c675b0fbe
Reviewed-on: https://go-review.googlesource.com/20691
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-15 19:56:43 +00:00
David Crawshaw
d06b0db5bd cmd/link: when pruning methods also prune funcType
Remove method type information for pruned methods from any program
that does not reflect on methods. This can be a significant saving:

	addr2line: -310KB (8.8%)

A future update might want to consider a more aggressive variant of
this: setting the Type and Func fields of reflect.Method to nil for
unexported methods. That would shrink cmd/go by 2% and jujud by 2.6%
but could be considered an API change. So this CL sticks to the
uncontroversial change.

For #6853.

Change-Id: I5d186d9f822dc118ee89dc572c4912a3b3c72577
Reviewed-on: https://go-review.googlesource.com/20701
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-15 19:41:17 +00:00
Keith Randall
41f9f6f471 cmd/compile: fix load-combining
Make sure symbol gets carried along by load-combining rule.
Add the new load into the right block where we know that
mem is live.

Use auxInt field to carry i along instead of an explicit ADDQ.

Incorporate LEA ops into MOVBQZX and friends.

Change-Id: I587f7c6120b98fd2a0d48ddd6ddd13345d4421b4
Reviewed-on: https://go-review.googlesource.com/20732
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
2016-03-15 19:18:13 +00:00
Matthew Dempsky
f6fab93a46 cmd/compile: make Type.Field stricter about bounds checking
Turns out there were only two call sites that expected
t.Field(t.NumFields()) to return nil.

Change-Id: I4679988d38ee9d7c9d89883537a17046717b2a77
Reviewed-on: https://go-review.googlesource.com/20731
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-15 18:46:03 +00:00
Dave Cheney
cea5d26aa2 cmd/compile/internal/gc: remove Thearch.Linkarchinit
Change-Id: I8e990204c7a1e65d6b8e4262f6b5b9bd0cb3540c
Reviewed-on: https://go-review.googlesource.com/20725
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-15 15:29:39 +00:00
Dave Cheney
70090654de cmd/compile/internal/gc: tidy plive.go
Make boolean looking things boolean.

Change-Id: I8d1c0a32b471412b25a72908c7da6458d7bbe65b
Reviewed-on: https://go-review.googlesource.com/20723
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-15 15:27:21 +00:00
Shahar Kohanim
3648d2d4cd cmd/link, cmd/compile: Add symbol references to object file.
Symbols in the object file currently refer to each other using symbol name
and version. Referring to the same symbol many times in an object file takes
up space and causes redundant map lookups. Instead write out a list of unique
symbol references and have symbols refer to each other using indexes into this
list.

Credit to Michael Hudson-Doyle for kicking this off.

Reduces pkg/linux_amd64 size by 30% from 61MB to 43MB

name       old s/op   new s/op   delta
LinkCmdGo  0.74 ± 3%  0.63 ± 4%  -15.22%  (p=0.000 n=20+20)
LinkJuju   6.38 ± 6%  5.73 ± 6%  -10.16%  (p=0.000 n=20+19)

Change-Id: I7e101a0c80b8e673a3ba688295e6f80ea04e1cfb
Reviewed-on: https://go-review.googlesource.com/20099
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-15 13:00:07 +00:00
Dave Cheney
ac47f66abc cmd/compile/internal: clean up galign.go constants
Move the C header style architecture constants to the per arch Main
methods.

Change-Id: Ie7ff39baa275ceaa6680e7d16441ca9f0aa12597
Reviewed-on: https://go-review.googlesource.com/20722
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-15 07:13:04 +00:00
Dave Cheney
04f23b6428 cmd/internal/obj: remove dead code
Partial automatic cleanup driven by Dominik Honnef's unused tool.

As _lookup now only has one caller, merge it into the caller and remove
the conditional create logic.

Change-Id: I2ea354d9d4b32a19905271eca74725231b6d8a93
Reviewed-on: https://go-review.googlesource.com/20589
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-15 06:02:13 +00:00
Josh Bleecher Snyder
11a80860ad cmd/compile: move testdclstack out of the xdcl_list loop
This is a band-aid, but it fixes the problem
until a deeper fix is in place.

Testing with genpkg -n 50000, I see:

Before:

      154.67 real       184.66 user         3.15 sys

After:

       61.82 real        96.99 user         2.17 sys


Fixes #14781.

Change-Id: I24c7822d60c289bdd6a18a7840b984954c95f7d4
Reviewed-on: https://go-review.googlesource.com/20696
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-15 04:15:41 +00:00
Jeremy Jackins
80f2aff9ef cmd/compile: clean up C-style variable declarations in plive.go
Change-Id: I928f51a1fe4830a81d4f5d3eb572785e06a75b77
Reviewed-on: https://go-review.googlesource.com/20581
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-15 00:57:54 +00:00
Robert Griesemer
eb4d1be285 cmd/compile: keep variable numbering for inlineable exported functions
Another step towards hooking up exported inlined function bodies.

Change-Id: Ib8094b03ac7970fee0e51b5826b5f8aa232e23fb
Reviewed-on: https://go-review.googlesource.com/20605
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
2016-03-14 21:56:25 +00:00
Matthew Dempsky
2e9369067b cmd/compile: replace TFIELD kind with separate Field type
Allows removing a bunch of unnecessary fields.

Passes toolstash/buildall.

Change-Id: Iec2492920e1c3ef352a9bf4296c74a55d9cc9ad6
Reviewed-on: https://go-review.googlesource.com/20677
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-14 21:30:41 +00:00
Matthew Dempsky
2a46b08a02 cmd/dist: build bootstrap toolchain with -l
Workaround Go 1.4 compiler bugs.  See discussion at:
https://groups.google.com/d/msg/golang-dev/Ss7mCKsvk8w/Gsq7VYI0AwAJ

Change-Id: I842335fddffb67a6e21c000fe5bef258ea61c77a
Reviewed-on: https://go-review.googlesource.com/20690
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-14 21:30:33 +00:00
Matthew Dempsky
c278f9302e cmd/compile: stop storing TFIELD types in Node.Type
Currently, the only use for this is on the Left side of OKEY nodes
within struct literals.  esc and fmt only care so they can recognize
that the ONAME nodes are actually field names, which need special
handling.

sinit additionally needs to know the field's offset within the struct,
which we can provide via Xoffset.

Passes toolstash/buildall.

Change-Id: I362d965e161f4d80fcd9c9bae0dfacc657dc0b29
Reviewed-on: https://go-review.googlesource.com/20676
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-14 21:12:29 +00:00
Josh Bleecher Snyder
9bffcf382b cmd/compile: minor cleanup in sinit.go
Passes toolstash -cmp.

Change-Id: Id16009ef3ef1173eafe0f0c578dbf325b61aab3c
Reviewed-on: https://go-review.googlesource.com/20674
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-14 21:03:33 +00:00
Matthew Dempsky
0d2e92c2ca cmd/compile: add Fields field to Type
Switch TSTRUCT and TINTER to use Fields instead of Type, which wrings
out the remaining few direct uses of the latter.

Preparation for converting fields to use a separate "Field" type.

Passes toolstash/buildall.

Change-Id: I5a2ea7e159d0dde1be2c9afafc10a8f739d95743
Reviewed-on: https://go-review.googlesource.com/20675
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-14 20:44:45 +00:00
Josh Bleecher Snyder
7971864267 cmd/compile: simplify InitPlan
Passes toolstash -cmp.

Change-Id: Iaa0d78c2552efb29e67f6c99c7287f8566027add
Reviewed-on: https://go-review.googlesource.com/20673
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-14 20:44:02 +00:00
Josh Bleecher Snyder
e59c1729ba cmd/compile: convert data siz to int
Follow-up to CL 20645.

Passes toolstash -cmp.

Change-Id: Idc63c41b2be2d52e3a6ac59b3a12eb41aa2efbed
Reviewed-on: https://go-review.googlesource.com/20670
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-14 20:22:21 +00:00
Josh Bleecher Snyder
57faad6677 cmd/compile: fix CTNIL static data comments
Change-Id: I434f881c10dec41a802641db8873abf1353beba2
Reviewed-on: https://go-review.googlesource.com/20671
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-14 19:55:30 +00:00
Josh Bleecher Snyder
a0232ea0dd cmd/compile: allow deduplication of long strings
String symbols' names used to appear in the final binary.
Using a string's contents as it's symbol's name
was a thus a bad idea if the string's name was long.
Recent improvements by crawshaw have changed that.

Instead of placing long strings behind opaque names
in local packages, place them in the global string
package and make them content-addressable.
Symbol names still occur in the object files,
so use a hash to avoid needless length there.

Reduces the size of cmd/go by 30k.

Change-Id: Ifdbbaf47bf44352418c90ddd903d5106e48db4f1
Reviewed-on: https://go-review.googlesource.com/20524
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-14 19:54:58 +00:00
Alexandru Moșoi
13f74db304 cmd/compile: fix no-opt build after moving decomposing user functions
decompose-builtin pass requires an opt pass, but -N disables
late-opt, the only opt pass (out of two) that happens
after decompose-builtin.  This CL enables both 'opt' and 'late opt'
passes. The extra compile time for 'late opt' in negligible
since most rewrites were already done in the first 'opt'
(also measured before). We should put some effort in splitting the
generic rules into required and optional.

Also update generic.rules comments about lowering
of StringMake and SliceMake.

Tested with GO_GCFLAGS=-N ./all.bash

Change-Id: I92999681aaa02587b6dc6e32ce997a91f1fc9499
Reviewed-on: https://go-review.googlesource.com/20682
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-14 18:44:10 +00:00
Michael Pratt
a4e31d42ee cmd/compile: remove amd64 code from package gc and the core gen tool
Parts of the SSA compiler in package gc contain amd64-specific code,
most notably Prog generation. Move this code into package amd64, so that
other architectures can be added more easily.

In package gc, this change is just moving code. There are no functional
changes or even any larger structural changes beyond changing function
names (mostly for export).

In the cmd/compile/internal/ssa/gen tool, more information is included
in arch to remove the AMD64-specific behavior in the main portion of the
tool. The generated opGen.go is identical.

Change-Id: I8eb37c6e6df6de1b65fa7dab6f3bc32c29daf643
Reviewed-on: https://go-review.googlesource.com/20609
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-14 16:59:03 +00:00
Todd Neal
98b88de56f cmd/compile: change the type of ssa Warnl line number
Line numbers are always int32, so the Warnl function should take the
line number as an int32 as well.  This matches gc.Warnl and removes
a cast every place it's used.

Change-Id: I5d6201e640d52ec390eb7174f8fd8c438d4efe58
Reviewed-on: https://go-review.googlesource.com/20662
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-14 11:04:40 +00:00
Matthew Dempsky
2dcbbbd193 cmd/internal/obj, cmd/asm: get rid of obj.ADATA
Just recognize "DATA" as a special pseudo op word in the assembler
directly.

Change-Id: I508e111fd71f561efa600ad69567a7089a57adb2
Reviewed-on: https://go-review.googlesource.com/20648
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-14 05:13:47 +00:00
Matthew Dempsky
edde955d7f cmd/internal/obj: support arbitrarily sized string data
Updates #14786.

Change-Id: I5fe889886f772167386cd10390ac50abc1383937
Reviewed-on: https://go-review.googlesource.com/20607
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-03-14 05:13:31 +00:00
Josh Bleecher Snyder
4f753e77f1 cmd/all: stop generating ADATA Progs
The only remaining place that generated ADATA
Prog was the assembler. Stop, and delete some
now-dead code.

Passes toolstash -cmp.

Change-Id: I26578ff1b4868e98562b44f69d909c083e96f8d5
Reviewed-on: https://go-review.googlesource.com/20646
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-14 02:22:49 +00:00
Josh Bleecher Snyder
7c18f8cdc3 cmd/compile: write some static data directly
Instead of generating ADATA instructions for
static data, write that static data directly
into the linker sym.
This is considerably more efficient.
The assembler still generates
ADATA instructions, so the ADATA machinery
cannot be dismantled yet. (Future work.)
Skipping ADATA has a significant impact
compiling the unicode package, which has lots
of static data.

name     old time/op    new time/op    delta
Unicode     227ms ±10%     192ms ± 4%  -15.61%  (p=0.000 n=29+30)

name     old alloc/op   new alloc/op   delta
Unicode    51.0MB ± 0%    45.8MB ± 0%  -10.29%  (p=0.000 n=30+30)

name     old allocs/op  new allocs/op  delta
Unicode      610k ± 0%      578k ± 0%   -5.29%  (p=0.000 n=30+30)

This does not pass toolstash -cmp, because
this changes the order in which some relocations
get added, and thus it changes the output from
the compiler. It is not worth the execution time
to sort the relocs in the normal case.

However, compiling with -S -v generates identical
output if (1) you suppress printing of ADATA progs
in flushplist and (2) you suppress printing of
cpu timing. It is reasonable to suppress printing
the ADATA progs, since the data itself is dumped
later. I am therefore fairly confident that all
changes are superficial and non-functional.

Fixes #14786, although there's more to do
in general.

Change-Id: I8dfabe7b423b31a30e516cfdf005b62a2e9ccd82
Reviewed-on: https://go-review.googlesource.com/20645
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-14 02:21:43 +00:00
Matthew Dempsky
d1341d6cf3 cmd/compile, runtime: eliminate growslice_n
Fixes #11419.

Change-Id: I7935a253e3e96191a33f5041bab203ecc5f0c976
Reviewed-on: https://go-review.googlesource.com/20647
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-13 23:34:31 +00:00
Alexandru Moșoi
8ec80176d4 cmd/compile: move decompose builtin closer to late opt
* Shaves about 10k from pkg/tools/linux_amd64.
* Was suggested by drchase before
* Found by looking at ssa output of #14758

Change-Id: If2c4ddf3b2603d4dfd8fb4d9199b9a3dcb05b17d
Reviewed-on: https://go-review.googlesource.com/20570
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-13 22:12:01 +00:00
Josh Bleecher Snyder
fdc04223c5 cmd/compile: clean up savedata
Simplify function signature.
Remove unused Ctxt field Enforce_data_order.

Passes toolstash -cmp.

Change-Id: I5caa270ca9ae725708fe415b2c978b5f40780255
Reviewed-on: https://go-review.googlesource.com/20644
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-13 21:11:27 +00:00
Josh Bleecher Snyder
e8fab405cb cmd/compile: minor cleanup
Passes toolstash -cmp.

Change-Id: Ib8c76081956e1d4eecef16b82bc8d527d7849d7e
Reviewed-on: https://go-review.googlesource.com/20643
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-13 21:06:25 +00:00
Egon Elbre
69f49e1cbc cmd/pprof: fix crash with invalid source
pprof crashed when running with:

     go tool pprof %INVALID

Change-Id: I47c2a4da7273e3a97a833f320a650b8c6b59d6b9
Reviewed-on: https://go-review.googlesource.com/20632
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-13 20:38:16 +00:00
Josh Bleecher Snyder
af1c29c1c1 cmd/internal/obj: sort relocs by off when printing
This makes the output of compiling with -S more
stable in the face of unimportant variation in the
order in which relocs are generated.
It is also more pleasant to read the relocs when
they are sorted.

Also, do some minor cleanup.

For #14786

Change-Id: Id92020b13fd21777dfb5b29c2722c3b2eb27001b
Reviewed-on: https://go-review.googlesource.com/20641
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-13 20:31:40 +00:00
Matthew Dempsky
a2a48069fe cmd/compile: rework how fieldtrack is implemented
Shrinks gc.Type and gc.Func slightly.

Passes "GOEXPERIMENT=fieldtrack ./all.bash" and "go test -a
-toolexec='toolstash -cmp' -ldflags=-k=rsc.io/tmp/fieldtrack.tracked
rsc.io/tmp/fieldtrack".

Change-Id: I785fe8a18eb830d9867d34247e4cd41a6a7921d4
Reviewed-on: https://go-review.googlesource.com/20557
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-13 16:58:00 +00:00
Todd Neal
f6ceed2cab cmd/compile: const folding for float32/64
Split the auxFloat type into 32/64 bit versions and perform checking for
exactly representable float32 values.  Perform const folding on
float32/64.  Comment out some const negation rules that the frontend
already performs.

Change-Id: Ib3f8d59fa8b30e50fe0267786cfb3c50a06169d2
Reviewed-on: https://go-review.googlesource.com/20568
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-13 13:32:41 +00:00
Alexandru Moșoi
cd798dcb88 cmd/compile/internal/ssa: generalize prove to all booleans
* Refacts a bit saving and restoring parents restrictions
* Shaves ~100k from pkg/tools/linux_amd64,
but most of the savings come from the rewrite rules.
* Improves on the following artificial test case:
func f1(a4 bool, a6 bool) bool {
  return a6 || (a6 || (a6 || a4)) || (a6 || (a4 || a6 || (false || a6)))
}

Change-Id: I714000f75a37a3a6617c6e6834c75bd23674215f
Reviewed-on: https://go-review.googlesource.com/20306
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-13 12:05:41 +00:00
Todd Neal
40bfec0022 cmd/compile: reuse auto symbols during ssa construction
Reuse auto symbols so cse can eliminate OpAddrs that refer to
them.

Change-Id: I69e6a3f77a3a33946459cf8c6eccf223f6125048
Reviewed-on: https://go-review.googlesource.com/20569
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-12 13:44:49 +00:00
Shahar Kohanim
eb57a1dd75 cmd/link: use string map for symbols with single version
Reduces link time by ~3%

Results with gc on:
name       old s/op   new s/op   delta
LinkCmdGo  0.82 ± 2%  0.78 ± 2%  -3.90%  (p=0.000 n=17+17)
LinkJuju   7.11 ± 7%  6.87 ± 6%  -3.41%  (p=0.012 n=20+19)

Less noisy results with gc turned off:
name       old s/op   new s/op   delta
LinkCmdGo  0.66 ± 2%  0.64 ± 2%  -3.14%  (p=0.000 n=18+20)
LinkJuju   5.91 ± 1%  5.72 ± 2%  -3.17%  (p=0.000 n=20+20)

Change-Id: I4cac7933b0b22d0aee18255e1ab54550ad364593
Reviewed-on: https://go-review.googlesource.com/20478
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
2016-03-12 11:11:10 +00:00
Alex Brainman
bb48b864b1 cmd/link: rewrite pe symbol table generating code
Every go executable has COFF symbol table appended at the end. The table is
used by nm and addr2line and contains all symbols present in the executable.
The table is quite large. For example, my go.exe has 11736 records.

To generate symbol table:
1) we walk "all symbols" list to count symbols we want for the table;
2) we allocate large global array of COFFSym structs (32 bytes each)
   to fit our symbols;
3) we walk "all symbols" list again to fill our array with contents;
4) we iterate over our global array to write all records to the file.

This CL changes all these steps with single step:
- walk "all symbols" list and write each COFF symbol table record to
  the file as we go.

I hope new version is faster and uses less garbage, but I don't know
how to benchmark this.

Change-Id: Ie4870583250131ea4428e0e83a0696c9df1794e0
Reviewed-on: https://go-review.googlesource.com/20580
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
2016-03-12 07:07:48 +00:00
Keith Randall
77b527e283 cmd/compile: strength reduce *24
We use *24 a lot for pointer arithmetic when accessing slices
of slices ([][]T).  Rewrite to use an LEA and a shift.
The shift will likely be free, as it often gets folded into
an indexed load/store.

Update #14606

Change-Id: Ie0bf6dc1093876efd57e88ce5f62c26a9bf21cec
Reviewed-on: https://go-review.googlesource.com/20567
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
2016-03-12 02:58:45 +00:00
Robert Griesemer
68c86a0096 cmd/compile: remove structpkg global variable
The structpkg global variable was only used to verify internal
consistency when declaring methods during import. Track the
value in the parser and binary importer directly and pass it
to the relevant function as an argument.

Change-Id: I7e5e006f9046d84f9a3959616f073798fda36c97
Reviewed-on: https://go-review.googlesource.com/20606
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-12 01:39:40 +00:00
David Crawshaw
7c546566c3 cmd/compile: compute number of arguments correctly
The outCount value includes a flag bit for dotdotdot.

If we have this count incorrect, then the offset for the
methodset *rtype are in the wrong place.

Fixes #14783

Change-Id: If5acb16af08d4ffe36c8c9ee389c32f2712ce757
Reviewed-on: https://go-review.googlesource.com/20566
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-12 01:23:25 +00:00
Ian Lance Taylor
1220ac27ce cmd/compile: don't copy all type nodes for builtin functions
Only copy the ones that actually change.  Also combine deep and substAny
functions into one.  The Type.Copyany field is now unused, so remove it.

Passes toolstash -cmp.

Change-Id: Id28a9bf144ecf3e522aad00496f8a21ae2b74680
Reviewed-on: https://go-review.googlesource.com/20600
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2016-03-12 00:30:44 +00:00
Matthew Dempsky
9d7b2b7b10 cmd/compile: move universe block code into new universe.go
Move lexinit, typeinit, lexinit1, and lexfini into new universe.go
file, and give them a more idiomatic and descriptive API. No code
changes.

Change-Id: I0e9b25dcc86ad10f4b990dc02bd33477b488cc85
Reviewed-on: https://go-review.googlesource.com/20604
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-11 23:56:56 +00:00
Robert Griesemer
76461c93a1 cmd/compile: move lexn and lexname into lex.go (cleanup)
Missed these two declarations in the previous cleanup.

Change-Id: I54ff3accd387dd90e12847daccf4477169797f81
Reviewed-on: https://go-review.googlesource.com/20603
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-11 23:26:59 +00:00
Robert Griesemer
998b6dd75c cmd/compile: move lexer into separate file (cleanup)
This is really moving all the non-lexer pieces out of lex.go
into main.go. It's always been confusing that the top-most
compiler entry point (Main) is in the same file with the
lexer. Both files remain of substantial size (> 1000 lines),
which justifies this even more.

No other changes.

Change-Id: I03895589d5e3cc2340580350bbc1420539893dfc
Reviewed-on: https://go-review.googlesource.com/20601
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-11 22:59:57 +00:00
Robert Griesemer
e78ff3823e cmd/compile: simplify lexer.ungetr
Change-Id: Id041c1b2d364aecd7a6613a53237f7de2c650a7e
Reviewed-on: https://go-review.googlesource.com/20599
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-11 22:17:01 +00:00
David Crawshaw
e2836935bb cmd/link: treat reflect.Value.Method like Call
Fixes #14740

Change-Id: Iad8d971c21977b0a1f4ef55a08bb180a8125e976
Reviewed-on: https://go-review.googlesource.com/20562
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-11 22:07:02 +00:00
David Crawshaw
5aa5db7593 cmd/compile: use bufio.Reader directly in lexer
Removes an intermediate layer of functions that was clogging up a
corner of the compiler's profile graph.

I can't measure a performance improvement running a large build
like jujud, but the profile reports less total time spent in
gc.(*lexer).getr.

Change-Id: I3000585cfcb0f9729d3a3859e9023690a6528591
Reviewed-on: https://go-review.googlesource.com/20565
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-11 21:27:23 +00:00
David Crawshaw
cc158403d6 cmd/compile: track reflect.Type.Method in deadcode
In addition to reflect.Value.Call, exported methods can be invoked
by the Func value in the reflect.Method struct. This CL has the
compiler track what functions get access to a legitimate reflect.Method
struct by looking for interface calls to either of:

	Method(int) reflect.Method
	MethodByName(string) (reflect.Method, bool)

This is a little overly conservative. If a user implements a type
with one of these methods without using the underlying calls on
reflect.Type, the linker will assume the worst and include all
exported methods. But it's cheap.

No change to any of the binary sizes reported in cl/20483.

For #14740

Change-Id: Ie17786395d0453ce0384d8b240ecb043b7726137
Reviewed-on: https://go-review.googlesource.com/20489
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-11 21:19:20 +00:00
Josh Bleecher Snyder
4112f0f7e6 cmd/compile: improve go.importpath.* docs
While we're here, remove a bit of dead code.

Change-Id: I1344bb41e5d368825ca5748189382f9e7023c59a
Reviewed-on: https://go-review.googlesource.com/20596
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-11 20:50:10 +00:00
Josh Bleecher Snyder
2ac8555d57 cmd/link: tidy up rdsym
Use an early return. Check errors. Deduplicate.

Change-Id: Iabefd563b5ef82a16fab4791277630804fd09003
Reviewed-on: https://go-review.googlesource.com/20597
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-11 20:49:53 +00:00
Matthew Dempsky
de4317cbd7 cmd/compile: eliminate uses of Type.Down in bexport.go
Change-Id: I298b9d389ac33a24365f4c06a122c3af989906c0
Reviewed-on: https://go-review.googlesource.com/20594
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-11 18:25:52 +00:00
Matthew Dempsky
d9bb693960 cmd/compile: sort interface methods in tointerface0
Might as well sort them while they're still in a slice.

Change-Id: I40c25ddc5c054dcb4da2aeefa79947967609d599
Reviewed-on: https://go-review.googlesource.com/20591
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-11 18:25:42 +00:00
Michael Munday
d05773ce73 cmd/internal/obj: fix nil pointer dereference in Dconv
p can be nil in Dconv so we need to do a check before dereferencing
it. Fixes a problem I was having running toolstash.

Change-Id: I34d6d278b319583d8454c2342ac88e054fc4b641
Reviewed-on: https://go-review.googlesource.com/20595
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-11 16:58:41 +00:00
Matthew Dempsky
f973e79d09 cmd/compile: move InitPlan and InitEntry into sinit.go
I don't know what they're used for, but that's the only file they're
referenced in.

Change-Id: Ie39d7d4621e2d5224408243b5789597ca0dc14be
Reviewed-on: https://go-review.googlesource.com/20593
Reviewed-by: Dave Cheney <dave@cheney.net>
2016-03-11 09:09:51 +00:00
Matthew Dempsky
3621600c92 cmd/compile: give "magic" code its own source file
This code is an eye sore to keep scrolling past in subr.go, so move it
out of the way.

Change-Id: I8eafc1725d868a4924ee7ca9b7738cce309f9eff
Reviewed-on: https://go-review.googlesource.com/20592
Reviewed-by: Dave Cheney <dave@cheney.net>
2016-03-11 09:09:33 +00:00
Robert Griesemer
def9c0b06d cmd/compile: remove Label.Link field and lastlabel global var
Change-Id: If2a174f482ecd56dee43f921d13fef98439872fc
Reviewed-on: https://go-review.googlesource.com/20559
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-11 06:13:06 +00:00
Matthew Dempsky
c7917de0bb cmd/compile: simplify transformclosure
Use idiomatic slicing operations instead of incrementally building a
linked list.

Passes toolstash -cmp.

Change-Id: Idb0e40c7b4d7d1110d23828afa8ae1d157ba905f
Reviewed-on: https://go-review.googlesource.com/20556
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-11 05:54:27 +00:00
Matthew Dempsky
501b1fc3f2 cmd/compile: cleanup unsafenmagic
In particular, make Alignof work more like Sizeof. Other idiomatic
cleanups while here.

Passes toolstash -cmp.

Change-Id: I4def20894f3d95e49ab6a50ddba189be36fdd258
Reviewed-on: https://go-review.googlesource.com/20555
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-11 05:42:59 +00:00
Matthew Dempsky
d3794f88e9 cmd/compile: eliminate uses of Type.Down in alg.go
This could be done by threading the Iter value down through memrun and
ispaddedfield, but that ends up a bit clunky. This way is also closer
to how we'll want the code to look once fields are kept in slices.

Passes toolstash -cmp.

Change-Id: I8a44445c85f921eb18d97199df2026c5ce0f4f67
Reviewed-on: https://go-review.googlesource.com/20558
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-11 05:30:49 +00:00
Keith Randall
369f4f5de5 cmd/compile: regalloc of two address instructions
x86 has a lot of instructions that require the output to be in the same
register as one of the inputs.  When allocating the output register,
allocate the same register as the input if it is available.

Improves the performance of golang.org/x/crypto/sha3 by
10% (from 6% slower than 1.6 to 4% faster).

Fixes #14745

Change-Id: I4d81785240c9368e4dc75107b45c959d200df8e6
Reviewed-on: https://go-review.googlesource.com/20488
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-03-11 04:13:07 +00:00
Robert Griesemer
157f069873 cmd/compile: call missing popdcl in various genxxx functions
Not calling popdcl doesn't have an impact on generated code but
the result is a growing (rather than empty) stack of symbols,
possibly causing more data to remain alive than necessary.

Also: minor cleanups.

Change-Id: Ic4fdbcd8843637d69ab1aa15e896a7e6339bc990
Reviewed-on: https://go-review.googlesource.com/20554
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
2016-03-11 04:12:31 +00:00
Matthew Dempsky
88a21ebb21 cmd/compile: rework checkdupfields
Use a map to detect duplicate symbols. Allows eliminating an otherwise
unneeded field from Sym and gets rid of a global variable.

Change-Id: Ic004bca7e9130a1261a1cddbc17244529a2a1df4
Reviewed-on: https://go-review.googlesource.com/20552
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
2016-03-11 01:52:42 +00:00
Todd Neal
6b3d4a5353 cmd/compile: modify regalloc/stackalloc to use the cmd line debug args
Change the existing flags from compile time consts to be configurable
from the command line.

Change-Id: I4aab4bf3dfcbdd8e2b5a2ff51af95c2543967769
Reviewed-on: https://go-review.googlesource.com/20560
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-11 01:35:12 +00:00
Keith Randall
31d13f479a cmd/compile: don't use PPARAMOUT names for temps
The location of VARDEFs is incorrect for PPARAMOUT variables
which are also used as temporary locations.  We put in VARDEFs
when setting the variable at return time, but when the location
is also used as a temporary the lifetime values are wrong.

Fix copyelim to update the names map properly.  This is a
real name bug fix which, as a result, allows me to
write a reasonable test to trigger the PPARAMOUT bug.

This is kind of a band-aid fix for #14591.  A more pricipled
fix (which allows values to be stored in the return variable
earlier than the return point) will be harder.

Fixes #14591

Change-Id: I7df8ae103a982d1f218ed704c080d7b83cdcfdd9
Reviewed-on: https://go-review.googlesource.com/20457
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-03-11 00:56:04 +00:00
Matthew Dempsky
1c2bdfb7d9 cmd/compile: add Key, FieldSlice, and SetFields helpers
Allows safely eliminating more direct uses of Type's Type and Down
fields.

Passes toolstash -cmp.

Change-Id: I5c17fe541a0473c3cd2978d8314c4ab759079a61
Reviewed-on: https://go-review.googlesource.com/20541
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-10 23:34:22 +00:00
Matthew Dempsky
0b281872e6 cmd/compile: rename ssa.Type's Elem method to ElemType
I would like to add a

    func (t *Type) Elem() *Type

method to package gc, but that would collide with the existing

    func (t *Type) Elem() ssa.Type

method needed to make *gc.Type implement ssa.Type.  Because the latter
is much less widely used right now than the former will be, this CL
renames it to ElemType.

Longer term, hopefully gc and ssa will share a common Type interface,
and ElemType can go away.

Change-Id: I270008515dc4c01ef531cf715637a924659c4735
Reviewed-on: https://go-review.googlesource.com/20546
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-10 23:02:33 +00:00
Matthew Dempsky
e4571d33ac cmd/compile: simplify parser.compound_stmt
Eliminate "else_clause" parameter and move error messages about bad if
statements into the if_stmt parsing method.

Passes toolstash -cmp.

Change-Id: Ibc31619bdb2e7e0cf28712b14640f7d9b6124a40
Reviewed-on: https://go-review.googlesource.com/20543
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-10 22:51:47 +00:00
Ian Lance Taylor
e6ea01685f cmd/compile: remove global variables in inl.go
Change-Id: I06dedf4ebfa32b598f5545dc9354c8e4a95610b1
Reviewed-on: https://go-review.googlesource.com/20525
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-10 22:49:53 +00:00
Keith Randall
ddc6b64444 cmd/compile: fix defer/deferreturn
Make sure we do any just-before-return cleanup on all paths out of a
function, including when recovering.  Each exit path should include
deferreturn (if there are any defers) and then the exit
code (e.g. copying heap-escaping return values back to the stack).

Introduce a Defer SSA block type which has two outgoing edges - one the
fallthrough edge (the defer was queued successfully) and one which
immediately returns (the defer had a successful recover() call and
normal execution should resume at the return point).

Fixes #14725

Change-Id: Iad035c9fd25ef8b7a74dafbd7461cf04833d981f
Reviewed-on: https://go-review.googlesource.com/20486
Reviewed-by: David Chase <drchase@google.com>
2016-03-10 22:33:49 +00:00
Josh Bleecher Snyder
9c8f549abb cmd/compile: continue is the new goto loop
Passes toolstash -cmp.

Change-Id: I014613985005780d1a622c1981b35a94cda798bb
Reviewed-on: https://go-review.googlesource.com/20530
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-10 20:59:54 +00:00
Ian Lance Taylor
ed4a27a8dd cmd/compile: change Func.Inldcl from *[]*Node to Nodes
Change-Id: I055e986c3f27d5c07badcd1684f4fe1d65a917a9
Reviewed-on: https://go-review.googlesource.com/20523
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-10 19:56:55 +00:00
Matthew Dempsky
fe5b4a6503 cmd/compile: more use of IterXXX functions
This CL was mostly produced by a one-off automated rewrite tool
looking for statements like "for X := T.Type; X != nil; X = X.Down"
and a few minor variations.

Passes toolstash -cmp.

Change-Id: Ib22705e37d078ef97841ee2e08f60bdbcabb94ad
Reviewed-on: https://go-review.googlesource.com/20520
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-10 19:54:03 +00:00
Ian Lance Taylor
c63dbd87c1 cmd/compile: add Nodes.Set1 method and use it where possible
Passes toolstash -cmp.

Change-Id: I05322fb5afd213f13fb247ec1a5f655c17a58774
Reviewed-on: https://go-review.googlesource.com/20522
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-10 18:35:10 +00:00
Ian Lance Taylor
72655afb4e cmd/compile: remove NodeList type
That was easy.

Fixes #14473.

Change-Id: I9d1d20a5c5a9b1423e6c72c0460ee4a78130864f
Reviewed-on: https://go-review.googlesource.com/20521
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-10 18:22:07 +00:00
Ian Lance Taylor
f444b8a80e cmd/compile: remove all remaining nodeSeq code
Passes toolstash -cmp.

Update #14473.

Change-Id: I2ac5c595d7af7a8da1a7e3945e6a753299446250
Reviewed-on: https://go-review.googlesource.com/20497
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-10 17:57:00 +00:00
Lynn Boger
b4b2ddb867 math: improve sqrt for ppc64le,ppc64
The existing implementation uses code written in Go to
implement Sqrt; this adds the assembler to use the sqrt
instruction for Power and makes the necessary changes to
allow it to be inlined.

The following tests showed this relative improvement:

benchmark                 delta
BenchmarkSqrt             -97.91%
BenchmarkSqrtIndirect     -96.65%
BenchmarkSqrtGo           -35.93%
BenchmarkSqrtPrime        -96.94%

Fixes #14349

Change-Id: I8074f4dc63486e756587564ceb320aca300bf5fa
Reviewed-on: https://go-review.googlesource.com/19515
Reviewed-by: Minux Ma <minux@golang.org>
2016-03-10 15:01:21 +00:00
Todd Neal
6cb2e1d015 cmd/compile: remove values from const cache upon free
When calling freeValue for possible const values, remove them from the
cache as well.

Change-Id: I087ed592243e33c58e5db41700ab266fc70196d9
Reviewed-on: https://go-review.googlesource.com/20481
Run-TryBot: Todd Neal <tolchz@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-10 10:28:05 +00:00
Dave Cheney
dbe54d23fe cmd/compile/internal: peep.go cleanups
More cleanups after CL 20089

- copysub, take a bool rather than an int for the f (force) parameter.
- copysub returns a bool rather than an int.
- prevl, reg is now int16, which reduces type conversion in its callers.
- copy1, reduce the scope of t and p variables.
- small simplifications in copyau1, copyas, etc.
- {mips64,ppc64}/regzer returns a bool.
- apply CL 20181 to x86/peep.go which was missed in the last CL.
- various comment fixes.

Change-Id: Ib73ffb768c979ce86f1614e5366fd576dea50986
Reviewed-on: https://go-review.googlesource.com/20281
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-10 07:01:34 +00:00
Matthew Dempsky
211cc40b11 cmd/compile: change ignorecase param types to bool
Change-Id: I93b4821254c9b0a3cebd912f447ed58f20adeb58
Reviewed-on: https://go-review.googlesource.com/19937
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-10 06:34:05 +00:00
Matthew Dempsky
49dad0f571 cmd/compile: support arbitrarily deep embedded fields
Fixes #13337.

Change-Id: Ie74d00390111796619150287d3f7a147750ab456
Reviewed-on: https://go-review.googlesource.com/19932
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-10 06:33:52 +00:00
Matthew Dempsky
f91b832ab5 cmd/compile: rename Recv->Recvs and Recv0->Recv
Change-Id: Ice3aa807169f4fec85745a3991b1084a9f85c1b5
Reviewed-on: https://go-review.googlesource.com/20499
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-10 05:52:24 +00:00
Matthew Dempsky
0cff505871 cmd/compile: add Recv0 and Field helper methods for Type
Accessing the n'th field of a struct is fairly common, and in
particular accessing the 0'th field of the receiver parameter list is
very common. Add helper methods for both of these tasks and update
code to make use of them.

Change-Id: I81f551fecdca306b3800636caebcd0dc106f2ed7
Reviewed-on: https://go-review.googlesource.com/20498
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
2016-03-10 05:34:37 +00:00
Matthew Dempsky
d20b92e07a cmd/compile: replace more unnecessary **Type with *Type
Also, more lazy variable declarations, and make Dijkstra happy by
replacing "goto loop" with a for loop.

Change-Id: Idf2cd779a92eb3f33bd3394e12c9a0be72002ff4
Reviewed-on: https://go-review.googlesource.com/20496
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-10 04:33:57 +00:00
Dave Cheney
9d77ad8d34 cmd/compile/internal/gc: type.go cleanup
Follow up to CL 20494 addressing Type.Copy and a few other tiny
cleanups.

Change-Id: I3d0913a9f50a22ac2fd802858b1a94c15c5cb1bc
Reviewed-on: https://go-review.googlesource.com/20501
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-10 03:53:53 +00:00
Matthew Dempsky
2339b131d6 cmd/compile: cleanup paramstoheap and returnsfromheap
Better documentation. Change parameter types from **Type and int to
just *Type and bool. Make use of short var declarations.

Change-Id: I909846ba0df65cd2bc05ee145b72d60e881588bd
Reviewed-on: https://go-review.googlesource.com/20495
Reviewed-by: Dave Cheney <dave@cheney.net>
2016-03-10 03:48:33 +00:00
Matthew Dempsky
b014b55b82 cmd/compile: consolidate Type construction and copying code
This should is preparatory cleanup to make it easier to use separate
types to represent each kind of Go type, rather than a single omnibus
Type struct with heavily overloaded fields.

Also, add TODO comments marking assignments that change an existing
Type's kind, as they need to be removed before we can factor Type.

Change-Id: If4b551fdea4ae045b10b1a3de2ee98f5cf32a517
Reviewed-on: https://go-review.googlesource.com/20494
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-10 01:37:09 +00:00
Josh Bleecher Snyder
e0032df81e cmd/compile: make alg gen prologue/epilogue match
With this, the start and end of geneq and genhash
are parallel. This removes a few rare nilchecks
from generated hash functions, but nothing
to write home about.

Change-Id: I3b4836111d04daa6f6834a579bbec374a3f42c70
Reviewed-on: https://go-review.googlesource.com/20456
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-09 22:52:22 +00:00
Ian Lance Taylor
cd6619d2e6 cmd/compile: remove remaining nodeSeqIterate calls
Mix in several other minor cleanups, including adding some new methods
to Nodes: Index, Addr, SetIndex, SetNodes.

Passes toolstash -cmp.

Update #14473.

Change-Id: I8bd4ae3fde7c5e20ba66e7dd1654fbc70c3ddeb8
Reviewed-on: https://go-review.googlesource.com/20491
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-09 22:52:11 +00:00
David Crawshaw
862b9ddda7 cmd/link: prune unused methods
Today the linker keeps all methods of reachable types. This is
necessary if a program uses reflect.Value.Call. But while use of
reflection is widespread in Go for encoders and decoders, using
it to call a method is rare.

This CL looks for the use of reflect.Value.Call in a program, and
if it is absent, adopts a (reasonably conservative) method pruning
strategy as part of dead code elimination. Any method that is
directly called is kept, and any method that matches a used
interface's method signature is kept.

Whether or not a method body is kept is determined by the relocation
from its receiver's *rtype to its *rtype. A small change in the
compiler marks these relocations as R_METHOD so they can be easily
collected and manipulated by the linker.

As a bonus, this technique removes the text segment of methods that
have been inlined. Looking at the output of building cmd/objdump with
-ldflags=-v=2 shows that inlined methods like
runtime.(*traceAllocBlockPtr).ptr are removed from the program.

Relatively little work is necessary to do this. Linking two
examples, jujud and cmd/objdump show no more than +2% link time.

Binaries that do not use reflect.Call.Value drop 4 - 20% in size:

	addr2line: -793KB (18%)
	asm:       -346KB (8%)
	cgo:       -490KB (10%)
	compile:   -564KB (4%)
	dist:      -736KB (17%)
	fix:       -404KB (12%)
	link:      -328KB (7%)
	nm:        -827KB (19%)
	objdump:   -712KB (16%)
	pack:      -327KB (14%)
	yacc:      -350KB (10%)

Binaries that do use reflect.Call.Value see a modest size decrease
of 2 - 6% thanks to pruning of unexported methods:

	api:    -151KB (3%)
	cover:  -222KB (4%)
	doc:    -106KB (2.5%)
	pprof:  -314KB (3%)
	trace:  -357KB (4%)
	vet:    -187KB (2.7%)
	jujud:  -4.4MB (5.8%)
	cmd/go: -384KB (3.4%)

The trivial Hello example program goes from 2MB to 1.68MB:

	package main

	import "fmt"

	func main() {
		fmt.Println("Hello, 世界")
	}

Method pruning also helps when building small binaries with
"-ldflags=-s -w". The above program goes from 1.43MB to 1.2MB.

Unfortunately the linker can only tell if reflect.Value.Call has been
statically linked, not if it is dynamically used. And while use is
rare, it is linked into a very common standard library package,
text/template. The result is programs like cmd/go, which don't use
reflect.Value.Call, see limited benefit from this CL. If binary size
is important enough it may be possible to address this in future work.

For #6853.

Change-Id: Iabe90e210e813b08c3f8fd605f841f0458973396
Reviewed-on: https://go-review.googlesource.com/20483
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-09 22:22:46 +00:00
Brad Fitzpatrick
0ac0e22fa7 cmd/compile: shrink tables
Drops cmd/binary size from 14.41 MiB to 11.42 MiB.

Before:

   text    data     bss     dec     hex filename
8121210 3521696  737960 12380866         bceac2 ../pkg/tool/linux_amd64/compile

bradfitz@dev-bradfitz-debian2:~/go/src$ ls -l ../pkg/tool/linux_amd64/compile
-rwxr-xr-x 1 bradfitz bradfitz 15111272 Mar  8 23:32 ../pkg/tool/linux_amd64/compile

  a2afc0      51312 R html.statictmp_0085
  6753f0      56592 T cmd/internal/obj/x86.doasm
  625480      58080 T cmd/compile/internal/gc.typecheck1
  f34c40      65688 D runtime.trace
  be0a20     133552 D cmd/compile/internal/ppc64.varianttable
  c013e0     265856 D cmd/compile/internal/arm.progtable
  c42260     417280 D cmd/compile/internal/amd64.progtable
  ca8060     417280 D cmd/compile/internal/x86.progtable
  f44ce0     500640 D cmd/internal/obj/arm64.oprange
  d0de60     534208 D cmd/compile/internal/ppc64.progtable
  d90520     667520 D cmd/compile/internal/arm64.progtable
  e334a0     790368 D cmd/compile/internal/mips64.progtable
  a3e8c0    1579362 r runtime.pclntab

After:

   text    data     bss     dec     hex filename
8128226  375954  246432 8750612  858614 ../pkg/tool/linux_amd64/compile

-rwxr-xr-x 1 bradfitz bradfitz 11971432 Mar  8 23:35 ../pkg/tool/linux_amd64/compile

  6436d0      43936 T cmd/compile/internal/gc.walkexpr
  c13ca0      45056 D cmd/compile/internal/ssa.opcodeTable
  5d8ea0      50256 T cmd/compile/internal/gc.(*state).expr
  818c50      50448 T cmd/compile/internal/ssa.rewriteValueAMD64_OpMove
  a2d0e0      51312 R html.statictmp_0085
  6753d0      56592 T cmd/internal/obj/x86.doasm
  625460      58080 T cmd/compile/internal/gc.typecheck1
  c38fe0      65688 D runtime.trace
  a409e0    1578810 r runtime.pclntab

Fixes #14703

Change-Id: I2177596d5c7fd67db0a3c423cd90801cf52adb12
Reviewed-on: https://go-review.googlesource.com/20450
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-09 21:56:28 +00:00
Alexandru Moșoi
bbd3ffbd83 cmd/compile: constant fold more of IsInBounds and IsSliceInBounds
Fixes #14721

Change-Id: Id1d5a819e5c242b91a37c4e464ed3f00c691aff5
Reviewed-on: https://go-review.googlesource.com/20482
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-09 18:05:28 +00:00
Matthew Dempsky
b594b8b039 cmd/compile: switch Eqtype and (*Type).Compare to use recvParamsResults
Change-Id: I5365b94b815bfb4795db643415c2df51fc815ea1
Reviewed-on: https://go-review.googlesource.com/20459
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
2016-03-09 17:08:30 +00:00
Alexandru Moșoi
dfcb853d9d cmd/compile/internal/ssa: lower builtins much later
* Move lowering into a separate pass.
* SliceLen/SliceCap is now available to various intermediate passes
which use useful for bounds checking.
* Add a second opt pass to handle the new opportunities

Decreases the code size of binaries in pkg/tool/linux_amd64
by ~45K.

Updates #14564 #14606

Change-Id: I5b2bd6202181c50623a3585fbf15c0d6db6d4685
Reviewed-on: https://go-review.googlesource.com/20172
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-03-09 11:08:59 +00:00
Matthew Dempsky
aa3650f019 cmd/compile: eliminate IterParams
It's only used once, so just make the caller responsible for iterating
both the receiver and input params.

Change-Id: Icb34f3f0cf96e80fbe27f3f49d12eddc26599b92
Reviewed-on: https://go-review.googlesource.com/20454
Reviewed-by: Dave Cheney <dave@cheney.net>
2016-03-09 09:13:43 +00:00
Ingo Oeser
33fd4535a4 cmd/compile: use range construct
so the code is more readable.

Also use n[i] = val instead of n = append(n, val),
because this avoids a function call to append.

NOTE: compiles, but I had trouble running toolstash -cmp and need sleep
now.

@Ian this might save you some grunt work :-)

Change-Id: I2a4c70396c58905f7d5aabf83f3020f11dea0e89
Reviewed-on: https://go-review.googlesource.com/20430
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-09 04:58:07 +00:00
Brady Catherman
9323de3da7 testing: implement 'Unordered Output' in Examples.
Adds a type of output to Examples that allows tests to have unordered
output. This is intended to help clarify when the output of a command
will produce a fixed return, but that return might not be in an constant
order.

Examples where this is useful would be documenting the rand.Perm()
call, or perhaps the (os.File).Readdir(), both of which can not guarantee
order, but can guarantee the elements of the output.

Fixes #10149

Change-Id: Iaf0cf1580b686afebd79718ed67ea744f5ed9fc5
Reviewed-on: https://go-review.googlesource.com/19280
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-03-09 04:34:41 +00:00
Josh Bleecher Snyder
903f096992 cmd/compile: superficial cleanup in alg.go
Passes toolstash -cmp.

Change-Id: I6ec2143a30c1f2c15f8ec74422c954ed6b9b1a0f
Reviewed-on: https://go-review.googlesource.com/20452
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-09 02:46:50 +00:00
Matthew Dempsky
4db3dde522 cmd/compile: small cleanups for structargs
Suggested by Dave Cheney in golang.org/cl/20405.

Change-Id: I581c11ae80034cb6ebef3de976e8ae9484472322
Reviewed-on: https://go-review.googlesource.com/20453
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-09 02:03:36 +00:00
Ian Lance Taylor
38921b36ba cmd/compile: rewrite code to omit many nodeSeq calls
This CL was automatically generated using a special-purpose AST
rewriting tool, followed by manual editing to put some comments back in
the right places and fix some bad line breaks.

The result is not perfect but it's a big step toward getting back to
sanity, and because it was automatically generated there is a decent
chance that it is correct.

Passes toolstash -cmp.

Update #14473.

Change-Id: I01c09078a6d78e2b008bc304d744b79469a38d3d
Reviewed-on: https://go-review.googlesource.com/20440
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-09 01:39:33 +00:00
Matthew Dempsky
db506fe98c cmd/compile: change get{this,inarg,outarg}x? into methods
More idiomatic naming (in particular, matches the naming used for
go/types.Signature).

Also, convert more code to use these methods and/or IterFields.
(Still more to go; only made a quick pass for low hanging fruit.)

Passes toolstash -cmp.

Change-Id: I61831bfb1ec2cd50d4c7efc6062bca4e0dcf267b
Reviewed-on: https://go-review.googlesource.com/20451
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-09 01:29:18 +00:00
David Crawshaw
8df733bd22 cmd/compile: remove slices from rtype.funcType
Alternative to golang.org/cl/19852. This memory layout doesn't have
an easy type representation, but it is noticeably smaller than the
current funcType, and saves significant extra space.

Some notes on the layout are in reflect/type.go:

// A *rtype for each in and out parameter is stored in an array that
// directly follows the funcType (and possibly its uncommonType). So
// a function type with one method, one input, and one output is:
//
//	struct {
//		funcType
//		uncommonType
//		[2]*rtype    // [0] is in, [1] is out
//		uncommonTypeSliceContents
//	}

There are three arbitrary limits introduced by this CL:

1. No more than 65535 function input parameters.
2. No more than 32767 function output parameters.
3. reflect.FuncOf is limited to 128 parameters.

I don't think these are limits in practice, but are worth noting.

Reduces godoc binary size by 2.4%, 330KB.

For #6853.

Change-Id: I225c0a0516ebdbe92d41dfdf43f716da42dfe347
Reviewed-on: https://go-review.googlesource.com/19916
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-09 01:25:18 +00:00
Matthew Dempsky
7758a9405f cmd/compile: simplify Iter
Passes toolstash -cmp.

Change-Id: I325b02dcc8412ded0dc304d43377c0bdf59c66a8
Reviewed-on: https://go-review.googlesource.com/20405
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-09 00:18:20 +00:00
David Crawshaw
a24b3ed753 cmd/compile: remove rtype *uncommonType field
Instead of a pointer on every rtype, use a bit flag to indicate that
the contents of uncommonType directly follows the rtype value when it
is needed.

This requires a bit of juggling in the compiler's rtype encoder. The
backing arrays for fields in the rtype are presently encoded directly
after the slice header. This packing requires separating the encoding
of the uncommonType slice headers from their backing arrays.

Reduces binary size of godoc by ~180KB (1.5%).
No measurable change in all.bash time.
For #6853.

Change-Id: I60205948ceb5c0abba76fdf619652da9c465a597
Reviewed-on: https://go-review.googlesource.com/19790
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-08 23:23:13 +00:00
David Chase
0321cabdfa cmd/compile: guard the &-to-<<>> opt against small constants
Converting an and-K into a pair of shifts for K that will
fit in a one-byte argument is probably not an optimization,
and it also interferes with other patterns that we want to
see fire, like (<< (AND K)) [for small K] and bounds check
elimination for masked indices.

Turns out that on Intel, even 32-bit signed immediates beat
the shift pair; the size reduction of tool binaries is 0.09%
vs 0.07% for only the 8-bit immediates.

RLH found this one working on the new/next GC.

Change-Id: I2414a8de1dd58d680d18587577fbadb7ff4f67d9
Reviewed-on: https://go-review.googlesource.com/20410
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
2016-03-08 23:06:11 +00:00
Matthew Dempsky
4720f49e18 cmd/compile: relocate a bunch of Type-related code
Some cleaned up documentation, but no code changes.

Change-Id: I145398bb6d118c626ab3873ef75dbb64ebc286e9
Reviewed-on: https://go-review.googlesource.com/20404
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-08 22:58:01 +00:00
Alexandru Moșoi
fb2f99d5fd cmd/compile/internal/ssa: simplify nil checks in opt.
* Simplify the nilcheck generated by
for _, e := range a {}
* No effect on the generated code because these nil checks
don't end up in the generated code.
* Useful for other analysis, e.g. it'll remove one dependecy
on the induction variable.

Change-Id: I6ee66ddfdc010ae22aea8dca48163303d93de7a9
Reviewed-on: https://go-review.googlesource.com/20307
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-08 22:17:47 +00:00
Matthew Dempsky
e806cd9f95 cmd/compile: cleanup compile function
Make more idiomatic with a defer cleanup, which allows declaring
variables closer to their first use, rather than up front before the
first goto statement.

Also, split the legacy code generation code path into a separate
genlegacy function, analogous to the new genssa.

Passes toolstash -cmp.

Change-Id: I86c22838704f6861b75716ae64ba103b0e73b12f
Reviewed-on: https://go-review.googlesource.com/20353
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-08 21:34:51 +00:00
Matthew Dempsky
4fc02d175b cmd/internal/obj: more Optab range simplification
Same idea as golang.org/cl/20322.

Passes toolstash/buildall.

Change-Id: Ida5960e57ff6e1e8de75c2720f21aeae56a8e415
Reviewed-on: https://go-review.googlesource.com/20352
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-08 21:34:45 +00:00
Brad Fitzpatrick
b330987711 cmd/compile: fix old comment references to go.y
Change-Id: Iec323998133ef20ff962f06a46d15dd342a82f5f
Reviewed-on: https://go-review.googlesource.com/20390
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-08 20:59:41 +00:00
Ian Lance Taylor
2350ca5a41 cmd/compile: remove useless declaration of llit
Accidentally added in https://golang.org/cl/20242.

This is in preparation for transformation by an automated tool.

Passes toolstash -cmp.

Update #14473.

Change-Id: I28c637d220df3ccaa8e368bfbea7282a6e66662e
Reviewed-on: https://go-review.googlesource.com/20402
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-08 20:55:18 +00:00
Russ Cox
0c7ccbf601 cmd/go: ignore C files when CGO_ENABLED=0
Before, those C files might have been intended for the Plan 9 C compiler,
but that option was removed in Go 1.5. We can simplify the maintenance
of cgo packages now if we assume C files (and C++ and M and SWIG files)
should only be considered when cgo is enabled.

Also remove newly unnecessary build tags in runtime/cgo's C files.

Fixes #14123

Change-Id: Ia5a7fe62b9469965aa7c3547fe43c6c9292b8205
Reviewed-on: https://go-review.googlesource.com/19613
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-08 20:10:52 +00:00
Ian Lance Taylor
df035a8d86 cmd/compile: fix bug in vmatch1 list traversal nodeSeq change
Bug accidentally inserted in https://golang.org/cl/20210.  Doesn't seem
to make a difference, but restore original code anyhow.

Update #14473.

Change-Id: I9cf87987ff158e27c7231027819317cdde8c132c
Reviewed-on: https://go-review.googlesource.com/20401
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-08 20:00:03 +00:00
David Chase
4c8589c328 cmd/compile: attach correct line number for fallthru-return
Fixes #14646.

Change-Id: I0bb82ed6d3533633cd8369ba37aa467948bbe155
Reviewed-on: https://go-review.googlesource.com/20381
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-08 19:23:25 +00:00
Brad Fitzpatrick
1264f6e2d4 cmd/compile: gofmt
Change-Id: I754861147838d0f6c184d8deb8a028062a1d3214
Reviewed-on: https://go-review.googlesource.com/20400
Reviewed-by: Russ Cox <rsc@golang.org>
2016-03-08 19:17:24 +00:00
Russ Cox
21af2d39c2 cmd/compile, cmd/link: eliminate string merging pass
Deleting the string merging pass makes the linker 30-35% faster
but makes jujud (using the github.com/davecheney/benchjuju snapshot) 2.5% larger.
Two optimizations bring the space overhead down to 0.6%.

First, change the default alignment for string data to 1 byte.
(It was previously defaulting to larger amounts, usually pointer width.)

Second, write out the type string for T (usually a bigger expression) as "*T"[1:],
so that the type strings for T and *T share storage.

Combined, these obtain the bulk of the benefit of string merging
at essentially no cost. The remaining benefit from string merging
is not worth the excessive cost, so delete it.

As penance for making the jujud binary 0.6% larger,
the next CL in this sequence trims the reflect functype
information enough to make the jujud binary overall 0.75% smaller
(that is, that CL has a net -1.35% effect).

For #6853.
Fixes #14648.

Change-Id: I3fdd74c85410930c36bb66160ca4174ed540fc6e
Reviewed-on: https://go-review.googlesource.com/20334
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2016-03-08 19:14:08 +00:00
Russ Cox
fb880b8a03 cmd/newlink: delete
cmd/link is clearly the way forward.
The original rationale for cmd/newlink was that it would be a clean Go reimplementation.
But when push came to shove, cmd/link got converted from C instead,
and all the work on build modes and the like is in cmd/link now.
Cleaning up cmd/link is likely a much better plan.

This directory is something to delete from releases and the
testdata is something that breaks every time the .6 format changes.
Fix both problems by just deleting it outright.

Change-Id: Ib00fecda258ba685f1752725971182af9d4459eb
Reviewed-on: https://go-review.googlesource.com/20380
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-08 19:07:45 +00:00
Ian Lance Taylor
c4012b6bbb cmd/compile: remove nodesOrNodeList outside of syntax.go
Passes toolstash -cmp.

Update #14473.

Change-Id: I717ebd948dfc8faf8b9ef5aa02c67484af618d18
Reviewed-on: https://go-review.googlesource.com/20359
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-08 18:54:23 +00:00
Josh Bleecher Snyder
f3a29f1f81 cmd/compile: preallocate storage for three Value args
benchstat master2 arg3b
name      old time/op    new time/op    delta
Template     441ms ± 4%     444ms ± 6%    ~     (p=0.335 n=22+25)
GoTypes      1.51s ± 2%     1.51s ± 2%    ~     (p=0.129 n=25+21)
Compiler     5.59s ± 1%     5.56s ± 2%  -0.65%  (p=0.001 n=24+21)

name      old alloc/op   new alloc/op   delta
Template    85.6MB ± 0%    85.3MB ± 0%  -0.40%  (p=0.000 n=25+24)
GoTypes      307MB ± 0%     305MB ± 0%  -0.38%  (p=0.000 n=25+25)
Compiler    1.06GB ± 0%    1.05GB ± 0%  -0.43%  (p=0.000 n=25+25)

name      old allocs/op  new allocs/op  delta
Template     1.10M ± 0%     1.09M ± 0%  -1.04%  (p=0.000 n=25+25)
GoTypes      3.36M ± 0%     3.32M ± 0%  -1.13%  (p=0.000 n=25+24)
Compiler     13.0M ± 0%     12.9M ± 0%  -1.12%  (p=0.000 n=25+25)

Change-Id: I1280b846e895c00b95bb6664958a7765bd819610
Reviewed-on: https://go-review.googlesource.com/20296
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-08 18:46:49 +00:00
Josh Bleecher Snyder
39214275d6 cmd/compile: cache const nil, iface, slice, and ""
name      old time/op    new time/op    delta
Template     441ms ± 4%     446ms ± 4%  +1.23%  (p=0.048 n=22+25)
GoTypes      1.51s ± 2%     1.51s ± 2%    ~     (p=0.224 n=25+25)
Compiler     5.59s ± 1%     5.57s ± 2%  -0.38%  (p=0.019 n=24+24)

name      old alloc/op   new alloc/op   delta
Template    85.6MB ± 0%    85.6MB ± 0%  -0.11%  (p=0.000 n=25+24)
GoTypes      307MB ± 0%     305MB ± 0%  -0.45%  (p=0.000 n=25+25)
Compiler    1.06GB ± 0%    1.06GB ± 0%  -0.34%  (p=0.000 n=25+25)

name      old allocs/op  new allocs/op  delta
Template     1.10M ± 0%     1.10M ± 0%  -0.03%  (p=0.001 n=25+24)
GoTypes      3.36M ± 0%     3.35M ± 0%  -0.13%  (p=0.000 n=25+25)
Compiler     13.0M ± 0%     13.0M ± 0%  -0.12%  (p=0.000 n=25+24)

Change-Id: I7fc18acbc3b1588aececef9692e24a0bd3dba974
Reviewed-on: https://go-review.googlesource.com/20295
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-08 16:21:51 +00:00
Brad Fitzpatrick
7529701d11 cmd/compile: fix comment accuracy after recent change
Change-Id: Ifa09bccb8482a6141d0aa862cef674fade30e2eb
Reviewed-on: https://go-review.googlesource.com/20355
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-08 15:30:26 +00:00
Matthew Dempsky
199cc194ac cmd/compile: simplify eq and hash function generation
Passes toolstash -cmp.

Change-Id: Ie4675e6f713c3bbb90556f5347cbd7268a9c1a5d
Reviewed-on: https://go-review.googlesource.com/20357
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-08 14:29:26 +00:00
Ian Lance Taylor
e28a890d5e cmd/compile: remove nodesOrNodeListPtr outside of syntax.go
Passes toolstash -cmp.

Update #14473.

Change-Id: I2620374b79c61b1e48467b98afe2d7d3beef878b
Reviewed-on: https://go-review.googlesource.com/20354
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-08 14:23:09 +00:00
Matthew Dempsky
beabd872f4 cmd/compile: fix lineno restoration after SSA compilation
Without SSA:

$ go build -a -gcflags='-S -ssa=0' runtime 2>&1 | grep 'TEXT.*""\.init(SB)'
        0x0000 00000 ($GOROOT/src/runtime/write_err.go:14)        TEXT    "".init(SB), $88-0

With SSA, before this CL:

$ go build -a -gcflags='-S -ssa=1' runtime 2>&1 | grep 'TEXT.*""\.init(SB)'
        0x0000 00000 ($GOROOT/src/runtime/traceback.go:608)       TEXT    "".init(SB), $152-0

With SSA, after this CL:

$ go build -a -gcflags='-S -ssa=1' runtime 2>&1 | grep 'TEXT.*""\.init(SB)'
        0x0000 00000 ($GOROOT/src/runtime/write_err.go:14)        TEXT    "".init(SB), $152-0

Change-Id: Ida3541e03a1af6ffc753ee5c3abeb653459edbf6
Reviewed-on: https://go-review.googlesource.com/20321
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-08 06:02:15 +00:00
Aaron Zinman
aea4222f67 darwin/amd64: fix text-relocation issues for c-archive libraries
The existing implementation deals with absolute relocations in __TEXT
for darwin/amd64 in build-mode c-shared, but it ignores c-archive.
This results in issues when trying to use a c-archive in an iOS
app on the 64-bit simulator. This patch adds c-archive to the
handling of this issue.

Fixes #14217

Change-Id: I2e4d5193caa531171ad22fd0cd420a8bfb4646a6
Reviewed-on: https://go-review.googlesource.com/19206
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-08 05:33:33 +00:00
Matthew Dempsky
0d9258a830 cmd/internal/obj: add As type for assembly opcodes
Passes toolstash/buildall.

Fixes #14692.

Change-Id: I4352678d8251309f2b8b7793674c550fac948006
Reviewed-on: https://go-review.googlesource.com/20350
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-08 04:20:09 +00:00
David Chase
b1785a5065 cmd/compile: Tinkering with schedule for debug and regalloc
This adds a heap-based proper priority queue to the
scheduler which made a relatively easy to test quite a few
heuristics that "ought to work well".  For go tools
themselves (which may not be representative) the heuristic
that works best is (1) in line-number-order, then (2) from
more to fewer args, then (3) in variable ID order.  Trying
to improve this with information about use at end of
blocks turned out to be fruitless -- all of my naive
attempts at using that information turned out worse than
ignoring it.  I can confirm that the stores-early heuristic
tends to help; removing it makes the results slightly worse.

My metric is code size reduction, which I take to mean fewer
spills from register allocation.  It's not uniform.
Here's the endpoints for "vet" from one set of pretty-good
heuristics (this is representative at least).

-2208 time.parse 13472 15680 -14.081633%
-1514 runtime.pclntab 1002058 1003572 -0.150861%
-352 time.Time.AppendFormat 9952 10304 -3.416149%
-112 runtime.runGCProg 1984 2096 -5.343511%
-64 regexp/syntax.(*parser).factor 7264 7328 -0.873362%
-44 go.string.alldata 238630 238674 -0.018435%

48 math/big.(*Float).round 1376 1328 3.614458%
48 text/tabwriter.(*Writer).writeLines 1232 1184 4.054054%
48 math/big.shr 832 784 6.122449%
88 go.func.* 75174 75086 0.117199%
96 time.Date 1968 1872 5.128205%

Overall there appears to be an 0.1% decrease in text size.
No timings yet, and given the distribution of size reductions
it might make sense to wait on those.

addr2line  text (code) = -4392 bytes (-0.156273%)
api  text (code) = -5502 bytes (-0.147644%)
asm  text (code) = -5254 bytes (-0.187810%)
cgo  text (code) = -4886 bytes (-0.148846%)
compile  text (code) = -1577 bytes (-0.019346%) * changed
cover  text (code) = -5236 bytes (-0.137992%)
dist  text (code) = -5015 bytes (-0.167829%)
doc  text (code) = -5180 bytes (-0.182121%)
fix  text (code) = -5000 bytes (-0.215148%)
link  text (code) = -5092 bytes (-0.152712%)
newlink  text (code) = -5204 bytes (-0.196986%)
nm  text (code) = -4398 bytes (-0.156018%)
objdump  text (code) = -4582 bytes (-0.155046%)
pack  text (code) = -4503 bytes (-0.294287%)
pprof  text (code) = -6314 bytes (-0.085177%)
trace  text (code) = -5856 bytes (-0.097818%)
vet  text (code) = -5696 bytes (-0.117334%)
yacc  text (code) = -4971 bytes (-0.213817%)

This leaves me sorely tempted to look into a "real" scheduler
to try to do a better job, but I think it might make more
sense to look into getting loop information into the
register allocator instead.

Fixes #14577.

Change-Id: I5238b83284ce76dea1eb94084a8cd47277db6827
Reviewed-on: https://go-review.googlesource.com/20240
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-08 02:32:20 +00:00
Todd Neal
481fe59012 cmd/compile: fix load combining from a non-zero pointer offset
When the pointer offset is non-zero in the small loads, we need to add the offset
when converting to the larger load.

Fixes #14694

Change-Id: I5ba8bcb3b9ce26c7fae0c4951500b9ef0fed54cd
Reviewed-on: https://go-review.googlesource.com/20333
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-08 02:21:01 +00:00
Matthew Dempsky
e853131699 cmd/internal/obj: stop using as+ALAST as an opcode
Currently, package obj reserves a range of 1<<12 opcodes for each
target architecture.  E.g., mips64 has [6<<12, 7<<12).

However, because mips.ABEQ and mips.ALAST are both within that range,
the expression mips.ABEQ+mips.ALAST in turn falls (far) outside that
range around 12<<12, meaning it could theoretically collide with
another arch's opcodes.

More practically, it's a problem because 12<<12 overflows an int16,
which hampers fixing #14692.  (We could also just switch to uint16 to
avoid the overflow, but that still leaves the first problem.)

As a workaround, use Michael Hudson-Doyle's solution from
https://golang.org/cl/20182 and use negative values for these variant
instructions.

Passes toolstash -cmp for GOARCH=arm and GOARCH=mips64.

Updates #14692.

Change-Id: Iad797d10652360109fa4db19d4d1edb6529fc2c0
Reviewed-on: https://go-review.googlesource.com/20345
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-08 00:11:15 +00:00
Ian Lance Taylor
6c4e90a99e cmd/compile: change Node fields from *NodeList to Nodes
Compile time is about the same.  Getting rid of the nodeSeq interfaces,
particularly nodeSeqIterate, should produce some improvements.

Passes toolstash -cmp.

Update #14473.

Change-Id: I678abafdd9129c6cccb0ec980511932eaed496a0
Reviewed-on: https://go-review.googlesource.com/20343
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-07 23:32:49 +00:00
Josh Bleecher Snyder
a81283d5d9 cmd/compile: inline list storage stealing
It is only necessary in a few places, and this inlining will
simplify the transition away from NodeLists.

Passes toolstash -cmp.

Change-Id: I4ee9b4bf56ffa04df23e20a0a83b302d36b33510
Reviewed-on: https://go-review.googlesource.com/20290
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-07 23:05:05 +00:00
Konstantin Shaposhnikov
b8a2e25f55 cmd/vet: remove -test flag
-test flag is a testing only flag that enables all vet checks. It was needed
because there was no way to run all vet checks in a single command
invocation. However it is possible to do this now by combining -all and -shadow
flags.

Also a recently added -tests flag is similarly named, having both -test and
-tests can be confusing.

Change-Id: Ie5bacbe0bef5c8409eeace46f16141fa4e782c32
Reviewed-on: https://go-review.googlesource.com/20006
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-07 22:54:38 +00:00
Josh Bleecher Snyder
bcce5bdabd cmd/compile: remove NodeList != NodeList comparisons
Opt for replacements that avoid any assumptions
about the representations in use.

Passes toolstash -cmp.

Change-Id: Ia858a33abcae344e03fc1862fc9b0e192fde80c1
Reviewed-on: https://go-review.googlesource.com/20279
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-07 22:46:51 +00:00
Josh Bleecher Snyder
8969ab89b8 cmd/compile: add sizeof test for ssa types
Fix some test output while we're here.

Change-Id: I265cedc222e078eff120f268b92451e12b0400b2
Reviewed-on: https://go-review.googlesource.com/20294
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-07 22:41:22 +00:00