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

7705 Commits

Author SHA1 Message Date
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
Matthew Dempsky
b4c66b176e cmd/internal/obj/mips: add ALUI const
Instead of abusing ALAST.

Passes GOARCH=mips64 toolstash -cmp.

Updates #14692.

Change-Id: Ie85e99cf76508c1d0f5847a4157056b614fd5cc6
Reviewed-on: https://go-review.googlesource.com/20341
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-07 22:09:08 +00:00
Dave Cheney
1ec4f227f4 cmd/compile/internal/ppc64: clean up table initalisation
Move initproginfo and initvariants to ppc64.Main to avoid checking that
the tables are initialised every time.

Change-Id: I95ff4146a7abc18c42a20bfad716cc80ea8367e5
Reviewed-on: https://go-review.googlesource.com/20286
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-07 20:46:53 +00:00
Matthew Dempsky
7893442011 cmd/internal/obj: simplify Optab range handling code
Use slices as slices, instead of as clumsy pointers.

Passes toolstash/buildall.

Change-Id: If09eacc2d8805d7d5eaa5566f9b6305541074371
Reviewed-on: https://go-review.googlesource.com/20322
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-07 20:20:38 +00:00
Matthew Dempsky
c876a1b11e cmd/internal/obj: remove unused ar.go
Change-Id: I3eab54cd27c43bab38641fbead4adb6442481356
Reviewed-on: https://go-review.googlesource.com/20248
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-07 19:09:03 +00:00
Ian Lance Taylor
2a68c6c27c cmd/compile: more nodeSeq conversions
Found by temporarily flipping fields from *NodeList to Nodes and fixing
all the compilation errors.  This CL does not actually change any
fields.

Passes toolstash -cmp.

Update #14473.

Change-Id: Ib98fa37e8752f96358224c973a743618a6a0e736
Reviewed-on: https://go-review.googlesource.com/20320
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-07 18:31:54 +00:00
Matthew Dempsky
c3dfad5df9 cmd/compile: change Oconv to take an Op parameter
Eliminates type conversions in a bunch of Oconv(int(n.Op), ...) calls.

Notably, this identified a misuse of Oconv in amd64/gsubr.go to try to
print an assembly instruction op instead of a compiler node op.

Change-Id: I93b5aa49fe14a5eaf868b05426d3b8cd8ab52bc5
Reviewed-on: https://go-review.googlesource.com/20298
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-07 17:27:05 +00:00
Caio Marcelo de Oliveira Filho
c97ddf9c10 cmd/compile: don't emit conversion error in non-numeric increment/decrement
In increment and decrement statements, explicit check that the type
of operand is numeric earlier. This avoids a related but less clear
error about converting "1" to be emitted.

So, when compiling

	package main

	func main() {
		var x bool
		x++
	}

instead of emitting two errors

	prog.go:5: cannot convert 1 to type bool
	prog.go:5: invalid operation: x++ (non-numeric type bool)

just emits the second error.

Fixes #12525.

Change-Id: I6e81330703765bef0d6eb6c57098c1336af7c799
Reviewed-on: https://go-review.googlesource.com/20245
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-07 14:34:58 +00:00
Josh Bleecher Snyder
6ed10382f7 cmd/compile: soup up isSamePtr
This increases the number of matches in make.bash
from 853 to 984.

Change-Id: I12697697a50ecd86d49698200144a4c80dd3e5a4
Reviewed-on: https://go-review.googlesource.com/20274
Reviewed-by: Todd Neal <todd@tneal.org>
2016-03-07 01:30:07 +00:00
Josh Bleecher Snyder
da1802f1df cmd/compile: use OffPtr when possible
OffPtr allocates less and is easier to optimize.

With this change, the OffPtr collapsing opt
rule matches increase from 160k to 263k,
and the Load-after-Store opt rule matches
increase from 217 to 853.

Change-Id: I763426a3196900f22a367f7f6d8e8047b279653d
Reviewed-on: https://go-review.googlesource.com/20273
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-03-06 23:57:06 +00:00
Josh Bleecher Snyder
3294014ae1 cmd/compile: collapse OffPtr sequences
This triggers an astonishing 160k times
during make.bash. The second biggest
generic rewrite triggers 100k times.

However, this is really just moving
rewrites that were happening at the
architecture level to the generic level.

Change-Id: Ife06fe5234f31433328460cb2e0741c071deda41
Reviewed-on: https://go-review.googlesource.com/20235
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
2016-03-06 23:56:55 +00:00
Keith Randall
12e60452e9 cmd/compile: Combine smaller loads into a larger load
This only deals with the loads themselves.  The bounds checks
are a separate issue.  Also doesn't handle stores, those are
harder because we need to make sure intermediate memory states
aren't observed (which is hard to do with rewrite rules).

Use one byte shorter instructions for zero-extending loads.

Update #14267

Change-Id: I40af25ab5208488151ba7db32bf96081878fa7d9
Reviewed-on: https://go-review.googlesource.com/20218
Reviewed-by: Alexandru Moșoi <alexandru@mosoi.ro>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-06 22:52:22 +00:00
Michael Hudson-Doyle
9f4a359fc2 cmd/compile, cmd/link, cmd/newlink: remove support for weak symbols
They were only used for rtype.ptrToThis which David Crawshaw removed a couple
of weeks ago. Removes two traversals of Ctxt.Allsym from the linker but it
doesn't seem to make much difference to performance.

Change-Id: I5c305e0180186f643221d57822d301de4aa18827
Reviewed-on: https://go-review.googlesource.com/20287
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-06 22:28:07 +00:00
Josh Bleecher Snyder
6bd63ca346 cmd/compile: hide NodeList details in evconst
The new code is a bit less efficient,
but it does not involve altering the structure
of any linked lists.
This will make it easier to replace NodeLists
with Node slices.
We can return to a more efficient algorithm
when NodeLists have been replaced.

Passes toolstash -cmp.

Change-Id: I0bb5ee75e7c0646e6d37fe558c8f0548729d8aa1
Reviewed-on: https://go-review.googlesource.com/20277
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-06 16:12:33 +00:00
Muhammed Uluyol
1d40e2b14b Rewrite leftover references to plan9.bell-labs.com to 9p.io.
Change-Id: Iadb4aa016a7b361d01827787dbc59164d5d147f2
Reviewed-on: https://go-review.googlesource.com/20291
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-06 07:07:01 +00:00
Josh Bleecher Snyder
786a2ef380 cmd/compile: use a uint8-sized named type for Addr.Type
No immediate reduction in the size of Addr.

Passes toolstash -cmp.

Change-Id: I78ea4c6e181b6e571ce70a5f1ae8158844eb197d
Reviewed-on: https://go-review.googlesource.com/20276
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-03-06 04:52:28 +00:00
Dave Cheney
8f5fb95db6 cmd/compile/internal/gc: assert size of important types
Add tests to ensure that the size of important types don't change
unexpectedly.

Skip the test on nacl platforms because of their unusual padding
requirements.

Change-Id: Iddb127a99499e089a309b721f5073356c0da8b24
Reviewed-on: https://go-review.googlesource.com/20285
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-06 04:09:07 +00:00
Matthew Dempsky
4ab1793a78 cmd/compile: convert asmlist to []*Node
Updates #14473.

Change-Id: I88745c2a6119dea3b81b57299e70a2a7e4c584a8
Reviewed-on: https://go-review.googlesource.com/20272
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-05 04:08:12 +00:00
Ian Lance Taylor
72d90d8238 cmd/compile: change parser, racewalk, range to use nodeSeq
Passes toolstash -cmp.

Update #14473.

Change-Id: I0809c6b88643f04c7fc503f866ffe25e69f29910
Reviewed-on: https://go-review.googlesource.com/20260
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-05 02:33:00 +00:00
Ian Lance Taylor
65c4b55aba cmd/compile: convert subr, swt, typecheck to nodeSeq
Passes toolstash -cmp.

Update #14473.

Change-Id: I836197810405cde72cbb49fef7e163a517601f9c
Reviewed-on: https://go-review.googlesource.com/20242
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-05 02:26:11 +00:00
Matthew Dempsky
3da1a26fba cmd/compile: stop leaking 'any' type into user package
The new check corresponds to the (etype != TANY || Debug['A'] != 0)
that was lost in golang.org/cl/19936.

Fixes #14652.

Change-Id: Iec3788ff02529b3b0f0d4dd92ec9f3ef20aec849
Reviewed-on: https://go-review.googlesource.com/20271
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-05 02:13:04 +00:00
Matthew Dempsky
dafbcf6df7 cmd/compile: remove syslook's copy parameter
Instead make substArgTypes responsible for cloning the function
definition Node and the function signature Type tree.

Passes toolstash -cmp.

Change-Id: I9ec84c90a7ae83d164d3f578e84a91cf1490d8ab
Reviewed-on: https://go-review.googlesource.com/20239
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-05 02:10:55 +00:00
Ian Lance Taylor
eb6ee75add cmd/compile: convert select, sinit, ssa to nodeSeq
Passes toolstash -cmp.

Update #14473.

Change-Id: I1b50fe981e7a266d4b14f31d849eb91afccdfda3
Reviewed-on: https://go-review.googlesource.com/20270
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-05 01:14:30 +00:00
Brad Fitzpatrick
e3a9dca7cc cmd/compile: don't allocate convX2X or assertX2X func names before syslook
Change-Id: Ib632ee7ac893750bec4cfe223745bca5f31900ab
Reviewed-on: https://go-review.googlesource.com/20234
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-04 23:24:13 +00:00
Ian Lance Taylor
80e5b52566 cmd/compile: change order.go to use nodeSeq
Passes toolstash -cmp

Update #14473.

Change-Id: I15b35d40a5ec1f4355ee38bc6d131920933ac95c
Reviewed-on: https://go-review.googlesource.com/20237
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-04 23:15:43 +00:00
Matthew Dempsky
16e2e95dd9 cmd/compile/internal/ssa: chmod -x likelyadjust.go
Change-Id: I01ec7d08884a1e0fbce94ea77281c1ee4a2cfd56
Reviewed-on: https://go-review.googlesource.com/20238
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-04 22:56:02 +00:00
Ian Lance Taylor
55c65d4a97 cmd/compile: change export.go and fmt.go to use nodeSeq
Also fix some uses of nodeSeqIterator.Len, and fix the implementation in
nodesIterator.

Passes toolstash -cmp.

Update #14473.

Change-Id: I228871470234b7f1314ffd2aae8a4c0624c35f98
Reviewed-on: https://go-review.googlesource.com/20231
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-04 21:46:30 +00:00
Rhys Hiltner
3375974e0d cmd/link/internal/ld: don't panic on short buildid
When the linker was written in C, command line arguments were passed
around as null-terminated byte arrays which encouraged checking
characters one at a time. In Go, that can easily lead to
out-of-bounds panics.

Use the more idiomatic strings.HasPrefix when checking cmd/link's -B
argument to avoid the panic, and replace the manual hex decode with
use of the encoding/hex package.

Fixes #14636

Change-Id: I45f765bbd8cf796fee1a9a3496178bf76b117827
Reviewed-on: https://go-review.googlesource.com/20211
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-04 21:20:09 +00:00