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

6973 Commits

Author SHA1 Message Date
Rob Pike
49580db149 asm: give error message for unadorned symbol reference
On amd64, the program

TEXT    foo0(SB),7,$-8
    ADDQ R520, R1
    RET

used to trigger this error because R520 was being passed through to obj:

asm: doasm: notfound ft=23 tt=23 00000 (x.s:2)	ADDQ	0, 0 23 23

Now it gets this one, as it is indeed a parse error:

x.s:2: illegal addressing mode for symbol R520

This couldn't be fixed until #12632 had been fixed for arm64.

Fixes #12470.

Change-Id: I19830c4ae9337887b93f85d9a239e2b89dbb2219
Reviewed-on: https://go-review.googlesource.com/14691
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-09-18 18:08:52 +00:00
Dave Cheney
d5fe165ca0 cmd/compile: convert externdecl to []*Node
This one of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: Ifd73501e06e8ea5efd028b6d473b3e5d1b07a5ac
Reviewed-on: https://go-review.googlesource.com/14570
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-18 07:15:52 +00:00
Shenghou Ma
1fd78e1f60 cmd/go: provide full path as os.Args[0] when invoking tools
cmd/dist needs to re-exec or open itself to detect GOARM (CL 3973) and
detect host machine endianness (CL 14460).

Change-Id: If6438831ab0715ba8e236d64bb2c7c1bde1470aa
Reviewed-on: https://go-review.googlesource.com/14476
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-18 01:55:22 +00:00
Håvard Haugen
eddd7ff3cd cmd/compile/internal/gc: avoid stringsCompare for string literals
Passes go build -a -toolexec 'toolstash -cmp' std cmp.

Change-Id: I7567355d405c976c5d91a0cd4e9486ebeb348dbb
Reviewed-on: https://go-review.googlesource.com/14682
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-18 00:23:34 +00:00
Keith Randall
b32217a273 [dev.ssa] cmd/compile: consistent naming of temporary vars
ptrvar -> ptrVar, etc.

Change-Id: Id38bed0e145711dfe3bdc9541ab4741da6a570a2
Reviewed-on: https://go-review.googlesource.com/14725
Reviewed-by: Todd Neal <todd@tneal.org>
2015-09-17 23:50:48 +00:00
Håvard Haugen
f482a0f023 cmd/compile/internal/gc: add unit test for cmpstackvar
A followup CL will rewrite listsort to use the new cmpstackvarlt and
change cmpstackvar to avoid stringsCompare.

Change-Id: Idf0857a3bd67f9e2243ba82aa0bff510612927c3
Reviewed-on: https://go-review.googlesource.com/14611
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-17 23:46:38 +00:00
Keith Randall
269baa981e [dev.ssa] cmd/compile: implement ODOTTYPE and OAS2DOTTYPE
Taken over and completed from Josh's change
https://go-review.googlesource.com/#/c/14524/

Change-Id: If5d4f732843cc3e99bd5edda54458f0a8be73e91
Reviewed-on: https://go-review.googlesource.com/14690
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-17 23:32:55 +00:00
Keith Randall
5f10573e60 [dev.ssa] cmd/compile: Generate AUNDEF at the end of BlockExit blocks
Generate AUNDEF for every exit block, not just for certain
control values.

Change-Id: Ife500ac5159ee790bc1e70c0e9b0b1f854bc4c47
Reviewed-on: https://go-review.googlesource.com/14721
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-17 23:31:02 +00:00
Marvin Stenger
2dc63d1544 cmd/compile/internal/gc: cleaning; use range when appropriate
Made use of range statement in for loops.
Cleaning along the way:
-remove unnecessary variable declarations
-rename variables
-remove dead code

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: Ife8c2a98482a81ba91f5bbb65142d9f3dc46d6ee
Reviewed-on: https://go-review.googlesource.com/14379
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-17 23:23:01 +00:00
Aram Hăvărneanu
61a3ebed55 cmd/asm/internal/asm: add aliases for ARM64 condition codes
Add CS as an alias for HS, and CC as an alias for LO, otherwise

	CSINV	CS, R1, R2, R3

was interpreted as

	CSINV	0, R1, R2, R3

Also fix the corresponding faulty test.

Fixes #12632
Updates #12470

Change-Id: I974cfc7e5ced682d4754ba09b0b102cb08a46567
Reviewed-on: https://go-review.googlesource.com/14680
Reviewed-by: Rob Pike <r@golang.org>
2015-09-17 15:11:08 +00:00
Keith Randall
d24768e14d [dev.ssa] cmd/compile/internal/ssa: complete call ops
OCALLINTER, as well as ODEFER/OPROC with OCALLMETH/OCALLINTER.

Move all the call logic to its own routine, a lot of the
code is shared.

Change-Id: Ieac59596165e434cc6d1d7b5e46b78957e9c5ed3
Reviewed-on: https://go-review.googlesource.com/14464
Reviewed-by: Todd Neal <todd@tneal.org>
Reviewed-by: David Chase <drchase@google.com>
2015-09-17 05:02:15 +00:00
Keith Randall
1e4ebfdda5 [dev.ssa] cmd/compile/internal/ssa: fix iface and slice comparisons
A simpler way to do iface/slice comparisons.  Fixes some
cases of failed lowerings.

Change-Id: Ia252bc8648293a2d460f63c41f1591785543a1e9
Reviewed-on: https://go-review.googlesource.com/14493
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-16 23:21:15 +00:00
Keith Randall
9d22c101f5 [dev.ssa] cmd/compile/internal/gc: implement OAPPEND
Change-Id: I1fbce8c421c48074a964b4d9481c92fbc3524f80
Reviewed-on: https://go-review.googlesource.com/14525
Reviewed-by: Todd Neal <todd@tneal.org>
2015-09-16 22:47:16 +00:00
Michael Hudson-Doyle
9a6a8a0586 cmd/link: fix addition of -Wl,-z,relro
Not sure how I managed to do this, or get it past review.

Change-Id: I141b97ef8e09dcc9c910c45493a584a3dced2b28
Reviewed-on: https://go-review.googlesource.com/14634
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-16 21:16:13 +00:00
Ilya Tocar
2421c6e3df runtime: optimize duffzero for amd64.
Use MOVUPS to zero 16 bytes at a time.

results (haswell):

name             old time/op  new time/op  delta
ClearFat8-48     0.62ns ± 2%  0.62ns ± 1%     ~     (p=0.085 n=20+15)
ClearFat12-48    0.93ns ± 2%  0.93ns ± 2%     ~     (p=0.757 n=19+19)
ClearFat16-48    1.23ns ± 1%  1.23ns ± 1%     ~     (p=0.896 n=19+17)
ClearFat24-48    1.85ns ± 2%  1.84ns ± 0%   -0.51%  (p=0.023 n=20+15)
ClearFat32-48    2.45ns ± 0%  2.46ns ± 2%     ~     (p=0.053 n=17+18)
ClearFat40-48    1.99ns ± 0%  0.92ns ± 2%  -53.54%  (p=0.000 n=19+20)
ClearFat48-48    2.15ns ± 1%  0.92ns ± 2%  -56.93%  (p=0.000 n=19+20)
ClearFat56-48    2.46ns ± 1%  1.23ns ± 0%  -49.98%  (p=0.000 n=19+14)
ClearFat64-48    2.76ns ± 0%  2.14ns ± 1%  -22.21%  (p=0.000 n=17+17)
ClearFat128-48   5.21ns ± 0%  3.99ns ± 0%  -23.46%  (p=0.000 n=17+19)
ClearFat256-48   10.3ns ± 4%   7.7ns ± 0%  -25.37%  (p=0.000 n=20+17)
ClearFat512-48   20.2ns ± 4%  15.0ns ± 1%  -25.58%  (p=0.000 n=20+17)
ClearFat1024-48  39.7ns ± 2%  29.7ns ± 0%  -25.05%  (p=0.000 n=19+19)

Change-Id: I200401eec971b2dd2450c0651c51e378bd982405
Reviewed-on: https://go-review.googlesource.com/14408
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-16 16:07:44 +00:00
Tormod Erevik Lea
f0ea976ee4 cmd/go: indent first test binary flag description for go test -h
Fixes #12642

Change-Id: I0b94437055b7d444f5caf7ea310e85357c467bdf
Reviewed-on: https://go-review.googlesource.com/14612
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-16 14:21:29 +00:00
Håvard Haugen
7c61d24f97 cmd/compile/internal/gc: remove dead code
Found with https://github.com/remyoudompheng/go-misc/deadcode:

deadcode: walk.go:2228:1: applywritebarrier_bv is unused
deadcode: subr.go:355:1: gethunk is unused
deadcode: subr.go:1991:1: localexpr is unused
deadcode: dcl.go:82:1: poptodcl is unused
deadcode: swt.go:810:1: dumpcase is unused
deadcode: esc.go:251:1: satAdd8 is unused
deadcode: esc.go:387:1: outputsPerTag is unused
deadcode: obj.go:190:1: duint64 is unused
deadcode: obj.go:287:1: dstringptr is unused
deadcode: plive.go:95:1: xmalloc is unused
deadcode: plive.go:119:1: freeblock is unused

followed by

deadcode: go.go:633:1: hunk is unused
deadcode: go.go:635:1: nhunk is unused
deadcode: go.go:637:1: thunk is unused

after 'gethunk' was removed.

Some dead code in bv.go, mparith3.go, and dcl.go was left as is.

Passes go build -a -toolexec 'toolstash -cmp' std cmd.

Change-Id: Ia63519adedc8650d7095572ddd454fd923d3204d
Reviewed-on: https://go-review.googlesource.com/14610
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-16 00:25:04 +00:00
Håvard Haugen
c1ad904bdb cmd/compile/internal/gc: remove unnecessary stringsCompare
Remove several uses of stringsCompare.

Passes go build -a -toolexec 'toolstash -cmp' std cmd.

Change-Id: I3f2323df2ad8c03bad77e0a91d6e2e714803705b
Reviewed-on: https://go-review.googlesource.com/14556
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-16 00:08:58 +00:00
Keith Randall
6793cb755c [dev.ssa] cmd/compile/internal/ssa: turn off runtime ssa tests
Fixes build.  Not great, but it will let others make progress.

Change-Id: If9cf2bbb5016e40aa91cf1c8bb62982ae2aed5e4
Reviewed-on: https://go-review.googlesource.com/14621
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-15 22:41:17 +00:00
Ian Lance Taylor
64ad58768e cmd/go: don't run TestIssue7573 if cgo not supported
Fixes #12629.

Change-Id: Iee96dc4f806a38f3cd8e065b8d0d5f682bb7e29b
Reviewed-on: https://go-review.googlesource.com/14597
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-15 21:15:59 +00:00
Rob Pike
448f84a43a internal/obj: protect against nil addr.Sym
This has been the root cause of a number of crashes caused by
fuzz throwing modem noise at the assembler, which in turn attempts
to print diagnostics but instead just gets crashes.

Fixes #12627.

Change-Id: I72c2da79d8eb240e1a37aa6140454c552b05e0f1
Reviewed-on: https://go-review.googlesource.com/14595
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-15 20:56:39 +00:00
Robert Griesemer
dace9397b1 src/cmd/compile/internal/gc: fix type assertion in overflow check
Fixes #11600.

Change-Id: I8871d4e525168fed35115855483a237bbd6e5445
Reviewed-on: https://go-review.googlesource.com/14596
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-15 19:50:09 +00:00
Keith Randall
731bdc5115 runtime: fix aeshash of empty string
Aeshash currently computes the hash of the empty string as
hash("", seed) = seed.  This is bad because the hash of a compound
object with empty strings in it doesn't include information about
where those empty strings were.  For instance [2]string{"", "foo"}
and [2]string{"foo", ""} might get the same hash.

Fix this by returning a scrambled seed instead of the seed itself.
With this fix, we can remove the scrambling done by the generated
array hash routines.

The test also rejects hash("", seed) = 0, if we ever thought
it would be a good idea to try that.

The fallback hash is already OK in this regard.

Change-Id: Iaedbaa5be8d6a246dc7e9383d795000e0f562037
Reviewed-on: https://go-review.googlesource.com/14129
Reviewed-by: jcd . <jcd@golang.org>
2015-09-15 17:51:23 +00:00
Keith Randall
cde977c23c [dev.ssa] cmd/compile/internal/ssa: fix sign extension + load combo
Load-and-sign-extend opcodes were being generated in the
wrong block, leading to having more than one memory variable
live at once.  Fix the rules + add a test.

Change-Id: Iadf80e55ea901549c15c628ae295c2d0f1f64525
Reviewed-on: https://go-review.googlesource.com/14591
Reviewed-by: Todd Neal <todd@tneal.org>
Run-TryBot: Todd Neal <todd@tneal.org>
2015-09-15 17:48:25 +00:00
Rob Pike
173bf3487f asm: more early returns on errors
More protection against random input bytes.

Fixes #12614.

Change-Id: Ie9f817de1376a10bb80b22ecee3bae4f1d26cc6c
Reviewed-on: https://go-review.googlesource.com/14563
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-15 16:10:05 +00:00
Marvin Stenger
211cdf1e00 cmd/compile/internal/gc: cleaning lex.go
Cleaning along the way:
-convert variable types from int to bool
-remove unnecessary functions
-remove unnecessary type conversion
-remove unnecessary variable declarations
-transform struct{string,string} with lookup to map[string]string

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I259728fe4afd7f23b67f08fab856ce0abee57b21
Reviewed-on: https://go-review.googlesource.com/14435
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-15 15:55:56 +00:00
Dave Cheney
af261a5c85 cmd/go: skip external tests on linux/arm
CL 13166 skipped external tests on freebsd/arm with the rationale
that the cmd/go tests are not architecture dependent.

This CL does the same for linux/arm to help linux/arm users who are
building Go on platforms like the Raspberry Pi where ./all.bash
frequently times out due to a lack of resources.

Change-Id: Iae1a25b63b74200da3f1b5637da0fa5c2dceeb83
Reviewed-on: https://go-review.googlesource.com/13342
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-15 03:57:49 +00:00
Keith Randall
e3869a6b65 [dev.ssa] cmd/compile/internal/ssa: implement write barriers
For now, we only use typedmemmove.  This can be optimized
in future CLs.

Also add a feature to help with binary searching bad compilations.
Together with GOSSAPKG, GOSSAHASH specifies the last few binary digits
of the hash of function names that should be compiled.  So
GOSSAHASH=0110 means compile only those functions whose last 4 bits
of hash are 0110.  By adding digits to the front we can binary search
for the function whose SSA-generated code is causing a test to fail.

Change-Id: I5a8b6b70c6f034f59e5753965234cd42ea36d524
Reviewed-on: https://go-review.googlesource.com/14530
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-14 16:25:40 +00:00
Keith Randall
5505e8ccc7 [dev.ssa] cmd/compile/internal/ssa: implement slice opcodes
Implement OSLICE, OSLICEARR, OSLICESTR, OSLICE3, OSLICE3ARR.

reviewer: Ignore the code in OINDEX, that's from CL 14466.

Change-Id: I00cc8aecd4c6f40ea5517cd660bb0ce759d91171
Reviewed-on: https://go-review.googlesource.com/14538
Reviewed-by: Todd Neal <todd@tneal.org>
2015-09-14 15:57:03 +00:00
Keith Randall
c7081409bb [dev.ssa] cmd/compile/internal/ssa: fix string index
Change-Id: I984d3e0410ac38c4e42ae8e3670ea47e2140de76
Reviewed-on: https://go-review.googlesource.com/14466
Reviewed-by: Alexandru Moșoi <alexandru@mosoi.ro>
Reviewed-by: Todd Neal <todd@tneal.org>
2015-09-14 05:14:51 +00:00
Håvard Haugen
b9dbb030d5 cmd/compiler/internal/gc: make Type.Copyto a []*Node
Passes go build -a -toolexec 'toolstash -cmp' std cmd

Change-Id: Ief4613cfb341172a85e3a894f44fb2bb308c7b55
Reviewed-on: https://go-review.googlesource.com/14554
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-14 04:51:46 +00:00
Håvard Haugen
4c96e7b79b cmd/compile/internal/gc: clean up errcmp
Change-Id: Id07811a25bf4aa3ff834e7254a3dfb04522b2926
Reviewed-on: https://go-review.googlesource.com/14174
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-13 23:50:25 +00:00
Keith Randall
fda72e0375 [dev.ssa] cmd/compile/internal/ssa: don't treat vardef/varkill as reads
This makes deadstore elimination work reasonably again.

Change-Id: I3a8caced71f12dfb6c1d0c68b7a7d8d7a736ea23
Reviewed-on: https://go-review.googlesource.com/14536
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-12 22:10:58 +00:00
Keith Randall
46ffb026b4 [dev.ssa] cmd/compile/internal/ssa: OCHECKNIL is a statement, not an expression
Change-Id: I5a683f532a5a0b2bc862d80c871e8dc6721016fc
Reviewed-on: https://go-review.googlesource.com/14534
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-12 21:30:46 +00:00
Keith Randall
7e390724d2 [dev.ssa] cmd/compile/internal/ssa: implement OCOMPLEX
Change-Id: I1e5993e0e56481ce838c0e3979b1a3052e72dba5
Reviewed-on: https://go-review.googlesource.com/14535
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-12 21:30:32 +00:00
Keith Randall
a329e21ccd [dev.ssa] cmd/compile/internal/ssa: implement OSQRT
Change-Id: Iec61ca1bdc064c29ceca6d47f600d5643d0a64dd
Reviewed-on: https://go-review.googlesource.com/14533
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-12 20:57:10 +00:00
Dave Cheney
ea4e321d4d cmd/compile/internal/gc: avoid allocation in bnum
Although bnum was being called with a Bits value, a limitation
of the escape analyser (golang/go#12588) meant that taking the
address of the Bits.b array in the range statement caused the
formal parameter to escape to the heap.

Passing the a pointer to a Bits, as with all the other Bits helper
methods avoids the allocation.

Before:
BenchmarkBnum1-4        20000000                69.6 ns/op            32 B/op          1 allocs/op

After:
BenchmarkBnum1-4        100000000               10.1 ns/op             0 B/op          0 allocs/op

Change-Id: I673bd57ddc032ee67d09474156d795fb1ba72018
Reviewed-on: https://go-review.googlesource.com/14501
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-12 02:55:38 +00:00
Josh Bleecher Snyder
0726931c10 [dev.ssa] cmd/compile: refactor assign
Move the AST to SSA conversion to the caller.
This enables it to be used in contexts in which
the RHS is already an *ssa.Value.

Change-Id: Ibb87210fb9fda095a9b7c7f4ad1264a7cbd269bf
Reviewed-on: https://go-review.googlesource.com/14521
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-11 20:50:46 +00:00
Josh Bleecher Snyder
9552295833 [dev.ssa] cmd/compile: minor CSE cleanup
Remove unnecessary local var split.

Change-Id: I907ef682b5fd9b3a67771edd1fe90c558f8937ea
Reviewed-on: https://go-review.googlesource.com/14523
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-11 20:49:18 +00:00
Rob Pike
67ddae87b9 all: use one 'l' when cancelling everywhere except Solaris
Fixes #11626.

Change-Id: I1b70c0844473c3b57a53d7cca747ea5cdc68d232
Reviewed-on: https://go-review.googlesource.com/14526
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-11 18:31:51 +00:00
Josh Bleecher Snyder
cea441427e [dev.ssa] cmd/compile: add constBool helpers
Change-Id: I1f93ea65bbdc895cd4eff7545e1688a64d85aae5
Reviewed-on: https://go-review.googlesource.com/14520
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-11 17:51:57 +00:00
Didier Spezia
41713b4d2b cmd/doc: slice/map literals janitoring
Simplify slice/map literal expression.
Caught with gofmt -d -s

Change-Id: I7f38ef9fb528e2fd284bd0f190fbdf4a91956e55
Reviewed-on: https://go-review.googlesource.com/13834
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-11 14:04:46 +00:00
Didier Spezia
90f69259ec cmd/compile/internal/ppc64: map/slice literals janitoring
Simplify slice/map literal expressions.
Caught with gofmt -d -s, fixed with gofmt -w -s
Checked that the result can still be compiled with Go 1.4.

Change-Id: I201cd90fdfb8de2971c46ad7fce64111152b697e
Reviewed-on: https://go-review.googlesource.com/13832
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-11 12:59:18 +00:00
Keith Randall
f5c53e0deb [dev.ssa] cmd/compile/internal/ssa: simplify how exit blocks are used
Move to implicit (mostly) instead of explicit exit blocks.
RET and RETJMP have no outgoing edges - they implicitly exit.
CALL only has one outgoing edge, as its exception edge is
implicit as well.
Exit blocks are only used for unconditionally panicking code,
like the failed branches of nil and bounds checks.

There may now be more than one exit block.  No merges happen
at exit blocks.

The only downside is it is harder to find all the places code
can exit the method.  See the reverse dominator code for an
example.

Change-Id: I42e2fd809a4bf81301ab993e29ad9f203ce48eb0
Reviewed-on: https://go-review.googlesource.com/14462
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-11 06:02:39 +00:00
Rob Pike
5e89acb580 cmd/asm: fix some fuzz bugs
One (12466) was an actual logic error, backing up when there was
nothing there. The others were due to continuing to process an
instruction when it cannot work.

Methodically stop assembling an instruction when it's not going to
succeed.

Fixes #12466.
Fixes #12467.
Fixes #12468.

Change-Id: I88c568f2b9c1a8408043b2ac5a78f5e2ffd62abd
Reviewed-on: https://go-review.googlesource.com/14498
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-11 00:52:21 +00:00
Shenghou Ma
3f2baa3e60 cmd/dist: re-enable GOARM auto-detection
cmd/dist will re-exec itself to detect VFP support at run-time.

Fixes #9732, #12548.

Change-Id: I9ad0c5c7fa3e97bd79a32da372e1a962565bb3af
Reviewed-on: https://go-review.googlesource.com/3973
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-10 22:43:07 +00:00
Keith Randall
c244ce097c [dev.ssa] cmd/compile/internal/ssa: fix complex compares
It was using 64-bit float comparison ops for complex64.
It should use 32-bit float comparison.

Fixes build.

Change-Id: I6452b227257fecc09e04cd092ccf328d1fc9917f
Reviewed-on: https://go-review.googlesource.com/14497
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-10 22:13:14 +00:00
Didier Spezia
7d48573d46 cmd/internal/obj: map/slice literals janitoring
Simplify slice/map literal expressions.
Caught with gofmt -d -s, fixed with gofmt -w -s
Checked that the result can still be compiled with Go 1.4.

Change-Id: I0a6773d12200a7b43491f25f914335069a1fa5e8
Reviewed-on: https://go-review.googlesource.com/13833
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-10 21:47:41 +00:00
Keith Randall
db380bf44b [dev.ssa] cmd/compile/internal/ssa: add == and != for complex
Change-Id: Iefabce4eb0dbc313dd1863513b45307cc76c545a
Reviewed-on: https://go-review.googlesource.com/14468
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-10 20:05:12 +00:00
Keith Randall
2f51807157 [dev.ssa] cmd/compile/internal/ssa: fix real/imag ops
They were using the result type to look up the op, not the arg type.

Change-Id: I0641cba363fa6e7a66ad0860aa340106c10c2cea
Reviewed-on: https://go-review.googlesource.com/14469
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-10 19:59:49 +00:00
Michael Hudson-Doyle
b0344e9fd5 cmd/internal/obj, cmd/link, runtime: a saner model for TLS on arm
this leaves lots of cruft behind, will delete that soon

Change-Id: I12d6b6192f89bcdd89b2b0873774bd3458373b8a
Reviewed-on: https://go-review.googlesource.com/14196
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-10 19:49:13 +00:00
Yao Zhang
b456aac388 cmd/objdump: skip TestDisasm* for mips64{,le}
Disassembler for mips64 is not supported yet.

Change-Id: Ie923dd1e37fed47fc395b9d1cd9194e55020bee5
Reviewed-on: https://go-review.googlesource.com/14459
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-10 18:27:09 +00:00
Yao Zhang
1153737e86 cmd/go: skip part of TestNoteReading for mips64{,le}
Because external linking is not supported for now.

Change-Id: Icdd8f3cb3bfb781a990e529fce9129d91e98a9ec
Reviewed-on: https://go-review.googlesource.com/14457
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-10 18:26:30 +00:00
Russ Cox
d8384e9a8f cmd/vet: diagnose plain assignment in copylock detector
It went out of its way to look for implicit assignments
but never checked explicit assignments.

This detects the root bug for #12099.

Change-Id: I6a6e774cc38749ea8be7cfd58ba6421247b67000
Reviewed-on: https://go-review.googlesource.com/13646
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
2015-09-10 16:55:51 +00:00
Dave Cheney
81a4bbffbf cmd/go: use RawToken to parse remote package metadata
CL 14315 broke the tests for parsing loosely formed remote package
metadata. Switch the parsing to use RawToken to recover the previous
behaviour that Token provided.

It could be argued that the parser should be stricter, but as remote
metadata has been readable with the parser for several years, it is
safer to change the parser to continue to accept the samples provided
in the test cases.

Change-Id: I2a3ba1757d3cff53b1a1c4386276955bb46cf8cd
Reviewed-on: https://go-review.googlesource.com/14482
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-10 07:30:43 +00:00
Dave Cheney
bab01a0b4b cmd/compile: convert typecheckdefstack to []*Node
This one of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: Ie02d2cf35f1e8438c6e9dc1d5fba51e8adde1bc0
Reviewed-on: https://go-review.googlesource.com/14480
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-10 05:37:22 +00:00
Todd Neal
def7c65b70 [dev.ssa] cmd/compile/internal/ssa: implement OCFUNC
Change-Id: Ieb9cddf8876bf8cd5ee1705d9210d22c3959e8cc
Reviewed-on: https://go-review.googlesource.com/14329
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Todd Neal <todd@tneal.org>
2015-09-10 00:25:31 +00:00
Todd Neal
adba6c4fdf [dev.ssa] cmd/compile/internal/ssa: treat -0.0 literal as 0.0
This matches existing behavior, see issue #2196

Change-Id: Ifa9359b7c821115389f337a57de355c5ec23be8f
Reviewed-on: https://go-review.googlesource.com/14261
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-10 00:25:18 +00:00
David Chase
2a29576562 [dev.ssa] cmd/compile: fix N^2 dominator queries in CSE
Added tree numbering data structure.
Changed dominator query in CSE.
Removed skip-for-too-big patch in CSE.
Passes all.bash.

Change-Id: I98d7c61b6015c81f5edab553615db17bc7a58d68
Reviewed-on: https://go-review.googlesource.com/14326
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-09 23:31:42 +00:00
Keith Randall
00c638d243 runtime: on map update, don't overwrite key if we don't need to.
Keep track of which types of keys need an update and which don't.

Strings need an update because the new key might pin a smaller backing store.
Floats need an update because it might be +0/-0.
Interfaces need an update because they may contain strings or floats.

Fixes #11088

Change-Id: I9ade53c1dfb3c1a2870d68d07201bc8128e9f217
Reviewed-on: https://go-review.googlesource.com/10843
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-09 21:06:49 +00:00
Keith Randall
8a1f6217c5 [dev.ssa] cmd/compile/internal/ssa: implement ORETJMP
Change-Id: I352c7b9aab053959bc74c15861339e1dbe545ddc
Reviewed-on: https://go-review.googlesource.com/14404
Reviewed-by: David Chase <drchase@google.com>
2015-09-09 20:33:35 +00:00
Rob Pike
cf3134a017 cmd/doc: the builtin package should always show unexported symbols
Trivial fix: set unexported=true for builtin.
Godoc itself has a similar hack.

Fixes #12541

Change-Id: Ib701f867d117931eb6ec6de223941b52eb6cd4a7
Reviewed-on: https://go-review.googlesource.com/14441
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-09 19:46:08 +00:00
Keith Randall
fd8c71be86 [dev.ssa] cmd/compile/internal/ssa: eval defer args before setting argsize and func
Evaluating args can overwrite arg area, so we can't write argsize and func
until args are evaluated.

Fixes test/recover.go, test/recover1.go, and test/fixedbugs/issue4066.go

Change-Id: I862e4934ccdb8661431bcc3e1e93817ea834ea3f
Reviewed-on: https://go-review.googlesource.com/14405
Reviewed-by: David Chase <drchase@google.com>
2015-09-09 18:16:53 +00:00
Keith Randall
1ca7a64a0d cmd/compile/internal/gc: handle weird map literals in key dedup
We compute whether two keys k1 and k2 in a map literal are duplicates by
constructing the expression OEQ(k1, k2) and calling the constant
expression evaluator on that expression, then extracting the boolean
result.

Unfortunately, the constant expression evaluator can fail for various
reasons.  I'm not really sure why it is dying in the case of 12536, but
to be safe we should use the result only if we get a constant back (if
we get a constant back, it must be boolean).  This probably isn't a
permanent fix, but it should be good enough for 1.5.2.

A permanent fix would be to ensure that the constant expression
evaluator can always work for map literal keys, and if not the compiler
should generate an error saying that the key isn't a constant (or isn't
comparable to some specific other key).

This patch has the effect of allowing the map literal to compile when
constant eval of the OEQ fails.  If the keys are really equal (which the
map impl will notice at runtime), one will overwrite the other in the
resulting map.  Not great, but better than a compiler crash.

Fixes #12536

Change-Id: Ic151a5e3f131c2e8efa0c25c9218b431c55c1b30
Reviewed-on: https://go-review.googlesource.com/14400
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-09 17:50:52 +00:00
Marvin Stenger
05c35ac5d1 cmd/compile/internal/gc: convert fields of TempVar to bool
Convert two fields of struct TempVar in popt.go from uint8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I1aa14313e0241a4e9cadd63c6c681ed4e965a9a3
Reviewed-on: https://go-review.googlesource.com/14377
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-09 17:03:02 +00:00
Marvin Stenger
a20fbe8e18 cmd/compile/internal/gc: convert fields of Symlink to bool
Convert two fields of struct Symlink in subr.go from uint8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I913006f41605b17b0d82fe358ee773f6ecaa681c
Reviewed-on: https://go-review.googlesource.com/14378
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-09 16:07:51 +00:00
Keith Randall
a7cfc759f2 [dev.ssa] cmd/compile/internal/ssa: handle returns correctly
Make sure that return blocks take a store as their control.  Without
this, code was getting inserted between the return and exit blocks.

Use AEND to mark the end of code.  The live variable analysis gets
confused when routines end like:
    JMP earlier
    RET
because the RET is unreachable.  The RET was incorrectly added to the
last basic block, rendering the JMP invisible to the CFG builder.

Change-Id: I91b32c8b37075347243ff039b4e4385856fba7cd
Reviewed-on: https://go-review.googlesource.com/14398
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-09 04:19:14 +00:00
Keith Randall
1c2975c305 [dev.ssa] cmd/compile/internal/gc: avoid generating test binary file
Using the main package causes a binary to be generated.  That binary
clutters up git listings.

Use a non-main package instead, so the results of a successful
compilation are thrown away.

Change-Id: I3ac91fd69ad297a5c0fe035c22fdef290b7dfbc4
Reviewed-on: https://go-review.googlesource.com/14399
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-09 04:05:09 +00:00
Michael Hudson-Doyle
f7b66fffc5 cmd/dist, cmd/link: force external linking for shared libs on arm
Also run testcshared.

Fixes #12425

Change-Id: I5baea8d772d3462f945aab96260b4197dbb20c0a
Reviewed-on: https://go-review.googlesource.com/14143
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-09 01:42:22 +00:00
Dave Cheney
fd50db2a66 cmd/internal/obj: remove unused code
Following on from CL 14350, remove the remaining dead code from data.go.

Also leave a TODO to be addressed later (with a unit test) to reduce
the overhead of SymGrow.

Change-Id: Iebad775b1280b54b89e87a3a073ca8af19a8bfba
Reviewed-on: https://go-review.googlesource.com/14359
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-09 00:39:36 +00:00
Michael Hudson-Doyle
5cbca8d84b cmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared object
Currently Go produces shared libraries that cannot be shared between processes
because they have relocations against the text segment (not text section). This
fixes this by moving some data to sections with magic names recognized by the
static linker.

The change in genasmsym to add STYPELINK to the switch should fix things on
darwin/arm64.

Fixes #10914
Updates #9210

Change-Id: Iab4a6678dd04cec6114e683caac5cf31b1063309
Reviewed-on: https://go-review.googlesource.com/14306
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-08 23:34:16 +00:00
Keith Randall
0ec72b6b9d [dev.ssa] Merge remote-tracking branch 'origin/master' into mergebranch
Semi-regular merge of master into dev.ssa.

Change-Id: I48aa17700096a14f2a20ad07491ebfcd7529f6d5
2015-09-08 15:59:09 -07:00
Shenghou Ma
14f919578d cmd/compile/internal/mips64: copy cmd/compile/internal/ppc64
Just a mechanical copy, no code changes.
This is to reduce code difference when adding the mips64 port.

Change-Id: Id06e975f414a7b09f4827167b30813b228a3bfaf
Reviewed-on: https://go-review.googlesource.com/14324
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-08 22:40:16 +00:00
Shenghou Ma
5cc86c6f55 cmd/internal/obj/mips: copy cmd/internal/obj/ppc64
Just a mechanical copy with filename renames, no code changes.
This is to reduce code difference when adding the mips64 port.

Change-Id: Id06e975f414a7b09f4827167b30813b228a3bfae
Reviewed-on: https://go-review.googlesource.com/14323
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-08 22:39:56 +00:00
Michael Hudson-Doyle
69a143e388 cmd/internal/obj: remove dead code and small cleanups
Change-Id: I88fa0cc245a2141af04acced8716e08b1133abd1
Reviewed-on: https://go-review.googlesource.com/14350
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-08 21:04:43 +00:00
Alexandru Moșoi
c684d4d26c [dev.ssa] cmd/compile/internal/ssa: fix string slice types.
Change-Id: I28bc6373bb42d9abf4f179664dbaab8d514a6ab9
Reviewed-on: https://go-review.googlesource.com/14376
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-08 19:13:22 +00:00
Keith Randall
ca9e450bed [dev.ssa] cmd/compile/internal/ssa: fix defer in functions with no return
The after-defer test jumps to a deferreturn site.  Some functions
(those with infinite loops) have no deferreturn site.  Add one
so we have one to jump to.

Change-Id: I505e7f3f888f5e7d03ca49a3477b41cf1f78eb8a
Reviewed-on: https://go-review.googlesource.com/14349
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-08 17:57:10 +00:00
Marvin Stenger
9ac0fff70a cmd/compile/internal/gc: convert fields of Type to bool
Convert some fields of struct Type in go.go from uint8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I0a6c53f8ee686839b5234010ee2de7ae3940d499
Reviewed-on: https://go-review.googlesource.com/14370
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-08 17:15:08 +00:00
Marvin Stenger
e03c7896a7 cmd/compile/internal/gc: convert fields of Pkg to bool
Convert Pkg.Imported, Pkg.Exported, Pkg.Direct from uint8/int8/int8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I67a71f1186ff9737c03eca413f7d35d8a79ebc9b
Reviewed-on: https://go-review.googlesource.com/14371
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-08 15:53:06 +00:00
Todd Neal
8d081679d5 [dev.ssa] test: ensure that all current tests run
Some of the test files were missing, so add them.

Change-Id: Ifac248edf33e1e4ccd82355f596d74eab4ff01a2
Reviewed-on: https://go-review.googlesource.com/14328
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-08 09:27:31 +00:00
Håvard Haugen
259466452d cmd/compile/internal/gc: unexport and make Hasdefer a bool
Passes go build -a -toolexec 'toolstash -cmp' std cmd.

Change-Id: I804ee4252fa9be78cb277faf7f467e6c9cfdd4a6
Reviewed-on: https://go-review.googlesource.com/14319
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-08 05:45:29 +00:00
Marvin Stenger
704e05c6ec cmd/compile/internal/gc: remove unused field Type.Siggen
Remove unused field Type.Siggen in go.go.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: Ia61fe65a226c913fbf4a11a71d7453c56aa46c0e
Reviewed-on: https://go-review.googlesource.com/14372
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-08 05:28:37 +00:00
Håvard Haugen
391cc54da8 cmd/compile: make importlist a []*Node instead of *NodeList
Passes go build -a -toolexec 'toolstash -cmp' std.

Change-Id: Ica62765d3c1ef052afed34da1b3ac3f80646cc55
Reviewed-on: https://go-review.googlesource.com/14318
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-08 03:41:24 +00:00
Dave Cheney
8937780c8a cmd/compile/internal/gc: convert Type.Broke into a bool
Convert Type.Broke from a uint8 to a boolean

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I44e7548c71b00467e36576bdf62933c42555a21a
Reviewed-on: https://go-review.googlesource.com/14307
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Håvard Haugen <havard.haugen@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-08 03:17:10 +00:00
Dave Cheney
8712e1867b cmd/compile/internal/gc: convert Label.Used to bool
Convert Label.Used to a boolean. Also move the field to the
bottom of the struct to avoid padding.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: If09ee92f9d54dce807e7b862cf771005daed810d
Reviewed-on: https://go-review.googlesource.com/14308
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-07 21:35:06 +00:00
Keith Randall
3fa0a75a02 [dev.ssa] cmd/compile/internal/ssa: large object load/store vs. vardef
VarDef declarations are getting in the way of rewriting load/store
pairs into moves.  This change fixes that, albeit in a really hacky way.
Better options would be appreciated.

Increases coverage during make.bash from 67% to 71%.

Change-Id: I336e967687e2238c7d0d64e3b37132a731ad15c3
Reviewed-on: https://go-review.googlesource.com/14347
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-07 21:05:22 +00:00
Todd Neal
6bf383c7b3 [dev.ssa] cmd/compile: clean up nilcheck logic
Be more clear about the two conditions that we care about:
1) a block that performs a nil check (OpIsNonNil), which may be removed
2) a block that is the non-nil sucessor for an OpIsNonNil block

Now we only care about removing nilchecks for two scenarios:
- a type 1 block is dominated by a type 2 block for the same value
- a block is both type 1 and type 2 for the same value

Fixes math/big.

Change-Id: I50018a4014830461ddfe2a2daf588468e4a8f0b4
Reviewed-on: https://go-review.googlesource.com/14325
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-07 20:04:59 +00:00
Josh Bleecher Snyder
ad5ceafa2c [dev.ssa] cmd/compile: update SSA todos
Change-Id: I1271c015e602cd7ec92bf24f019dd8839b3180fc
Reviewed-on: https://go-review.googlesource.com/14346
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-07 18:06:37 +00:00
Marvin Stenger
932c1e3dd3 cmd/compile/internal: some janitoring
Nicer swaps, loops (removed tmp variables). Use of bool instead of int.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I541904c74b57297848decc51a8a4913a8eca4af3
Reviewed-on: https://go-review.googlesource.com/14316
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-07 17:42:48 +00:00
Josh Bleecher Snyder
fa5fe19137 [dev.ssa] cmd/compile: implement OIMAG and OREAL
Change-Id: I17c83f6552367d42d48c1ec62fbb494f010fd866
Reviewed-on: https://go-review.googlesource.com/14343
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-07 16:05:25 +00:00
Dave Cheney
60f0345667 cmd/dist: fix mkzversion to produce gofmt'd output
Fix mkzversion to produce correctly formatted runtime/zversion.go.

Change-Id: Ie6bcd361a2f2e390b7f6c4980fcae2c41bb7e52f
Reviewed-on: https://go-review.googlesource.com/14355
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-07 06:12:21 +00:00
Josh Bleecher Snyder
1792b36310 [dev.ssa] cmd/compile: implement OEFACE
Change-Id: I32953c4e1d82795bacba9eb94d65cd2e26bfeb87
Reviewed-on: https://go-review.googlesource.com/14339
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-07 01:54:38 +00:00
Josh Bleecher Snyder
e22ae879d3 [dev.ssa] cmd/compile: implement OCHECKNIL
Change-Id: Ifb6b2ad6078ad084b73c0e785e748e92139684e2
Reviewed-on: https://go-review.googlesource.com/14338
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-07 01:54:16 +00:00
Dave Cheney
dab0dac01a cmd/compile: convert typecheck_stack to []*Node
This one of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I4d041b343952f4a31f3150fd70669e08fcaa74f8
Reviewed-on: https://go-review.googlesource.com/14305
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-06 23:50:51 +00:00
Keith Randall
c3eb1a7e8a [dev.ssa] cmd/compile/internal/gc: handle local function declarations
They are already handled by the frontend, we just need to
skip them when we see them in ssa.

Change-Id: I309d91552f96a761f8d429a2cab3a47d200ca9e5
Reviewed-on: https://go-review.googlesource.com/14341
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-06 23:41:10 +00:00
Josh Bleecher Snyder
95bb89f6dd [dev.ssa] cmd/compile: fix build
CL 14337 made SSA support fixedbugs/issue9604b.go.
That test contains > 40k blocks.
This made the O(n^2) dom algorithm fail to terminate
in a reasonable length of time, breaking the build.

For the moment, cap the number of blocks
to fix the build.

This will be reverted when a more efficient
dom algorithm is put in place,
which will be soon.

Change-Id: Ia66c2629481d29d06655ec54d1deff076b0422c6
Reviewed-on: https://go-review.googlesource.com/14342
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-06 22:08:14 +00:00
Josh Bleecher Snyder
4178f20776 [dev.ssa] cmd/compile: implement OPLUS
Change-Id: Iaf282211a717e38b05e5d2661d400d465decad50
Reviewed-on: https://go-review.googlesource.com/14337
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-06 03:46:51 +00:00
Keith Randall
9569b957cb [dev.ssa] cmd/compile/internal/gc: implement go and defer
TODO: for now, just function calls.  Do method and interface calls.

Change-Id: Ib262dfa31cb753996cde899beaad4dc2e66705ac
Reviewed-on: https://go-review.googlesource.com/14035
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-06 02:42:24 +00:00
Josh Bleecher Snyder
6b9b618787 [dev.ssa] cmd/compile: run std tests with SSA codegen as part of all.bash
Todd Neal has made all the stdlib tests pass.
Now the trybots and build dashboard can
help us keep them passing.

All of this code will be unwound bit by bit
as SSA matures and then becomes the default.

Change-Id: I52ac7e72a87d329ccce974d6671c054374828d11
Reviewed-on: https://go-review.googlesource.com/14294
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-05 20:12:23 +00:00
Didier Spezia
63e2bed0ab cmd/asm: fix another infinite loop in register list parser
The code parsing register lists involves an inner loop on
each range defined by the lo,hi bounds. The condition on
this loop (for lo<=hi) is fragile, because the bounds
are unsigned 16 bits numbers.

In some corner cases, the calculated upper bound is 2^16-1
leading to an infinite loop.

Parsing operand `[):[o-FP` results in:
- an infinite loop for non ARM architectures
- the generation of almost 2^16 errors for the ARM architecture
  (which are then ignored)

This CL improves the code in 3 ways:
- bail out early when parsing non R prefixed registers
- make sure the register index is never negative
- make sure the number of iterations is limited by the
  maximum size of the range (as a defensive measure).

Fixes #12469

Change-Id: Ib1e7e36fb8ad5a3a52c50fc6219d3cfe2b39cc34
Reviewed-on: https://go-review.googlesource.com/14314
Reviewed-by: Rob Pike <r@golang.org>
2015-09-05 18:57:11 +00:00
Keith Randall
d2107fc987 [dev.ssa] cmd/runtime: generate gc bitmaps for SSA-compiled code
This change is all about leveraging the gc bitmap generation
that is already done by the current compiler.  We rearrange how
stack allocation is done so that we generate a variable declaration
for each spill.  We also reorganize how args/locals are recorded
during SSA.  Then we can use the existing allocauto/defframe to
allocate the stack frame and liveness to make the gc bitmaps.

With this change, stack copying works correctly and we no longer
need hacks in runtime/stack*.go to make tests work.  GC is close
to working, it just needs write barriers.

Change-Id: I990fb4e3fbe98850c6be35c3185a1c85d9e1a6ba
Reviewed-on: https://go-review.googlesource.com/13894
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-05 06:41:05 +00:00
Dave Cheney
22452ac592 cmd/compile: use []*Node instead of NodeList in bottomUpVisitor
This one of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I582ff8b077eb384b84721a1edb0c1efbc0c40059
Reviewed-on: https://go-review.googlesource.com/14304
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-05 04:34:55 +00:00
David Chase
d052bbd051 [dev.ssa] cmd/compile: cleanup fp conversions in ssa.go
Change to table-driven instead of branchy code; leads to
net reduction in lines, easier to understand what happens,
easier to modify code if we want option to exclude generation
of branchy cases.

Doesn't appear to scale for 8x8 case of integer types.

Change-Id: Ib40104b149d30bb329c5782f6cac45c75743e768
Reviewed-on: https://go-review.googlesource.com/14163
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-05 02:39:32 +00:00
Josh Bleecher Snyder
a3f72956f1 [dev.ssa] cmd/compile: add allocs to pass stats
Also, improve HTML formatting.

Change-Id: I07e2482a30862e2091707f260a2c43d6e9a85d97
Reviewed-on: https://go-review.googlesource.com/14333
Reviewed-by: Todd Neal <todd@tneal.org>
2015-09-05 02:25:42 +00:00
Josh Bleecher Snyder
1b5ffda01e [dev.ssa] cmd/compile: minor code cleanup
Change-Id: I9c84f5ca18745fb2358494c6944bf7ddd05cf8f0
Reviewed-on: https://go-review.googlesource.com/14332
Reviewed-by: Todd Neal <todd@tneal.org>
2015-09-05 02:25:25 +00:00
Dave Cheney
703bd83623 cmd/compile: use []*Node instead of NodeList in sinit
This is a first of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: Iad10b75e42b5b24e1694407841282fa3bab2dc9f
Reviewed-on: https://go-review.googlesource.com/14232
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-05 02:25:01 +00:00
Todd Neal
ec8a597cd2 [dev.ssa] cmd/compile: rewrite user nil check as OpIsNonNil
Rewite user nil checks as OpIsNonNil so our nil check elimination pass
can take advantage and remove redundant checks.

With make.bash this removes 10% more nilchecks (34110 vs 31088).

Change-Id: Ifb01d1b6d2d759f5e2a5aaa0470e1d5a2a680212
Reviewed-on: https://go-review.googlesource.com/14321
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-05 01:06:30 +00:00
Robert Griesemer
ace303297f cmd/compile/internal/gc: fix go.y (rename of Fatal -> Fatalf)
Also go generate to update generated files.

Change-Id: I049708db93455f0030ba5afc6f218fde6220958d
Reviewed-on: https://go-review.googlesource.com/14331
Reviewed-by: Damien Neil <dneil@google.com>
2015-09-05 00:01:33 +00:00
Keith Randall
617e892b87 [dev.ssa] cmd/compile: teach live variable analysis about LEAW
SSA uses this opcode, the old compiler doesn't.

Change-Id: Ic3dde6216496b4b89d570584d34cb0971fdf379d
Reviewed-on: https://go-review.googlesource.com/14330
Reviewed-by: Minux Ma <minux@golang.org>
2015-09-04 20:28:02 +00:00
Shawn Walker-Salas
4f74de1e4d cmd/go: fix Go buildid reading on Solaris
TestNoteReading fails on Solaris with linkmode=external due to some
assumptions made about how ELF .note sections are written by some
linkers.

On current versions of Solaris and older derivatives, SHF_ALLOC is
intentionally ignored for .note sections unless the .note section is
assigned to the text segment via a mapfile.  Also, if .note sections
are assigned to the text segment, no PT_NOTE program header will be
created thwarting Go's attempts at attempting to quickly find the
.note.

Furthermore, Go assumes that the relevant note segment will be placed
early in the file while the Solaris linker currently places the note
segment last in the file, additionally thwarting Go's optimisation
attempts that read only the first 16KB of the file to find the
buildid.

The fix is to detect when the note section is outside of the first
16KB of the file and then fallback to additionally reading that
section of the file.  This way, in future versions of Solaris when
this linking behaviour is changed, the fast path will always succeed
and we'll only be slower if it fails; likewise, any other linker that
does this will also just work.

Fixes #12178

Change-Id: I61c1dc3f744ae3ad63938386d2ace8a432c0efe1
Reviewed-on: https://go-review.googlesource.com/14210
Run-TryBot: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-09-04 20:01:09 +00:00
Dave Cheney
e49b2460a4 Revert "cmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared object"
This reverts commit 2c2cbb69c8.

Broke darwin/arm64

Change-Id: Ibd2dea475d6ce6a8b4b40e2da19a83fc0514025d
Reviewed-on: https://go-review.googlesource.com/14301
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-04 19:47:36 +00:00
Didier Spezia
3c37a61455 cmd/compile/internal: slice/map literals janitoring
Simplify slice/map literal expressions.
Caught with gofmt -d -s, fixed with gofmt -w -s
Checked that the result can still be compiled with Go 1.4.

Change-Id: I5c58801c20919618d2ad52b8e2380d53df2783f1
Reviewed-on: https://go-review.googlesource.com/13831
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-04 15:27:59 +00:00
Todd Neal
24dcede1c0 [dev.ssa] cmd/compile/ssa: add timing to compiler passes
Add timing/allocation information to each compiler pass for both the
console and html output.

Change-Id: I75833003b806a09b4fb1bbf63983258612cdb7b0
Reviewed-on: https://go-review.googlesource.com/14277
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-04 15:19:12 +00:00
Todd Neal
19447a66d6 [dev.ssa] cmd/compile: store floats in AuxInt
Store floats in AuxInt to reduce allocations.

Change-Id: I101e6322530b4a0b2ea3591593ad022c992e8df8
Reviewed-on: https://go-review.googlesource.com/14320
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-04 15:15:21 +00:00
Todd Neal
991036aef3 [dev.ssa] cmd/compile: store bools in AuxInt
Store bools in AuxInt to reduce allocations.

Change-Id: Ibd26db67fca5e1e2803f53d7ef094897968b704b
Reviewed-on: https://go-review.googlesource.com/14276
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-04 14:53:44 +00:00
Michael Hudson-Doyle
876b7cc227 cmd/compile, cmd/go: generate position independent code with -buildmode=c-shared on arm
All the code was there to do this, it just wasn't hooked up.

Fixes #10914

Change-Id: Ide8f9bbe50fecb5d11cd579915ee98d4c7efe403
Reviewed-on: https://go-review.googlesource.com/14142
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-04 07:08:09 +00:00
Shenghou Ma
821e124c24 cmd/link/internal/ld: align PE .text section to 32-byte when external linking
Some symbols, for example, masks requires 16-byte alignment, and
they are placed in the text section. Before this change, the text
section is only aligned to 4-byte, and it's making masks unaligned.

Fixes #12415.

Change-Id: I7767778d1b4f7d3e74c2719a02848350782a4160
Reviewed-on: https://go-review.googlesource.com/14166
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-04 05:27:02 +00:00
Michael Hudson-Doyle
2c2cbb69c8 cmd/internal/ld: put read-only relocated data into .data.rel.ro when making a shared object
Currently Go produces shared libraries that cannot be shared between processes
because they have relocations against the text segment (not text section). This
fixes this by moving some data to sections with magic names recognized by the
static linker.

Fixes #10914
Updates #9210

Change-Id: I7178daadc0ae87953d5a084aa3d580f4e3b46d47
Reviewed-on: https://go-review.googlesource.com/10300
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-04 05:25:10 +00:00
Michael Hudson-Doyle
eaea5ade2b cmd/asm: fix handling of nested #if[n]defs
The lexer needs to process all #if[n]defs, even those found when processing is
disabled by a preceding failed conditional, or the first #endif in something
like:

    #ifdef <undefined>
    #ifdef whatever
    #endif
    #endif

terminates the first #ifdef and the second causes an error. And then the
processing of the inner #ifdefs needs to ignore their argument when they are
disabled by an outer failed condition.

Change-Id: Iba259498f1e16042f5b7580b9c000bb0599733d0
Reviewed-on: https://go-review.googlesource.com/14253
Reviewed-by: Rob Pike <r@golang.org>
2015-09-04 05:23:28 +00:00
Andrew Gerrand
b8efc006f2 all: remove executable bit from several files
Change-Id: Iab669b2a9dd0510c0e54f9ec1cbe2b83b991bceb
Reviewed-on: https://go-review.googlesource.com/14283
Reviewed-by: Minux Ma <minux@golang.org>
2015-09-04 02:59:49 +00:00
Michael Hudson-Doyle
06da8fd84a cmd/link: only embed runtime.goarm in the module that contains the runtime package
And do it properly so freebsd and nacl still work.

Change-Id: I6f9f30e93ceae6dee59215ed608c6a158bdbdbb0
Reviewed-on: https://go-review.googlesource.com/14280
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-04 02:20:47 +00:00
Shenghou Ma
dac87e9ed3 cmd/compile/internal/gc: allow //go:systemstack only in runtime
Fixes #12454.

Change-Id: I6406b0119bc4d6c3d1e6f1896b588b7d101448a3
Reviewed-on: https://go-review.googlesource.com/14274
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-04 02:16:50 +00:00
Keith Randall
d9f2cafb50 [dev.ssa] cmd/compile/internal/ssa: fix fallthrough return
Fallthrough return needs to be a return block before jumping
to the exit block.

Change-Id: I994de2064da5c326c9cade2c33cbb15bdbce5acb
Reviewed-on: https://go-review.googlesource.com/14256
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-03 22:04:07 +00:00
Michael Hudson-Doyle
c788a8e05d Revert "cmd/link: only embed runtime.goarm in the module that contains the runtime package"
This reverts commit bf99d8f843.

Change-Id: Id4374ed35802cfbfe11e015ccd9526d3497dc8cc
Reviewed-on: https://go-review.googlesource.com/14239
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-03 21:20:53 +00:00
Rob Pike
36af087aef cmd/asm: handle CMPF and CMPD on ARM
These instructions are special cases that were missed in the translation.
The second argument must go into the Reg field not the To field.

Fixes #12458

For Go 1.5.1

Change-Id: Iad57c60c7e38e3bcfafda483ed5037ce670e8816
Reviewed-on: https://go-review.googlesource.com/14183
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-09-03 19:40:11 +00:00
Keith Randall
10f38f51ef [dev.ssa] cmd/compile/internal/ssa: distinguish exit and return blocks
It is confusing to have exceptional edges jump back into
real code.  Distinguish return blocks, which execute acutal
code, and the exit block, which is a merge point for the regular
and exceptional return flow.

Prevent critical edge insertion from adding blocks on edges
into the exit block.  These added blocks serve no purpose and
add a bunch of dead jumps to the assembly output.  Furthermore,
live variable analysis is confused by these jumps.

Change-Id: Ifd69e6c00e90338ed147e7cb351b5100dc0364df
Reviewed-on: https://go-review.googlesource.com/14254
Reviewed-by: David Chase <drchase@google.com>
2015-09-03 17:42:38 +00:00
Michael Hudson-Doyle
bf99d8f843 cmd/link: only embed runtime.goarm in the module that contains the runtime package
Change-Id: Ia18984343ca4ced3671d967ff9a5b0e32874430c
Reviewed-on: https://go-review.googlesource.com/14220
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-03 16:22:21 +00:00
Keith Randall
73024083b0 [dev.ssa] cmd/compile: add pxor to list of instructions analyzeable by liveness analysis
Change-Id: I6ea0a3482d8813b8555b16fe6c377cad33554619
Reviewed-on: https://go-review.googlesource.com/14247
Reviewed-by: David Chase <drchase@google.com>
2015-09-03 14:15:21 +00:00
Michael Hudson-Doyle
9e6ba37b86 cmd/internal/obj: some platform independent bits of proper toolchain support for thread local storage
Also simplifies some silliness around making the .tbss section wrt internal
vs external linking. The "make TLS make sense" project has quite a few more
steps to go.

Issue #11270

Change-Id: Ia4fa135cb22d916728ead95bdbc0ebc1ae06f05c
Reviewed-on: https://go-review.googlesource.com/13990
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-03 14:06:07 +00:00
Todd Neal
ce4317266c [dev.ssa] cmd/compile: cse should treat -0.0 and 0.0 as different
cse was incorrectly classifying -0.0 and 0.0 as equivalent. This lead
to invalid code as ssa uses PXOR -0.0, reg to negate a floating point.

Fixes math.

Change-Id: Id7eb10c71749eaed897f29b02c33891cf5820acf
Reviewed-on: https://go-review.googlesource.com/14205
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-03 03:05:02 +00:00
Todd Neal
19285efaed [dev.ssa] cmd/compile: fix complex128
complex128 was being treated as a complex64

Fixes math/cmplx.

Change-Id: I2996915b4cb6b94198d41cf08a30bd8531b9fec5
Reviewed-on: https://go-review.googlesource.com/14206
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-03 03:04:36 +00:00
Michael Hudson-Doyle
7bf959c67a cmd/internal/obj: remove Link.Tlsoffset
Nothing uses it any more.

Change-Id: I42ee7222b06b1a79b8b44894f3071752f9166d7a
Reviewed-on: https://go-review.googlesource.com/14193
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-03 02:16:22 +00:00
Didier Spezia
df37c4b987 cmd/asm: fix several panics with erroneous input
The parser tries to read as much information as possible,
issuing some errors when needed. Errors generally do not
stop the parsing.

With some pathological input, it may result in various
panics when the error message itself is built, or when the
next operand is parsed. It happens while parsing
pseudo-instructions.

For instance, the following lines all generate a panic:

	TEXT
	TEXT%
	TEXT 1,1
	TEXT $"toto", 0, $1
	FUNCDATA
	DATA 0
	DATA(0),1
	FUNCDATA(SB
	GLOBL 0, 1
	PCDATA 1

Added corresponding tests.

Introduced a writer in the parser to capture error messages
for testing purpose. It defaults to os.Stderr.

Added an explicit check when symbol names cannot be displayed.

Interrupted parsing early when the number of operands is wrong for
pseudo-instructions.

Note that the last point is a change of behavior, because some
operands will not get parsed anymore in case of early error.

IMO, it is acceptable, because only the first error of the line
is considered anyway. If it is not acceptable, it can probably
be improved at the price of a more verbose CL.

Fixes #11765
Fixes #11760
Fixes #11759

Change-Id: I9602a848132e358a1bccad794d7555e0823970dd
Reviewed-on: https://go-review.googlesource.com/13925
Reviewed-by: Rob Pike <r@golang.org>
2015-09-02 20:24:40 +00:00
Håvard Haugen
dc3540d982 compile/internal/gc: make typecheckok a bool
Change-Id: Ib3960321a4c8164f6b221bfd15977d2f34dbc65b
Reviewed-on: https://go-review.googlesource.com/14175
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-02 19:08:19 +00:00
Rob Pike
45537d893d cmd/doc: document that json.Decode documents encoding/json.Decoder.Decode
Refine the documentation in cmd/doc and go help doc.

Fixes #12377.

Change-Id: I670c0a5cf18c9c9d5bb9bb222d8a3dd3722a3934
Reviewed-on: https://go-review.googlesource.com/14121
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-02 17:58:17 +00:00
Rob Pike
43a7a9cf43 cmd/vet: diagnose using Printf on a function value
Printing a function value is nearly useless outside of debugging, but
can occur by mistake when one forgets to call it. Diagnose this.

I did this myself just the other day and it arose in cl/14031.
Easy to fix and seems worthwhile.

Fixes #12295.

Change-Id: Ice125a84559f0394f7fa7272b5d31ae602b07f83
Reviewed-on: https://go-review.googlesource.com/14122
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-02 17:58:04 +00:00
Todd Neal
5cb352edeb [dev.ssa] cmd/compile: fix liblink rewrite of -0.0
liblink was rewriting xor by a negative zero (used by SSA
for negation) as XORPS reg,reg.

Fixes strconv.

Change-Id: I627a0a7366618e6b07ba8f0ad0db0e102340c5e3
Reviewed-on: https://go-review.googlesource.com/14200
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-02 10:41:55 +00:00
Todd Neal
634b50c6e1 [dev.ssa] cmd/compile: truncate when converting floats to ints
Modified to use the truncating conversion.

Fixes reflect.

Change-Id: I47bf3200abc2d2c662939a2a2351e2ff84168f4a
Reviewed-on: https://go-review.googlesource.com/14167
Reviewed-by: David Chase <drchase@google.com>
2015-09-02 01:11:29 +00:00
Todd Neal
4219aba5db [dev.ssa] cmd/compile: make REPSTOSQ clobber flags
It does a XOR internally and clobbers flags.

Change-Id: Id6ef9219c4e6c3a2b5fc79c8d52bcfa30c148617
Reviewed-on: https://go-review.googlesource.com/14165
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-02 00:35:25 +00:00
Keith Randall
2511cf03b9 [dev.ssa] cmd/compile/internal/ssa: make SETEQF and SETNEF clobber flags
They do an AND or an OR internally, so they clobber flags.

Fixes #12441

Change-Id: I6c843bd268496bc13fc7e3c561d76619e961e8ad
Reviewed-on: https://go-review.googlesource.com/14180
Reviewed-by: Todd Neal <todd@tneal.org>
2015-09-01 22:21:45 +00:00
Todd Neal
6411533ebf [dev.ssa] cmd/compile: fix rare issue caused by liblink rewrite
liblink rewrites MOV $0, reg into XOR reg, reg. Make MOVxconst clobber
flags so we don't generate invalid code in the unlikely case that it
matters.  In testing, this change leads to no additional regenerated
flags due to a scheduling fix in CL14042.

Change-Id: I7bc1cfee94ef83beb2f97c31ec6a97e19872fb89
Reviewed-on: https://go-review.googlesource.com/14043
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-01 22:19:49 +00:00
Håvard Haugen
dd42eff8fe cmd/compile/internal/gc: use slice instead of NodeList for Label.Use
Change-Id: I021c95df24edbff24ff2922769ef2b2acd47016a
Reviewed-on: https://go-review.googlesource.com/14081
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-01 22:13:16 +00:00
Håvard Haugen
e8da46f6db cmd/compile/internal/gc: remove dead code found by vet
See report in commit 3c9fa388df.

Change-Id: I74a5995a1c1ca62b8d01857e89b084502e7da928
Reviewed-on: https://go-review.googlesource.com/14170
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-01 21:21:15 +00:00
David Chase
3a9d0ac3c8 [dev.ssa] cmd/compile: add complex arithmetic
Still to do:
details, more testing corner cases. (e.g. negative zero)
Includes small cleanups for previous CL.

Note: complex division is currently done in the runtime,
so the division code here is apparently not yet necessary
and also not tested.  Seems likely better to open code
division and expose the widening/narrowing to optimization.

Complex64 multiplication and division is done in wide
format to avoid cancellation errors; for division, this
also happens to be compatible with pre-SSA practice
(which uses a single complex128 division function).

It would-be-nice to widen for complex128 multiplication
intermediates as well, but that is trickier to implement
without a handy wider-precision format.

Change-Id: I595a4300f68868fb7641852a54674c6b2b78855e
Reviewed-on: https://go-review.googlesource.com/14028
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-01 17:47:58 +00:00
Keith Randall
65677cabfd [dev.ssa] cmd/compile/internal/ssa: allow ops to have a default type
Specifying types in rewrites for all subexpressions gets verbose
quickly.  Allow opcodes to specify a default type which is used when
none is supplied explicitly.

Provide default types for a few easy opcodes.  There are probably more
we can do, but this is a good start.

Change-Id: Iedc2a1a423cc3e2d4472640433982f9aa76a9f18
Reviewed-on: https://go-review.googlesource.com/14128
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-01 16:40:28 +00:00
Michael Hudson-Doyle
e92d0d82e0 cmd/link: remove some dead code
Change-Id: I125a12a2cb7e792f357e4d841f55c0bed2971dce
Reviewed-on: https://go-review.googlesource.com/14140
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-01 16:28:49 +00:00
Todd Neal
a0022d9b8c [dev.ssa] cmd/compile: add more specific regalloc logging
Change-Id: Ib0ea4b9c245f3d551e0f703826caa6b444b56a2d
Reviewed-on: https://go-review.googlesource.com/14136
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-01 02:37:42 +00:00
Todd Neal
21e6a055c1 [dev.ssa] cmd/compile: schedule values dependent on the control later
To reduce the number of spills, give any non-phi values whose argument
is the control the same priority as the control.

With mask.bash, this reduces regenerated flags from 603 to 240.

Change-Id: I26883d69e80357c56b343428fb528102b3f26e7a
Reviewed-on: https://go-review.googlesource.com/14042
Reviewed-by: Keith Randall <khr@golang.org>
2015-08-31 22:17:23 +00:00
Dave Cheney
8d478e845c cmd/internal/obj/arm: remove CASE and BCASE
Update #10994

CASE and BCASE were used by 5c in switch statements, cmd/compile
does not use them.

Change-Id: I7a578c461b52b94690e35460926849b28971b770
Reviewed-on: https://go-review.googlesource.com/14009
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-08-31 21:03:57 +00:00
Dave Cheney
3578bdf3c3 internal/obj/arm64: remove CASE and BCASE
Fixes #10994

CASE and BCASE were used by 7c in switch statements, cmd/compile
does not use them, cmd/assemble couldn't assemble them, and the arm64
peephole optimiser didn't know about them.

Change-Id: Id04835fcb37e207f76d211ce54a4db9c057d6112
Reviewed-on: https://go-review.googlesource.com/14100
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Run-TryBot: Aram Hăvărneanu <aram@mgk.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-08-31 13:22:55 +00:00