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

6831 Commits

Author SHA1 Message Date
Russ Cox
669f5be2ac cmd/go: prefer <meta> tags on launchpad.net to the hard-coded logic
Fixes #11436.

Change-Id: I5c4455e9b13b478838f23ac31e6343672dfc60af
Reviewed-on: https://go-review.googlesource.com/12143
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-28 03:30:44 +00:00
David Crawshaw
fd9b9c31fb cmd/go: import runtime/cgo into darwin/arm64 tests
Until cl/12721 and cl/12574, all standard library tests included
runtime/cgo on darwin/arm64 by virtue of package os including it. Now
that is no longer true, runtime/cgo needs to be added by the go tool
just as it is for darwin/arm. (This installs the Mach exception
handler used to properly handle EXC_BAD_ACCESS.)

Fixes #11901

Change-Id: I991525f46eca5b0750b93595579ebc0ff10e47eb
Reviewed-on: https://go-review.googlesource.com/12723
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-28 03:19:25 +00:00
Alexandru Moșoi
c15b0e83d2 [dev.ssa] cmd/compile/internal/ssa/gen: implement all bit sizes for Eq and Neq
Change-Id: I2c5c75153493b5dd3f1a743e5edf04403e83b31b
Reviewed-on: https://go-review.googlesource.com/12474
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-07-27 22:39:49 +00:00
Josh Bleecher Snyder
1807d54d85 [dev.ssa] cmd/compile: detect unbalanced rules
Rules may span multiple lines,
but if we're still unbalanced at the
end of the file, something is wrong.

I write unbalanced rules depressingly often.

Change-Id: Ibd04aa06539e2a0ffef73bb665febf3542fd11f1
Reviewed-on: https://go-review.googlesource.com/12710
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-27 22:32:28 +00:00
Josh Bleecher Snyder
15dcdfba0f [dev.ssa] cmd/compile: implement OCALLMETH
This mimics the way the old backend
compiles OCALLMETH.

Change-Id: I635c8e7a48c8b5619bd837f78fa6eeba83a57b2f
Reviewed-on: https://go-review.googlesource.com/12549
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-27 22:24:02 +00:00
Todd Neal
c9a38ce758 [dev.ssa] cmd/compile: don't flush a value derived from the current value
If flushing a value from a register that might be used by the current
old-schedule value, save it to the home location.

This resolves the error that was changed from panic to unimplemented in
CL 12655.

Change-Id: If864be34abcd6e11d6117a061376e048a3e29b3a
Reviewed-on: https://go-review.googlesource.com/12682
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-07-27 20:14:14 +00:00
Ian Lance Taylor
129cfa2745 cmd/dist: run misc/cgo/testsovar on darwin and netbsd
CL https://golang.org/cl/12470 has reportedly fixed the problems that
the misc/cgo/testsovar test encountered on darwin and netbsd.  Let's
actually run the test.

Update #10360.
Update #11654.

Change-Id: I4cdd27a8ec8713620e0135780a03f63cfcc538d0
Reviewed-on: https://go-review.googlesource.com/12702
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-27 18:10:26 +00:00
Russ Cox
ea085414ef cmd/go: do not panic on template I/O error
Fixes #11839.

Change-Id: Ie092a3a512a2d35967364b41081a066ab3a6aab4
Reviewed-on: https://go-review.googlesource.com/12571
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-27 17:44:02 +00:00
Russ Cox
00cf88e2c6 cmd/go: use hg repo for code.google.com shutdown check
svn dies due to not being able to validate the googlecode.com certificate.
hg does not even attempt to validate it.

Fixes #11806.

Change-Id: I84ced5aa84bb1e4a4cdb2254f2d08a64a1ef23f6
Reviewed-on: https://go-review.googlesource.com/12558
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-27 17:32:48 +00:00
Russ Cox
ca2a66431e cmd/go: fix custom import path wildcards (go get rsc.io/pdf/...)
Fixes TestGoGetWorksWithVanityWildcards,
but that test uses the network and is not run
on the builders.

For #11806.

Change-Id: I35c6677deaf84e2fa9bdb98b62d80d388b5248ae
Reviewed-on: https://go-review.googlesource.com/12557
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-27 17:32:27 +00:00
Josh Bleecher Snyder
b61f8c8df3 [dev.ssa] cmd/compile: fix registers for in-place instructions
Some of these were right; others weren't.

Fixes 'GOGC=off GOSSAPKG=mime go test -a mime'.

The right long term fix is probably to teach the
register allocator about in-place instructions.
In the meantime, all the tests that we can run
now pass.

Change-Id: I8e37b00a5f5e14f241b427d45d5f5cc1064883a2
Reviewed-on: https://go-review.googlesource.com/12664
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-27 17:24:54 +00:00
Josh Bleecher Snyder
0bb2a50a55 [dev.ssa] cmd/compile: respect stack slot width when storing/loading registers
Prior to this, we were smashing our own stack,
which caused the crypto/sha256 tests to fail.

Change-Id: I7dd94cf466d175b3be0cd65f9c4fe8b1223081fe
Reviewed-on: https://go-review.googlesource.com/12660
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-27 17:22:29 +00:00
Todd Neal
db5232620a [dev.ssa] cmd/compile: only fold 32 bit integers for add/multiply
Fix an issue where doasm fails if trying to multiply by a larger
than 32 bit const (doasm: notfound ft=9 tt=14 00008 IMULQ
$34359738369, CX 9 14).  Fix truncation of 64 to 32 bit integer
when generating LEA causing incorrect values to be computed.

Change-Id: I1e65b63cc32ac673a9bb5a297b578b44c2f1ac8f
Reviewed-on: https://go-review.googlesource.com/12678
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-27 02:08:59 +00:00
Rob Pike
3dcfb72fa3 cmd/go: mention go tool compile etc. in the help text for build
Not everyone is aware that go build is a wrapper for other
tools. Mention this in the text for go help build so people using
other build systems won't just wrap go build, which is usually a
mistake (it doesn't do incremental builds by default, for instance).

Update #11854.

Change-Id: I759f91f23ccd3671204c39feea12a3bfaf9f0114
Reviewed-on: https://go-review.googlesource.com/12625
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-27 01:09:36 +00:00
Ian Lance Taylor
dc4dd57594 cmd/cgo: document how CGO_ENABLED works today
Fixes #9530.

Change-Id: Iadfc027c7164e3ba35adb5c67deb42b51d3498ca
Reviewed-on: https://go-review.googlesource.com/12603
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-07-26 21:04:47 +00:00
Todd Neal
52d76f7a6a [dev.ssa] cmd/compile: rewrite if not
Rewrite if !cond by swapping the branches and removing the not.

Change-Id: If3af1bac02bfc566faba872a8c7f7e5ce38e9f58
Reviewed-on: https://go-review.googlesource.com/12610
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-07-26 02:10:45 +00:00
Josh Bleecher Snyder
7e74e43366 [dev.ssa] cmd/compile: minor cleanup
Cull dead code. Add TODOs.

Change-Id: I81d24371de47f5a27d3a3a0ec0ef5baaf6814c06
Reviewed-on: https://go-review.googlesource.com/12659
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-24 22:28:43 +00:00
Matthew Dempsky
c09d284953 cmd/compile: add missing quotation mark
Change-Id: I102901e3df76830ccd5ab74d757203d103eef9e8
Reviewed-on: https://go-review.googlesource.com/12657
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-24 22:12:14 +00:00
Josh Bleecher Snyder
71b570774d [dev.ssa] cmd/compile: finish implementing comparisons
Change-Id: I4e496c7c7239111133631f76ca25e14be64800c6
Reviewed-on: https://go-review.googlesource.com/12656
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-24 20:44:11 +00:00
Josh Bleecher Snyder
5c5f2a731c [dev.ssa] cmd/compile: convert localOffset panic to unimplemented
This prevents panics while attempting to generate code
for the runtime package. Now:

<unknown line number>: internal compiler error: localOffset of non-LocalSlot value: v10 = ADDQconst <*m> [256] v22

Change-Id: I20ed6ec6aae2c91183b8c826b8ebcc98e8ceebff
Reviewed-on: https://go-review.googlesource.com/12655
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-24 20:43:53 +00:00
Josh Bleecher Snyder
8d31df18af [dev.ssa] cmd/compile: use string contents instead of offset from string header
This generates more efficient code.

Before:

	0x003a 00058 (rr.go:7)	LEAQ	go.string.hdr."="(SB), BX
	0x0041 00065 (rr.go:7)	LEAQ	16(BX), BP
	0x0045 00069 (rr.go:7)	MOVQ	BP, 16(SP)

After:

	0x003a 00058 (rr.go:7)	LEAQ	go.string."="(SB), BX
	0x0041 00065 (rr.go:7)	MOVQ	BX, 16(SP)

It also matches the existing backend
and is more robust to other changes,
such as CL 11698, which I believe broke
the current code.

This CL fixes the encoding/base64 tests, as run with:

	GOGC=off GOSSAPKG=base64 go test -a encoding/base64

Change-Id: I3c475bed1dd3335cc14e13309e11d23f0ed32c17
Reviewed-on: https://go-review.googlesource.com/12654
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-24 20:43:32 +00:00
Todd Neal
d90e0481bf [dev.ssa] cmd/compile: implement LEAQ2/LEAQ4/LEAQ8 opcodes
Change-Id: I8da76b9a4c5c80e8515e69e105d6349fe3ad9281
Reviewed-on: https://go-review.googlesource.com/12611
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-07-24 15:16:23 +00:00
Ian Lance Taylor
d23973d23c cmd/go: document environment variables
This adds documentation for all the environment variables I could
locate in the go tool and the commands that it invokes.

Fixes #9672.

Change-Id: Id5f09160a3a8a938af4a3fcb8757eb3eced05416
Reviewed-on: https://go-review.googlesource.com/12620
Reviewed-by: Rob Pike <r@golang.org>
2015-07-24 05:19:09 +00:00
David Chase
731dcdae6d cmd/compile: prepend captured args to called-closure params
Old code appended, did not play well with a closure
with a ... param.

Fixes #11075.

Change-Id: Ib7c8590c5c4e576e798837e7499e00f3494efb4a
Reviewed-on: https://go-review.googlesource.com/12580
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Chase <drchase@google.com>
2015-07-23 19:02:19 +00:00
Josh Bleecher Snyder
851ceebceb [dev.ssa] cmd/compile: don't alloc new CSE classes
This reduces the time to compile
test/slice3.go on my laptop from ~12s to ~3.8s.
It reduces the max memory use from ~4.8gb to
~450mb.

This is still considerably worse than tip,
at 1s and 300mb respectively, but it's
getting closer.

Hopefully this will fix the build at long last.

Change-Id: Iac26b52023f408438cba3ea1b81dcd82ca402b90
Reviewed-on: https://go-review.googlesource.com/12566
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-23 18:13:32 +00:00
Josh Bleecher Snyder
317226e61c [dev.ssa] cmd/compile: use v.Args[x].Op in CSE key
Experimentally, the Ops of v.Args do a good job
of differentiating values that will end up in
different partitions.

Most values have at most two args, so use them.

This reduces the wall time to run test/slice3.go
on my laptop from ~20s to ~12s.

Credit to Todd Neal for the idea.

Change-Id: I55d08f09eb678bbe8366924ca2fabcd32526bf41
Reviewed-on: https://go-review.googlesource.com/12565
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-23 18:12:44 +00:00
Josh Bleecher Snyder
5254be3a9c [dev.ssa] cmd/compile: make etypes readable
Change-Id: Id89ea3b458597dd93d269b9fe5475e9cccc6d992
Reviewed-on: https://go-review.googlesource.com/12562
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-23 18:09:12 +00:00
Josh Bleecher Snyder
d298209b1c [dev.ssa] cmd/compile: add GOSSAFUNC and GOSSAPKG
These temporary environment variables make it
possible to enable using SSA-generated code
for a particular function or package without
having to rebuild the compiler.

This makes it possible to start bulk testing
SSA generated code.

First, bump up the default stack size
(_StackMin in runtime/stack2.go) to something
large like 32768, because without stackmaps
we can't grow stacks.

Then run something like:

for pkg in `go list std`
do
  GOGC=off GOSSAPKG=`basename $pkg` go test -a $pkg
done

When a test fails, you can re-run those tests,
selectively enabling one function after another,
until you find the one that is causing trouble.

Doing this right now yields some interesting results:

* There are several packages for which we generate
  some code and whose tests pass. Yay!

* We can generate code for encoding/base64, but
  tests there fail, so there's a bug to fix.

* Attempting to build the runtime yields a panic during codegen:
  panic: interface conversion: ssa.Location is nil, not *ssa.LocalSlot

* The top unimplemented codegen items are (simplified):
  59 genValue not implemented: REPMOVSB
  18 genValue not implemented: REPSTOSQ
  14 genValue not implemented: SUBQ
   9 branch not implemented: If v -> b b. Control: XORQconst <bool> [1]
   8 genValue not implemented: MOVQstoreidx8
   4 branch not implemented: If v -> b b. Control: SETG <bool>
   3 branch not implemented: If v -> b b. Control: SETLE <bool>
   2 load flags not implemented: LoadReg8 <flags>
   2 genValue not implemented: InvertFlags <flags>
   1 store flags not implemented: StoreReg8 <flags>
   1 branch not implemented: If v -> b b. Control: SETGE <bool>

Change-Id: Ib64809ac0c917e25bcae27829ae634c70d290c7f
Reviewed-on: https://go-review.googlesource.com/12547
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-23 18:08:17 +00:00
Josh Bleecher Snyder
8c954d5780 [dev.ssa] cmd/compile: speed up cse
By walking only the current set of partitions
at any given point, the cse pass ended up doing
lots of extraneous, effectively O(n^2) work.

Using a regular for loop allows each cse pass to
make as much progress as possible by processing
each new class as it is introduced.

This can and should be optimized further,
but it already reduces by 75% cse time on test/slice3.go.

The overall time to compile test/slice3.go is still
dominated by the O(n^2) work in the liveness pass.
However, Keith is rewriting regalloc anyway.

Change-Id: I8be020b2f69352234587eeadeba923481bf43fcc
Reviewed-on: https://go-review.googlesource.com/12244
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-23 18:06:04 +00:00
Josh Bleecher Snyder
00437ebe73 [dev.ssa] cmd/compile: don't combine phi vars from different blocks in CSE
Here is a concrete case in which this goes wrong.

func f_ssa() int {
	var n int
Next:
	for j := 0; j < 3; j++ {
		for i := 0; i < 10; i++ {
			if i == 6 {
				continue Next
			}
			n = i
		}
		n += j + j + j + j + j + j + j + j + j + j // j * 10
	}
	return n
}

What follows is the function printout before and after CSE.

Note blocks b8 and b10 in the before case.

b8 is the inner loop's condition: i < 10.
b10 is the inner loop's increment: i++.
v82 is i. On entry to b8, it is either 0 (v19) the first time,
or the result of incrementing v82, by way of v29.

The CSE pass considered v82 and v49 to be common subexpressions,
and eliminated v82 in favor of v49.

In the after case, v82 is now dead and will shortly be eliminated.
As a result, v29 is also dead, and we have lost the increment.
The loop runs forever.

BEFORE CSE

f_ssa <nil>
  b1:
    v1 = Arg <mem>
    v2 = SP <uint64>
    v4 = Addr <*int> {~r0} v2
    v13 = Zero <mem> [8] v4 v1
    v14 = Const <int>
    v15 = Const <int>
    v17 = Const <int> [3]
    v19 = Const <int>
    v21 = Const <int> [10]
    v24 = Const <int> [6]
    v28 = Const <int> [1]
    v43 = Const <int> [1]
    Plain -> b3
  b2: <- b7
    Exit v47
  b3: <- b1
    Plain -> b4
  b4: <- b3 b6
    v49 = Phi <int> v15 v44
    v68 = Phi <int> v14 v67
    v81 = Phi <mem> v13 v81
    v18 = Less <bool> v49 v17
    If v18 -> b5 b7
  b5: <- b4
    Plain -> b8
  b6: <- b12 b11
    v67 = Phi <int> v66 v41
    v44 = Add <int> v49 v43
    Plain -> b4
  b7: <- b4
    v47 = Store <mem> v4 v68 v81
    Plain -> b2
  b8: <- b5 b10
    v66 = Phi <int> v68 v82
    v82 = Phi <int> v19 v29
    v22 = Less <bool> v82 v21
    If v22 -> b9 b11
  b9: <- b8
    v25 = Eq <bool> v82 v24
    If v25 -> b12 b13
  b10: <- b13
    v29 = Add <int> v82 v28
    Plain -> b8
  b11: <- b8
    v32 = Add <int> v49 v49
    v33 = Add <int> v32 v49
    v34 = Add <int> v33 v49
    v35 = Add <int> v34 v49
    v36 = Add <int> v35 v49
    v37 = Add <int> v36 v49
    v38 = Add <int> v37 v49
    v39 = Add <int> v38 v49
    v40 = Add <int> v39 v49
    v41 = Add <int> v66 v40
    Plain -> b6
  b12: <- b9
    Plain -> b6
  b13: <- b9
    Plain -> b10

AFTER CSE

f_ssa <nil>
  b1:
    v1 = Arg <mem>
    v2 = SP <uint64>
    v4 = Addr <*int> {~r0} v2
    v13 = Zero <mem> [8] v4 v1
    v14 = Const <int>
    v15 = Const <int>
    v17 = Const <int> [3]
    v19 = Const <int>
    v21 = Const <int> [10]
    v24 = Const <int> [6]
    v28 = Const <int> [1]
    v43 = Const <int> [1]
    Plain -> b3
  b2: <- b7
    Exit v47
  b3: <- b1
    Plain -> b4
  b4: <- b3 b6
    v49 = Phi <int> v19 v44
    v68 = Phi <int> v19 v67
    v81 = Phi <mem> v13 v81
    v18 = Less <bool> v49 v17
    If v18 -> b5 b7
  b5: <- b4
    Plain -> b8
  b6: <- b12 b11
    v67 = Phi <int> v66 v41
    v44 = Add <int> v49 v43
    Plain -> b4
  b7: <- b4
    v47 = Store <mem> v4 v68 v81
    Plain -> b2
  b8: <- b5 b10
    v66 = Phi <int> v68 v49
    v82 = Phi <int> v19 v29
    v22 = Less <bool> v49 v21
    If v22 -> b9 b11
  b9: <- b8
    v25 = Eq <bool> v49 v24
    If v25 -> b12 b13
  b10: <- b13
    v29 = Add <int> v49 v43
    Plain -> b8
  b11: <- b8
    v32 = Add <int> v49 v49
    v33 = Add <int> v32 v49
    v34 = Add <int> v33 v49
    v35 = Add <int> v34 v49
    v36 = Add <int> v35 v49
    v37 = Add <int> v36 v49
    v38 = Add <int> v37 v49
    v39 = Add <int> v38 v49
    v40 = Add <int> v39 v49
    v41 = Add <int> v66 v40
    Plain -> b6
  b12: <- b9
    Plain -> b6
  b13: <- b9
    Plain -> b10

Change-Id: I16fc4ec527ec63f24f7d0d79d1a4a59bf37269de
Reviewed-on: https://go-review.googlesource.com/12444
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-23 18:05:33 +00:00
Keith Randall
be1eb57a8b [dev.ssa] cmd/compile/internal/ssa: implement multiplies
Use width-and-signed-specific multiply opcodes.
Implement OMUL.
A few other cleanups.

Fixes #11467

Change-Id: Ib0fe80a1a9b7208dbb8a2b6b652a478847f5d244
Reviewed-on: https://go-review.googlesource.com/12540
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-07-23 17:58:59 +00:00
Ian Lance Taylor
ad84f84cb4 cmd/link: don't generate .exe extension for external Windows link
On Windows, gcc -o foo will generate foo.exe.  Prevent that from
happening by adding a final '.' if necessary so that GCC thinks that
the file already has an extension.

Also remove the initial output file when doing an external link, and
use mayberemoveoutfile, not os.Remove, when building an archive
(otherwise we will do the wrong thing for -buildmode=c-archive -o
/dev/null).

I didn't add a test, as it requires using cgo and -o on Windows.

Fixes #11725.

Change-Id: I6ea12437bb6b4b9b8ee5c3b52d83509fa2437b2d
Reviewed-on: https://go-review.googlesource.com/12243
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-23 17:49:44 +00:00
Josh Bleecher Snyder
d5297f7261 [dev.ssa] cmd/compile: speed up liveness analysis
This reduces the wall time to run test/slice3.go
on my laptop from >10m to ~20s.

This could perhaps be further reduced by using
a worklist of blocks and/or implementing the
suggestion in the comment in this CL, but at this
point, it's fast enough that there is no need.

Change-Id: I741119e0c8310051d7185459f78be8b89237b85b
Reviewed-on: https://go-review.googlesource.com/12564
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-23 17:27:08 +00:00
Josh Bleecher Snyder
e61e7c96f7 [dev.ssa] cmd/compile: add some common binary ops
Change-Id: I1af486a69960b9b66d5c2c9bbfcf7db6ef075d8c
Reviewed-on: https://go-review.googlesource.com/12563
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-23 17:10:56 +00:00
Josh Bleecher Snyder
e0ac5c5337 [dev.ssa] cmd/compile: minor cleanup
Change-Id: Ib33f3b1cfa09f410675d275e214d8ddc246c53c3
Reviewed-on: https://go-review.googlesource.com/12548
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-23 17:10:28 +00:00
David Chase
2584974d16 cmd/compile: adjust annotation of implicit operations.
Limit probe to ODOT/OIND/ODOTPTR for now; that works.

Fixes #11790

Change-Id: I411271e702c5fe6ceb880ca47c7dacc37ffcbb6a
Reviewed-on: https://go-review.googlesource.com/12532
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-23 14:19:07 +00:00
Russ Cox
aad4fe4d8f cmd/go: document internal and vendor
Fixes #11606.

Change-Id: I70d38c22812c17119b998aad9c1c68e7cf74e98a
Reviewed-on: https://go-review.googlesource.com/12524
Reviewed-by: Rob Pike <r@golang.org>
2015-07-23 05:50:53 +00:00
Russ Cox
5659964d67 cmd/link: write combined dwarf file to same directory as output file
Fixes #11681.

Change-Id: I679d71ed25ac585af7d43611be01c1a0c4807871
Reviewed-on: https://go-review.googlesource.com/12554
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-23 03:52:20 +00:00
Russ Cox
3bab4ef68d cmd/pprof: fix race between viewer and web command
Fixes #11729.

Change-Id: I6e5e23169ac1368afcbd016ed544a710aa045326
Reviewed-on: https://go-review.googlesource.com/12553
Reviewed-by: Rob Pike <r@golang.org>
2015-07-23 03:51:39 +00:00
Josh Bleecher Snyder
61aa0953e5 [dev.ssa] cmd/compile: implement control flow handling
Add label and goto checks and improve test coverage.

Implement OSWITCH and OSELECT.

Implement OBREAK and OCONTINUE.

Allow generation of code in dead blocks.

Change-Id: Ibebb7c98b4b2344f46d38db7c9dce058c56beaac
Reviewed-on: https://go-review.googlesource.com/12445
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-23 00:45:26 +00:00
Alexandru Moșoi
3e7e519c36 [dev.ssa] cmd/compile/internal/ssa/gen: generalize strength reduction.
Handle multiplication with -1, 0, 3, 5, 9 and all powers of two.

Change-Id: I8e87e7670dae389aebf6f446d7a56950cacb59e0
Reviewed-on: https://go-review.googlesource.com/12350
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-22 22:00:31 +00:00
Alexandru Moșoi
954d5ada29 [dev.ssa] cmd/compile/internal/ssa/gen: implement OMINUS
Change-Id: Ibc645d6cf229ecc18af3549dd3750be9d7451abe
Reviewed-on: https://go-review.googlesource.com/12472
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-22 22:00:17 +00:00
Ian Lance Taylor
a5caa7c94e cmd/go: for get -t and list, look up path in vendor directories
This is needed to handle vendor directories correctly.  It was already
done for the regular imports when the package was loaded, but not for
the test-only imports.

It would be nice to do this while loading the package, but that breaks
the code that checks for direct references to vendor packages when
running go test.  This change is relatively contained.

While we're at it, skip "C" test imports in go get.

Fixes #11628.
Fixes #11717.

Change-Id: I9cc308cf45683e3ff905320c2b5cb45db7716846
Reviewed-on: https://go-review.googlesource.com/12488
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-22 21:16:53 +00:00
Russ Cox
75d779566b runtime/cgo: make compatible with race detector
Some routines run without and m or g and cannot invoke the
race detector runtime. They must be opaque to the runtime.
That used to be true because they were written in C.
Now that they are written in Go, disable the race detector
annotations for those functions explicitly.

Add test.

Fixes #10874.

Change-Id: Ia8cc28d51e7051528f9f9594b75634e6bb66a785
Reviewed-on: https://go-review.googlesource.com/12534
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-22 20:28:47 +00:00
Russ Cox
0acecb7164 cmd/link: elide individual gcbits symbols
Same as we do for string symbols.

Fixes #11583.

Change-Id: Ia9264f6faf486697d987051b7f9851d37d8ad381
Reviewed-on: https://go-review.googlesource.com/12531
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-22 20:27:24 +00:00
Konstantin Shaposhnikov
428ed1e3d9 cmd/go: support git.apache.org Git repos
This change fixes resolution of secure (https) repo URL for
git.apache.org Git repositories.

E.g. the correct repo URL for git.apache.org/thrift.git/lib/go/thrift is
https://git.apache.org/thrift.git, not https://git.apache.org/thrift

Fixes #10797

Change-Id: I67d5312ad8620eb780e42c2e002c8f286f60645a
Reviewed-on: https://go-review.googlesource.com/10092
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-22 19:50:08 +00:00
Ingo Krabbe
1e9f59a7da cmd/dist: add command output for dist tests
It is very useful to see which test commands are executed.
This is of global use, but I wrote it for #11654.

Change-Id: I9bfc8e55d5bef21f4c49b917f58bc9a44aefcade
Reviewed-on: https://go-review.googlesource.com/12510
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-22 17:39:44 +00:00
Russ Cox
d709434313 cmd/go: fix missing internal import error
Fixes #11331.

Change-Id: I19b8172421044c301bc136fc8f7bfdadbf880e25
Reviewed-on: https://go-review.googlesource.com/12450
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-22 17:33:18 +00:00
Dmitry Vyukov
ae1ea2aa94 runtime/trace: add new package
Move tracing functions from runtime/pprof to the new runtime/trace package.

Fixes #9710

Change-Id: I718bcb2ae3e5959d9f72cab5e6708289e5c8ebd5
Reviewed-on: https://go-review.googlesource.com/12511
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-22 15:47:16 +00:00
Brad Fitzpatrick
fc7f6d307a cmd/dist: remove prints during test registration
dist test should not print (especially to stdout) during test
registration.  This confuses other tools interacting with dist using
dist test --list, etc.

Change-Id: Ie4f82c13e49590c23a7a235d90ddbc4f5ed81e0b
Reviewed-on: https://go-review.googlesource.com/12487
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-21 22:40:01 +00:00
Ian Lance Taylor
c97b49976d cmd/go: fix typo in comment
Change-Id: I3d5e46d376953fbdd21ce8c161214eaed6378d84
Reviewed-on: https://go-review.googlesource.com/12490
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-21 22:25:11 +00:00
Ian Lance Taylor
419a6c0709 cmd/go: pass an unmodified environment to a go run program
Fixes #11709.
Fixed #11449.

Change-Id: If8fdb27d3dc25fb7017226d143a29cbebc1374c5
Reviewed-on: https://go-review.googlesource.com/12483
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-07-21 22:19:00 +00:00
Ian Lance Taylor
72921c663d cmd/go: skip TestGoInstallErrorOnCrossCompileToBin in short mode
That test will install cmd/pack for linux_386; we don't want to change
GOROOT in short mode.

Change-Id: I4b00c578a99779a13c558208bfd4115f8f0513fa
Reviewed-on: https://go-review.googlesource.com/12481
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-07-21 19:31:54 +00:00
Josh Bleecher Snyder
8fb6358153 [dev.ssa] cmd/compile: don't generate zero values for ssa ops
Shorter code, easier to read, no pointless empty slices.

Change-Id: Id410364b4f6924b5665188af3373a5e914117c38
Reviewed-on: https://go-review.googlesource.com/12480
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-21 16:03:54 +00:00
Josh Bleecher Snyder
ac1935b3a7 [dev.ssa] cmd/compile: fix build
Bad rebase in CL 12439.

Change-Id: I7ad359519c6274be37456b655f19bf0ca6ac6692
Reviewed-on: https://go-review.googlesource.com/12449
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-07-21 14:02:34 +00:00
Josh Bleecher Snyder
a402b58e51 [dev.ssa] cmd/compile: implement "if SETEQ" branches
Change-Id: I814fd0c2f1a622cca7dfd1b771f81de309a1904c
Reviewed-on: https://go-review.googlesource.com/12441
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-21 13:50:14 +00:00
Josh Bleecher Snyder
2574e4ac1c [dev.ssa] cmd/compile: call through to expr for expression statements
Change-Id: I8625eff33f5a49dbaaec060c3fa067d7531193c4
Reviewed-on: https://go-review.googlesource.com/12313
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-21 13:49:48 +00:00
Josh Bleecher Snyder
67bfd69564 [dev.ssa] cmd/compile: fix stackalloc handling of zero-aligned variables
Prior to this fix, a zero-aligned variable such as a flags
variable would reset n to 0.

While we're here, log the stack layout so that debugging
and reading the generated assembly is easier.

Change-Id: I18ef83ea95b6ea877c83f2e595e14c48c9ad7d84
Reviewed-on: https://go-review.googlesource.com/12439
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-21 13:49:10 +00:00
Josh Bleecher Snyder
26f135d7c1 [dev.ssa] cmd/compile: mark LoadReg8 and StoreReg8 of flags as unimplemented
It is not clear to me what the right implementation is.
LoadReg8 and StoreReg8 are introduced during regalloc,
so after the amd64 rewrites. But implementing them
in genValue seems silly.

Change-Id: Ia708209c4604867bddcc0e5d75ecd17cf32f52c3
Reviewed-on: https://go-review.googlesource.com/12437
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-21 13:41:39 +00:00
Josh Bleecher Snyder
a794074da0 [dev.ssa] cmd/compile: implement genValue for AMD64SETxx
Change-Id: I591f2c0465263dcdeef46920aabf1bbb8e7ac5c0
Reviewed-on: https://go-review.googlesource.com/12436
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-21 13:40:52 +00:00
Josh Bleecher Snyder
983bc8d1a2 Revert "[dev.ssa] cmd/compile: don't Compile if Unimplemented"
This reverts commit 766bcc92a5.

Change-Id: I55413c1aa80d82c856a3ea89b4ffccf80fb58013
Reviewed-on: https://go-review.googlesource.com/12361
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-21 13:38:53 +00:00
Keith Randall
67fdb0de86 [dev.ssa] cmd/compile/internal/ssa: use width and sign specific opcodes
Bake the bit width and signedness into opcodes.
Pro: Rewrite rules become easier.  Less chance for confusion.
Con: Lots more opcodes.

Let me know what you think.  I'm leaning towards this, but I could be
convinced otherwise if people think this is too ugly.

Update #11467

Change-Id: Icf1b894268cdf73515877bb123839800d97b9df9
Reviewed-on: https://go-review.googlesource.com/12362
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-07-21 04:34:02 +00:00
Ian Lance Taylor
e9fcd6ed2b cmd/link: if -B option was used, pass it to the external linker
Fixes #10607.

Change-Id: Ib294cf65b07103b60f62b86b21ff2d07b25136fe
Reviewed-on: https://go-review.googlesource.com/12242
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-21 03:57:55 +00:00
Brad Fitzpatrick
852f383c9b api: add go1.5.txt API file, reset next.txt
Fixes #11752

Change-Id: If4196b4bbba4f1485608bfafa98fa54781177273
Reviewed-on: https://go-review.googlesource.com/12325
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-21 02:48:35 +00:00
Josh Bleecher Snyder
8043f450c1 [dev.ssa] cmd/compile: fix test verb
The verb doesn't do anything, but if/when we move
these to the test directory, having it be right
will be one fewer thing to remember.

Change-Id: Ibf0280d7cc14bf48927e25215de6b91c111983d9
Reviewed-on: https://go-review.googlesource.com/12438
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-21 00:09:24 +00:00
Josh Bleecher Snyder
21bd483c4a [dev.ssa] cmd/compile: refactor out zero value creation
This will be used in a subsequent commit.

Change-Id: I43eca21f4692d99e164c9f6be0760597c46e6a26
Reviewed-on: https://go-review.googlesource.com/12440
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-21 00:08:59 +00:00
Ian Lance Taylor
1a0818a40d cmd/dist: increase timeout for standard tests
The cmd/go tests run too long on a Raspberry Pi.  I've cut times as
much as I can see without more serious steps like not running tests.

Fixes #11779.

Change-Id: Ice5da052902decea2e6ac32d0f2ce084c39ea1ab
Reviewed-on: https://go-review.googlesource.com/12368
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-07-20 18:05:59 +00:00
Josh Bleecher Snyder
f421735bb4 [dev.ssa] cmd/compile: handle OpCopy loops in rewrite
Change-Id: Icbaad6e5cbfc5430a651538fe90c0a9ee664faf4
Reviewed-on: https://go-review.googlesource.com/12360
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-20 17:35:08 +00:00
Ian Lance Taylor
510f1dbad7 cmd/go: build errors rather than fmt in a couple of tests
The errors package is smaller and builds faster.

Update #11779.

Change-Id: Iaf2d43734ec4b0aa325590eb5d38522306b608cb
Reviewed-on: https://go-review.googlesource.com/12366
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-07-20 16:31:37 +00:00
Ian Lance Taylor
b9a3e5979d cmd/go: build errors rather than strings in some tests
Speed up the test suite by building the errors package rather than the
strings package in some cases where the specific package we are
building doesn't matter.  The errors package is smaller, and doesn't
have any assembler code.

Also make a couple of tests run in parallel.

Update #11779.

Change-Id: I62e47f8655f9d85bf93c70ae6e6121276d96aee0
Reviewed-on: https://go-review.googlesource.com/12365
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-07-20 15:57:05 +00:00
Ian Lance Taylor
f35868a49a cmd/go: don't run TestInstalls in short mode
It changes GOROOT, so we shouldn't run it in short mode.  Also, it's
fairly slow.

Update #11779.

Change-Id: I3d3344954cf9b2ac70070c878a67cb65ac8fd85c
Reviewed-on: https://go-review.googlesource.com/12364
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-20 03:27:22 +00:00
Ian Lance Taylor
f7e7719f65 cmd/go: rewrite TestNoteReading to use test harness
On my laptop reduces time required for test from 22 seconds to 0.14
seconds.

Update #11779.

Change-Id: I715d85bd9c6f7683c6915eedd2539813aa5efc58
Reviewed-on: https://go-review.googlesource.com/12363
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-20 03:25:18 +00:00
Michael Hudson-Doyle
1125cd4997 cmd/compile: define func value symbols at declaration
This is mostly Russ's https://golang.org/cl/12145 but with some extra fixes to
account for the fact that function declarations without implementations now
break shared libraries, and including my test case.

Fixes #11480.

Change-Id: Iabdc2934a0378e5025e4e7affadb535eaef2c8f1
Reviewed-on: https://go-review.googlesource.com/12340
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-20 00:50:46 +00:00
Ian Lance Taylor
dabb268170 cmd/compile: ignore carriage return in magic comments
Update #11771.

Change-Id: I3bb3262619765d3ca79652817e17e8f260f41907
Reviewed-on: https://go-review.googlesource.com/12379
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-18 17:33:53 +00:00
Ian Lance Taylor
c4f18d5374 cmd/go: ignore import of "C" when fetching dependencies
The change https://golang.org/cl/12192 changed the get code to use the
list of package imports, not the computed list of dependencies, as the
computed list could be out of date if the package changed when using
go get -u.  Computing the dependency list would skip an import of "C",
but that would still be on the package import list.  This changes the
code to skip "C" when walking the import list.

No test--the best test would be to add an import of "C" to
github.com/rsc/go-get-issue-9224-cmd for TestGoGetUpdate.

Fixes #11738.

Change-Id: Id89ddafeade2391d15688bfd142fafd67844a941
Reviewed-on: https://go-review.googlesource.com/12322
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-17 22:58:39 +00:00
Keith Randall
c1593da817 [dev.ssa] cmd/compile/internal/ssa/gen: Fix *64 strength reduction
*64 is <<6, not <<5.

Change-Id: I2eb7e113d5003b2c77fbd3abc3defc4d98976a5e
Reviewed-on: https://go-review.googlesource.com/12323
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-17 15:59:10 +00:00
Rob Pike
5c62e5f9da cmd/fix: add gotypes module
Adjusts for the move from golang.org/x/tools/go/types and .../go/exact
to go/types and go/constant in the main repository.

Change-Id: I0da7248c540939e3e9b09c915b0a296937f1be73
Reviewed-on: https://go-review.googlesource.com/12284
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-17 01:47:14 +00:00
Mikio Hara
29ffa4bd92 cmd/go: don't put mycmd in wrong directory
Change-Id: Ia7cc1d52211b32a2eb2b3888d621b28d6932aca9
Reviewed-on: https://go-review.googlesource.com/12290
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-17 01:28:16 +00:00
Keith Randall
3dcc424be7 [dev.ssa] cmd/compile/internal/ssa: compute outarg size correctly
Keep track of the outargs size needed at each call.
Compute the size of the outargs section of the stack frame.  It's just
the max of the outargs size at all the callsites in the function.

Change-Id: I3d0640f654f01307633b1a5f75bab16e211ea6c0
Reviewed-on: https://go-review.googlesource.com/12178
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-07-16 21:06:13 +00:00
Josh Bleecher Snyder
8adc905a10 [dev.ssa] cmd/compile: implement lowering of constant bools
Change-Id: Ia56ee9798eefe123d4da04138a6a559d2c25ddf3
Reviewed-on: https://go-review.googlesource.com/12312
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-16 19:28:45 +00:00
Josh Bleecher Snyder
766bcc92a5 [dev.ssa] cmd/compile: don't Compile if Unimplemented
If we've already hit an Unimplemented, there may be important
SSA invariants that do not hold and which could cause
ssa.Compile to hang or spin.

While we're here, make detected dependency cycles stop execution.

Change-Id: Ic7d4eea659e1fe3f2c9b3e8a4eee5567494f46ad
Reviewed-on: https://go-review.googlesource.com/12310
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-16 18:54:09 +00:00
Keith Randall
cd7e059496 [dev.ssa] cmd/compile/internal/ssa: implement ODOT
Implement ODOT.  Similar to ArrayIndex, StructSelect selects a field
out of a larger Value.

We may need more ways to rewrite StructSelect, but StructSelect/Load
is the typical way it is used.

Change-Id: Ida7b8aab3298f4754eaf9fee733974cf8736e45d
Reviewed-on: https://go-review.googlesource.com/12265
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-16 05:43:36 +00:00
Russ Cox
08dbd8ae6d Revert "cmd/internal/obj: fix pc/sp information for prologue"
This seems to have broken arm64 in a mysterious way. Will try again later.

This reverts commit 0a3c991fd3.

Change-Id: Ic1b53413c4168977a27381d9cc6fb8d9d7cbb780
Reviewed-on: https://go-review.googlesource.com/12245
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-15 23:28:42 +00:00
Andrew Gerrand
5cd2944803 cmd/go: fix parsing of Git SCP-like remotes
Now that we care about the protocol of Git remotes (for the -insecure
flag), we need to recognize and parse the SCP-like remote format.

Fixes golang/go#11457

Change-Id: Ia26132274fafb1cbfefe2475f7ac5f17ccd6da40
Reviewed-on: https://go-review.googlesource.com/12226
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-15 21:33:57 +00:00
Todd Neal
078ba138d3 [dev.ssa] cmd/compile/internal : Implement Lengauer-Tarjan for dominators
Implements the simple Lengauer-Tarjan algorithm for dominator
and post-dominator calculation.

benchmark                           old ns/op     new ns/op     delta
BenchmarkDominatorsLinear-8         1403862       1292741       -7.92%
BenchmarkDominatorsFwdBack-8        1270633       1428285       +12.41%
BenchmarkDominatorsManyPred-8       225932354     1530886       -99.32%
BenchmarkDominatorsMaxPred-8        445994225     1393612       -99.69%
BenchmarkDominatorsMaxPredVal-8     447235248     1246899       -99.72%
BenchmarkNilCheckDeep1-8            829           1259          +51.87%
BenchmarkNilCheckDeep10-8           2199          2397          +9.00%
BenchmarkNilCheckDeep100-8          57325         29405         -48.70%
BenchmarkNilCheckDeep1000-8         6625837       2933151       -55.73%
BenchmarkNilCheckDeep10000-8        763559787     319105541     -58.21%

benchmark                           old MB/s     new MB/s     speedup
BenchmarkDominatorsLinear-8         7.12         7.74         1.09x
BenchmarkDominatorsFwdBack-8        7.87         7.00         0.89x
BenchmarkDominatorsManyPred-8       0.04         6.53         163.25x
BenchmarkDominatorsMaxPred-8        0.02         7.18         359.00x
BenchmarkDominatorsMaxPredVal-8     0.02         8.02         401.00x
BenchmarkNilCheckDeep1-8            1.21         0.79         0.65x
BenchmarkNilCheckDeep10-8           4.55         4.17         0.92x
BenchmarkNilCheckDeep100-8          1.74         3.40         1.95x
BenchmarkNilCheckDeep1000-8         0.15         0.34         2.27x
BenchmarkNilCheckDeep10000-8        0.01         0.03         3.00x

Change-Id: Icec3d774422a9bc64914779804c8c0ab73aa72bf
Reviewed-on: https://go-review.googlesource.com/11971
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-15 16:17:04 +00:00
Ian Lance Taylor
2e4b659954 cmd/compile: recognize embedded field in inlined function
There was already special code to recognize "?" in hidden_structdcl,
which is used for inlined types and variables.  This recognizes "?" in
structdcl as well, a case that arises when a struct type appears
within an inlined function body.

Fixes #10219.

Change-Id: Ic5257ae54f817e0d4a189c2294dcd633c9f2101a
Reviewed-on: https://go-review.googlesource.com/12241
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-15 06:04:51 +00:00
Rob Pike
2d25318f08 asm: fix error messages and comments for "register pair"
The parser treats (R1+R2) on ppc64 the same as (R1,R2) on arm,
but it is not strictly a "register pair". Improve the text.

No semantic change.

Change-Id: Ib8b14881c6467add0d53150a901c01e962afb28b
Reviewed-on: https://go-review.googlesource.com/12212
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-15 05:45:29 +00:00
Russ Cox
7feb424928 cmd/compile: fix PtrTo(t) for unnamed t with embedded fields
Fixes #8427.

Change-Id: I826a3bc4519845ad30d6dbaf058fe7ed7bee8db0
Reviewed-on: https://go-review.googlesource.com/12233
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-15 05:36:27 +00:00
Russ Cox
307d6919bd cmd/go: print all test flags in "go test -h"
Originally 'go test -h' printed the output of 'go help test'.
Then issue #6576 was filed, because that output didn't list (for example) -bench.
CL 14502065 changed 'go test -h' to print the output of 'go help testflag'.
Then issue #9209 was filed, because that output didn't list (for example) -c.

To print all the relevant flags, parts of both 'go help test' and 'go help testflag'
are needed. Refactor the help messages to make those parts available
and print them.

Fixes #9209.

Change-Id: Ie8205b8fb37d00c10d25b3fc98f14286ec46c4e3
Reviewed-on: https://go-review.googlesource.com/12173
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 05:34:13 +00:00
Russ Cox
ef6d3a94fb cmd/dist: diagnose lack of gcc earlier in build
Fixes #10731.

Change-Id: I105629b03fd3323c0a2ca5b6b0fd35ee92b7fd2e
Reviewed-on: https://go-review.googlesource.com/12146
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 05:33:55 +00:00
Russ Cox
5a4cc600b7 cmd/go: fix nocgo builder
Change-Id: I0f167d9769d9b6b9888c13fcb48e538fc87aa1b7
Reviewed-on: https://go-review.googlesource.com/12240
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-15 05:23:35 +00:00
Russ Cox
238a39594b cmd/go: add test for issue 3652
Fixes #3652. (Well, already fixed, but tests that it stays fixed.)

Change-Id: I4e17f595ee2ad513de86ac3861e8e66b1230b3be
Reviewed-on: https://go-review.googlesource.com/12195
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-15 05:06:50 +00:00
Russ Cox
7126da2fd5 cmd/go: fix build
Failures noted by dashboard.

Change-Id: I22f90120c6687b64b9efff9df7a7fa8f26d24bac
Reviewed-on: https://go-review.googlesource.com/12207
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-15 05:05:52 +00:00
Russ Cox
2f54de0df8 cmd/go: accept go get domain.root
Fixes #9357.

Change-Id: I11f0652758c4ea80debec29c3b99a72baca6d745
Reviewed-on: https://go-review.googlesource.com/12193
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-15 04:44:54 +00:00
Russ Cox
af96030150 cmd/go: fix go get -u handling of changing dependencies
Fixes #9224.

Change-Id: Ie0f4f14407099e4fa7ebe361a95b6492012928a2
Reviewed-on: https://go-review.googlesource.com/12192
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-15 04:41:08 +00:00
Russ Cox
8df0bcc1fb cmd/go: disable password prompt when running git
This fix only works on Git 2.3.0 and later.

There appears to be no portable way to fix the earlier versions.
We already run git with stdin closed, but on Unix git calls getpass,
which opens /dev/tty itself. We could do package syscall-specific
things to get /dev/tty invalidated during the exec, but I'd really
rather not. And on Windows, Git opens "CONIN$" and "CONOUT$"
itself, and I have no idea how to invalidate those.

Fix the problem for newish Git versions and wait for people to update.
Best we can do.

Fixes #9341.

Change-Id: I576579b106764029853e0f74d411e19108deecf5
Reviewed-on: https://go-review.googlesource.com/12175
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:36:49 +00:00
Russ Cox
505f6e335e cmd/pprof: store temporary files in temporary directory
Fixes #9180.

Change-Id: Id5adaea0ca9005946fb89c88a10c6f59d8c0943c
Reviewed-on: https://go-review.googlesource.com/12202
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-15 04:30:50 +00:00
Russ Cox
2bd1e5e50b cmd/pprof: run $BROWSER and system browser before Chrome
Fixes #10259.

Change-Id: Ica6b8301cc8291785a3c496fb513050813b2d8df
Reviewed-on: https://go-review.googlesource.com/12201
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-15 04:30:35 +00:00
Russ Cox
9adf684686 cmd/go: fix TestVendorRun when $GOROOT is inside a symlinked path
Fixes #11305.

Change-Id: Icaa3a009aa4ab214c9aaf74f52c3e622fa266a9d
Reviewed-on: https://go-review.googlesource.com/12194
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-15 04:30:13 +00:00
Russ Cox
4325a9ee2a cmd/go: reject missing source code in go get -d, same as go get -d -u
Fixes #11090.

Change-Id: I1518df7a48346b175ec80079a07225901fdd51fb
Reviewed-on: https://go-review.googlesource.com/12177
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:29:10 +00:00
Russ Cox
f849f6b7fd cmd/go: give full import stack for errors in dependencies of test dependencies
Fixes #9558.

Change-Id: I68506af58088155d38d492b49b19c5fc2048b087
Reviewed-on: https://go-review.googlesource.com/12176
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:28:00 +00:00
Russ Cox
6ab582a80d cmd/go: go test -race -i runtime/race must not install race-enabled cmd/cgo
Fix now uses same test as 'go build'.

Fixes #10500.

Change-Id: I2fcf2d95430643370aa29165d89a188988dee446
Reviewed-on: https://go-review.googlesource.com/12174
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:27:17 +00:00
Russ Cox
b2cb3b416c cmd/go: add -pkgdir build flag
Fixes #10210.

Change-Id: I82ddd665bca31773b1fb1b056338c04818ef68f5
Reviewed-on: https://go-review.googlesource.com/12171
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:19:08 +00:00
Russ Cox
b5bc87ce59 cmd/go: remove duplication of build flag info in testflag.go
Also adds to 'go test' all the build flags that were missing
due to inconsistency in the duplication (for example, -toolexec).

Fixes #10504.

Change-Id: I1935b5caa13d5e551a0483904adffa8877087df7
Reviewed-on: https://go-review.googlesource.com/12170
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:18:54 +00:00
Russ Cox
3585f215c8 cmd/go: fix error for go run with files in different directories
Fixes #9853.

Change-Id: Ic4803aa499ca20215085a87bad649014984d84c8
Reviewed-on: https://go-review.googlesource.com/12149
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:18:39 +00:00
Russ Cox
687925ffcf cmd/go: document that <meta> tags should be early in the HTML for go get
While we are here, fix a few things not updated for -insecure.

Fixes #8163.

Change-Id: Ib80c9ac00d6b61cce26c3d20bee3d30ab9af1331
Reviewed-on: https://go-review.googlesource.com/12148
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:13:56 +00:00
Russ Cox
023047d14b cmd/go: diagnose trivial test import cycle
Was detecting only non-trivial ones.

Fixes #9690.

Change-Id: I662d81dd4818ddf29592057c090805772c84287b
Reviewed-on: https://go-review.googlesource.com/12147
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:13:55 +00:00
Russ Cox
ea918ef535 Revert "cmd/compile: define func value symbols at declaration"
This reverts commit 3b411bf1a1bb08d6868083981cecba8088dc7aea.

Change-Id: I321a43fa378a43b3e4d7aa97e0222775640af64b
Reviewed-on: https://go-review.googlesource.com/12205
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-15 04:11:54 +00:00
Russ Cox
fa1ea497d5 cmd/compile: define func value symbols at declaration
These used to be defined at use, but that breaks when shared libraries
are involved.

For #11480.

Change-Id: I416a848754fb615c0d75f9f0ccc00723d07f7f01
Reviewed-on: https://go-review.googlesource.com/12145
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:11:01 +00:00
Russ Cox
0a3c991fd3 cmd/internal/obj: fix pc/sp information for prologue
When the prologue call to morestack was moved down to the
bottom of the function, the pc/sp tables were not updated.
If a traceback through a call to morestack is needed, it would
get confused at and stop at morestack.

Confirmed the fix by adding //go:systemstack (which calls
morestackc, but same issue) where it did not belong
and inspecting the crash.

Change-Id: Id0294bb9dba51ef1a49154637228fb57f1086a94
Reviewed-on: https://go-review.googlesource.com/12144
Reviewed-by: Rob Pike <r@golang.org>
2015-07-15 04:09:35 +00:00
Todd Neal
b383de2ef9 [dev.ssa] cmd/compile: implement OIND
Change-Id: I15aee8095e6388822e2222f1995fe2278ac956ca
Reviewed-on: https://go-review.googlesource.com/12129
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-07-15 03:24:05 +00:00
David Crawshaw
e3c67dda0a cmd/go: do not create subdirs of $GOBIN
Fixes #9769.

Change-Id: I2959906c71d0ce62cdb750dab78eab631a26f229
Reviewed-on: https://go-review.googlesource.com/12080
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-14 19:25:40 +00:00
Ian Lance Taylor
a6dc541436 cmd/go: warn on get from code.google.com that it is shutting down
Fixes #10193.

Change-Id: Ibbb747babb697a66b943e5da76b0ada41f1fb14f
Reviewed-on: https://go-review.googlesource.com/12070
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-14 18:18:12 +00:00
Keith Randall
4e204b42f5 [dev.ssa] cmd/compile/internal/ssa: ensure Phi ops are scheduled first
Phi ops should always be scheduled first.  They have the semantics
of all happening simultaneously at the start of the block.  The regalloc
phase assumes all the phis will appear first.

Change-Id: I30291e1fa384a0819205218f1d1ec3aef6d538dd
Reviewed-on: https://go-review.googlesource.com/12154
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-07-14 15:39:56 +00:00
Ross Light
c218a075be cmd/go: mark ssh:// URLs as secure
Add tests for isSecure function.

Change-Id: I49de9d2846b75d4c7be745484f85d351a6fd851d
Reviewed-on: https://go-review.googlesource.com/11514
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-14 05:27:57 +00:00
Brad Fitzpatrick
337b7e7e3b [dev.ssa] cmd/compile: handle OLITERAL nil expressions
Change-Id: I02b8fb277b486eaf0916ddcd8f28c062d4022d4b
Reviewed-on: https://go-review.googlesource.com/12150
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-14 00:07:31 +00:00
Rob Pike
1bd1880906 cmd/internal/obj: rename *.out.go to a.out.go
The old numerical names like 6.out.go are a relic from the old tools.
Easier to rename than explain.

The anames.go files were modified by go generate; no changes
beyond the explanatory comment at the top.

Change-Id: I84742c75c60e47724baa9d49a91fef1f8581f021
Reviewed-on: https://go-review.googlesource.com/12069
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-13 23:47:38 +00:00
Keith Randall
c3c84a2544 [dev.ssa] cmd/compile/internal/gc: Implement ODOT and ODOTPTR in addr.
Change-Id: If8a9d5901fa2141d16b1c8d001761ea62bc23207
Reviewed-on: https://go-review.googlesource.com/12141
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-13 23:17:08 +00:00
Brad Fitzpatrick
b06961b4f0 [dev.ssa] cmd/compile: treat unsafe.Pointer as a pointer
Change-Id: I3f3ac3055c93858894b8852603d79592bbc1696b
Reviewed-on: https://go-review.googlesource.com/12140
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-13 22:36:24 +00:00
Brad Fitzpatrick
a92bd66282 [dev.ssa] cmd/compile: support zero type for *T
Change-Id: I4c9bcea01e2c4333c2a3592b66f1da9f424747a4
Reviewed-on: https://go-review.googlesource.com/12130
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-13 21:29:01 +00:00
Brad Fitzpatrick
50e59bb9c8 [dev.ssa] cmd/compile/internal/gc: fix tests on non-amd64
Change-Id: Ibd6a59db2d5feea41a21fbea5c1a7fdd49238aa8
Reviewed-on: https://go-review.googlesource.com/12131
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-13 21:27:44 +00:00
Russ Cox
d7a8d3eb08 cmd/go: fix go get -u with internal
Fixes #11307.
Fixes #11055.

Change-Id: I8d6b04cb509e62e27d6935b91ffe35fdaea4ebcd
Reviewed-on: https://go-review.googlesource.com/12028
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-13 19:17:17 +00:00
Michael Hudson-Doyle
616cb3c0ea cmd/dist: actually disable testso and testsovar on ppc64
This is clearly what was intended all along. ./all.bash passes with this
change.

Change-Id: I16996da11cf1e4d2dc2a4434b7611a724691e8dc
Reviewed-on: https://go-review.googlesource.com/12068
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-13 04:11:39 +00:00
Brad Fitzpatrick
e81671115c [dev.ssa] cmd/compile: OANDAND, OOROR
Joint hacking with josharian. Hints from matloob and Todd Neal.

Now with tests, and OROR.

Change-Id: Iff8826fde475691fb72a3eea7396a640b6274af9
Reviewed-on: https://go-review.googlesource.com/12041
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-13 04:08:16 +00:00
Keith Randall
7e4c06dad0 [dev.ssa] cmd/compile/internal/gc: handle _ label correctly
An empty label statement can just be ignored, as it cannot
be the target of any gotos.

Tests are already in test/fixedbugs/issue7538*.go

Fixes #11589
Fixes #11593

Change-Id: Iadcd639e7200ce16aa40fd7fa3eaf82522513e82
Reviewed-on: https://go-review.googlesource.com/12093
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-12 20:43:01 +00:00
Daniel Morsing
4c521ac8f2 [dev.ssa] cmd/compile/internal/gc: implement more no-op statements
Change-Id: I26c268f46dcffe39912b8c92ce9abb875310934f
Reviewed-on: https://go-review.googlesource.com/12100
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-12 16:55:31 +00:00
Alex Brainman
4ef836faf6 cmd/dist: disable misc/scgo/testsovar on netbsd
Update #11654

Change-Id: Ia199b8dd349542ad8b92b463dd2f3734dd7e66a4
Reviewed-on: https://go-review.googlesource.com/12060
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-12 10:23:06 +00:00
Brad Fitzpatrick
783297ad6a all: link to https for golang subdomains too
The previous commit (git 2ae77376) just did golang.org.  This one
includes golang.org subdomains like blog, play, and build.

Change-Id: I4469f7b307ae2a12ea89323422044e604c5133ae
Reviewed-on: https://go-review.googlesource.com/12071
Reviewed-by: Rob Pike <r@golang.org>
2015-07-12 04:42:40 +00:00
Keith Randall
accf9b5951 [dev.ssa] cmd/compile/internal/ssa: comment why replacing phi with copy is ok
Change-Id: I3e2e8862f2fde4349923016b97e8330b0d494e0e
Reviewed-on: https://go-review.googlesource.com/12092
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-07-12 04:39:44 +00:00
Brad Fitzpatrick
d9c72d739c [dev.ssa] cmd/compile: implement ONOT
Co-hacking with josharian at Gophercon.

Change-Id: Ia59dfab676c6ed598c2c25483439cd1395a4ea87
Reviewed-on: https://go-review.googlesource.com/12029
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-12 04:30:03 +00:00
Brad Fitzpatrick
7af53d98cf [dev.ssa] cmd/compile: implement OCAP
And dependent fixes and misc cleanup.

Co-hacking with josharian at Gophercon.

Change-Id: Ib85dc13b303929017eb0a4d2fc2f603485f7479b
Reviewed-on: https://go-review.googlesource.com/12027
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-12 04:14:58 +00:00
Keith Randall
050ce4390a [dev.ssa] cmd/compile/internal/ssa: Phi inputs from dead blocks are not live
Fixes #11676

Change-Id: I941f951633c89bb1454ce6d1d1b4124d46a7d9dd
Reviewed-on: https://go-review.googlesource.com/12091
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-11 22:45:14 +00:00
ALTree
7a982e3c49 [dev.ssa] cmd/compile/ssa: Replace less-or-equal with equal in len comparison with zero
Since the spec guarantees than 0 <= len always:

https://golang.org/ref/spec#Length_and_capacity

replace len(...) <= 0 check with len(...) == 0 check

Change-Id: I5517a9cb6b190f0b1ee314a67487477435f3b409
Reviewed-on: https://go-review.googlesource.com/12034
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-11 19:38:57 +00:00
Keith Randall
06f329220f [dev.ssa] cmd/compile/internal/ssa: Use Ninit from expressions
If an expression has an Ninit list, generate code for it.
Required for (at least) OANDAND.

Change-Id: I94c9e22e2a76955736f4a8e574d92711419c5e5c
Reviewed-on: https://go-review.googlesource.com/12072
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-11 19:32:35 +00:00
Brad Fitzpatrick
2ae77376f7 all: link to https instead of http
The one in misc/makerelease/makerelease.go is particularly bad and
probably warrants rotating our keys.

I didn't update old weekly notes, and reverted some changes involving
test code for now, since we're late in the Go 1.5 freeze. Otherwise,
the rest are all auto-generated changes, and all manually reviewed.

Change-Id: Ia2753576ab5d64826a167d259f48a2f50508792d
Reviewed-on: https://go-review.googlesource.com/12048
Reviewed-by: Rob Pike <r@golang.org>
2015-07-11 14:36:33 +00:00
Josh Bleecher Snyder
9b048527db [dev.ssa] cmd/compile/ssa: handle nested dead blocks
removePredecessor can change which blocks are live.
However, it cannot remove dead blocks from the function's
slice of blocks because removePredecessor may have been
called from within a function doing a walk of the blocks.

CL 11879 did not handle this correctly and broke the build.

To fix this, mark the block as dead but leave its actual
removal for a deadcode pass. Blocks that are dead must have
no successors, predecessors, values, or control values,
so they will generally be ignored by other passes.
To be safe, we add a deadcode pass after the opt pass,
which is the only other pass that calls removePredecessor.

Two alternatives that I considered and discarded:

(1) Make all call sites aware of the fact that removePrecessor
might make arbitrary changes to the list of blocks. This
will needlessly complicate callers.

(2) Handle the things that can go wrong in practice when
we encounter a dead-but-not-removed block. CL 11930 takes
this approach (and the tests are stolen from that CL).
However, this is just patching over the problem.

Change-Id: Icf0687b0a8148ce5e96b2988b668804411b05bd8
Reviewed-on: https://go-review.googlesource.com/12004
Reviewed-by: Todd Neal <todd@tneal.org>
Reviewed-by: Michael Matloob <michaelmatloob@gmail.com>
2015-07-11 00:08:50 +00:00
Josh Bleecher Snyder
9201c86b57 [dev.ssa] cmd/compile/ssa: print lazily
Reduces 'go run run.go 64bit.go' from 23s to 8s on my machine.

Change-Id: Ie5b642d0abb56e8eb3899d69472bc88a85a1c985
Reviewed-on: https://go-review.googlesource.com/12023
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-11 00:07:52 +00:00
Matthew Dempsky
1082e2390e cmd/link/internal/ld: stricter object file decoding
Instead of silently truncating integers to their expected range, check
that they're within range and emit errors if not.  Intended to help
narrow down the cause of issue #11617.

Change-Id: Ia7b577270f8438ca7479262702371e26277f1ea7
Reviewed-on: https://go-review.googlesource.com/12050
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-10 22:01:54 +00:00
Ian Lance Taylor
6a90b1d621 runtime, cmd/go: fix tests to work when GOROOT_FINAL is set
When GOROOT_FINAL is set when running all.bash, the tests are run
before the files are copied to GOROOT_FINAL.  The tests are run with
GOROOT set, so most work fine.  This fixes two cases that do not.

In cmd/go/go_test.go we were explicitly removing GOROOT from the
environment, causing tests that did not themselves explicitly set
GOROOT to fail.  There was no need to explicitly remove GOROOT, so
don't do it.  If people choose to run "go test cmd/go" with a bad
GOROOT, that is their own lookout.

In the runtime GDB test, the linker has told gdb to find the support
script in GOROOT_FINAL, which will fail.  Check for that case, and
skip the test when we see it.

Fixes #11652.

Change-Id: I4d3a32311e3973c30fd8a79551aaeab6789d0451
Reviewed-on: https://go-review.googlesource.com/12021
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-10 21:29:37 +00:00
Rob Pike
a625b91916 cmd/doc: submit to the punched card tyranny
People use 80-column terminals because their grandparents used
punched cards. When I last used a punched card, in 1978, it seemed
antiquated even then. But today, people still set their terminal
widths to 80 to honor the struggles their fallen ancestors made to
endure this painful technology.

We must all stand and salute the 80 column flag, or risk the opprobium
of our peers.

For Pete's sake, I don't even use a fixed-width font. I don't even
believe in columns.

Fixes #11639 with extreme reluctance.

P.S. To avoid the horror of an automatically folded line of text, this commit message has been formatted to fit on an 80-column line, except for this postscript.

Change-Id: Ia2eb2dcf293dabe804c22ee5abb4bbb703f45c33
Reviewed-on: https://go-review.googlesource.com/12011
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-10 03:52:48 +00:00
Josh Bleecher Snyder
5173868325 [dev.ssa] cmd/compile/ssa: place for loop incr in a separate block
This is a prerequisite for implementing break and continue;
blocks ending in break or continue need to have
the increment block as a successor.

While we're here, implement for loops with no condition.

Change-Id: I85d8ba020628d805bfd0bd583dfd16e1be6f6fae
Reviewed-on: https://go-review.googlesource.com/11941
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-10 03:39:20 +00:00
Rob Pike
91976aa676 cmd/doc: suppress symbols for commands when showing package docs
Change the default behavior when showing the package docs
for a command to elide the symbols. This makes

	go doc somecommand

show the top-level package docs only and hide the symbols,
which are probably irrelevant to the user. This has no effect
on explicit requests for internals, such as

	go doc somecommand.sometype

The new -cmd flag restores the old behavior.

Fixes #10733.

Change-Id: I4d363081fe7dabf76ec8e5315770ac3609592f80
Reviewed-on: https://go-review.googlesource.com/11953
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-09 04:09:00 +00:00
Rob Pike
1b74c71da5 cmd/asm: add copyright notices to tests
They were missing from the inputs.
Unfortunately this means the .out files all have wrong line numbers,
but they are easy to update.

Change-Id: I254742f24ab803421f34d52d13b9afa93674edd6
Reviewed-on: https://go-review.googlesource.com/11958
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-09 03:27:48 +00:00
Russ Cox
b6ead9f171 cmd/go: disable vendoredImportPath for code outside $GOPATH
It was crashing.
This fixes the build for
GO15VENDOREXPERIMENT=1 go test -short runtime

Fixes #11416.

Change-Id: I74a9114cdd8ebafcc9d2a6f40bf500db19c6e825
Reviewed-on: https://go-review.googlesource.com/11964
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-07 21:53:11 +00:00
Russ Cox
9f90f31c3a cmd/compile: allow static init for unsafe.Pointer(&x) where x is global
This avoids both a write barrier and then dynamic initialization
globals of the form

	var x something
	var xp = unsafe.Pointer(&x)

Using static initialization avoids emitting a relocation for &x,
which helps cgo.

Fixes #9411.

Change-Id: I0dbf480859cce6ab57ab805d1b8609c45b48f156
Reviewed-on: https://go-review.googlesource.com/11693
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
2015-07-07 21:51:57 +00:00
David Chase
7929a0ddfa cmd/compile: initialize line number properly for temporaries
The expansion of structure, array, slice, and map literals
does not use the right line number in its introduced assignments
to temporaries, which leads to incorrect line number attribution
for expressions in those literals.

Inlining also incorrectly replaced the line numbers of args to
inlined functions.

This was revealed in CL 9721 because a now-avoided temporary
assignment introduced the correct line number.
I.e. before CL 9721
  "tmp_wrongline := expr"
was transformed to
  "tmp_rightline := expr; tmp_wrongline := tmp_rightline"

Also includes a repair to CL 10334 involving line numbers
where a spurious -1 remained (should have been 0, now is 0).

Fixes #11400.

Change-Id: I3a4687efe463977fa1e2c996606f4d91aaf22722
Reviewed-on: https://go-review.googlesource.com/11730
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Sameer Ajmani <sameer@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-07 21:30:59 +00:00
Daniel Theophanes
0409158cd0 cmd/go: ignore volume name case when checking vendor path
Fixes #11409

Change-Id: Ic1610e124b2d8b2b12310fc9538d5078cc7302a0
Reviewed-on: https://go-review.googlesource.com/11316
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-07 21:02:17 +00:00
Ross Light
11a19ae8da cmd/go: create executable when installing to working directory
Fixes #11065.

Change-Id: Idd854facd5fa78c0334f86740f351d404f9a5b2d
Reviewed-on: https://go-review.googlesource.com/11511
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-07 21:00:44 +00:00
Daniel Theophanes
06b280214c cmd/go: do not panic on invalid import path containing "/vendor/"
Fixes #11414

Change-Id: I45a41b98554f00362d9222e9c68a441dbfc23cb8
Reviewed-on: https://go-review.googlesource.com/11700
Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-07 21:00:01 +00:00
Todd Neal
41dafe6ecc [dev.ssa] cmd/compile/ssa: dominator tests and benchmarks
This change has some tests verifying functionality and an assortment of
benchmarks of various block lists. It modifies NewBlock to allocate in
contiguous blocks improving the performance of intersect() for extremely
large graphs by 30-40%.

benchmark                           old ns/op      new ns/op     delta
BenchmarkDominatorsLinear-8         1185619        901154        -23.99%
BenchmarkDominatorsFwdBack-8        1302138        863537        -33.68%
BenchmarkDominatorsManyPred-8       404670521      247450911     -38.85%
BenchmarkDominatorsMaxPred-8        455809002      471675119     +3.48%
BenchmarkDominatorsMaxPredVal-8     819315864      468257300     -42.85%

BenchmarkNilCheckDeep1-8            766            706           -7.83%
BenchmarkNilCheckDeep10-8           2553           2209          -13.47%
BenchmarkNilCheckDeep100-8          58606          57545         -1.81%
BenchmarkNilCheckDeep1000-8         7753012        8025750       +3.52%
BenchmarkNilCheckDeep10000-8        1224165946     789995184     -35.47%

Change-Id: Id3d6bc9cb1138e8177934441073ac7873ddf7ade
Reviewed-on: https://go-review.googlesource.com/11716
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-07 19:42:35 +00:00
Josh Bleecher Snyder
7d10a2c04a [dev.ssa] cmd/compile/ssa: implement constant booleans
The removal of if false { ... } blocks in the opt
pass exposed that removePredecessor needed
to do more cleaning, on pain of failing later
consistency checks.

Change-Id: I45d4ff7e1f7f1486fdd99f867867ce6ea006a288
Reviewed-on: https://go-review.googlesource.com/11879
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-06 21:54:10 +00:00
Rob Pike
173fa1d809 cmd/go: delete references to old tools (5a etc.) from cmd/go docs
Don't talk about commands that no longer exist.

There are still references throughout the tree, mostly in comments,
but they provide a charming historical backdrop for the idle tourist.

Change-Id: I637ebdce05bbc7df5addcc46cb772d2bb9f3e073
Reviewed-on: https://go-review.googlesource.com/11885
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-05 06:25:51 +00:00
Josh Bleecher Snyder
cc3f031a31 [dev.ssa] cmd/compile/ssa: implement OLEN
Change-Id: Ie23b13142fd820d7071a348a8370175e58b76d64
Reviewed-on: https://go-review.googlesource.com/11878
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-05 03:52:56 +00:00
Josh Bleecher Snyder
6c14059e65 [dev.ssa] cmd/compile/ssa: handle loops that don't loop
Loops such as

func f(c chan int) int {
	for x := range c {
		return x
	}
	return 0
}

don't loop. Remove the assumption that they must.

Partly fixes the build.

Change-Id: I766cebeec8e36d14512bea26f54c06c8eaf95e23
Reviewed-on: https://go-review.googlesource.com/11876
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-05 03:52:34 +00:00
Josh Bleecher Snyder
d465f049cd [dev.ssa] cmd/compile/ssa: stop compilation immediately on leading goto
There is clearly work to do to fix labels and gotos.
The compiler currently hangs on ken/label.go.

For the moment, stop the bleeding.

Fixes the build.

Change-Id: Ib68360d583cf53e1a8ca4acff50644b570382728
Reviewed-on: https://go-review.googlesource.com/11877
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-05 03:51:44 +00:00
Josh Bleecher Snyder
0a133cddd5 [dev.ssa] cmd/compile/ssa: mark race/nodfp as unimplemented
Partly fixes the build, by punting.
Other things have broken in the meantime.

Change-Id: I1e2b8310057cbbbd9ffc501ef51e744690e00726
Reviewed-on: https://go-review.googlesource.com/11875
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-05 03:50:17 +00:00
Josh Bleecher Snyder
1edf4897df [dev.ssa] cmd/compile/ssa: add Logf state helper
Change-Id: I4e4200b0fa847a1ff8a8b7d1e318bbc1c5e26b5b
Reviewed-on: https://go-review.googlesource.com/11874
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-05 03:36:56 +00:00
Dmitry Vyukov
11f50f41ee cmd/trace: log errors to console in AJAX handler
Fixes #11508

Change-Id: I72e83893b76f75685d6edfe65ca6691d97539226
Reviewed-on: https://go-review.googlesource.com/11864
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-02 19:10:00 +00:00
Daniel Morsing
be2a3e2ac9 [dev.ssa] cmd/compile/internal/gc: mark unimplemented variable classes as such
Doesn't fix the build entirely, but does make it get to the race
detector tests.

Change-Id: Ie986d52374936855b7ee975dc68742306527eb15
Reviewed-on: https://go-review.googlesource.com/11835
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-02 08:29:33 +00:00
Josh Bleecher Snyder
596ddf4368 [dev.ssa] cmd/compile/ssa: add checks for nil args in values
These additional checks were useful in
tracking down the broken build (CL 11238).

This CL does not fix the build, sadly.

Change-Id: I34de3bed223f450aaa97c1cadaba2e4e5850050b
Reviewed-on: https://go-review.googlesource.com/11681
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-01 16:10:38 +00:00
Daniel Morsing
66b47812eb [dev.ssa] cmd/compile/internal/ssa: Initial implementation of memory zeroing
This will make it possible for us to start implementing interfaces
and other stack allocated types which are more than one machine word.

Change-Id: I52b187a791cf1919cb70ed6dabdc9f57b317ea83
Reviewed-on: https://go-review.googlesource.com/11631
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-01 15:47:41 +00:00
Dmitry Vyukov
1cbbd7f545 cmd/trace: fix time scale
Integrate the latest trace-viewer changes.
It now handles nanoseconds without any issues (thanks to @egonelbre!).
So change timestamps from microseconds to nanoseconds.

Change-Id: I010f27effde7e80c9992e6f276f6912354d27df4
Reviewed-on: https://go-review.googlesource.com/11244
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Egon Elbre <egonelbre@gmail.com>
2015-07-01 10:37:10 +00:00
Keith Randall
c9372619f2 [dev.ssa] cmd/compile/internal/gc: fix stringsym call
Forgot to add this in the tip merge.

Change-Id: I0e5a2681133f4ae7a7c360ae2c2d71d46420c693
Reviewed-on: https://go-review.googlesource.com/11793
Reviewed-by: Keith Randall <khr@golang.org>
2015-07-01 04:18:52 +00:00
Keith Randall
90b0a93244 [dev.ssa] Merge remote-tracking branch 'origin/master' into ssamerge
Semi-regular merge from tip into ssa branch.

Change-Id: I9cbe23f566410496d4ceb97c1435e2df7f2b56ec
2015-06-30 21:11:33 -07:00
Russ Cox
6f80e5edf4 cmd/link: reject data size > 2 GB
We can't address more than this on amd64 anyway.

Fixes #9862.

Change-Id: Ifb1abae558e2e1ee2dc953a76995f3f08c60b1df
Reviewed-on: https://go-review.googlesource.com/11715
Reviewed-by: Austin Clements <austin@google.com>
2015-06-30 19:40:39 +00:00
Russ Cox
e8f2eb4349 cmd/compile: allow linker to drop string headers when not needed
Compiling a simple file containing a slice of 100,000 strings,
the size of the resulting binary dropped from 5,896,224 bytes
to 3,495,968 bytes, which is the expected 2,400,000 bytes,
give or take.

Fixes #7384.

Change-Id: I3e551b5a1395b523a41b33518d81a1bf28da0906
Reviewed-on: https://go-review.googlesource.com/11698
Reviewed-by: Austin Clements <austin@google.com>
2015-06-30 19:27:52 +00:00
Russ Cox
3b6e86f48a cmd/compile: fix race detector handling of OBLOCK nodes
Fixes #7561 correctly.
Fixes #9137.

Change-Id: I7f27e199d7101b785a7645f789e8fe41a405a86f
Reviewed-on: https://go-review.googlesource.com/11713
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-06-30 19:25:18 +00:00
Dmitry Vyukov
8884fa7476 cmd/trace: sort procs
If you have more than 10 procs, then currently they are sorted alphabetically as
0, 10, 11, ..., 19, 2, 20, ...
Assign explicit order to procs so that they are sorted numerically.

Change-Id: I6d978d2cd439aa2fcbcf147842a643f9073eef75
Reviewed-on: https://go-review.googlesource.com/11750
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-30 16:50:57 +00:00
Dmitry Vyukov
19b8aa3b5d cmd/compile/internal/gc: give OASWB name
Change-Id: Iacb84421215ca80c7add2818118b2af1a650fd58
Reviewed-on: https://go-review.googlesource.com/11639
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-30 15:51:59 +00:00
Andrew Gerrand
ab9c25f2de cmd/go: use GOOS and GOARCH from build context for "go generate"
Fixes #11438

Change-Id: Iedd31918aa5187fc3fdaed71c8dad82075559084
Reviewed-on: https://go-review.googlesource.com/11667
Reviewed-by: Rob Pike <r@golang.org>
2015-06-30 06:52:47 +00:00
Russ Cox
1122836b5f cmd/compile: reject large floating point exponents without math/big
For #11326 (but not a fix).

Change-Id: Ic51814f5cd7357427c3fd990a5522775d05e7987
Reviewed-on: https://go-review.googlesource.com/11673
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-06-29 21:18:01 +00:00
Russ Cox
69f0d4c6be cmd/link: detect -X setting non-string variable
Fixes #9621.

Change-Id: Ib9c6001378364af899f57fd4b89fb23af2042923
Reviewed-on: https://go-review.googlesource.com/11694
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2015-06-29 20:28:36 +00:00
Russ Cox
34846aef78 cmd/link: fix -s with external linking
This code used to only be run for ELF, with the predictable
result that using -s with external linking broke on Windows and OS X.
Moving it here should fix Windows and does fix OS X.

CL 10835 also claims to fix the crash on Windows.
I don't know whether it does so correctly, but regardless,
this CL should make that one a no-op.

Fixes #10254.

Change-Id: I2e7b45ab0c28568ddbb1b50581dcc157ae0e7ffe
Reviewed-on: https://go-review.googlesource.com/11695
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-29 19:49:38 +00:00
Russ Cox
27edd7209e cmd/compile: enable PAUTO capture variables on arch != 6
Fixes #9865.

Change-Id: I8ce5b1708ed938910c59899706e470271c2e7e9d
Reviewed-on: https://go-review.googlesource.com/11699
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-29 19:49:18 +00:00
Tom Heng
162d2c1608 cmd/go: 'go env' print GO15VENDOREXPERIMENT in Go1.5
Fixes #11410

Change-Id: I9d01be3e01f74f4b12a516aba8a5d20d9b277ec6
Reviewed-on: https://go-review.googlesource.com/11539
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-29 19:29:01 +00:00
Russ Cox
5267bf075b cmd/go: disable TestIssue10952 without external network
Should fix arm64 build failure.

Change-Id: Ib35e4a69a1082e461a1eddf3265544a1d2ff98e5
Reviewed-on: https://go-review.googlesource.com/11710
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-29 18:00:07 +00:00
Russ Cox
55203c7dd5 cmd/compile: allow unnamed constants to set line number
Fixes #8836.

Change-Id: Idda9f4a987e03b3bdf5e8fdb984fe56d6f84aa59
Reviewed-on: https://go-review.googlesource.com/11672
Reviewed-by: David Chase <drchase@google.com>
2015-06-29 17:35:55 +00:00
Josh Bleecher Snyder
46815b9f62 [dev.ssa] cmd/compile/ssa: add comparison ops
Increase SSA coverage of functions in the
standard library from 20.79% to 27.81%.

The most significant unimplemented items are now:

 10.16%  2597 SSA unimplemented: zero for type error not implemented
  8.44%  2157 SSA unimplemented: addr: bad op DOTPTR
  7.98%  2039 SSA unimplemented: unhandled OLITERAL 7
  6.29%  1607 SSA unimplemented: unhandled expr OROR
  4.73%  1209 SSA unimplemented: unhandled expr LEN
  4.55%  1163 SSA unimplemented: unhandled expr LROT
  3.42%   874 SSA unimplemented: unhandled OLITERAL 6
  2.46%   629 SSA unimplemented: unhandled expr DOT
  2.41%   615 SSA unimplemented: zero for type []byte not implemented
  2.02%   516 SSA unimplemented: unhandled stmt CALLMETH
  1.90%   486 SSA unimplemented: unhandled expr ANDAND
  1.79%   458 SSA unimplemented: unhandled expr CALLINTER
  1.69%   433 SSA unimplemented: unhandled stmt SWITCH
  1.67%   428 SSA unimplemented: unhandled expr CALLMETH
  1.67%   426 SSA unimplemented: unhandled expr CLOSUREVAR

Change-Id: I40959b22993c4f70784b4eca472cae752347879c
Reviewed-on: https://go-review.googlesource.com/11452
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-29 16:26:35 +00:00
Russ Cox
434e0bc0a0 cmd/link: record missing pcdata tables correctly
The old code was recording the current table output offset,
so the table from the next function would be used instead of
the runtime realizing that there was no table at all.

Add debug constant in runtime to check this for every function
at startup. It's too expensive to do that by default, but we can
do the last five functions. The end of the table is usually where
the C symbols end up, so that's where the problems typically are.

Fixes #10747.
Fixes #11396.

Change-Id: I13592e78017969fc22979fa902e19e1b151d41b1
Reviewed-on: https://go-review.googlesource.com/11657
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2015-06-29 16:07:14 +00:00
Russ Cox
4e61c516f4 cmd/cgo: fix a problem with 'go build -compiler gccgo'
Port of https://golang.org/cl/154360045 to Git.
Original author is Xia Bin <snyh@snyh.org> (already a contributor).

Fixes #8945.

Change-Id: I28bcaf3348794202ca59fbc3466bd7b9670030e4
Reviewed-on: https://go-review.googlesource.com/11658
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-29 15:15:59 +00:00
Josh Bleecher Snyder
1746e711ad [dev.ssa] cmd/compile/ssa: add nilcheckelim benchmarks
These benchmarks demonstrate that
the nilcheckelim pass is roughly O(n^2):

BenchmarkNilCheckDeep1    	 2000000	       741 ns/op	   1.35 MB/s
BenchmarkNilCheckDeep10   	 1000000	      2237 ns/op	   4.47 MB/s
BenchmarkNilCheckDeep100  	   20000	     60713 ns/op	   1.65 MB/s
BenchmarkNilCheckDeep1000 	     200	   7925198 ns/op	   0.13 MB/s
BenchmarkNilCheckDeep10000	       1	1220104252 ns/op	   0.01 MB/s

Profiling suggests that building the
dominator tree is also O(n^2),
and before size factors take over,
considerably more expensive than nilcheckelim.

Change-Id: If966b38ec52243a25f355dab871300d29db02e16
Reviewed-on: https://go-review.googlesource.com/11520
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-29 04:07:11 +00:00
Josh Bleecher Snyder
d9a704cd40 [dev.ssa] cmd/compile/ssa: refine type equality in cse
The correct way to compare gc.Types is Eqtype,
rather than pointer equality.
Introduce an Equal method for ssa.Type to allow
us to use it.

In the cse pass, use a type's string to build
the coarse partition, and then use Type.Equal
during refinement.

This lets the cse pass do a better job.
In the ~20% of the standard library that SSA
can compile, the number of common subexpressions
recognized by the cse pass increases from
27,550 to 32,199 (+17%). The number of nil checks
eliminated increases from 75 to 115 (+50%).

Change-Id: I0bdbfcf613ca6bc2ec987eb19b6b1217b51f3008
Reviewed-on: https://go-review.googlesource.com/11451
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-29 03:27:30 +00:00
Keith Randall
214c7a2c43 cmd/link/internal/ld: exclude only real container symbols from symtab
It looks like the test for whether symbols contain subsymbols is wrong.
In particular, symbols in C libraries are mistakenly considered container
symbols.

Fix the test so only symbols which actually have a subsymbol
are excluded from the symtab.  When linking cgo programs the list
of containers is small, something like:

container _/home/khr/sandbox/symtab/misc/cgo/test(.text)<74>
container _/home/khr/sandbox/symtab/misc/cgo/test/issue8828(.text)<75>
container _/home/khr/sandbox/symtab/misc/cgo/test/issue9026(.text)<76>
container runtime/cgo(.text)<77>

I'm not sure this is the right fix.  In particular I can't reproduce
the original problem.  Anyone have a repro they can try and see if
this fix works?

Fixes #10747
Fixes #11396

Change-Id: Id8b016389d33348b4a791fdcba0f9db8ae71ebf3
Reviewed-on: https://go-review.googlesource.com/11652
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-29 02:54:09 +00:00
Keith Randall
dbd83c4464 [dev.ssa] cmd/compile/internal/gc: Fix constant shift generation
Change-Id: Ib142185de3f6e4d2f4983511c063492529d8fb8a
Reviewed-on: https://go-review.googlesource.com/11656
Reviewed-by: Michael Matloob <michaelmatloob@gmail.com>
2015-06-29 02:10:44 +00:00
Alex Brainman
3b7841b3af cmd/go: reset read-only flag during TestIssue10952
git sets read-only flag on all its repo files on Windows.
os.Remove cannot delete these files.

Fixes windows build

Change-Id: Icaf72470456b88a1c26295caecd4e0d3dc22a1b6
Reviewed-on: https://go-review.googlesource.com/11602
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-06-29 01:49:05 +00:00
David Crawshaw
58578de0dc cmd/link: no dwarf on darwin/arm
Partial revert of cl/10284 to get -buildmode=c-archive working for
darwin/arm.

Manually tested with iostest.bash while builder is offline.

Change-Id: I98e4e209765666e320e680e11151fce59e2afde9
Reviewed-on: https://go-review.googlesource.com/11306
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
2015-06-27 21:32:38 +00:00
Ross Light
64078bf3cf cmd/go: ignore custom import check when there is no import comment
Fixes #10952

Change-Id: I56ab6a806bd3741cffd9d2a53929a6d043626a26
Reviewed-on: https://go-review.googlesource.com/10693
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-27 19:06:56 +00:00
Tamir Duberstein
a444da033c cmd/go: fetch git submodules in go get
Change createCmd, downloadCmd, tagSyncCmd, tagSyncDefault to allow
multiple commands.

When using the vendoring experiment, fetch git submodules in `go get`,
and update them in `go get -u`.

This is a reincarnation of https://codereview.appspot.com/142180043.

For #7764.

Change-Id: I8248efb851130620ef762a765ab8716af430572a
Reviewed-on: https://go-review.googlesource.com/9815
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-27 18:52:53 +00:00
Alex Brainman
ebfc5be5b9 cmd/go: adjust TestFileLineInErrorMessages
cmd/go sometimes returns relative path in the error message
(see shortPath function). Account for that during
TestFileLineInErrorMessages.

Fixes #11355

Change-Id: Ica79359eab48d669d307449fdd458764895fab2c
Reviewed-on: https://go-review.googlesource.com/11475
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-27 18:43:45 +00:00
c9s
29ff86b05b cmd/go: handle error when git remote origin doesn't exist
- Let runOutput return the error message
- When `git config ...` returns empty buffer, it means the config key is
  correct, but there is no corresponding value.
- Return the correct error when the url of remote origin is not found.
- Update error message

Fixes: #10922

Change-Id: I3f8880f6717a4f079b840d1249174378d36bca1b
Reviewed-on: https://go-review.googlesource.com/10475
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-27 18:43:15 +00:00
Rob Pike
aea348a3af cmd/asm: add tests for erroneous expressions
Also add a couple more errors, such as modulo with a zero divisor.

Change-Id: If24c95477f7ae86cf4aef5b3460e9ec249ea5ae2
Reviewed-on: https://go-review.googlesource.com/11535
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-26 23:33:39 +00:00
Russ Cox
32fddadd98 runtime: reduce slice growth during append to 2x
The new inlined code for append assumed that it could pass the
desired new cap to growslice, not the number of new elements.
But growslice still interpreted the argument as the number of new elements,
making it always grow by >2x (more precisely, 2x+1 rounded up
to the next malloc block size). At the time, I had intended to change
the other callers to use the new cap as well, but it's too late for that.
Instead, introduce growslice_n for the old callers and keep growslice
for the inlined (common case) caller.

Fixes #11403.

Filed #11419 to merge them.

Change-Id: I1338b1e5b352f3be4e43641f44b652ef7195251b
Reviewed-on: https://go-review.googlesource.com/11541
Reviewed-by: Austin Clements <austin@google.com>
2015-06-26 17:49:33 +00:00
Todd Neal
765c0f37ed cmd/compile: fix half multiply issue
In walkdiv, an OMUL node was created and passed to typecheck,
before the op was changed back to OHMUL.  In some instances,
the node that came back was an evaluated literal constant that
occurred with a full multiply.  The end result was a literal node
with a non-shifted value and an OHMUL op. This change causes code
to be generated for the OHMUL.

Fixes #11358
Fixes #11369

Change-Id: If42a98c6830d07fe065d5ca57717704fb8cfbd33
Reviewed-on: https://go-review.googlesource.com/11400
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-26 15:55:22 +00:00
Dmitry Vyukov
cd0a8ed48a cmd/compile: add instrumentation of OKEY
Instrument operands of OKEY.
Also instrument OSLICESTR. Previously it was not needed
because of preceeding bounds checks (which were instrumented).
But the preceeding bounds checks have disappeared.

Change-Id: I3b0de213e23cbcf5b8ef800abeded5eeeb3f8287
Reviewed-on: https://go-review.googlesource.com/11417
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-26 15:54:03 +00:00
Keith Randall
7b858018b3 [dev.ssa] cmd/compile/internal/gc: Interpret init list of OFOR conditions
Fixes build.  Some variables are initialized in this list.

Q: How do we tell that we've included all the required Ninit lists?

Change-Id: I96b3f03c291440130303a2b95a651e97e4d8113c
Reviewed-on: https://go-review.googlesource.com/11542
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-26 04:08:44 +00:00
Aaron Jacobs
8628688304 Fix several out of date references to 4g/5g/6g/8g/9g.
Change-Id: Ifb8e4e13c7778a7c0113190051415e096f5db94f
Reviewed-on: https://go-review.googlesource.com/11390
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-26 03:38:21 +00:00
Todd Neal
929c2aa2ae [dev.ssa] cmd/compile/ssa: fix unit tests
Fix out of bounds array panic due to CL 11238.

Change-Id: Id8a46f1ee20cb1f46775d0c04cc4944d729dfceb
Reviewed-on: https://go-review.googlesource.com/11540
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-26 02:25:57 +00:00
Keith Randall
8c46aa5481 [dev.ssa] cmd/compile/internal/ssa: Handle variables correctly
Use *Node of type ONAME instead of string as the key for variable maps.
This will prevent aliasing between two identically named but
differently scoped variables.

Introduce an Aux value that encodes the offset of a variable
from a base pointer (either global base pointer or stack pointer).

Allow LEAQ and derivatives (MOVQ, etc.) to also have such an Aux field.

Allocate space for AUTO variables in stackalloc.

Change-Id: Ibdccdaea4bbc63a1f4882959ac374f2b467e3acd
Reviewed-on: https://go-review.googlesource.com/11238
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-25 17:54:18 +00:00
Keith Randall
dbe9ab69d9 cmd/compile/internal/gc: make sure nonzero-sized objects have nonzero alignment
See issue #11354.

Change-Id: I6817d499e6c02e4a9c83f80bc66a2bee368a69ec
Reviewed-on: https://go-review.googlesource.com/11406
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-25 02:22:58 +00:00
Russ Cox
66130907d1 cmd/compile: handle copy in escape analysis
Somehow we missed this!
Fixes #11387.

Change-Id: Ida08fe52eff7da2ef7765b4cf35a39a301420c43
Reviewed-on: https://go-review.googlesource.com/11460
Reviewed-by: David Chase <drchase@google.com>
2015-06-24 22:22:55 +00:00
Josh Bleecher Snyder
37ddc270ca [dev.ssa] cmd/compile/ssa: add -f suffix to logging methods
Requested in CL 11380.

Change-Id: Icf0d23fb8d383c76272401e363cc9b2169d11403
Reviewed-on: https://go-review.googlesource.com/11450
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-24 21:48:26 +00:00
Josh Bleecher Snyder
d779b20cd2 [dev.ssa] cmd/compile/ssa: improve comments, logging, and debug output
Change-Id: Id949db82ddaf802c1aa245a337081d4d46fd914f
Reviewed-on: https://go-review.googlesource.com/11380
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-24 20:44:57 +00:00
Josh Bleecher Snyder
44be0e9c60 [dev.ssa] cmd/compile/ssa: fix build
Somehow I missed this in CL 11160.
Without it, all.bash fails on fixedbugs/bug303.go.

The right fix is probably to discard the variable
and keep going, even though the code is dead.

For now, defer the decision by declaring
such situations unimplemented and get the build
fixed.

Change-Id: I679197f780c7a3d3eb7d05e91c86a4cdc3b70131
Reviewed-on: https://go-review.googlesource.com/11440
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-24 20:32:11 +00:00
Josh Bleecher Snyder
2a846d2bd3 [dev.ssa] cmd/compile/ssa: add nilcheckelim pass
The nilcheckelim pass eliminates unnecessary nil checks.
The initial implementation removes redundant nil checks.
See the comments in nilcheck.go for ideas for future
improvements.

The efficacy of the cse pass has a significant impact
on this efficacy of this pass.

There are 886 nil checks in the parts of the standard
library that SSA can currently compile (~20%).

This pass eliminates 75 (~8.5%) of them.

As a data point, with a more aggressive but unsound
cse pass that treats many more types as identical,
this pass eliminates 115 (~13%) of the nil checks.

Change-Id: I13e567a39f5f6909fc33434d55c17a7e3884a704
Reviewed-on: https://go-review.googlesource.com/11430
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-24 19:56:51 +00:00
Andrew Gerrand
5bf1853e59 cmd/go: don't fetch from insecure repositories without -insecure
Fixes #9637
Fixes #10120

Change-Id: I3728239089efb94d04cd4115c9f840afd7badeaf
Reviewed-on: https://go-review.googlesource.com/9715
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-24 06:36:07 +00:00
Rob Pike
989b372a5c cmd/asm: fix shifts again, this time for sure
There are two conditions to worry about:

1) The shift count cannot be negative. Since the evaluator uses unsigned
arithmetic throughout, this means checking that the high bit of
the shift count is always off, which is done by converting to int64
and seeing if the result is negative.

2) For right shifts, the value cannot be negative. We don't want a
high bit in the value because right shifting a value depends on the
sign, and for clarity we always want unsigned shifts.

Next step is to build some testing infrastructure for the parser.

Change-Id: I4c46c79989d02c107fc64954403fc18613763f1d
Reviewed-on: https://go-review.googlesource.com/11326
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-23 06:44:54 +00:00
Rob Pike
cb3e2bf0ba cmd/doc: fix copy/paste error in test
Some of those consts were supposed to be vars.

Caught by Ingo Oeser.

Change-Id: Ifc12e4a8ee61ebf5174e4ad923956c546dc096e2
Reviewed-on: https://go-review.googlesource.com/11296
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-22 22:29:35 +00:00
Rob Pike
58d177c63e cmd/asm: fix handling of negative shifts.
The change that "fixed" LSH was incorrect, and the fix for RSH was poor.
Make both use a correct, simple test: if the 64-bit value as a signed
integer is negative, it's an error.

Really fixes #11278.

Change-Id: I72cca03d7ad0d64fd649fa33a9ead2f31bd2977b
Reviewed-on: https://go-review.googlesource.com/11325
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-22 20:42:22 +00:00
Rob Pike
98c9e9e74f cmd/vet: refer info about -printfuncs to the -printf flag
And vice versa.

The flags are tightly coupled so make the connection clear.

Change-Id: I505f76be631ffa6e489a441c2f3c717aa09ec802
Reviewed-on: https://go-review.googlesource.com/11324
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-22 20:42:01 +00:00
Russ Cox
794c01b8b4 cmd/go: fix test for issue 8181
The test was translated from shell incorrectly,
and it depended on having hg installed, which
may not be the case.

Moved repo to GitHub, updated code, and fixed
go list ... command to be expected to succeed.

Fixes test for #8181.

Change-Id: I7f3e8fb20cd16cac5ed24de6fd952003bc5e08d4
Reviewed-on: https://go-review.googlesource.com/11301
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-22 16:44:46 +00:00
Rob Pike
71859efceb cmd/asm: remove needless check for negative right shift
In the parser, the shift value is always a uint64.

Change-Id: I9b50295a9f7d174ed1f6f9baf78ec0ed43db417f
Reviewed-on: https://go-review.googlesource.com/11322
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-22 06:57:19 +00:00
Rob Pike
3cab4760d5 cmd/asm: remove pointless check for negative uint
Fixes #11278.

Change-Id: Ic46fda0f42cefedc3f6085c0e77e67616ce4955e
Reviewed-on: https://go-review.googlesource.com/11297
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-21 03:11:01 +00:00
Josh Bleecher Snyder
8c6abfeacb [dev.ssa] cmd/compile/ssa: separate logging, work in progress, and fatal errors
The SSA implementation logs for three purposes:

	* debug logging
	* fatal errors
	* unimplemented features

Separating these three uses lets us attempt an SSA
implementation for all functions, not just
_ssa functions. This turns the entire standard
library into a compilation test, and makes it
easy to figure out things like
"how much coverage does SSA have now" and
"what should we do next to get more coverage?".

Functions called _ssa are still special.
They log profusely by default and
the output of the SSA implementation
is used. For all other functions,
logging is off, and the implementation
is built and discarded, due to lack of
support for the runtime.

While we're here, fix a few minor bugs and
add some extra Unimplementeds to allow
all.bash to pass.

As of now, SSA handles 20.79% of the functions
in the standard library (689 of 3314).

The top missing features are:

 10.03%  2597 SSA unimplemented: zero for type error not implemented
  7.79%  2016 SSA unimplemented: addr: bad op DOTPTR
  7.33%  1898 SSA unimplemented: unhandled expr EQ
  6.10%  1579 SSA unimplemented: unhandled expr OROR
  4.91%  1271 SSA unimplemented: unhandled expr NE
  4.49%  1163 SSA unimplemented: unhandled expr LROT
  4.00%  1036 SSA unimplemented: unhandled expr LEN
  3.56%   923 SSA unimplemented: unhandled stmt CALLFUNC
  2.37%   615 SSA unimplemented: zero for type []byte not implemented
  1.90%   492 SSA unimplemented: unhandled stmt CALLMETH
  1.74%   450 SSA unimplemented: unhandled expr CALLINTER
  1.74%   450 SSA unimplemented: unhandled expr DOT
  1.71%   444 SSA unimplemented: unhandled expr ANDAND
  1.65%   426 SSA unimplemented: unhandled expr CLOSUREVAR
  1.54%   400 SSA unimplemented: unhandled expr CALLMETH
  1.51%   390 SSA unimplemented: unhandled stmt SWITCH
  1.47%   380 SSA unimplemented: unhandled expr CONV
  1.33%   345 SSA unimplemented: addr: bad op *
  1.30%   336 SSA unimplemented: unhandled OLITERAL 6

Change-Id: I4ca07951e276714dc13c31de28640aead17a1be7
Reviewed-on: https://go-review.googlesource.com/11160
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-21 02:56:36 +00:00
Rob Pike
13c44d27b7 cmd/doc: add test for constructor, fix build
Most important: skip test on darwin/arm64 for unclear reasons.

First cut at the test missed this feature of go doc: when asking for
the docs for a type, include any function that looks like it constructs
a that type as a return value.

Change-Id: I124e7695e5d365e2b12524b541a9a4e6e0300fbc
Reviewed-on: https://go-review.googlesource.com/11295
Reviewed-by: Rob Pike <r@golang.org>
2015-06-20 10:35:38 +00:00
Rob Pike
2f2908bec3 cmd/doc: fix test on nacl
nacl is really giving a hard time. avoid all external dependencies in the test.
Worked with trybots, failed in the build. No explanation, but this should fix it.

TBR=rsc

Change-Id: Icb644286dbce88f17ee3d96ad90efba34a80a92d
Reviewed-on: https://go-review.googlesource.com/11291
Reviewed-by: Rob Pike <r@golang.org>
2015-06-19 22:13:20 +00:00
Rob Pike
d0652e7f82 cmd/doc: add test
Refactor main a bit to make it possible to run tests without an exec every time.
(Makes a huge difference in run time.)

Add a silver test. Not quite golden, since it looks for pieces rather than the
full output, and also includes tests for what should not appear.

Fixes #10920.

Change-Id: I6a4951cc14e61763379754a10b0cc3484d30c267
Reviewed-on: https://go-review.googlesource.com/11272
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
2015-06-19 21:56:59 +00:00
Srdjan Petrovic
cc6554f750 cmd/link/internal/ld, cmd/go: -buildmode=c-shared support for darwin/amd64
All of the heavy-lifting was done by minux@, with his external-linking support
for darwin/arm64: golang.org/cl/8781

Change-Id: I7c9fbc19246f418c065c92fb2c13c00026ff0f82
Reviewed-on: https://go-review.googlesource.com/11127
Run-TryBot: Srdjan Petrovic <spetrovic@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-19 20:28:01 +00:00
Russ Cox
dc89350fed cmd/go: fix build
Change-Id: Ia13d1fa450e88e278b81048b99686395ca474c99
Reviewed-on: https://go-review.googlesource.com/11259
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-19 20:05:31 +00:00
Russ Cox
183cc0cd41 cmd/go: add preliminary support for vendor directories
When GO15VENDOREXPERIMENT=1 is in the environment,
this CL changes the resolution of import paths according to
the Go 1.5 vendor proposal:

	If there is a source directory d/vendor, then,
	when compiling a source file within the subtree rooted at d,
	import "p" is interpreted as import "d/vendor/p" if that exists.

	When there are multiple possible resolutions,
	the most specific (longest) path wins.

	The short form must always be used: no import path can
	contain “/vendor/” explicitly.

	Import comments are ignored in vendored packages.

The goal of these changes is to allow authors to vendor (copy) external
packages into their source trees without any modifications to the code.
This functionality has been achieved in tools like godep, nut, and gb by
requiring GOPATH manipulation. This alternate directory-based approach
eliminates the need for GOPATH manipulation and in keeping with the
go command's use of directory layout-based configuration.

The flag allows experimentation with these vendoring semantics once
Go 1.5 is released, without forcing them on by default. If the experiment
is deemed a success, the flag will default to true in Go 1.6 and then be
removed in Go 1.7.

For more details, see the original proposal by Keith Rarick at
https://groups.google.com/d/msg/golang-dev/74zjMON9glU/dGhnoi2IMzsJ.

Change-Id: I2c6527e777d14ac6dc43c53e4b3ff24f3279216e
Reviewed-on: https://go-review.googlesource.com/10923
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-19 19:05:01 +00:00
Russ Cox
7bcc6a1615 cmd/compile: add -importmap option
The -importmap option takes an argument of the form old=new
and specifies that import "old" should be interpreted as if it said
import "new". The option may be repeated to specify multiple mappings.

This option is here to support the go command's new -vendor flag.

Change-Id: I31b4ed4249b549982a720bf61bb230462b33c59b
Reviewed-on: https://go-review.googlesource.com/10922
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-19 18:50:12 +00:00
Alex Brainman
9d968cb47b runtime: rename cgocall_errno and asmcgocall_errno into cgocall and asmcgocall
Change-Id: I5917bea8bb35b0e725dcc56a68f3a70137cfc180
Reviewed-on: https://go-review.googlesource.com/9387
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-19 01:47:11 +00:00
Ian Lance Taylor
1a040c9230 cmd/cgo: static variables in the preamble may not be referenced
This is a documentation fix that reflects the current reality.

Fixes #9673.

Change-Id: Ie436b277dfd1b68b13c67813d29c238d2c23b820
Reviewed-on: https://go-review.googlesource.com/11221
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-19 01:08:43 +00:00
Ian Lance Taylor
679fd5b447 cmd/go: do not permit importing a main package
Fixes #4210.

Change-Id: Id981814a6e55a57403ce7a8ac45ab3ba081a3a86
Reviewed-on: https://go-review.googlesource.com/10925
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-19 01:06:36 +00:00
Ian Lance Taylor
18d9a8d05f cmd/go: format temporary Go files in testsuite
Indent the temporary file source code embedded in go_test.go, so that
we don't have temporary Go code in the first column.

No real changes to the tests, just formatting.

Change-Id: I416b4a812c8db452ea61afe63a00989ec598c228
Reviewed-on: https://go-review.googlesource.com/10926
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-19 00:53:56 +00:00
Andrey Petrov
9f3a2d5f9a doc: clarify duplicate symbol condition in cgo
Spell out what will happen if a declaration and definition is included
in the same file, should help people who run into duplicate symbol
errors and search for relevant keywords.

This edit is based on opening issue #11263 erroneously.

Change-Id: I0645a9433b8668d2ede9b9a3f6550d802c26388b
Reviewed-on: https://go-review.googlesource.com/11247
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-19 00:48:42 +00:00
Michael Matloob
32f2f72c47 cmd/compile: provide better error when method called without receiver
When a method is called using the Type.Method(receiver, args...) syntax
without the receiver, or enough arguments, provide the more helpful
error message "not enough arguments in call to method expression
Type.Method" instead of the old message "not enough arguments in call
to Type.Method".

Fixes #8385

Change-Id: Id5037eb1ee5fa93687d4a6557b4a8233b29e9df2
Reviewed-on: https://go-review.googlesource.com/2193
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 19:37:38 +00:00
Shenghou Ma
3925a7c5db all: switch to the new deprecation convention
While we're at it, move some misplaced comment blocks around.

Change-Id: I1847d7f1ca1dbb8e5de737203c4ed6c66e112508
Reviewed-on: https://go-review.googlesource.com/10188
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 19:16:23 +00:00
Egon Elbre
4f4da07ea0 cmd/go: suggest running 'go help gopath' with problematic GOPATH
Suggest running 'go help gopath' when the running 'go install .'
and the folder is outside of GOPATH.

Added link to 'https://golang.org/doc/code.html' in gopath help
for more information.

Example output:

% go install .
go install: no install location for directory f:\x\badmessage outside GOPATH
        please run 'go help gopath' for more information

% go help gopath
... SNIP ...
See https://golang.org/doc/code.html for an example.

Fixes #8457

Change-Id: I0ef6ee3c65bb12af2168eafeb757258aa3835664
Reviewed-on: https://go-review.googlesource.com/9258
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 17:34:26 +00:00
Dmitry Vyukov
1b269463a5 cmd/trace: gracefully handle empty profiles
Return a meaningful message when a profile is empty.
Also rename "IO blocking" to "Network blocking",
currently only network blocking is captured.

Fixes #11098

Change-Id: Ib6f1292b8ade4805756fcb6696ba1fca8f9f39a9
Reviewed-on: https://go-review.googlesource.com/11243
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-18 14:46:49 +00:00
Russ Cox
1fc114c797 cmd/addr2line: simplify windows test
Change-Id: I0fcc35f43bc6059e6203af6134319cfc060c4b9a
Reviewed-on: https://go-review.googlesource.com/11085
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-17 14:23:20 +00:00
Russ Cox
08e25fc1ba cmd/compile: introduce //go:systemstack annotation
//go:systemstack means that the function must run on the system stack.

Add one use in runtime as a demonstration.

Fixes #9174.

Change-Id: I8d4a509cb313541426157da703f1c022e964ace4
Reviewed-on: https://go-review.googlesource.com/10840
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
2015-06-17 14:23:00 +00:00
Jeremy Jackins
7354978950 doc: replace references to {5..9}{g,l} with go tool compile and go tool link
I updated some references to 6g, 6l and friends that I came across, as those
programs don't exist anymore. I also fixed some echos in make.rc to match other make.* scripts while I was there.

Change-Id: Ib84532cd4688cf65174dd9869e5d42af98a20a48
Reviewed-on: https://go-review.googlesource.com/11162
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-17 04:05:50 +00:00
Michael Matloob
2aabacdb5a [dev.ssa] cmd/compile/internal/gc: support CALLFUNC as statement
I don't have strong understanding of the AST structure, so I'm
not sure if this is the right way to handle function call statements.

Change-Id: Ib526f667ab483b32d9fd17da800b5d6f4b26c4c9
Reviewed-on: https://go-review.googlesource.com/11139
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-17 03:34:34 +00:00
David Chase
5be61b18d4 cmd/compile: run escape analysis after method wrapper generation
Also modified test/run.go to ignore messages prefixed <autogenerated>
because those cannot be described with "// ERROR ...", and backed out
patch from issue #9537 because it is no longer necessary.  The reasons
described in the 9537 discussion for why escape analysis cannot run
late no longer hold, happily.

Fixes #11053.

Change-Id: Icb14eccdf2e8cde3d0f8fb8a216b765400a96385
Reviewed-on: https://go-review.googlesource.com/11088
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Chase <drchase@google.com>
2015-06-17 02:36:45 +00:00
Alex Brainman
6428a8b437 cmd/dist: add new misc/cgo/testsovar test
This change reintroduces CL 8523. CL 8523 was reverted because
it broke darwin and netbsd builds. Now that this test is part
of "go tool dist test" command we could skip OSes that fail.

Updates #10360

Change-Id: Iaaeb5b800126492f36415a439c333a218fe4ab67
Reviewed-on: https://go-review.googlesource.com/11119
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-17 02:33:40 +00:00
Alex Brainman
8e723109de cmd/go: vary executable names in tests
So the tests don't interfere with each other on windows.

Fixes #11217

Change-Id: I4b3936bc64c95c7274298d6f137b24a28876b625
Reviewed-on: https://go-review.googlesource.com/11138
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-17 01:26:40 +00:00
Michael Matloob
73054f5729 [dev.ssa] cmd/compile/internal/ssa: adds for 8,16,32 bit ints
Change-Id: I33025a4a41fd91f6ee317d33a6eebf27fa00ab51
Reviewed-on: https://go-review.googlesource.com/11115
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-17 00:13:58 +00:00
Michael Matloob
0991ec454b [dev.ssa] cmd/compile/internal/ssa: set line in newValue variants
This CL sets line numbers on Values in the newValue variants
introduced in cl/10929.

Change-Id: Ibd15bc90631a1e948177878ea4191d995e8bb19b
Reviewed-on: https://go-review.googlesource.com/11090
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-17 00:12:24 +00:00
Josh Bleecher Snyder
a5c3b6642b [dev.ssa] cmd/compile/ssa: fix string compilation
Compilation of f_ssa was broken by CL 10929.

This CL does not include tests because
I have a work in progress CL that will catch
this and much more.

package p

func f_ssa() string {
	return "ABC"
}

Change-Id: I0ce0e905e4d30ec206cce808da406b9b7f0f38e9
Reviewed-on: https://go-review.googlesource.com/11136
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-16 23:38:59 +00:00
Michael Hudson-Doyle
a5f57d7950 cmd/link: when reading symbols from a shared library, allow duplicates when they are both in bss
This makes the behaviour match what happens when duplicate symbols are read
from regular object files and fixes errors about cgoAlwaysFalse when linking
an executable that uses cgo against a shared library.

Change-Id: Ibb8cd8fe3f7813cde504b7483f1e857868d7e063
Reviewed-on: https://go-review.googlesource.com/11117
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-16 22:33:36 +00:00
Keith Randall
50ceef26e6 [dev.ssa] cmd/compile/internal/ssa: Fix bootstrap of ssa codegen
The cmd/compile/internal/ssa/gen directory can't depend on cmd/internal/gc
because that package doesn't exist in go1.4.  Use strings instead of
constants from that package.

The asm fields seem somewhat redundant to the opcode names we
conventionally use.  Maybe we can just trim the lowercase from the end
of the op name?  At least by default?

Change-Id: I96e8cda44833763951709e2721588fbd34580989
Reviewed-on: https://go-review.googlesource.com/11129
Reviewed-by: Michael Matloob <michaelmatloob@gmail.com>
2015-06-16 21:28:21 +00:00
Michael Matloob
703ef06039 [dev.ssa] cmd/compile/internal/gc: reduce genValue redundancy
Add an asm field to opcodeTable containing the Prog's as field.
Then instructions that fill the Prog the same way can be collapsed
into a single switch case.

I'm still thinking of a better way to reduce redundancy, but
I think this might be a good temporary solution to prevent duplication
from getting out of control. What do you think?

Change-Id: I0c4a0992741f908bd357ee2707edb82e76e4ce61
Reviewed-on: https://go-review.googlesource.com/11130
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-16 19:37:59 +00:00
Mikio Hara
0266bc8494 cmd/go: fix build
Change-Id: I2cd58a665d9df26583128c633c443325dcc3f288
Reviewed-on: https://go-review.googlesource.com/11131
Reviewed-by: Minux Ma <minux@golang.org>
2015-06-16 19:26:07 +00:00
Russ Cox
7bc3e58806 all: extract "can I exec?" check from tests into internal/testenv
Change-Id: I7b54be9d8b50b39e01c6be21f310ae9a10404e9d
Reviewed-on: https://go-review.googlesource.com/10753
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-16 18:07:36 +00:00
Shenghou Ma
d00e7ad640 cmd/compile: show compiler panics when -d panic=1
Fixes #10683.

Change-Id: I4cce3f298b787c736dbabe544a11a9215bcd3671
Reviewed-on: https://go-review.googlesource.com/10336
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-16 16:50:21 +00:00
Michael Hudson-Doyle
12b05bf8fd cmd/go: support -buildmode=shared with gccgo
Change-Id: Id93b8ab42fa311ce32209734ec9a0813f8736e25
Reviewed-on: https://go-review.googlesource.com/9914
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2015-06-16 01:43:29 +00:00
Robert Griesemer
d63c42df25 go/types: port recent x/tools/go/types fixes
The main change is:

golang.org/cl/10800  add pos parameter to Eval; remove New, EvalNode

followed by several cleanups/follow-up fixes:

golang.org/cl/10992  remove global vars in test
golang.org/cl/10994  remove unused scope parameter from NewSignature
golang.org/cl/10995  provide full source file extent to file scope
golang.org/cl/10996  comment fix in resolver.go
golang.org/cl/11004  updated cmd/vet
golang.org/cl/11042  be robust in the presence of incorrect/missing position info

Fixes #9980.

Change-Id: Id4aff688f6a399f76bf92b84c7e793b8da8baa48
Reviewed-on: https://go-review.googlesource.com/11122
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-15 20:11:37 +00:00
Brad Fitzpatrick
4965a77f1d cmd/go: fix typo
Change-Id: I171a1125e25b13c934c2cd545bd03f49f642910d
Reviewed-on: https://go-review.googlesource.com/11113
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-15 20:08:24 +00:00
Russ Cox
4dab6d01f1 cmd/go: make -a apply to the standard library, like in Go 1.3
This CL adds a very long comment explaining how isStale and
the new build IDs work. As part of writing the comment I realized:

// When the go command makes the wrong build decision and does not
// rebuild something it should, users fall back to adding the -a flag.
// Any common use of the -a flag should be considered prima facie evidence
// that isStale is returning an incorrect false result in some important case.
// Bugs reported in the behavior of -a itself should prompt the question
// ``Why is -a being used at all? What bug does that indicate?''

The two uses of -a that are most commonly mentioned in bugs filed
against the go command are:

	go install -a ./...
	go build -tags netgo -a myprog

Both of these commands now do the right thing without needing -a.

The -a exception we introduced in Go 1.4 was for the first form, and
it broke the second form. Again, neither needs -a anymore, so restore
the old, simpler, easier to explain, less surprising meaning used in Go 1.3:
if -a is given, rebuild EVERYTHING.

See the comment for more justification and history.

Summary of recent CLs (to link bugs to this one):

Fixes #3036. Now 'go install ./...' works.
Fixes #6534. Now 'go install ./...' works.
Fixes #8290. Now 'go install ./...' works.
Fixes #9369. Now 'go build -tags netgo myprog' works.
Fixes #10702. Now using one GOPATH with Go 1.5 and Go 1.6 works.
  (Each time you switch, everything needed gets rebuilt.
  Switching from Go 1.4 to Go 1.5 will rebuild properly.
  Switching from Go 1.5 back to Go 1.4 still needs -a when
  invoking the Go 1.4 go command.)

Change-Id: I19f9eb5286efaa50de7c8326602e94604ab572eb
Reviewed-on: https://go-review.googlesource.com/10761
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-15 19:38:11 +00:00
Russ Cox
3ab9ff1107 cmd/go: include Go toolchain information in build ID
This causes packages and binaries built by Go 1.5 to look
out of date to Go 1.6 and vice versa, so that when you flip
between different Go versions but keep the same GOPATH,
the right rebuilding happens at each flip.

Go 1.4 binaries will also look out of date to Go 1.5,
but Go 1.5 binaries will not look out of date to Go 1.4
(since Go 1.4 doesn't have anything like this).
People flipping between Go 1.4 and Go 1.5 will still
need to use go install -a every time to flip to Go 1.4,
but not when they flip back to Go 1.5.

Fixes #6534.
Fixes #10702.

Change-Id: I0ae7f268f822d483059a938a4f22846ff9275b4c
Reviewed-on: https://go-review.googlesource.com/10760
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-15 18:57:35 +00:00
Srdjan Petrovic
85b333dbf8 cmd/go: force-overwrite destination files when installing cgo headers
Fixes #11131

When running 'go install -buildmode=c-shared', under the circumstances
described in issue #11131, the install command would fail trying to
install cgo headers if they have already been installed (by a previous
call to 'go install -buildmode=c-shared').

Since it's safe to overwrite said headers (according to iant@), this CL
introduces a parameter to builder's 'copy' and 'move' functions that,
if set to 'true', would force the overwriting of already installed
files.

This parameter value is set to 'true' only when installing cgo headers,
for now.

Change-Id: I5bda17ee757066a8e5d2b39f2e8f3a389eb1e4a2
Reviewed-on: https://go-review.googlesource.com/10870
Run-TryBot: Srdjan Petrovic <spetrovic@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-15 18:29:39 +00:00
Russ Cox
2c2770c3d4 cmd/cgo: make sure pointers passed to C escape to heap
Fixes #10303.

Change-Id: Ia68d3566ba3ebeea6e18e388446bd9b8c431e156
Reviewed-on: https://go-review.googlesource.com/10814
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-15 17:39:53 +00:00
Russ Cox
80ec711755 runtime: use type-based write barrier for remote stack write during chansend
A send on an unbuffered channel to a blocked receiver is the only
case in the runtime where one goroutine writes directly to the stack
of another. The garbage collector assumes that if a goroutine is
blocked, its stack contains no new pointers since the last time it ran.
The send on an unbuffered channel violates this, so it needs an
explicit write barrier. It has an explicit write barrier, but not one that
can handle a write to another stack. Use one that can (based on type bitmap
instead of heap bitmap).

To make this work, raise the limit for type bitmaps so that they are
used for all types up to 64 kB in size (256 bytes of bitmap).
(The runtime already imposes a limit of 64 kB for a channel element size.)

I have been unable to reproduce this problem in a simple test program.

Could help #11035.

Change-Id: I06ad994032d8cff3438c9b3eaa8d853915128af5
Reviewed-on: https://go-review.googlesource.com/10815
Reviewed-by: Austin Clements <austin@google.com>
2015-06-15 16:50:30 +00:00
Daniel Morsing
3b817ef8f8 [dev.ssa] fix equivalence class after aux/auxint refactor.
This caused the following code snippet to be miscompiled

	var f int
	x := g(&f)
	f = 10

Moving the store of 10 above the function call.

Change-Id: Ic6951f5e7781b122cd881df324a38e519d6d66f0
Reviewed-on: https://go-review.googlesource.com/11073
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-15 12:06:05 +00:00
Andrew Gerrand
d14e9e6323 cmd/go: stop early in disallowInternal on erroneous packages
Fixes #11201

Change-Id: I80d8fcfcb5c856aaf9d0e73d756d86018e2bec3b
Reviewed-on: https://go-review.googlesource.com/11110
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-15 04:27:27 +00:00
Dmitry Vyukov
202de394f2 cmd/trace: fix panic in goroutine profile
In generateTrace we check that event timestamp is within the interesting range.
Then later in traceContext.time we double check event time.
However, for some events (e.g. emitSlice) we convert time of ev.Link (slice end) rather than ev itself (slice begin).
Slice end can be outside of the interesting time range, and so traceContext.time crashes.
Remove the check in traceContext.time, check in generateTrace loop is sufficient.

Change-Id: If94e93b5653c5816c0a8dcdd920f15df97616835
Reviewed-on: https://go-review.googlesource.com/11100
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-14 21:57:24 +00:00
Dmitry Vyukov
9a8750b276 misc/trace: update trace viewer
Update to tip to fix #11003 (not possible to select events in chromium).
Fixed #11003

Change-Id: Ibba5d39ca809cfd5cb79c9e6d152b00899d49e08
Reviewed-on: https://go-review.googlesource.com/11062
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-14 20:58:23 +00:00
Daniel Morsing
c31b6dd0be [dev.ssa] initial implementation of PAUTO|PHEAP variables
Call to the runtime to generate escaping variables and use the returned
address when accessing these variables.

Fix a couple of errors on the way. The rule for CALLstatic was missed
during the Aux refactor and OCONVNOP wasn't converted.

Change-Id: I2096beff92cca92d648bfb6e8ec0b120f02f44af
Reviewed-on: https://go-review.googlesource.com/11072
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-14 20:01:03 +00:00
Michael Matloob
ea5cd68646 [dev.ssa] cmd/compile/internal/gc: fix call to newValue1
Change-Id: I235a759e4688358adc088cf5a80f8ce7ad12d2f2
Reviewed-on: https://go-review.googlesource.com/11093
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-14 17:36:24 +00:00
Michael Matloob
3a0df1f82a [dev.ssa] cmd/compile/internal/ssa: set Line in NewValue funcs
In the previous line number CL the NewValue\d? functions took
a line number argument but neglected to set the Line field on
the value struct. Fix that.

Change-Id: I53c79ff93703f66f5f0266178c94803719ae2074
Reviewed-on: https://go-review.googlesource.com/11054
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-14 16:46:01 +00:00
Michael Matloob
47791c1a18 [dev.ssa] cmd/compile/internal/gc: generate TESTQ instruction
TESTQ is produced by the IsNonNil lowering.

Change-Id: I9df8f17e6def7e34d07e3ddf2dd5dd8f0406aa04
Reviewed-on: https://go-review.googlesource.com/11053
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-14 16:45:20 +00:00
Daniel Morsing
2efdaefdb0 [dev.ssa] Protect control value from being moved away from end of block
If there isn't a value dependency between the control value of a
block and some other value, the schedule pass might move the control
value to a spot that is not EOB. Fix by handling the control value
specially like phis.

Change-Id: Iddaf0924d98c5b3d9515c3ced927b0c85722818c
Reviewed-on: https://go-review.googlesource.com/11071
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-14 16:40:40 +00:00
Keith Randall
8f22b5292f [dev.ssa] cmd/compiler/internal/ssa: Add auxint field
Add an additional int64 auxiliary field to Value.

There are two main reasons for doing this:
1) Ints in interfaces require allocation, and we store ints in Aux a lot.
2) I'd like to have both *gc.Sym and int offsets included in lots
   of operations (e.g. MOVQloadidx8).  It will be more efficient to
   store them as separate fields instead of a pointer to a sym/int pair.

It also simplifies a bunch of code.

This is just the refactoring.  I'll start using this some more in a
subsequent changelist.

Change-Id: I1ca797ff572553986cf90cab3ac0a0c1d01ad241
Reviewed-on: https://go-review.googlesource.com/10929
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-14 06:00:30 +00:00
Keith Randall
0ad9c8c720 [dev.ssa] cmd/compile/internal/gc: Small fixes
Allow labels to be unreachable via fallthrough from above.
Implement OCONVNOP.

Change-Id: I6869993cad8a27ad134dd637de89a40117daf47b
Reviewed-on: https://go-review.googlesource.com/11001
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
2015-06-14 03:56:47 +00:00
Josh Bleecher Snyder
ff8f3f0fa1 cmd/vet: extend copylocks to anonymous functions
Running -copylocks over a large corpus generates 1507 warnings.
Of those, only 3 are from the new anonymous function check,
but they are all bugs.

Fixes #10927.

Change-Id: I2672f6871036bed711beec5f88bc39aa8b3b6a94
Reviewed-on: https://go-review.googlesource.com/11051
Reviewed-by: Rob Pike <r@golang.org>
2015-06-13 03:07:43 +00:00
Alexandre Cesaro
0d0ce8a2af cmd/go: fix documentation
The command "go tool pprof help" does not work:

    $ go tool pprof help
    open help: no such file or directory

The right command is "go tool pprof -h".

Change-Id: Icef5d4ab76774905854e46665ac1166d26d35f46
Reviewed-on: https://go-review.googlesource.com/10970
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-12 13:23:14 +00:00
Daniel Morsing
d5ad9ced1c [dev.ssa] clarify ODCL todo, remove irrelevant colas todo
ODCL nodes are used as the point where the variable is allocated in
the old pass. colas is irrelevant at this point of the compile. All
the checks on it happen at parse time and an ODCL node will have been
inserted right before it.

Change-Id: I1aca053aaa4363bacd12e1156de86fa7b6190a55
Reviewed-on: https://go-review.googlesource.com/10901
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-12 09:24:08 +00:00
Alex Brainman
202ef487fe cmd/dist: convert testso test into Go
I would like to re-apply reverted http://golang.org/cl/8523.
Reverted tests still fail in some environments (see issue #10360).
It is easier to run tests selectively when in Go.
This CL prepares for the changes.

Updates #10360

Change-Id: Iefeb1d71cb3d1cfa653a6ccd9f6e35686c0c5b24
Reviewed-on: https://go-review.googlesource.com/10608
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-12 04:33:50 +00:00
Josh Bleecher Snyder
ba8a146af4 [dev.ssa] cmd/compile/ssa: print reg names in generated code
Change-Id: I6c6196449dd3d5e036d420fa7ae90feb0cf8d417
Reviewed-on: https://go-review.googlesource.com/10928
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-12 03:40:13 +00:00
Alex Brainman
117506aab6 cmd/go: clean up after 'go build' even on windows
This CL makes CL 10682 work on windows.

Fixes #9645 (again)

Change-Id: Ie9b9af8b041c483a236b46adad4a50aa6e598c92
Reviewed-on: https://go-review.googlesource.com/10930
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-12 02:15:43 +00:00
Ian Lance Taylor
06ef022ba3 cmd/go: add some parallelism to the testsuite
As these tests were originally in bash, they are not designed to be
particularly hermetic.  This CL adds various protective mechanisms to
try to catch cases where the tests can not run in parallel.

Change-Id: I983bf7b6ffba04eda58b4939eb89b0bdfcda8eff
Reviewed-on: https://go-review.googlesource.com/10911
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-11 18:39:14 +00:00
Ian Lance Taylor
9850886fe9 cmd/go: in testsuite, sleep for less than one second if possible
Examine the mtime of an existing file to guess a length of time to
sleep to ensure a different mtime.

Change-Id: I9e8b5c9486f5c3c8bd63125e3ed4763ce1ba767d
Reviewed-on: https://go-review.googlesource.com/10932
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-11 18:36:37 +00:00
Keith Randall
e707fbe1d7 [dev.ssa] Merge remote-tracking branch 'origin/master' into mbranch
Semi-regular merge of tip into dev.ssa.

Change-Id: Iec8e4266426bed233892e7dbe4448d16c8b89018
2015-06-11 11:06:21 -07:00
Brad Fitzpatrick
a788c913fa cmd/vet: skip another test on Android
Forgot this one in my previous commit.

Change-Id: Ief089e99bdad24b3bcfb075497dc259d06cc727c
Reviewed-on: https://go-review.googlesource.com/10913
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-11 16:30:56 +00:00
Chris Broadfoot
239ec73e66 cmd/go: reject relative paths that don't start with a dot (.)
Change-Id: Idc4a7fdb561ba5b3b52094d895deaf3fcdf475bf
Reviewed-on: https://go-review.googlesource.com/10716
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-11 16:13:37 +00:00
Brad Fitzpatrick
0beb931c76 cmd/go, cmd/vet: skip tests on Android
Might get the Android build passing, or at least going further.

Change-Id: I08f97156a687abe5a3d95203922f4ffd84fbb212
Reviewed-on: https://go-review.googlesource.com/10924
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-11 14:33:40 +00:00
Ainar Garipov
7f9f70e5b6 all: fix misprints in comments
These were found by grepping the comments from the go code and feeding
the output to aspell.

Change-Id: Id734d6c8d1938ec3c36bd94a4dbbad577e3ad395
Reviewed-on: https://go-review.googlesource.com/10941
Reviewed-by: Aamir Khan <syst3m.w0rm@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-11 14:18:57 +00:00
David du Colombier
15c8ab00e8 cmd/go: remove Stat workaround for Plan 9
This issue was fixed in CL 10900.

Change-Id: I88f107cb73c8a515f39e02506ddd2ad1e286b1fb
Reviewed-on: https://go-review.googlesource.com/10940
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-11 14:03:14 +00:00
Keith Randall
6f1884757f [dev.ssa] cmd/compile/internal/ssa: Complete 64-bit shifts
Implement correct Go shifts.

Allow multi-line rewrite rules.

Fix offset & alignment in stack alloc.

Change-Id: I0ae9e522c83df9205bbe4ab94bc0e43d16dace58
Reviewed-on: https://go-review.googlesource.com/10891
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-11 03:54:06 +00:00
Keith Randall
290d8fc14a [dev.ssa] cmd/compile/internal/ssa: add call opcodes
Add calls, particularly closure calls.

Reorg SSAable variable test for converting to SSA.

Change-Id: Ia75c04295e6b0b040122f97e2381836a393b7f42
Reviewed-on: https://go-review.googlesource.com/10912
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-11 03:10:01 +00:00
Ian Lance Taylor
dc32b7f0fd cmd/go: rewrite testsuite from bash to Go
Change-Id: I8473e3f7653d5389d5fcd94862f0831049b8266e
Reviewed-on: https://go-review.googlesource.com/10809
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-10 20:34:56 +00:00
Michael Matloob
81ccf508aa [dev.ssa] cmd/compile/internal/ssa: add line numbers to Values
Change-Id: I1dfffd75cc1f49307c654f910f7133c03da6c84f
Reviewed-on: https://go-review.googlesource.com/10559
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-10 15:01:13 +00:00
Alex Brainman
ab08f79af3 cmd/link: stop linker crashing with -s flag on windows
Update #10254

Change-Id: I3ddd26607813ca629e3ab62abf87dc5ab453e36f
Reviewed-on: https://go-review.googlesource.com/10835
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-10 06:49:23 +00:00
Josh Bleecher Snyder
442959ec47 cmd/compile: fix builtin generation
This was a refactoring bug during
'go tool compile', CL 10289.

Change-Id: Ibfd333be39ec72bba331fdf352df619cc21851a9
Reviewed-on: https://go-review.googlesource.com/10849
Reviewed-by: Minux Ma <minux@golang.org>
2015-06-09 21:26:39 +00:00
Josh Bleecher Snyder
a44becef4a cmd/compile: use generated temps in bool codegen
Bool codegen was generating a temp for function calls
and other complex expressions, but was not using it.

This was a refactoring bug introduced by CL 7853.
The cmp code used to do (in short):

	l, r := &n1, &n2

It was changed to:

	l, r := nl, nr

But the requisite assignments:

	nl, nr = &n1, &n2

were only introduced on one of two code paths.

Fixes #10654.

Change-Id: Ie8de0b3a333842a048d4308e02911bb10c6915ce
Reviewed-on: https://go-review.googlesource.com/10844
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-09 17:38:26 +00:00
Michael Matloob
43a2676ff0 [dev.ssa] cmd/compile/internal/ssa: delete lowergeneric.go
It's been replaced by rewritegeneric.go

Change-Id: I2658abbc6201ecfedae4513c6da04ea3cac8bb9c
Reviewed-on: https://go-review.googlesource.com/10846
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-09 15:29:12 +00:00
Brad Fitzpatrick
10425507fd cmd/dist: move guts of race.bash into dist
After a little build coordinator change, this will get us sharding of
the race builder.

Update #11074

Change-Id: I4c55267563b6f5e213def7dd6707c837ae2106bf
Reviewed-on: https://go-review.googlesource.com/10845
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-09 05:22:37 +00:00
Hyang-Ah (Hana) Kim
c9778ec302 cmd/link/internal/ld: include table of contents of c-archive output.
Change-Id: If11621985c0a5a1f2133cdc974f37fd944b93e5e
Reviewed-on: https://go-review.googlesource.com/10808
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-09 00:55:11 +00:00
Josh Bleecher Snyder
494ff188f8 cmd/compile: early typecheck top level OAS2 nodes
Fixes #10977.

Change-Id: I706c953c16daad48595c7fae2d82124614dfc3ad
Reviewed-on: https://go-review.googlesource.com/10780
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-09 00:25:02 +00:00
Keith Randall
0dca7351e9 [dev.ssa] cmd/compile/internal/ssa: autogenerate opcodes
Revamp autogeneration.  Get rid of gogenerate commands, they are more
trouble than they are worth.  (If the code won't compile, gogenerate
doesn't work.)

Generate opcode enums & tables.  This means we only have to specify
opcodes in one place instead of two.

Add arch prefixes to opcodes so they will be globally unique.

Change-Id: I175d0a89b701b2377bbe699f3756731b7c9f5a9f
Reviewed-on: https://go-review.googlesource.com/10812
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-08 21:02:03 +00:00
Robert Griesemer
13e2412876 cmd/vet: remove dependency on types.New
- remove TODO on non-existing fmt.Formatter type
  (type exists now)
- guard uses of imported types against nil

Change-Id: I9ae8e5a448e73c84dec1606ea9d9ed5ddeee8dc6
Reviewed-on: https://go-review.googlesource.com/10777
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-08 20:52:07 +00:00
Michael Matloob
6241a41e33 [dev.ssa] cmd/compile/internal/ssa: enforce single live mem
Change-Id: I21edff280a283895e4f0cbf91a3b4406f2f86788
Reviewed-on: https://go-review.googlesource.com/10558
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-08 20:12:40 +00:00
Alex Brainman
a58e731287 cmd/vet: fix tests on windows
Add .exe to exectable name, so it can be executed on windows.
Use proper windows paths when searching vet output.
Replace Skip with Skipf.

Fixes build

Change-Id: Ife40d8f5ab9d7093ca61c50683a358d4d6a3ba34
Reviewed-on: https://go-review.googlesource.com/10742
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Patrick Mézard <patrick@mezard.eu>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-08 15:14:39 +00:00
Austin Clements
16310571d1 cmd/asm: drop legacy RETURN mnemonic on ppc64
Change-Id: I999b57ef5535c18e02cc27c9bc9f896d73126b50
Reviewed-on: https://go-review.googlesource.com/10674
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2015-06-06 00:11:13 +00:00
Austin Clements
9389a86b01 cmd/compile: use obj.ARET instead of ppc64.ARETURN
obj.ARET is the portable return mnemonic. ppc64.ARETURN is a legacy
alias.

This was done with
    sed -i s/ppc64\.ARETURN/obj.ARET/ cmd/compile/**/*.go
    sed -i s/ARETURN/obj.ARET/ cmd/internal/obj/ppc64/obj9.go

Change-Id: I4d8e83ff411cee764774a40ef4c7c34dcbca4e43
Reviewed-on: https://go-review.googlesource.com/10673
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2015-06-06 00:07:31 +00:00
Robert Griesemer
11b9928185 cmd/go: update documentation: use 'go doc' rather than 'godoc'
Change-Id: I318c1ef75b18d4687f13499ac225dde2d053505e
Reviewed-on: https://go-review.googlesource.com/10776
Reviewed-by: Rob Pike <r@golang.org>
2015-06-05 21:33:52 +00:00
Robert Griesemer
a544a3a6f7 cmd/go: use new vet location
Change-Id: I7d96ebcca5954152edb821bb41b6047a1c622949
Reviewed-on: https://go-review.googlesource.com/10731
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2015-06-05 20:09:36 +00:00
Michael Matloob
c8285bb501 [dev.ssa] cmd/compile/internal/ssa: add missing copyright notices
Change-Id: I9d4e0f3e9afc9920ee0d77b0073ac8597c7c048f
Reviewed-on: https://go-review.googlesource.com/10756
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-05 17:19:05 +00:00
Brad Fitzpatrick
24de40a846 cmd/dist: add more logging details when go list std cmd fails
Change-Id: I12e6990b46ea9c733a5718dc5ca67f1fcd2dec66
Reviewed-on: https://go-review.googlesource.com/10754
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 15:19:29 +00:00
Russ Cox
95919328ac cmd/vet: skip exec tests on systems that can't exec
Change-Id: I09257b8f5482cba10b5f4d3813c778d6e9e74d40
Reviewed-on: https://go-review.googlesource.com/10752
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-05 14:35:13 +00:00
Russ Cox
48f2d30d43 cmd/go: fix detection of ELF binaries
Change-Id: I0e6f1a39b3d6b15d05891c8b25ab6644356bde5f
Reviewed-on: https://go-review.googlesource.com/10751
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-05 13:59:30 +00:00
Rob Pike
bbc4351eca cmd/go: add -tags option to go vet
Actually add all build flags, so we also get things like -race.

Fixes #10228.

Change-Id: I5f77dda9d1ee3208e1833702f12f68c2731c4b22
Reviewed-on: https://go-review.googlesource.com/10697
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-05 05:39:36 +00:00
Russ Cox
cd9f417dbb cmd/compile: document Node fields used by each Op
Change-Id: If969d7a06c83447ee38da30f1477a6cf4bfa1a03
Reviewed-on: https://go-review.googlesource.com/10691
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-05 05:01:24 +00:00
Russ Cox
aefa6cd1f9 cmd/link: delete dead flags
Also fix the interaction between -buildmode and -shared.
It's okay for -shared to change the default build mode,
but it's not okay for it to silently override an explicit -buildmode=exe.

Change-Id: Id40f93d140cddf75b19e262b3ba4856ee09a07ba
Reviewed-on: https://go-review.googlesource.com/10315
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-05 04:55:53 +00:00
Russ Cox
12795c02f3 cmd/link: deprecate -X name value in favor of -X name=value
People invoking the linker directly already have to change their scripts
to use the new "go tool link", so this is a good time to make the -X flag
behave like all other Go flags and take just a single argument.

The old syntax will continue to be accepted (it is rewritten into the new
syntax before flag parsing). Maybe some day we will be able to retire it.

Even if we never retire the old syntax, having the new syntax at least
makes the rewriting much less of a kludge.

Change-Id: I91e8df94f4c22b2186e81d7f1016b8767d777eac
Reviewed-on: https://go-review.googlesource.com/10310
Reviewed-by: Rob Pike <r@golang.org>
2015-06-05 04:55:41 +00:00
Russ Cox
630930c35e cmd/compile, cmd/link: add docs
These are the Go 1.4 docs but refreshed for Go 1.5.
The most sigificant change is that all references to the Plan 9 toolchain are gone.
The tools no longer bear any meaningful resemblance.

Change-Id: I44f5cadb832a982323d7fee0b77673e55d761b35
Reviewed-on: https://go-review.googlesource.com/10298
Reviewed-by: Rob Pike <r@golang.org>
2015-06-05 04:42:35 +00:00
Russ Cox
14da5bef5f cmd/pprof: use copy of svgpan library instead of link to remote site
Fixes #10375.

Change-Id: I78dc3e12035d130c405bdb284b0cceea19f084f6
Reviewed-on: https://go-review.googlesource.com/10690
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-05 04:36:00 +00:00
Russ Cox
fddc3ca11c testing: add -test.count flag to run tests and benchmarks multiple times
The flag is available from the go test command as -count:

% go test -run XXX -bench . -count 3
PASS
BenchmarkSprintfEmpty      	30000000	        54.0 ns/op
BenchmarkSprintfEmpty      	30000000	        51.9 ns/op
BenchmarkSprintfEmpty      	30000000	        53.8 ns/op
BenchmarkSprintfString     	10000000	       238 ns/op
BenchmarkSprintfString     	10000000	       239 ns/op
BenchmarkSprintfString     	10000000	       234 ns/op
BenchmarkSprintfInt        	10000000	       232 ns/op
BenchmarkSprintfInt        	10000000	       226 ns/op
BenchmarkSprintfInt        	10000000	       225 ns/op
...

If -cpu is set, each test is run n times for each cpu value.

Original by r (CL 10663).

Change-Id: If3dfbdf21698952daac9249b5dbca66f5301e91b
Reviewed-on: https://go-review.googlesource.com/10669
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-05 04:31:10 +00:00
Russ Cox
de305a197f cmd/go: read new non-ELF build ID in binaries
Fixes #11048.
Fixes #11075.

Change-Id: I81f5ef1e1944056ce5494c91aa4a4a63c758f566
Reviewed-on: https://go-review.googlesource.com/10709
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 04:08:51 +00:00
Russ Cox
9ae3c560b9 cmd/link: implement -buildid for non-ELF binaries
Non-ELF binary formats are much less flexible and typically do not
have a good place to store the build ID.

We store it as raw bytes at the beginning of the text segment.

The only system I know of that will be upset about this is NaCl,
and NaCl is an ELF system and does not use this.

For #11048.

Change-Id: Iaa7ace703c4cf36392e752eea9b55e2ce49e9826
Reviewed-on: https://go-review.googlesource.com/10708
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 04:06:46 +00:00
Russ Cox
16ebe9f72e cmd/go: use ELF note instead of binary stamp on ELF systems
Other binary formats to follow.

For #11048.

Change-Id: Ia2d8b47c99c99d171c014b7cfd23c1c7ada5231c
Reviewed-on: https://go-review.googlesource.com/10707
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 04:06:08 +00:00
Russ Cox
ac1f48e2f6 cmd/link: add -buildid flag to write Go build ID to ELF output, same as cmd/compile
Other binary formats to follow.

Using our own note instead of the GNU build ID note because
we are not the GNU project, and I can't guarantee that the semantics
of our note and the semantics of the GNU note will match forever.
(Also they don't match today.)

For #11048.

Change-Id: Iec7e5a2e49d52b6d3a51b0aface2de7c77a45491
Reviewed-on: https://go-review.googlesource.com/10706
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 04:02:26 +00:00
Russ Cox
a2c50ece2b cmd/link: add -h flag, for debugging, same as cmd/compile
Change-Id: I3c9b05879fe0b6e94b63e9b65e4411ba2a917134
Reviewed-on: https://go-review.googlesource.com/10705
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 04:00:11 +00:00
Russ Cox
7e27625e25 cmd/go, cmd/link: use "Go" not "GO" as ELF note identifier
Change-Id: I038e892725836ab7718f7638e8ad5712953f2cb5
Reviewed-on: https://go-review.googlesource.com/10704
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 03:59:46 +00:00
Russ Cox
a9267db56a cmd/go: simplify ELF note reading and enable during bootstrap
The bootstrap restriction is to avoid needing cgo for package net.
There's no problem with building debug/elf and debug/dwarf,
so do that.

An upcoming CL is going to add more note processing code,
and it simplifies things not to have to think about the code being
missing half the time.

Change-Id: I0e2f120ac23f14db6ecfcec7bfe254a69abcf7b6
Reviewed-on: https://go-review.googlesource.com/10703
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-05 03:53:14 +00:00
Josh Bleecher Snyder
e00d60901a [dev.ssa] cmd/compile/internal/ssa: minor fixes
* Improve some docs and logging.
* Set correct type and len for indexing into strings.

Fixes #11029.

Change-Id: Ib22c45908e41ba3752010d2f5759e37e3921a48e
Reviewed-on: https://go-review.googlesource.com/10635
Reviewed-by: Keith Randall <khr@golang.org>
2015-06-04 23:13:45 +00:00
Robert Griesemer
09a3a092af cmd/go: fix fmt.Errorf call sites (latent bug)
Change-Id: I4ff42113c5dda553d6f3d58f0e4836dce7c84710
Reviewed-on: https://go-review.googlesource.com/10730
Reviewed-by: Rob Pike <r@golang.org>
2015-06-04 23:06:13 +00:00
Keith Randall
8d32360bdd [dev.ssa] cmd/internal/ssa: add deadstore pass
Eliminate dead stores.  Dead stores are those which are
unconditionally followed by another store to the same location, with
no intervening load.

Just a simple intra-block implementation for now.

Change-Id: I2bf54e3a342608fc4e01edbe1b429e83f24764ab
Reviewed-on: https://go-review.googlesource.com/10386
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-04 23:03:41 +00:00
Keith Randall
1114a76ae6 [dev.ssa] cmd/compile/internal/ssa: Add dummy frontend for testing.
Change-Id: Ica26c0297ac7afeb0b5b668cf5f5cd1667c6cc43
Reviewed-on: https://go-review.googlesource.com/10699
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-04 22:26:22 +00:00
Keith Randall
f7f604e284 [dev.ssa] cmd/internal/ssa: add string operations
Add ops to load, store, select ptr & len, and build constant strings.
A few other minor cleanups.

Change-Id: I6f0f7419d641b119b613ed44561cd308a466051c
Reviewed-on: https://go-review.googlesource.com/10449
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-04 22:00:27 +00:00
Rob Pike
ea92f42cc8 cmd/doc: do not show unexported constants
The go/doc package doesn't remove unexported entries from const
and var blocks, so we must trim them ourselves.

Fixes #11008

Change-Id: Ibd60d87e09333964e2588340a2ca2b8804bbaa28
Reviewed-on: https://go-review.googlesource.com/10643
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-04 21:51:49 +00:00
Robert Griesemer
a7d2d4835b cmd/vet: adjust vet to use go/types and friends from std repo
- s|"golang.org/x/tools/go/exact"|"go/constant"|
- s|"golang.org/x/tools/go/types"|"go/types"|
- removed import of gcimporter
- import "go/importer" instead
- trivial adjustments to make use of go/importer
- adjusted import paths for whitelist.go

Change-Id: I43488ff44c329cd869c92dcc31193fb31bebfd29
Reviewed-on: https://go-review.googlesource.com/10695
Reviewed-by: Rob Pike <r@golang.org>
2015-06-04 21:24:52 +00:00
Robert Griesemer
1b8b2c1551 cmd/vet: move cmd/vet into std repo
cp -r x/tools/cmd/vet cmd/vet without any changes.
The next change will adjust the source to use std
repo go/types and friends.

This may (temporarily) break the build; the next
commit (immediately following) will fix it. We do
it in two commits so that we can see the manual
changes.

Change-Id: Ic45dab7066f13923e21f8c61200c8c3fd447b171
Reviewed-on: https://go-review.googlesource.com/10694
Reviewed-by: Rob Pike <r@golang.org>
2015-06-04 21:22:13 +00:00
David Crawshaw
ebcc7ec148 cmd/dist: use -tags=lldb for iOS tests
As of golang.org/cl/9154, running go test will override a previous
go install -a -tags=lldb std with the tag-less version of stdlib. So
we pass -tags=lldb into the relevant go test commands.

Change-Id: I1c718289d7212373a9383eff53a643f06598f5ed
Reviewed-on: https://go-review.googlesource.com/10701
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-04 20:56:48 +00:00
Brad Fitzpatrick
ec745fc4cb test: make test/run.go support sharding
Also modifies 'dist test' to use that sharding, and removes some old
temporary stuff from dist test which are no longer required.

'dist test' now also supports running a list of tests given in
arguments, mutually exclusive with the existing -run=REGEXP flag. The
hacky fast paths for avoiding the 1 second "go list" latency are now
removed and only apply to the case where partial tests are run via
args, instead of regex.  The build coordinator will use both styles
for awhile. (the statically-sharded ARM builders on scaleway will
continue to use regexps, but the dynamically-shared builders on GCE
will use the list of tests)

Updates #10029

Change-Id: I557800a54dfa6f3b5100ef4c26fe397ba5189813
Reviewed-on: https://go-review.googlesource.com/10688
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-06-04 19:45:29 +00:00
Josh Bleecher Snyder
54789eff38 cmd/internal/obj/arm64: make function prologue more predictable
Static branch prediction guesses that forward branches aren't taken.
Since stacks are rarely grown, make the forward branch mean grow.

While we're here, remove the debug-only instruction
saving the frame size in the temp register.

Sample disassembly for

func f() {
	_ = [128]byte{}
}

Before:

0x4008248         ldr        x1, [x28, #0x10]
0x400824c         sub        x2, sp, #0x90
0x4008250         cmp        x2, x1
0x4008254         b.hi       0x4008268
0x4008258         mov        x3, x30
0x400825c         movz       x27, #0x90
0x4008260         bl         runtime.morestack_noctxt
0x4008264         b          main.f
0x4008268         sub        sp, sp, #0x90
0x400826c         add        x16, sp, #0x10
0x4008270         str        xzr, [x16]
0x4008274         str        xzr, [x16, #0x8]
0x4008278         str        xzr, [x16, #0x10]
0x400827c         str        xzr, [x16, #0x18]
0x4008280         str        xzr, [x16, #0x20]
0x4008284         str        xzr, [x16, #0x28]
0x4008288         str        xzr, [x16, #0x30]
0x400828c         str        xzr, [x16, #0x38]
0x4008290         str        xzr, [x16, #0x40]
0x4008294         str        xzr, [x16, #0x48]
0x4008298         str        xzr, [x16, #0x50]
0x400829c         str        xzr, [x16, #0x58]
0x40082a0         str        xzr, [x16, #0x60]
0x40082a4         str        xzr, [x16, #0x68]
0x40082a8         str        xzr, [x16, #0x70]
0x40082ac         str        xzr, [x16, #0x78]
0x40082b0         add        sp, sp, #0x90
0x40082b4         ret

After:

0x4004bc8         ldr        x1, [x28, #0x10]
0x4004bcc         sub        x2, sp, #0x90
0x4004bd0         cmp        x2, x1
0x4004bd4         b.ls       0x4004c28
0x4004bd8         sub        sp, sp, #0x90
0x4004bdc         add        x16, sp, #0x10
0x4004be0         str        xzr, [x16]
0x4004be4         str        xzr, [x16, #0x8]
0x4004be8         str        xzr, [x16, #0x10]
0x4004bec         str        xzr, [x16, #0x18]
0x4004bf0         str        xzr, [x16, #0x20]
0x4004bf4         str        xzr, [x16, #0x28]
0x4004bf8         str        xzr, [x16, #0x30]
0x4004bfc         str        xzr, [x16, #0x38]
0x4004c00         str        xzr, [x16, #0x40]
0x4004c04         str        xzr, [x16, #0x48]
0x4004c08         str        xzr, [x16, #0x50]
0x4004c0c         str        xzr, [x16, #0x58]
0x4004c10         str        xzr, [x16, #0x60]
0x4004c14         str        xzr, [x16, #0x68]
0x4004c18         str        xzr, [x16, #0x70]
0x4004c1c         str        xzr, [x16, #0x78]
0x4004c20         add        sp, sp, #0x90
0x4004c24         ret
0x4004c28         mov        x3, x30
0x4004c2c         bl         runtime.morestack_noctxt
0x4004c30         b          main.f

Updates #10587.

Package sort benchmarks using an iPhone 6:

name            old time/op  new time/op  delta
SearchWrappers   355ns ± 1%   328ns ± 1%  -7.57%  (p=0.000 n=25+19)
SortString1K     580µs ± 1%   577µs ± 1%  -0.48%  (p=0.000 n=25+25)
StableString1K  1.04ms ± 0%  1.04ms ± 0%    ~     (p=0.851 n=24+25)
SortInt1K        251µs ± 1%   247µs ± 1%  -1.52%  (p=0.000 n=23+25)
StableInt1K      267µs ± 2%   261µs ± 2%  -2.02%  (p=0.000 n=25+25)
SortInt64K      23.8ms ± 1%  23.6ms ± 0%  -0.97%  (p=0.000 n=25+23)
StableInt64K    22.8ms ± 0%  22.4ms ± 1%  -1.76%  (p=0.000 n=24+25)
Sort1e2          123µs ± 1%   124µs ± 1%    ~     (p=0.256 n=23+23)
Stable1e2        248µs ± 1%   247µs ± 1%  -0.69%  (p=0.000 n=23+25)
Sort1e4         24.3ms ± 2%  24.6ms ± 5%  +1.36%  (p=0.017 n=22+25)
Stable1e4       77.2ms ± 6%  76.2ms ± 5%  -1.36%  (p=0.020 n=25+25)
Sort1e6          3.95s ± 8%   3.95s ± 8%    ~     (p=0.863 n=25+25)
Stable1e6        15.7s ± 1%   15.5s ± 1%  -1.11%  (p=0.000 n=22+23)

Change-Id: I377b3817af2ed27ddeecf24edef97fad91fc1afc
Reviewed-on: https://go-review.googlesource.com/10500
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-06-04 16:54:22 +00:00
Josh Bleecher Snyder
5353cde080 runtime, cmd/internal/obj/arm: improve arm function prologue
When stack growth is not needed, as it usually is not,
execute only a single conditional branch
rather than three conditional instructions.
This adds 4 bytes to every function,
but might speed up execution in the common case.

Sample disassembly for

func f() {
	_ = [128]byte{}
}

Before:

TEXT main.f(SB) x.go
	x.go:3	0x2000	e59a1008	MOVW 0x8(R10), R1
	x.go:3	0x2004	e59fb028	MOVW 0x28(R15), R11
	x.go:3	0x2008	e08d200b	ADD R11, R13, R2
	x.go:3	0x200c	e1520001	CMP R1, R2
	x.go:3	0x2010	91a0300e	MOVW.LS R14, R3
	x.go:3	0x2014	9b0118a9	BL.LS runtime.morestack_noctxt(SB)
	x.go:3	0x2018	9afffff8	B.LS main.f(SB)
	x.go:3	0x201c	e52de084	MOVW.W R14, -0x84(R13)
	x.go:4	0x2020	e28d1004	ADD $4, R13, R1
	x.go:4	0x2024	e3a00000	MOVW $0, R0
	x.go:4	0x2028	eb012255	BL 0x4a984
	x.go:5	0x202c	e49df084	RET #132
	x.go:5	0x2030	eafffffe	B 0x2030
	x.go:5	0x2034	ffffff7c	?

After:

TEXT main.f(SB) x.go
	x.go:3	0x2000	e59a1008	MOVW 0x8(R10), R1
	x.go:3	0x2004	e59fb02c	MOVW 0x2c(R15), R11
	x.go:3	0x2008	e08d200b	ADD R11, R13, R2
	x.go:3	0x200c	e1520001	CMP R1, R2
	x.go:3	0x2010	9a000004	B.LS 0x2028
	x.go:3	0x2014	e52de084	MOVW.W R14, -0x84(R13)
	x.go:4	0x2018	e28d1004	ADD $4, R13, R1
	x.go:4	0x201c	e3a00000	MOVW $0, R0
	x.go:4	0x2020	eb0124dc	BL 0x4b398
	x.go:5	0x2024	e49df084	RET #132
	x.go:5	0x2028	e1a0300e	MOVW R14, R3
	x.go:5	0x202c	eb011b0d	BL runtime.morestack_noctxt(SB)
	x.go:5	0x2030	eafffff2	B main.f(SB)
	x.go:5	0x2034	eafffffe	B 0x2034
	x.go:5	0x2038	ffffff7c	?

Updates #10587.

package sort benchmarks on an iPhone 6:

name            old time/op  new time/op  delta
SortString1K     569µs ± 0%   565µs ± 1%  -0.75%  (p=0.000 n=23+24)
StableString1K   872µs ± 1%   870µs ± 1%  -0.16%  (p=0.009 n=23+24)
SortInt1K        317µs ± 2%   316µs ± 2%    ~     (p=0.410 n=26+26)
StableInt1K      343µs ± 1%   339µs ± 1%  -1.07%  (p=0.000 n=22+23)
SortInt64K      30.0ms ± 1%  30.0ms ± 1%    ~     (p=0.091 n=25+24)
StableInt64K    30.2ms ± 0%  30.0ms ± 0%  -0.69%  (p=0.000 n=22+22)
Sort1e2          147µs ± 1%   146µs ± 0%  -0.48%  (p=0.000 n=25+24)
Stable1e2        290µs ± 1%   286µs ± 1%  -1.30%  (p=0.000 n=23+24)
Sort1e4         29.5ms ± 2%  29.7ms ± 1%  +0.71%  (p=0.000 n=23+23)
Stable1e4       88.7ms ± 4%  88.6ms ± 8%  -0.07%  (p=0.022 n=26+26)
Sort1e6          4.81s ± 7%   4.83s ± 7%    ~     (p=0.192 n=26+26)
Stable1e6        18.3s ± 1%   18.1s ± 1%  -0.76%  (p=0.000 n=25+23)
SearchWrappers   318ns ± 1%   344ns ± 1%  +8.14%  (p=0.000 n=23+26)

package sort benchmarks on a first generation rpi:

name            old time/op  new time/op  delta
SearchWrappers  4.13µs ± 0%  3.95µs ± 0%   -4.42%  (p=0.000 n=15+13)
SortString1K    5.81ms ± 1%  5.82ms ± 2%     ~     (p=0.400 n=14+15)
StableString1K  9.69ms ± 1%  9.73ms ± 0%     ~     (p=0.121 n=15+11)
SortInt1K       3.30ms ± 2%  3.66ms ±19%  +10.82%  (p=0.000 n=15+14)
StableInt1K     5.97ms ±15%  4.17ms ± 8%  -30.05%  (p=0.000 n=15+15)
SortInt64K       319ms ± 1%   295ms ± 1%   -7.65%  (p=0.000 n=15+15)
StableInt64K     343ms ± 0%   332ms ± 0%   -3.26%  (p=0.000 n=12+13)
Sort1e2         3.36ms ± 2%  3.22ms ± 4%   -4.10%  (p=0.000 n=15+15)
Stable1e2       6.74ms ± 1%  6.43ms ± 2%   -4.67%  (p=0.000 n=15+15)
Sort1e4          247ms ± 1%   247ms ± 1%     ~     (p=0.331 n=15+14)
Stable1e4        864ms ± 0%   820ms ± 0%   -5.15%  (p=0.000 n=14+15)
Sort1e6          41.2s ± 0%   41.2s ± 0%   +0.15%  (p=0.000 n=13+14)
Stable1e6         192s ± 0%    182s ± 0%   -5.07%  (p=0.000 n=14+14)

Change-Id: I8a9db77e1d4ea1956575895893bc9d04bd81204b
Reviewed-on: https://go-review.googlesource.com/10497
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-04 16:35:12 +00:00
Josh Bleecher Snyder
f4b48de3ad cmd/internal/obj/x86: make function prologue more predictable
Static branch prediction guesses that forward branches aren't taken.
Since stacks are rarely grown, make the forward branch mean grow.

Sample disassembly for

func f() {
	_ = [128]byte{}
}

Before:

TEXT main.f(SB) x.go
	x.go:3	0x2000	65488b0c25a0080000	GS MOVQ GS:0x8a0, CX
	x.go:3	0x2009	483b6110		CMPQ 0x10(CX), SP
	x.go:3	0x200d	7707			JA 0x2016
	x.go:3	0x200f	e88c410400		CALL runtime.morestack_noctxt(SB)
	x.go:3	0x2014	ebea			JMP main.f(SB)
	x.go:3	0x2016	4881ec80000000		SUBQ $0x80, SP
	x.go:4	0x201d	488d3c24		LEAQ 0(SP), DI
	x.go:4	0x2021	31c0			XORL AX, AX
	x.go:4	0x2023	e8cc640400		CALL 0x484f4
	x.go:5	0x2028	4881c480000000		ADDQ $0x80, SP
	x.go:5	0x202f	c3			RET

After:

TEXT main.f(SB) x.go
	x.go:3	0x2000	65488b0c25a0080000	GS MOVQ GS:0x8a0, CX
	x.go:3	0x2009	483b6110		CMPQ 0x10(CX), SP
	x.go:3	0x200d	761a			JBE 0x2029
	x.go:3	0x200f	4881ec80000000		SUBQ $0x80, SP
	x.go:4	0x2016	488d3c24		LEAQ 0(SP), DI
	x.go:4	0x201a	31c0			XORL AX, AX
	x.go:4	0x201c	e813740400		CALL 0x49434
	x.go:5	0x2021	4881c480000000		ADDQ $0x80, SP
	x.go:5	0x2028	c3			RET
	x.go:3	0x2029	e8224f0400		CALL runtime.morestack_noctxt(SB)
	x.go:3	0x202e	ebd0			JMP main.f(SB)

Updates #10587.

Sample benchmarks on a 2.8 GHz Intel Core i7:

package sort

name            old mean              new mean              delta
SearchWrappers   134ns × (0.99,1.01)   132ns × (0.99,1.01)  -1.73% (p=0.000 n=15+14)
SortString1K     215µs × (0.99,1.01)   213µs × (0.99,1.01)  -0.61% (p=0.020 n=14+15)
StableString1K   311µs × (0.99,1.02)   309µs × (0.99,1.02)    ~    (p=0.077 n=14+15)
SortInt1K        103µs × (0.99,1.02)   100µs × (0.98,1.01)  -3.34% (p=0.000 n=15+15)
StableInt1K      102µs × (0.99,1.01)    98µs × (0.97,1.04)  -3.53% (p=0.000 n=15+15)
SortInt64K      10.1ms × (0.98,1.02)   9.7ms × (0.99,1.01)  -3.86% (p=0.000 n=14+15)
StableInt64K    8.70ms × (0.99,1.01)  8.44ms × (0.99,1.03)  -2.93% (p=0.000 n=14+15)
Sort1e2         51.2µs × (1.00,1.01)  48.9µs × (0.99,1.02)  -4.48% (p=0.000 n=13+15)
Stable1e2        100µs × (0.99,1.02)    99µs × (0.99,1.01)  -1.15% (p=0.000 n=14+13)
Sort1e4         11.1ms × (0.99,1.02)  10.4ms × (0.99,1.01)  -6.02% (p=0.000 n=15+14)
Stable1e4       30.6ms × (0.99,1.01)  30.3ms × (0.99,1.02)  -1.02% (p=0.001 n=15+14)
Sort1e6          1.75s × (0.99,1.02)   1.66s × (0.98,1.03)  -4.95% (p=0.000 n=14+15)
Stable1e6        6.31s × (0.99,1.01)   6.26s × (0.99,1.01)  -0.79% (p=0.002 n=15+15)

package regexp

name                          old mean              new mean              delta
Literal                        131ns × (0.99,1.01)   130ns × (0.99,1.03)  -1.07% (p=0.004 n=14+15)
NotLiteral                    2.13µs × (0.99,1.01)  2.01µs × (0.99,1.03)  -5.71% (p=0.000 n=14+14)
MatchClass                    3.15µs × (0.99,1.01)  3.04µs × (0.99,1.02)  -3.40% (p=0.000 n=15+15)
MatchClass_InRange            2.92µs × (0.99,1.01)  2.77µs × (0.99,1.02)  -5.05% (p=0.000 n=13+15)
ReplaceAll                    2.17µs × (0.99,1.02)  2.06µs × (0.99,1.01)  -5.19% (p=0.000 n=15+13)
AnchoredLiteralShortNonMatch   116ns × (0.99,1.02)   113ns × (0.99,1.01)  -2.75% (p=0.000 n=15+14)
AnchoredLiteralLongNonMatch    125ns × (0.99,1.01)   127ns × (0.98,1.02)  +1.49% (p=0.000 n=15+15)
AnchoredShortMatch             178ns × (0.99,1.02)   175ns × (0.99,1.01)  -1.62% (p=0.000 n=15+13)
AnchoredLongMatch              328ns × (0.99,1.00)   341ns × (0.99,1.01)  +3.73% (p=0.000 n=12+15)
OnePassShortA                  773ns × (0.99,1.02)   752ns × (0.99,1.01)  -2.78% (p=0.000 n=15+13)
NotOnePassShortA               794ns × (0.99,1.03)   780ns × (0.99,1.02)  -1.75% (p=0.001 n=15+15)
OnePassShortB                  608ns × (0.99,1.01)   591ns × (0.99,1.02)  -2.86% (p=0.000 n=15+14)
NotOnePassShortB               576ns × (0.99,1.01)   571ns × (0.99,1.02)  -0.74% (p=0.035 n=15+15)
OnePassLongPrefix              131ns × (0.99,1.02)   130ns × (0.99,1.02)  -1.32% (p=0.003 n=15+15)
OnePassLongNotPrefix           503ns × (0.99,1.02)   481ns × (0.99,1.01)  -4.34% (p=0.000 n=15+13)
MatchEasy0_32                  102ns × (0.98,1.01)   101ns × (0.99,1.02)    ~    (p=0.907 n=15+14)
MatchEasy0_1K                  617ns × (0.99,1.02)   634ns × (0.98,1.02)  +2.77% (p=0.000 n=15+15)
MatchEasy0_32K                10.9µs × (0.99,1.01)  11.1µs × (0.99,1.01)  +1.59% (p=0.000 n=15+15)
MatchEasy0_1M                  406µs × (0.99,1.02)   410µs × (0.99,1.02)  +1.01% (p=0.000 n=14+15)
MatchEasy0_32M                13.4ms × (0.99,1.01)  13.7ms × (0.99,1.02)  +1.64% (p=0.000 n=12+15)
MatchEasy1_32                 83.7ns × (0.98,1.02)  83.0ns × (0.98,1.02)    ~    (p=0.190 n=15+15)
MatchEasy1_1K                 1.46µs × (0.99,1.02)  1.39µs × (0.99,1.02)  -4.83% (p=0.000 n=15+15)
MatchEasy1_32K                49.4µs × (0.99,1.01)  49.4µs × (0.99,1.01)    ~    (p=0.205 n=15+15)
MatchEasy1_1M                 1.72ms × (0.99,1.02)  1.75ms × (0.99,1.01)  +1.34% (p=0.000 n=15+15)
MatchEasy1_32M                55.5ms × (0.99,1.01)  56.1ms × (0.99,1.02)  +1.10% (p=0.002 n=15+15)
MatchMedium_32                1.37µs × (0.99,1.04)  1.33µs × (0.99,1.01)  -2.87% (p=0.000 n=15+15)
MatchMedium_1K                41.1µs × (0.99,1.02)  40.4µs × (0.99,1.02)  -1.59% (p=0.000 n=15+15)
MatchMedium_32K               1.71ms × (0.99,1.01)  1.75ms × (0.99,1.02)  +2.36% (p=0.000 n=14+15)
MatchMedium_1M                54.5ms × (0.99,1.01)  56.1ms × (0.99,1.01)  +2.94% (p=0.000 n=13+15)
MatchMedium_32M                1.75s × (0.99,1.01)   1.80s × (0.99,1.01)  +2.77% (p=0.000 n=15+15)
MatchHard_32                  2.12µs × (0.99,1.02)  2.06µs × (0.99,1.01)  -2.60% (p=0.000 n=15+14)
MatchHard_1K                  64.4µs × (0.98,1.02)  62.2µs × (0.99,1.01)  -3.33% (p=0.000 n=15+15)
MatchHard_32K                 2.74ms × (0.99,1.01)  2.75ms × (0.99,1.01)    ~    (p=0.310 n=15+14)
MatchHard_1M                  87.1ms × (0.99,1.02)  88.2ms × (0.99,1.01)  +1.36% (p=0.000 n=14+15)
MatchHard_32M                  2.79s × (0.99,1.02)   2.83s × (0.99,1.02)  +1.26% (p=0.004 n=15+14)

go1 benchmarks

name                   old time/op    new time/op    delta
BinaryTree17              3.34s ± 3%     3.28s ± 2%  -1.86%  (p=0.000 n=67+66)
Fannkuch11                2.50s ± 1%     2.51s ± 1%  +0.24%  (p=0.016 n=63+66)
FmtFprintfEmpty          50.3ns ± 1%    50.2ns ± 2%  -0.30%  (p=0.001 n=62+67)
FmtFprintfString          178ns ± 1%     166ns ± 1%  -7.10%  (p=0.000 n=62+59)
FmtFprintfInt             168ns ± 1%     161ns ± 2%  -4.41%  (p=0.000 n=66+64)
FmtFprintfIntInt          292ns ± 1%     282ns ± 2%  -3.55%  (p=0.000 n=62+60)
FmtFprintfPrefixedInt     245ns ± 2%     239ns ± 2%  -2.24%  (p=0.000 n=66+65)
FmtFprintfFloat           338ns ± 2%     326ns ± 1%  -3.42%  (p=0.000 n=64+59)
FmtManyArgs              1.14µs ± 1%    1.10µs ± 2%  -3.55%  (p=0.000 n=62+62)
GobDecode                8.88ms ± 2%    8.74ms ± 1%  -1.55%  (p=0.000 n=66+62)
GobEncode                6.84ms ± 2%    6.61ms ± 2%  -3.32%  (p=0.000 n=61+67)
Gzip                      356ms ± 2%     352ms ± 2%  -1.07%  (p=0.000 n=67+66)
Gunzip                   90.6ms ± 2%    89.8ms ± 1%  -0.83%  (p=0.000 n=65+64)
HTTPClientServer         82.6µs ± 2%    82.5µs ± 2%    ~     (p=0.832 n=65+63)
JSONEncode               17.5ms ± 2%    16.8ms ± 2%  -3.77%  (p=0.000 n=63+63)
JSONDecode               63.3ms ± 2%    59.0ms ± 2%  -6.85%  (p=0.000 n=64+63)
Mandelbrot200            3.85ms ± 1%    3.85ms ± 1%    ~     (p=0.127 n=65+62)
GoParse                  3.75ms ± 2%    3.66ms ± 2%  -2.39%  (p=0.000 n=66+64)
RegexpMatchEasy0_32       100ns ± 2%     100ns ± 1%  -0.65%  (p=0.000 n=62+64)
RegexpMatchEasy0_1K       342ns ± 1%     341ns ± 1%  -0.43%  (p=0.000 n=65+64)
RegexpMatchEasy1_32      82.8ns ± 2%    82.8ns ± 2%    ~     (p=0.977 n=63+64)
RegexpMatchEasy1_1K       511ns ± 2%     506ns ± 2%  -1.01%  (p=0.000 n=63+64)
RegexpMatchMedium_32      139ns ± 1%     134ns ± 3%  -3.27%  (p=0.000 n=59+60)
RegexpMatchMedium_1K     41.8µs ± 2%    40.5µs ± 2%  -3.05%  (p=0.000 n=62+64)
RegexpMatchHard_32       2.13µs ± 1%    2.09µs ± 1%  -2.22%  (p=0.000 n=60+65)
RegexpMatchHard_1K       64.4µs ± 3%    62.8µs ± 2%  -2.58%  (p=0.000 n=65+59)
Revcomp                   531ms ± 2%     529ms ± 1%  -0.28%  (p=0.022 n=61+61)
Template                 73.2ms ± 1%    73.1ms ± 1%    ~     (p=0.794 n=66+63)
TimeParse                 369ns ± 1%     352ns ± 1%  -4.68%  (p=0.000 n=65+66)
TimeFormat                374ns ± 2%     348ns ± 2%  -7.01%  (p=0.000 n=66+64)

Change-Id: Ib190b5bb48a3e9087711d9e3383621d3103dd342
Reviewed-on: https://go-review.googlesource.com/10367
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-04 16:32:23 +00:00
Russ Cox
227fb116be cmd/go: clean up after 'go build' during 'go install'
If 'go install' (with no arguments, meaning the current directory)
succeeds, remove the executable written by 'go build', if present.
This avoids leaving a stale binary behind during a sequence like:

	go build
	<test, mostly works, make small change>
	go install

Before this CL, the current directory still has the stale binary
from 'go build'. If $PATH contains dot, running the name of
the program will find this stale binary instead of the new,
installed one.

Remove the 'go build' target during 'go install', both to clean
up the directory and to avoid accidentally running the stale binary.

Another way to view this CL is that it makes the go command
behave as if 'go install' is implemented by 'go build' followed by
moving the resulting binary to the install location.

See #9645 for discussion and objections.

Fixes #9645.

Change-Id: Ide109572f96bbb5a35be45dda17738317462a7d4
Reviewed-on: https://go-review.googlesource.com/10682
Reviewed-by: Rob Pike <r@golang.org>
2015-06-04 04:12:32 +00:00
Russ Cox
119daba94e cmd/go: always rebuild GOPATH code that looks out of date
We used to put a rebuilding barrier between GOPATHs, so that if
you had GOPATH=dir1:dir2 and you had "p" in dir1/src/p
and "q" in dir2/src/q, with "p" importing "q", then when you
ran 'go install p', it would see that it was working in dir1
and (since nothing from dir2 was explicitly mentioned)
would assume that everything in dir2 is up-to-date, provided
it is built at all.

This has the confusing behavior that if "q" hasn't been built ever,
then if you update sources in q and run 'go install p', the right
thing happens (q is rebuilt and then p), but after that, if you update
sources in q and run 'go install p', nothing happens: the installed
q is assumed up-to-date.

People using code conventions with multiple GOPATH entries
(for example, with commands in one place and libraries in another,
or vendoring conventions that try to avoid rewriting import paths)
run into this without realizing it and end up with incorrect build
results.

The original motivation here was to avoid rebuild standard packages
since a system-installed GOROOT might be unwritable.
The change introduced to separate GOROOT also separated
individual GOPATH entries. Later changes added a different, more
aggressive earlier shortcut for GOROOT in release settings,
so the code here is now only applying to (and confusing)
multiple GOPATH entries. Remove it.

Fixes #10509.

Change-Id: I687a3baa81eff4073b0d67f9acbc5a3ab192eda5
Reviewed-on: https://go-review.googlesource.com/9155
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-04 04:11:17 +00:00
Russ Cox
7b87631e8c cmd/go: detect when package or binary is stale due to removed source file
The go command uses file modification times to decide when a
package is out of date: if the .a file is older than a source file,
the .a file needs to be rebuilt. This scheme breaks down when
multiple source files compile into a single .a file: if one source file
is removed but no other changes are made, there is no indication
that the .a file is out of date.

The fix is to store a value called a build ID in the package archive itself.
The build ID is a hash of the names of all source files compiled into the package.
A later go command can read the build ID out of the package archive
and compare to the build ID derived from the list of source files it now
sees in the directory. If the build IDs differ, the file list has changed,
and the package must be rebuilt.

There is a cost here: when scanning a package directory, in addition
to reading the beginning of every source file for build tags and imports,
the go command now also reads the beginning of the associated
package archive, for the build ID. This is at most a doubling in the
number of files read. On my 2012 MacBook Pro, the time for
'go list std' increases from about 0.215 seconds to about 0.23 seconds.

For executable binaries, the approach is the same except that the
build ID information is stored in a trailer at the end of the executable file.
It remains to be seen if anything objects to the trailer.
I don't expect problems except maybe on Plan 9.

Fixes #3895.

Change-Id: I21b4ebf5890c1a39e4a013eabe1ddbb5f3510c04
Reviewed-on: https://go-review.googlesource.com/9154
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-04 04:11:03 +00:00
Russ Cox
81d5810be9 cmd/compile: merge Node.Opt and Node.Val behind access methods
$ sizeof -p cmd/compile/internal/gc Node
Node 144
$

Change-Id: I688e3790964fe42f48c19f697ec38094a92fe1c1
Reviewed-on: https://go-review.googlesource.com/10531
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-04 03:58:41 +00:00
Russ Cox
a53710ffcb cmd/compile: cleanups for Node trimming sequence
Suggested during code reviews of last 15 CLs (or so).

Change-Id: If780f6eb47a7a31df133c64d5dcf0eaf04d8447b
Reviewed-on: https://go-review.googlesource.com/10675
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-04 03:58:27 +00:00
Josh Bleecher Snyder
ca19e55f9a cmd/link: make stkcheck more flexible
stkcheck is flow-insensitive: It processes calls in PC order.
Since morestack was always the first call in a function,
it was a safe, conservative approximation to simply adjust stack
space as we went, recognizing morestack when it showed up.

Subsequent CLS will rearrange the function prologue;
morestack may no longer be the first call in a function.

Introducing flow-sensitivity to stkcheck would allow this,
and possibly allow a smaller stackguard.
It is also a high risk change and possibly expensive.

Instead, assume that all calls to morestack occur as
part of the function prologue, no matter where they
are located in the program text.

Updates #10587.

Change-Id: I4dcdd4256a980fc4bc433a68a10989ff57f7034f
Reviewed-on: https://go-review.googlesource.com/10496
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-04 03:14:23 +00:00
Russ Cox
73d109c509 cmd/internal/gc: accept map literals with omitted key type
Fixes #10209.

Change-Id: I248434f9195c868befd1ed8a6000a9cac72d1df8
Reviewed-on: https://go-review.googlesource.com/10263
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-04 02:31:38 +00:00
Robert Griesemer
1e48683708 src/cmd/compile/internal/gc: re-vendor math/big, manually adjust mparith3.go
The only unreviewed change is in mparith3.go.

Change-Id: Iec0885e7688981cbaed04c152dc9b1c7032677e6
Reviewed-on: https://go-review.googlesource.com/10665
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
2015-06-03 22:28:06 +00:00
Russ Cox
0f6da8923f cmd/internal/gc: add -buildid flag to write build ID into object file
The build ID is an opaque token supplied by the build system.
The compiler writes it out early in the Go export metadata
(the second line), in a way that does not bother existing readers.

The intent is that the go command can use this to store information
about the sources for the generated code, so that it can detect
stale packages even in cases (like removed files) where mtimes fail.

Change-Id: Ib5082515d6cde8a07a8d4b5c69d1e8e4190cb5e1
Reviewed-on: https://go-review.googlesource.com/9153
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-03 20:43:51 +00:00
Russ Cox
3974357ecd cmd/dist: one more file for CL 9152
This one didn't get written out.

Change-Id: Iee173861fb4dc7cafa64ba5f601f4664b6e8da4e
Reviewed-on: https://go-review.googlesource.com/10681
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-03 20:42:13 +00:00
Russ Cox
e346adf568 cmd/dist: do not rewrite files that already have the correct content
In particular, this avoids moving the mtime on runtime/zversion.go
forward unless the file is out of date. In turn, this makes cross compiles
that run dist multiple times coexist nicely.

(It's no longer necessary to run dist multiple times to set up cross compiles,
but people still might, and it's easy to fix regardless.)

Fixes #4749.

Change-Id: Id430525f168f106bc4b821ca74b2ca498a748f14
Reviewed-on: https://go-review.googlesource.com/9152
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-03 20:39:35 +00:00
Russ Cox
85069e9e9b cmd/dist: fix build tag parser
It was mishandling conjunctions containing negations.

Change-Id: Ife571b28416870ba2ceadbdac5ecb4670432bba1
Reviewed-on: https://go-review.googlesource.com/9151
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-03 20:35:04 +00:00
Russ Cox
c345f7ff95 cmd/go: make test.bash pass again
Fixes #8809.

Change-Id: Id443fd406e9c611d5dfabc71a98eb71d1cc0972c
Reviewed-on: https://go-review.googlesource.com/9150
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-03 20:33:30 +00:00
Russ Cox
8f0cc6c0d8 cmd/go: expand 'internal' rule to all repositories
See golang.org/s/go14internal.

Fixes #10479.

Change-Id: I8c657dadeb5f10af060f22dedc15c1af989d4519
Reviewed-on: https://go-review.googlesource.com/9156
Reviewed-by: Rob Pike <r@golang.org>
2015-06-03 20:27:25 +00:00
Russ Cox
3be7f28e82 cmd/compile: remove Node.Nname, now unused
$ sizeof -p cmd/compile/internal/gc Node
Node 160
$

Change-Id: Ib0bd4230c8547f36972b2a9d81ba3eca81496e39
Reviewed-on: https://go-review.googlesource.com/10537
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-03 20:11:25 +00:00
Russ Cox
f1f0eda446 cmd/compile: remove use of Node.Nname in initplan
$ sizeof -p cmd/compile/internal/gc Node
Node 168
$

Change-Id: Ie7e2cee8cec101560bd5dd013b23969278f89b12
Reviewed-on: https://go-review.googlesource.com/10536
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-03 20:10:42 +00:00
Russ Cox
da094f19f1 cmd/compile: move OCASE/OXCASE Node.Nname into Node.Rlist (type switch variable)
$ sizeof -p cmd/compile/internal/gc Node
Node 168
$

Change-Id: I22bcea8099f308298c9db75c937f35e7fca906f1
Reviewed-on: https://go-review.googlesource.com/10535
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-03 20:10:31 +00:00
Russ Cox
bd4fff6358 cmd/compile: move ODCLFUNC Node.Nname into Node.Func.Nname
$ sizeof -p cmd/compile/internal/gc Node
Node 168
$

Change-Id: I7decd950fe068c0f294c6c9bff07ef809c394429
Reviewed-on: https://go-review.googlesource.com/10534
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-03 20:10:17 +00:00
Russ Cox
8f4d964641 cmd/compile, cmd/internal: replace %P with %v in a few final prints
$ sizeof -p cmd/compile/internal/gc Node
Node 168
$

Change-Id: I1e2f17bfee0e6ca7213706c4cef8d990f4461915
Reviewed-on: https://go-review.googlesource.com/10533
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-03 20:10:03 +00:00
Russ Cox
fd2154f906 cmd/compile: move Node.Curfn into both Node.Func and Node.Name
$ sizeof -p cmd/compile/internal/gc Node
Node 168
$

Change-Id: If624a2d72ec04ef30a1bc7ce76c0d61a526d8a37
Reviewed-on: https://go-review.googlesource.com/10532
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-03 20:09:52 +00:00
Russ Cox
3c3019aa51 cmd/compile: move Node.Param, Node.Funcdepth into Node.Name; remove Node.Walkgen
$ sizeof -p cmd/compile/internal/gc Node
Node 176
$

Change-Id: Ibf1ab531a60d4af8a0c242c0e504f4fd50cd5b36
Reviewed-on: https://go-review.googlesource.com/10530
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-03 20:09:41 +00:00
Russ Cox
11322d45a1 cmd/compile: move Node.Vargen, Node.Iota into Node.Name
$ sizeof -p cmd/compile/internal/gc Node
Node 192
$

Change-Id: I8f0c1a3cc2bf9c8eff02bbd8d061ff98affc9eb0
Reviewed-on: https://go-review.googlesource.com/10529
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-06-03 20:09:20 +00:00