1
0
mirror of https://github.com/golang/go synced 2024-10-04 13:21:22 -06:00
Commit Graph

8613 Commits

Author SHA1 Message Date
Robert Griesemer
1f446432dd cmd/compile: fix error msg mentioning different packages with same name
This is a regression from 1.6. The respective code in importimport
(export.go) was not exactly replicated with the new importer. Also
copied over the missing cyclic import check.

Added test cases.

Fixes #16133.

Change-Id: I1e0a39ff1275ca62a8054874294d400ed83fb26a
Reviewed-on: https://go-review.googlesource.com/24312
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
2016-06-22 00:12:55 +00:00
Alan Donovan
b65cb7f198 cmd/vet: -lostcancel: check for discarded result of context.WithCancel
The cfg subpackage builds a control flow graph of ast.Nodes.
The lostcancel module checks this graph to find paths, from a call to
WithCancel to a return statement, on which the cancel variable is
not used.  (A trivial case is simply assigning the cancel result to
the blank identifier.)

In a sample of 50,000 source files, the new check found 2068 blank
assignments and 118 return-before-cancel errors.  I manually inspected
20 of the latter and didn't find a single false positive among them.

Change-Id: I84cd49445f9f8d04908b04881eb1496a96611205
Reviewed-on: https://go-review.googlesource.com/24150
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-06-21 14:58:33 +00:00
qeed
d282427248 cmd/cgo: error, not panic, if not enough arguments to function
Fixes #16116.

Change-Id: Ic3cb0b95382bb683368743bda49b4eb5fdcc35c0
Reviewed-on: https://go-review.googlesource.com/24286
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-21 04:32:04 +00:00
Ian Lance Taylor
252eda470a cmd/pprof: don't use offset if we don't have a start address
The test is in the runtime package because there are other tests of
pprof there. At some point we should probably move them all into a pprof
testsuite.

Fixes #16128.

Change-Id: Ieefa40c61cf3edde11fe0cf04da1debfd8b3d7c0
Reviewed-on: https://go-review.googlesource.com/24274
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-06-21 01:44:38 +00:00
Andrew Gerrand
109823ec93 cmd/go: for generate, use build context values for GOOS/GOARCH
Fixes #16120

Change-Id: Ia352558231e00baab5c698e93d7267564c07ec0c
Reviewed-on: https://go-review.googlesource.com/24242
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-20 23:55:43 +00:00
Michael Munday
f3d54789f7 cmd/compile: use power5 instructions for uint64 to float casts
Use the same technique as mips64 for these casts (CL 22835).

We could use the FCFIDU instruction for ppc64le however it seems
better to keep it the same as ppc64 for now.

Updates #15539, updates #16004.

Change-Id: I550680e485327568bf3238c4615a6cc8de6438d7
Reviewed-on: https://go-review.googlesource.com/24191
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-17 19:15:29 +00:00
Austin Clements
79f2f008a3 cmd/dist: make zosarch.go deterministic
Currently zosarch.go is written out in non-deterministic map order.
Sort the keys and write it out in sorted order to make the generated
file contents deterministic.

Change-Id: Id490f0e8665a2c619c5a7a00a30f4fc64f333258
Reviewed-on: https://go-review.googlesource.com/24174
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-06-16 19:32:33 +00:00
Josh Bleecher Snyder
8086ce44c4 [dev.ssa] cmd/compile: unify OpARMMOVWaddr cases
Minor code cleanup. Done as part of understanding
OpARMMOVWaddr, since other architectures will
need to do something similar.

Change-Id: Iea2ecf3defb4f884e63902c369cd55e4647bce7a
Reviewed-on: https://go-review.googlesource.com/24157
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-06-16 14:34:57 +00:00
Josh Bleecher Snyder
22d1318e7b [dev.ssa] cmd/compile: refactor out CheckLoweredPhi
This will be used verbatim in other architectures.

Change-Id: I307891ae597d797fd45f296b6a38ffe9fac6b975
Reviewed-on: https://go-review.googlesource.com/24155
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-16 14:34:28 +00:00
Josh Bleecher Snyder
a2beee000b [dev.ssa] cmd/compile: improve special register error checking
Provide better diagnostic messages.

Use an int for numRegs comparisons,
to avoid asking whether a uint8 is > 255.

Change-Id: I33ae193ce292b24b369865abda3902c3207d7d3f
Reviewed-on: https://go-review.googlesource.com/24135
Reviewed-by: Keith Randall <khr@golang.org>
2016-06-16 14:34:01 +00:00
Josh Bleecher Snyder
d0fa6c2f9e [dev.ssa] cmd/compile: add and use SSAReg
This will be needed by other architectures as well.
Put a cleaner encapsulation around it.

Change-Id: I0ac25d600378042b2233301678e9d037e20701d8
Reviewed-on: https://go-review.googlesource.com/24154
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-06-16 14:12:30 +00:00
Cherry Zhang
93b8aab5c9 [dev.ssa] cmd/compile: handle GetG on ARM
Use hardware g register (R10) for GetG, allow g to appear at LHS of
some ops.

Progress on SSA backend for ARM. Now everything compiles and runs.

Updates #15365.

Change-Id: Icdf93585579faa86cc29b1e17ab7c90f0119fc4e
Reviewed-on: https://go-review.googlesource.com/23952
Reviewed-by: David Chase <drchase@google.com>
2016-06-15 15:36:35 +00:00
David Crawshaw
af0fc83985 cmd/compile, etc: handle many struct fields
This adds 8 bytes of binary size to every type that has methods. It is
the smallest change I could come up with for 1.7.

Fixes #16037

Change-Id: Ibe15c3165854a21768596967757864b880dbfeed
Reviewed-on: https://go-review.googlesource.com/24070
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-14 15:32:34 +00:00
Keith Randall
0393ed8201 [dev.ssa] Merge remote-tracking branch 'origin/master' into mergebranch
Change-Id: Idd150294aaeced0176b53d6b95852f5d21ff4fdc
2016-06-14 07:34:09 -07:00
Ian Lance Taylor
0deb49f9c0 cmd/go: include .syso files even if CGO_ENABLED=0
A .syso file may include information that should go into the object file
that is not object code, and should be included even if not using cgo.
The example in the issue is a Windows manifest file.

Fixes #16050.

Change-Id: I1f4f3f80bb007e84d153ca2d26e5919213ea4f8d
Reviewed-on: https://go-review.googlesource.com/24032
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-06-14 03:44:27 +00:00
Ian Lance Taylor
9273e25ecc cmd/go: remove obsolete comment referring to deleted parameter
The dir parameter was removed in https://golang.org/cl/5732045.

Fixes #15503.

Change-Id: I02a6d8317233bea08633715a095ea2514822032b
Reviewed-on: https://go-review.googlesource.com/24011
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <shurcool@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-06-14 03:33:45 +00:00
Keith Randall
5701174c52 cmd/link: put padding between functions, not at the end of a function
Functions should be declared to end after the last real instruction, not
after the last padding byte. We achieve this by adding the padding while
assembling the text section in the linker instead of adding the padding
to the function symbol in the compiler. This change makes dtrace happy.

TODO: check that this works with external linking

Fixes #15969

Change-Id: I973e478d0cd34b61be1ddc55410552cbd645ad62
Reviewed-on: https://go-review.googlesource.com/24040
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-06-13 14:05:52 +00:00
Cherry Zhang
c40dcff2f2 [dev.ssa] cmd/compile: use MOVWaddr for address on ARM
Introduce an op MOVWaddr for addresses on ARM, instead of overuse
ADDconst.

Mark MOVWaddr as rematerializable. This fixes a liveness problem: if
it were not rematerializable, the address of a variable may be spilled
and later use of the address may just load the spilled value without
mentioning the variable, and the liveness code may think it is dead
prematurely.

Update #15365.

Change-Id: Ib0b0fa826bdb75c9e6bb362b95c6cf132cc6b1c0
Reviewed-on: https://go-review.googlesource.com/23942
Reviewed-by: David Chase <drchase@google.com>
2016-06-13 12:55:51 +00:00
Cherry Zhang
e3a6d00876 [dev.ssa] cmd/compile: ensure OffPtr has pointer type
SSA treats SP as constant throughout a function, so as OffPtr [off] SP.
When the stack moves, spilled OffPtr values become invalid, if they are
not pointer-typed.

(Currently it is fine because of the optimization rules that folds OffPtr
into Load/Store. But it'd better be "optimization", not requirement.)

Updates #15365.

Change-Id: I76cf4008dfdc169e1cb5a55a2605b6678efc915d
Reviewed-on: https://go-review.googlesource.com/23941
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-06-13 12:55:30 +00:00
David Chase
595426c0d9 cmd/compile: fix OASWB rewriting in racewalk
Special case for rewriting OAS inits omitted OASWB, added
that and OAS2FUNC.  The special case cannot be default case,
that causes racewalk to fail in horrible ways.

Fixes #16008.

Change-Id: Ie0d2f5735fe9d8255a109597b36d196d4f86703a
Reviewed-on: https://go-review.googlesource.com/23954
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-12 23:58:25 +00:00
Dmitri Shuralyov
2ba3d5fc96 cmd/go: remove invalid space in import comment docs
Generate package comment in alldocs.go using line comments rather than
general comments. This scales better, general comments cannot contain the
"*/" character sequence. Line comments do not have any restrictions on
the comment text that can be contained.

Remove the dependency on sed, which is not cross-platform, not go-gettable
external command.

Remove trailing whitespace from usage string in test.go. It's unnecessary.

Fixes #16030.

Change-Id: I3c0bc9955e7c7603c3d1fb4878218b0719d02e04
Reviewed-on: https://go-review.googlesource.com/23968
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-12 04:13:07 +00:00
Ian Lance Taylor
fee02d270b cmd/go: clarify go get documentation
Make the documentation for `go get` match the documentation for `go
install`, since `go get` essentially invokes `go install`.

Update #15825.

Change-Id: I374d80efd301814b6d98b86b7a4a68dd09704c92
Reviewed-on: https://go-review.googlesource.com/23925
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-06-10 04:12:50 +00:00
Keith Randall
e3f1c66f31 cmd/compile: for tail calls in stubs, ensure args are alive
The generated code for interface stubs sometimes just messes
with a few of the args and then tail-calls to the target routine.
The args that aren't explicitly modified appear to not be used.
But they are used, by the thing we're tail calling.

Fixes #16016

Change-Id: Ib9b3a8311bb714a201daee002885fcb59e0463fa
Reviewed-on: https://go-review.googlesource.com/23960
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-06-09 19:32:51 +00:00
Ian Lance Taylor
1bdf1c3024 cmd/cgo: fix use of unsafe argument in new deferred function
The combination of https://golang.org/cl/23650 and
https://golang.org/cl/23675 did not work--they were tested separately
but not together.

The problem was that 23650 introduced deferred argument checking, and
the deferred function loses the type that 23675 started requiring. The
fix is to go back to using an empty interface type in a deferred
argument check.

No new test required--fixes broken build.

Change-Id: I5ea023c5aed71d70e57b11c4551242d3ef25986d
Reviewed-on: https://go-review.googlesource.com/23961
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2016-06-09 19:05:19 +00:00
Ian Lance Taylor
837984f372 cmd/cgo: use function arg type for _cgoCheckPointerN function
When cgo writes a _cgoCheckPointerN function to handle unsafe.Pointer,
use the function's argument type rather than interface{}. This permits
type errors to be detected at build time rather than run time.

Fixes #13830.

Change-Id: Ic7090905e16b977e2379670e0f83640dc192b565
Reviewed-on: https://go-review.googlesource.com/23675
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2016-06-09 16:02:03 +00:00
Ian Lance Taylor
763883632e cmd/go: only run TestGoGetHTTPS404 where it works
The test TestGoGetHTTPS404 downloads a package that does not build on
every OS, so change it to only run where the package builds. It's not
great for the test to depend on an external package, but this is an
improvement on the current situation.

Fixes #15644.

Change-Id: I1679cee5ab1e61a5b26f4ad39dc8a397fbc0da69
Reviewed-on: https://go-review.googlesource.com/23920
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-06-09 03:48:34 +00:00
Cherry Zhang
fa54bf16e0 [dev.ssa] cmd/compile: fix a few bugs for SSA for ARM
- 64x signed right shift was wrong for shift larger than 0x80000000.
- for Lsh-followed-by-Rsh, the intermediate value should be full int
  width, so when it is spilled MOVW should be used.
- use RET for RetJmp, so the assembler can take case of restoring LR
  for non-leaf case.
- reserve R9 in dynlink mode. R9 is used for GOT by the assembler.

Progress on SSA backend for ARM. Still not complete.

Updates #15365.

Change-Id: I3caca256b92ff7cf96469da2feaf4868a592efc5
Reviewed-on: https://go-review.googlesource.com/23793
Reviewed-by: David Chase <drchase@google.com>
2016-06-08 20:37:31 +00:00
Cherry Zhang
225ef76c25 [dev.ssa] cmd/compile: fix scheduling of tuple ops
We want tuple-reading ops immediately follow tuple-generating op, so
that tuple values will not be spilled/copied.

The mechanism introduced in the previous CL cannot really avoid tuples
interleaving. In this CL we always emit tuple and their selectors together.
Maybe remove the tuple scores if it does not help on performance (todo).

Also let tighten not move tuple-reading ops across blocks.

In the previous CL a special case of regenerating flags with tuple-reading
pseudo-op is added, but it did not cover end-of-block case. This is fixed
in this CL and the condition is generalized.

Progress on SSA backend for ARM. Still not complete.

Updates #15365.

Change-Id: I8980b34e7a64eb98153540e9e19a3782e20406ff
Reviewed-on: https://go-review.googlesource.com/23792
Reviewed-by: David Chase <drchase@google.com>
2016-06-08 20:37:13 +00:00
Cherry Zhang
f3689d1382 cmd/compile: nilcheck interface value in go/defer interface call for SSA
This matches the behavior of the legacy backend.

Fixes #15975 (if this is the intended behavior)

Change-Id: Id277959069b8b8bf9958fa8f2cbc762c752a1a19
Reviewed-on: https://go-review.googlesource.com/23820
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-08 20:35:53 +00:00
Keith Randall
afad74ec30 cmd/compile: cgen_append can handle complex targets
Post-liveness fix, the slices on both sides can now be
indirects of & variables.  The cgen code handles those
cases just fine.

Fixes #15988

Change-Id: I378ad1d5121587e6107a9879c167291a70bbb9e4
Reviewed-on: https://go-review.googlesource.com/23863
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-06-08 00:01:09 +00:00
Keith Randall
2f088884ae cmd/compile: use fake package for allocating autos
Make sure auto names don't conflict with function names. Before this CL,
we confused name a.len (the len field of the slice a) with a.len (the function
len declared on a).

Fixes #15961

Change-Id: I14913de697b521fb35db9a1b10ba201f25d552bb
Reviewed-on: https://go-review.googlesource.com/23789
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-07 06:04:23 +00:00
Andrew Gerrand
27c5dcffef cmd/dist: use "set" instead of "export" in diagnostic message
On Windows, "export" doesn't mean anything, but Windows users are the
most likely to see this message.

Fixes #15977

Change-Id: Ib09ca08a7580713cacb65d0cdc43730765c377a8
Reviewed-on: https://go-review.googlesource.com/23840
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-07 04:31:29 +00:00
Cherry Zhang
59e11d7827 [dev.ssa] cmd/compile: handle floating point on ARM
Machine supports (or the runtime simulates in soft float mode)
(u)int32<->float conversions. The frontend rewrites int64<->float
conversions to call to runtime function.

For int64->float32 conversion, the frontend generates

.   .   AS u(100) l(10) tc(1)
.   .   .   NAME-main.~r1 u(1) a(true) g(1) l(9) x(8+0) class(PPARAMOUT) f(1) float32
.   .   .   CALLFUNC u(100) l(10) tc(1) float32
.   .   .   .   NAME-runtime.int64tofloat64 u(1) a(true) x(0+0) class(PFUNC) tc(1) used(true) FUNC-func(int64) float64

The CALLFUNC node has type float32, whereas runtime.int64tofloat64
returns float64. The legacy backend implicitly makes a float64->float32
conversion. The SSA backend does not do implicit conversion, so we
insert an explicit CONV here.

All cmd/compile/internal/gc/testdata/*_ssa.go tests passed.

Progress on SSA for ARM. Still not complete.

Update #15365.

Change-Id: I30937c8ff977271246b068f48224693776804339
Reviewed-on: https://go-review.googlesource.com/23652
Reviewed-by: Keith Randall <khr@golang.org>
2016-06-06 14:06:38 +00:00
Cherry Zhang
e78d90beeb [dev.ssa] cmd/compile: handle Div, Convert, GetClosurePtr etc. on ARM
This CL adds support of Div, Mod, Convert, GetClosurePtr and 64-bit indexing
support to SSA backend for ARM.

Add tests for 64-bit indexing to cmd/compile/internal/gc/testdata/string_ssa.go.

Tests cmd/compile/internal/gc/testdata/*_ssa.go passed, except compound_ssa.go
and fp_ssa.go.

Progress on SSA for ARM. Still not complete. Essentially the only unsupported
part is floating point.

Updates #15365.

Change-Id: I269e88b67f641c25e7a813d910c96d356d236bff
Reviewed-on: https://go-review.googlesource.com/23542
Reviewed-by: David Chase <drchase@google.com>
2016-06-05 03:56:42 +00:00
Mikio Hara
0326e28f17 Revert "cmd/go: re-enable TestCgoConsistentResults on solaris"
This reverts commit b89bcc1dae.

Change-Id: Ief2f317ffc175f7e6002d0c39694876f46788c69
Reviewed-on: https://go-review.googlesource.com/23744
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2016-06-03 22:41:47 +00:00
Mikio Hara
b89bcc1dae cmd/go: re-enable TestCgoConsistentResults on solaris
Updates #13247.

Change-Id: If5e4c9f4db05f58608b0eeed1a2312a04015b207
Reviewed-on: https://go-review.googlesource.com/23741
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-06-03 22:18:16 +00:00
Ian Lance Taylor
7b48020cfe cmd/cgo: check pointers for deferred C calls at the right time
We used to check time at the point of the defer statement. This change
fixes cgo to check them when the deferred function is executed.

Fixes #15921.

Change-Id: I72a10e26373cad6ad092773e9ebec4add29b9561
Reviewed-on: https://go-review.googlesource.com/23650
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2016-06-03 20:51:39 +00:00
Stephen McQuay (smcquay)
adf261b7d6 cmd/go: match go-import package prefixes by slash
The existing implementation for path collision resolution would
incorrectly determine that:

    example.org/aa

collides with:

    example.org/a

This change splits by slash rather than comparing on a byte-by-byte
basis.

Fixes: #15947

Change-Id: I18b3aaafbc787c81253203cf1328bb3c4420a0c4
Reviewed-on: https://go-review.googlesource.com/23732
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2016-06-03 19:47:37 +00:00
Ian Lance Taylor
6901b08482 cmd/link: avoid name collision with DWARF .def suffix
Adding a .def suffix for DWARF info collided with the DWARF info,
without the suffix, for a method named def. Change the suffix to ..def
instead.

Fixes #15926.

Change-Id: If1bf1bcb5dff1d7f7b79f78e3f7a3bbfcd2201bb
Reviewed-on: https://go-review.googlesource.com/23733
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-06-03 16:56:29 +00:00
Michael Hudson-Doyle
26849746c9 cmd/internal/obj, runtime: fixes for defer in 386 shared libraries
Any defer in a shared object crashed when GOARCH=386. This turns out to be two
bugs:

 1) Calls to morestack were not processed to be PIC safe (must have been
    possible to trigger this another way too)
 2) jmpdefer needs to rewind the return address of the deferred function past
    the instructions that load the GOT pointer into BX, not just past the call

Bug 2) requires re-introducing the a way for .s files to know when they are
being compiled for dynamic linking but I've tried to do that in as minimal
a way as possible.

Fixes #15916

Change-Id: Ia0d09b69ec272a176934176b8eaef5f3bfcacf04
Reviewed-on: https://go-review.googlesource.com/23623
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-06-03 02:50:27 +00:00
Andrew Gerrand
5799973c3e cmd/go: fix staleness test for releases, also deflake it
Fixes #15933

Change-Id: I2cd6365e6d0ca1cafdc812fbfaaa55aa64b2b289
Reviewed-on: https://go-review.googlesource.com/23731
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-03 02:46:58 +00:00
Elias Naur
14968bc1e5 cmd/dist: skip an unsupported test on darwin/arm
Fixes the darwin/arm builder (I hope)

Change-Id: I8a3502a1cdd468d4bf9a1c895754ada420b305ce
Reviewed-on: https://go-review.googlesource.com/23684
Run-TryBot: Elias Naur <elias.naur@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-06-02 14:02:07 +00:00
Cherry Zhang
4636d02244 [dev.ssa] cmd/compile: handle 64-bit shifts on ARM
Also fix a mistake in previous CL about x8 and x16 shifts:
the shift needs ZeroExt.

Progress on SSA for ARM. Still not complete.

Updates #15365.

Change-Id: Ibc352760023d38bc6b9c5251e929fe26e016637a
Reviewed-on: https://go-review.googlesource.com/23486
Reviewed-by: David Chase <drchase@google.com>
2016-06-02 13:03:59 +00:00
Cherry Zhang
90883091ff [dev.ssa] cmd/compile: clean up hardcoded regmasks in ssa/regalloc.go
Auto-generate register masks and load them through Config.

Passed toolstash -cmp on AMD64.

Tests phi_ssa.go and regalloc_ssa.go in cmd/compile/internal/gc/testdata
passed on ARM.

Updates #15365.

Change-Id: I393924d68067f2dbb13dab82e569fb452c986593
Reviewed-on: https://go-review.googlesource.com/23292
Reviewed-by: David Chase <drchase@google.com>
2016-06-02 13:01:44 +00:00
Cherry Zhang
8756d9253f [dev.ssa] cmd/compile: decompose 64-bit integer on ARM
Introduce dec64 rules to (generically) decompose 64-bit integer on
32-bit architectures. 64-bit integer is composed/decomposed with
Int64Make/Hi/Lo ops, as for complex types.

The idea of dealing with Add64 is the following:

(Add64 (Int64Make xh xl) (Int64Make yh yl))
->
(Int64Make
	(Add32withcarry xh yh (Select0 (Add32carry xl yl)))
	(Select1 (Add32carry xl yl)))

where Add32carry returns a tuple (flags,uint32). Select0 and Select1
read the first and the second component of the tuple, respectively.
The two Add32carry will be CSE'd.

Similarly for multiplication, Mul32uhilo returns a tuple (hi, lo).

Also add support of KeepAlive, to fix build after merge.

Tests addressed_ssa.go, array_ssa.go, break_ssa.go, chan_ssa.go,
cmp_ssa.go, ctl_ssa.go, map_ssa.go, and string_ssa.go in
cmd/compile/internal/gc/testdata passed.

Progress on SSA for ARM. Still not complete.

Updates #15365.

Change-Id: I7867c76785a456312de5d8398a6b3f7ca5a4f7ec
Reviewed-on: https://go-review.googlesource.com/23213
Reviewed-by: Keith Randall <khr@golang.org>
2016-06-02 13:01:09 +00:00
Elias Naur
42c51debe8 misc/cgo/test,cmd/dist: enable (more) Cgo tests on iOS
For #15919

Change-Id: I9fc38d9c8a9cc9406b551315e1599750fe212d0d
Reviewed-on: https://go-review.googlesource.com/23635
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-02 10:09:12 +00:00
Michael Hudson-Doyle
d25c3eadea cmd/compile: do not generate tail calls when dynamic linking on ppc64le
When a wrapper method calls the real implementation, it's not possible to use a
tail call when dynamic linking on ppc64le. The bad scenario is when a local
call is made to the wrapper: the wrapper will call the implementation, which
might be in a different module and so set the TOC to the appropriate value for
that module. But if it returns directly to the wrapper's caller, nothing will
reset it to the correct value for that function.

Change-Id: Icebf24c9a2a0a9a7c2bce6bd6f1358657284fb10
Reviewed-on: https://go-review.googlesource.com/23468
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-02 02:34:01 +00:00
Andrew Gerrand
3c6b6684ce api: promote next.txt to go1.7.txt and update api tool
Change-Id: Idb348be00f949da553aa6aab62836f59dfee298d
Reviewed-on: https://go-review.googlesource.com/23671
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
2016-06-02 00:22:03 +00:00
Elias Naur
6de014b9e2 misc/cgo/test,cmd/dist: enable (most) Cgo tests on Android
Some tests cannot build for Android; use build tags and stubs to
skip them.

For #15919

Change-Id: Ieedcb73d4cabe23c3775cfb1d44c1276982dccd9
Reviewed-on: https://go-review.googlesource.com/23634
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-06-01 22:06:51 +00:00
Robert Griesemer
bbd1dcdf7d cmd/compile: correctly export underlying type of predecl. error type
Fixes #15920.

Change-Id: I78cd79b91a58d0f7218b80f9445417f4ee071a6e
Reviewed-on: https://go-review.googlesource.com/23606
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-01 21:32:46 +00:00
Keith Randall
52fe472472 cmd/compile: for arm, zero unaligned memory 1 byte at a time
If memory might be unaligned, zero it one byte at a time
instead of 4 bytes at a time.

Fixes #15902

Change-Id: I4eff0840e042e2f137c1a4028f08793eb7dfd703
Reviewed-on: https://go-review.googlesource.com/23587
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2016-06-01 14:14:13 +00:00
David du Colombier
e29e0ba19a cmd/compile: fix TestAssembly on Plan 9
Since CL 23620, TestAssembly is failing on Plan 9.

In CL 23620, the process environment is passed to 'go tool compile'
after setting GOARCH. On Plan 9, if GOARCH is already set in the
process environment, it would take precedence. On Unix, it works
as expected because the first GOARCH found takes precedence.

This change uses the mergeEnvLists function from cmd/go/main.go
to merge the two environment lists such that variables with the
same name in "in" replace those in "out".

Change-Id: Idee22058343932ee18666dda331c562c89c33507
Reviewed-on: https://go-review.googlesource.com/23593
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-01 13:33:43 +00:00
Michael Hudson-Doyle
2885e07c25 cmd/compile: pass process env to 'go tool compile' in compileToAsm
In particular, this stops the test failing when GOROOT and GOROOT_FINAL are
different.

Change-Id: Ibf6cc0a173f1d965ee8aa31eee2698b223f1ceec
Reviewed-on: https://go-review.googlesource.com/23620
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-06-01 03:55:09 +00:00
Keith Randall
e106122200 cmd/compile: test non-constant shifts
Test all the weird shifts, like int8 shifted right by uint16.
Increases coverage for shift lowerings in AMD64.rules.

Change-Id: I066fe6ad6bfc05253a8d6a2ee17ff244d3a7652e
Reviewed-on: https://go-review.googlesource.com/23585
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
2016-06-01 00:06:00 +00:00
Michael Hudson-Doyle
1846c632ee cmd/go: combine gccgo's ld and ldShared methods
This fixes handling of cgo flags and makes sure packages that are only
implicitly included in the shared library are passed to the link.

Fixes #15885

Change-Id: I1e8a72b5314261973ca903c78834700fb113dde9
Reviewed-on: https://go-review.googlesource.com/23537
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-31 22:23:53 +00:00
Michael Hudson-Doyle
2c1791b13b cmd/link: suppress PIE whenever externally linking with a sanitizer
golang.org/issue/15443 complained that a race-enabled PIE binary crashed at
startup, but other ways of linking in tsan (or other sanitizers) such as

 #cgo CFLAGS: -fsanitize=thread
 #cgo LDFLAGS: -fsanitize=thread

have the same problem. Pass -no-pie to the host linker (if supported) if any
-fsanitizer=foo cgo LDFLAG is seen when linking.

Fixes #15887

Change-Id: Id799770f8d045f6f40fa8c463563937a5748d1a8
Reviewed-on: https://go-review.googlesource.com/23535
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-31 20:57:57 +00:00
Michael Hudson-Doyle
2a6544b604 cmd/go, cmd/link: set LC_ALL=C when checking if host compiler supports -no-pie
Fixes #15900

Change-Id: Ieada5f4e3b3b2ae358414e013f3090b4b820569b
Reviewed-on: https://go-review.googlesource.com/23536
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-31 20:57:21 +00:00
Ian Lance Taylor
66736880ca runtime/cgo: add TSAN acquire/release calls
Add TSAN acquire/release calls to runtime/cgo to match the ones
generated by cgo.  This avoids a false positive race around the malloc
memory used in runtime/cgo when other goroutines are simultaneously
calling malloc and free from cgo.

These new calls will only be used when building with CGO_CFLAGS and
CGO_LDFLAGS set to -fsanitize=thread, which becomes a requirement to
avoid all false positives when using TSAN.  These are needed not just
for runtime/cgo, but also for any runtime package that uses cgo (such as
net and os/user).

Add an unused attribute to the _cgo_tsan_acquire and _cgo_tsan_release
functions, in case there are no actual cgo function calls.

Add a test that checks that setting CGO_CFLAGS/CGO_LDFLAGS avoids a
false positive report when using os/user.

Change-Id: I0905c644ff7f003b6718aac782393fa219514c48
Reviewed-on: https://go-review.googlesource.com/23492
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2016-05-31 20:53:16 +00:00
Josh Bleecher Snyder
0e13dbc1a9 cmd/compile: disallow multiple nil cases in a type switch
Fixes #15898.

Change-Id: I66e2ad21f283563c7142aa820f0354711d964768
Reviewed-on: https://go-review.googlesource.com/23573
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2016-05-31 20:31:00 +00:00
Ian Lance Taylor
4223294eab runtime/pprof, cmd/pprof: fix profiling for PIE
In order to support pprof for position independent executables, pprof
needs to adjust the PC addresses stored in the profile by the address at
which the program is loaded. The legacy profiling support which we use
already supports recording the GNU/Linux /proc/self/maps data
immediately after the CPU samples, so do that. Also change the pprof
symbolizer to use the information, if available, when looking up
addresses in the Go pcline data.

Fixes #15714.

Change-Id: I4bf679210ef7c51d85cf873c968ce82db8898e3e
Reviewed-on: https://go-review.googlesource.com/23525
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
2016-05-31 13:02:09 +00:00
Keith Randall
1739657513 cmd/compile: shift tests, fix triple-shift rules
Add a bunch of tests for shifts.

Fix triple-shift rules to always take constant shifts as 64 bits.
(Earlier rules always promote shift amounts to 64 bits.)
Add overflow checks.

Increases generic rule coverage to 91%

Change-Id: I6b42d368d19d36ac482dbb8e0d4f67e30ad7145d
Reviewed-on: https://go-review.googlesource.com/23555
Reviewed-by: Todd Neal <todd@tneal.org>
2016-05-29 20:36:21 +00:00
Keith Randall
79f7ccf2c3 cmd/compile: add constant fold comparison tests
Increases generic.rules coverage from 91% to 95%.

Change-Id: I981eb94f3cd10d2f87c836576a43786787a25d83
Reviewed-on: https://go-review.googlesource.com/23556
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
2016-05-29 20:23:55 +00:00
Keith Randall
42da35c699 cmd/compile: SSA, don't let write barrier clobber return values
When we do *p = f(), we might need to copy the return value from
f to p with a write barrier.  The write barrier itself is a call,
so we need to copy the return value of f to a temporary location
before we call the write barrier function.  Otherwise, the call
itself (specifically, marshalling the args to typedmemmove) will
clobber the value we're trying to write.

Fixes #15854

Change-Id: I5703da87634d91a9884e3ec098d7b3af713462e7
Reviewed-on: https://go-review.googlesource.com/23522
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-27 22:11:45 +00:00
David Chase
31e13c83c2 [dev.ssa] Merge branch 'master' into dev.ssa
Change-Id: Iabc80b6e0734efbd234d998271e110d2eaad41dd
2016-05-27 15:19:33 -04:00
Austin Clements
e149624ebb cmd/compile/internal/gc: gofmt
Commit 36a80c5 introduced formatting errors.

Change-Id: I6d5b231200cd7abcd5b94c1a3f4e99f10ee11c4f
Reviewed-on: https://go-review.googlesource.com/23513
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
2016-05-27 19:08:39 +00:00
Russ Cox
36a80c5941 cmd/compile: clean up, document Node closure fields
Requested during CL 23431.

Change-Id: I513ae42166b3a9fcfe51231ff55c163ab672e7d2
Reviewed-on: https://go-review.googlesource.com/23485
Reviewed-by: David Chase <drchase@google.com>
2016-05-27 15:33:10 +00:00
Russ Cox
93369001c7 cmd/compile: delete Func.Outer
This was just storage for a linked list.

Change-Id: I850e8db1e1f5e72410f5c904be9409179b56a94a
Reviewed-on: https://go-review.googlesource.com/23484
Reviewed-by: David Chase <drchase@google.com>
2016-05-27 15:33:01 +00:00
Russ Cox
dec1bae916 cmd/compile: additional paranoia and checking in plive.go
The main check here is that liveness now crashes if it finds an instruction
using a variable that should be tracked but is not.

Comments and adjustments in nodarg to explain what's going on and
to remove the "-1" argument added a few months ago, plus a sketch
of a future simplification.

The need for n.Orig in the earlier CL seems to have been an intermediate
problem rather than fundamental: the new explanations in nodarg make
clear that nodarg is not causing the problem I thought, and in fact now
using n instead of n.Orig works fine in plive.go.

Change-Id: I3f5cf9f6e4438a6d27abac7d490e7521545cd552
Reviewed-on: https://go-review.googlesource.com/23450
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-05-27 14:13:11 +00:00
Cherry Zhang
d108bc0e73 [dev.ssa] cmd/compile: implement Defer, RetJmp on SSA for ARM
Also fix argument offset for runtime calls.

Also fix LoadReg/StoreReg by generating instructions by type.

Progress on SSA backend for ARM. Still not complete.
Tests append_ssa.go, assert_ssa.go, loadstore_ssa.go, short_ssa.go, and
deferNoReturn.go in cmd/compile/internal/gc/testdata passed.

Updates #15365.

Change-Id: I0f0a2398cab8bbb461772a55241a16a7da2ecedf
Reviewed-on: https://go-review.googlesource.com/23212
Reviewed-by: David Chase <drchase@google.com>
2016-05-27 12:53:22 +00:00
Dmitri Shuralyov
e9228dd949 cmd/go: fixup for parsing SCP-like addresses
This is a fixup change for commit 5cd2944803
that added parsing of SCP-like addresses. To get the expected output
from (*url.URL).String(), Path needs to be set, not RawPath.

Add a test for this, since it has already regressed multiple times.

Updates #11457.

Change-Id: I806f5abbd3cf65e5bdcef01aab872caa8a5b8891
Reviewed-on: https://go-review.googlesource.com/23447
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-27 06:28:40 +00:00
Russ Cox
20803b845f cmd/compile: eliminate PPARAMREF
As in the elimination of PHEAP|PPARAM in CL 23393,
this is something the front end can trivially take care of
and then not bother the back ends with.
It also eliminates some suspect (and only lightly exercised)
code paths in the back ends.

I don't have a smoking gun for this one but it seems
more clearly correct.

Change-Id: I3b3f5e669b3b81d091ff1e2fb13226a6f14c69d5
Reviewed-on: https://go-review.googlesource.com/23431
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2016-05-27 05:16:16 +00:00
Russ Cox
b6dc3e6f66 cmd/compile: fix liveness computation for heap-escaped parameters
The liveness computation of parameters generally was never
correct, but forcing all parameters to be live throughout the
function covered up that problem. The new SSA back end is
too clever: even though it currently keeps the parameter values live
throughout the function, it may find optimizations that mean
the current values are not written back to the original parameter
stack slots immediately or ever (for example if a parameter is set
to nil, SSA constant propagation may replace all later uses of the
parameter with a constant nil, eliminating the need to write the nil
value back to the stack slot), so the liveness code must now
track the actual operations on the stack slots, exposing these
problems.

One small problem in the handling of arguments is that nodarg
can return ONAME PPARAM nodes with adjusted offsets, so that
there are actually multiple *Node pointers for the same parameter
in the instruction stream. This might be possible to correct, but
not in this CL. For now, we fix this by using n.Orig instead of n
when considering PPARAM and PPARAMOUT nodes.

The major problem in the handling of arguments is general
confusion in the liveness code about the meaning of PPARAM|PHEAP
and PPARAMOUT|PHEAP nodes, especially as contrasted with PAUTO|PHEAP.
The difference between these two is that when a local variable "moves"
to the heap, it's really just allocated there to start with; in contrast,
when an argument moves to the heap, the actual data has to be copied
there from the stack at the beginning of the function, and when a
result "moves" to the heap the value in the heap has to be copied
back to the stack when the function returns
This general confusion is also present in the SSA back end.

The PHEAP bit worked decently when I first introduced it 7 years ago (!)
in 391425ae. The back end did nothing sophisticated, and in particular
there was no analysis at all: no escape analysis, no liveness analysis,
and certainly no SSA back end. But the complications caused in the
various downstream consumers suggest that this should be a detail
kept mainly in the front end.

This CL therefore eliminates both the PHEAP bit and even the idea of
"heap variables" from the back ends.

First, it replaces the PPARAM|PHEAP, PPARAMOUT|PHEAP, and PAUTO|PHEAP
variable classes with the single PAUTOHEAP, a pseudo-class indicating
a variable maintained on the heap and available by indirecting a
local variable kept on the stack (a plain PAUTO).

Second, walkexpr replaces all references to PAUTOHEAP variables
with indirections of the corresponding PAUTO variable.
The back ends and the liveness code now just see plain indirected
variables. This may actually produce better code, but the real goal
here is to eliminate these little-used and somewhat suspect code
paths in the back end analyses.

The OPARAM node type goes away too.

A followup CL will do the same to PPARAMREF. I'm not sure that
the back ends (SSA in particular) are handling those right either,
and with the framework established in this CL that change is trivial
and the result clearly more correct.

Fixes #15747.

Change-Id: I2770b1ce3cbc93981bfc7166be66a9da12013d74
Reviewed-on: https://go-review.googlesource.com/23393
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-27 03:19:52 +00:00
Ian Lance Taylor
b5d18b50ac cmd/cgo: remove -O options when generating compiler errors
The cgo tool generates compiler errors to find out what kind of name it
is using.  Turning on optimization can confuse that process by producing
new unexpected messages.

Fixes #14669.

Change-Id: Idc8e35fd259711ecc9638566b691c11d17140325
Reviewed-on: https://go-review.googlesource.com/23231
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-27 01:40:30 +00:00
Keith Randall
9369f22b84 cmd/compile: testing harness for checking generated assembly
Add a test which compiles a function and checks the
generated assembly to make sure certain patterns are present.
This test allows us to do white box tests of the compiler
to make sure optimizations don't regress.

Added a few simple tests for now.  More to come.

Change-Id: I4ab5ce5d95b9e04e7d0d9328ffae47b8d1f95e74
Reviewed-on: https://go-review.googlesource.com/23403
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-26 23:07:01 +00:00
Keith Randall
02bf6b5ef9 cmd/compile: add tests for logical simplification rewrite rules
Increases coverage of generic.rules from 72% to 84%.

Change-Id: I1b139aeeb6410d025d49cbe4e4601f6f935ce1e5
Reviewed-on: https://go-review.googlesource.com/23490
Reviewed-by: Todd Neal <todd@tneal.org>
2016-05-26 22:16:52 +00:00
Keith Randall
0e930015c1 cmd/compile: log rules to a file for rule coverage tool
When rules are generated with -log, log rule application to a file.

The file is opened in append mode so multiple calls to the compiler
union their logs.

Change-Id: Ib35c7c85bf58e5909ea9231043f8cbaa6bf278b7
Reviewed-on: https://go-review.googlesource.com/23406
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-05-26 20:37:05 +00:00
Josh Bleecher Snyder
13a5b1faee cmd/compile: improve domorder documentation
domorder has some non-obvious useful properties
that we’re relying on in cse.
Document them and provide an argument that they hold.
While we’re here, do some minor renaming.

The argument is a re-working of a private email
exchange with Todd Neal and David Chase.

Change-Id: Ie154e0521bde642f5f11e67fc542c5eb938258be
Reviewed-on: https://go-review.googlesource.com/23449
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-05-26 20:01:24 +00:00
Russ Cox
bfccf4071e cmd/dist: drop ppc64le from testcshared
I'm glad my CL fixed the library use case inside Google.
It fixes neither of the two tests here.

Change-Id: Ica91722dced8955a0a8ba3aad3d288816b46564e
Reviewed-on: https://go-review.googlesource.com/23482
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-26 19:04:48 +00:00
Russ Cox
7fdec6216c build: enable framepointer mode by default
This has a minor performance cost, but far less than is being gained by SSA.
As an experiment, enable it during the Go 1.7 beta.
Having frame pointers on by default makes Linux's perf, Intel VTune,
and other profilers much more useful, because it lets them gather a
stack trace efficiently on profiling events.
(It doesn't help us that much, since when we walk the stack we usually
need to look up PC-specific information as well.)

Fixes #15840.

Change-Id: I4efd38412a0de4a9c87b1b6e5d11c301e63f1a2a
Reviewed-on: https://go-review.googlesource.com/23451
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-26 19:02:00 +00:00
Russ Cox
6247ca2dbb cmd/dist: drop testcarchive on ppc64le
It is timing out on the dashboard.
(We enabled it as an experiment to see if it was still broken. Looks that way.)

Change-Id: I425b7e54a2ab95b623ab7a15554b4173078f75e2
Reviewed-on: https://go-review.googlesource.com/23480
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-26 14:05:27 +00:00
Austin Clements
adff422779 cmd/link/internal/ld: fix DWARF offsets with GOEXPERIMENT=framepointer
The offsets computed by the DWARF expressions for local variables
currently don't account for the extra stack slot used by the frame
pointer when GOEXPERIMENT=framepointer is enabled.

Fix this by adding the extra stack slot to the offset.

This fixes TestGdbPython with GOEXPERIMENT=framepointer.

Updates #15840.

Change-Id: I1b2ebb2750cd22266f4a89ec8d9e8bfa05fabd19
Reviewed-on: https://go-review.googlesource.com/23458
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-26 13:54:02 +00:00
Russ Cox
d9557523c2 runtime: make framepointer mode safe for Windows
A few other architectures have already defined a NOFRAME flag.
Use it to disable frame pointer code on a few very low-level functions
that must behave like Windows code.

Makes the failing os/signal test pass on a Windows gomote.

Change-Id: I982365f2c59a0aa302b4428c970846c61027cf3e
Reviewed-on: https://go-review.googlesource.com/23456
Reviewed-by: Austin Clements <austin@google.com>
2016-05-26 13:53:01 +00:00
Russ Cox
8a1dc32447 runtime: add library startup support for ppc64le
I have been running this patch inside Google against Go 1.6 for the last month.

The new tests will probably break the builders but let's see
exactly how they break.

Change-Id: Ia65cf7d3faecffeeb4b06e9b80875c0e57d86d9e
Reviewed-on: https://go-review.googlesource.com/23452
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-26 03:31:59 +00:00
Robert Griesemer
30282b091d cmd/compile: correctly import labels, gotos, and fallthroughs
The importer had several bugs with respect to labels and gotos:
- it didn't create a new ONAME node for label names (label dcl,
  goto, continue, and break)
- it overwrote the symbol for gotos with the dclstack
- it didn't set the dclstack for labels

In the process changed export format slightly to always assume
a label name for labels and gotos, and never assume a label for
fallthroughs.

For fallthroughs and switch cases, now also set Xoffset like in
the parser. (Not setting it, i.e., using 0 was ok since this is
only used for verifying correct use of fallthroughs, which was
checked already. But it's an extra level of verification of the
import.)

Fixes #15838.

Change-Id: I3637f6314b8651c918df0c8cd70cd858c92bd483
Reviewed-on: https://go-review.googlesource.com/23445
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-26 00:32:03 +00:00
Ian Lance Taylor
a5d1a72a40 cmd/cgo, runtime, runtime/cgo: TSAN support for malloc
Acquire and release the TSAN synchronization point when calling malloc,
just as we do when calling any other C function. If we don't do this,
TSAN will report false positive errors about races calling malloc and
free.

We used to have a special code path for malloc and free, going through
the runtime functions cmalloc and cfree. The special code path for cfree
was no longer used even before this CL. This CL stops using the special
code path for malloc, because there is no place along that path where we
could conditionally insert the TSAN synchronization. This CL removes
the support for the special code path for both functions.

Instead, cgo now automatically generates the malloc function as though
it were referenced as C.malloc.  We need to automatically generate it
even if C.malloc is not called, even if malloc and size_t are not
declared, to support cgo-provided functions like C.CString.

Change-Id: I829854ec0787a80f33fa0a8a0dc2ee1d617830e2
Reviewed-on: https://go-review.googlesource.com/23260
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2016-05-25 23:22:24 +00:00
Robert Griesemer
a689f6b8af cmd/compile: document how to update builtin.go
No code changes.

Fixes #15835.

Change-Id: Ibae3f20882f976babc4093df5e9fea0b2cf0e9d9
Reviewed-on: https://go-review.googlesource.com/23443
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-05-25 19:19:25 +00:00
Keith Randall
786e51d7ba cmd/compile: add generated tests for constant folding
Covers a bunch of constant-folding rules in generic.rules that aren't
being covered currently.

Increases coverage in generic.rules from 65% to 72%.

Change-Id: I7bf58809faf22e97070183b42e6dd7d3f35bf5f9
Reviewed-on: https://go-review.googlesource.com/23407
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
2016-05-25 14:11:10 +00:00
Elias Naur
f2f3b6cd8f cmd/link: fix ARM gold linker check
CL 23400 introduced a check to make sure the gold linker is used
on ARM host links. The check itself works, but the error checking
logic was reversed; fix it.

I manually verified that the check now correctly rejects host links
on my RPi2 running an ancient rasbian without the gold linker
installed.

Updates #15696

Change-Id: I927832620f0a60e91a71fdedf8cbd2550247b666
Reviewed-on: https://go-review.googlesource.com/23421
Run-TryBot: Elias Naur <elias.naur@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-25 11:50:49 +00:00
Jeff R. Allen
2f9eeea212 cmd/go: document testdata directory in "go help test"
Document the correct use of the testdata directory
where test writers might be expecting to find it.

It seems that alldocs.go was out of date, so it
has picked up some other changes with this commit.

Fixes #14715.

Change-Id: I0a22676bb7a64b2a61b56495f7ea38db889d8b37
Reviewed-on: https://go-review.googlesource.com/23353
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-24 19:05:09 +00:00
David Crawshaw
a0abecf102 cmd/link: ensure -fuse-ld=gold uses gold
Fixes #15696

Change-Id: I134e918dc56f79a72a04aa54f415371884113d2a
Reviewed-on: https://go-review.googlesource.com/23400
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-24 18:56:11 +00:00
Aliaksandr Valialkin
dcc42c7d11 cmd/vet: do not check print-like functions with unknown type
Fixes #15787

Change-Id: I559ba886527b474dbdd44fe884c78973b3012377
Reviewed-on: https://go-review.googlesource.com/23351
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-05-24 16:13:44 +00:00
Russ Cox
85e3c9e6b8 cmd/compile, go/types: omit needless word in error message
CL 21462 and CL 21463 made this message say explicitly that the problem
was a struct field in a map, but the word "directly" is unnecessary,
sounds wrong, and makes the error long.

Change-Id: I2fb68cdaeb8bd94776b8022cf3eae751919ccf6f
Reviewed-on: https://go-review.googlesource.com/23373
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-05-24 15:07:16 +00:00
Russ Cox
8e724e7bba cmd/go: fix //go:binary-only-package check
The use of a prefix check was too liberal.
Noted in review after submit.

Change-Id: I4fe1df660997efd225609e818040b8392fab79f0
Reviewed-on: https://go-review.googlesource.com/23375
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-24 13:54:24 +00:00
Keith Randall
7a9f6c2b56 cmd/compile: benchmark needs dominator tree
Now that CSE uses dom tree to order partitions, we need the
dom tree computed before benchmarking CSE.

Fixes #15801

Change-Id: Ifa4702c7b75250f34de185e69a880b3f3cc46a12
Reviewed-on: https://go-review.googlesource.com/23361
Reviewed-by: David Chase <drchase@google.com>
2016-05-23 20:21:15 +00:00
Robert Griesemer
054a721dca cmd/compile: read safemode bit from package header
Ignore respective bit in export data, but leave the info to
minimize format changes for 1.7. Scheduled to remove by 1.8.

For #15772.

Change-Id: Ifb3beea655367308a4e2d5dc8cb625915f904287
Reviewed-on: https://go-review.googlesource.com/23285
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-05-20 21:41:50 +00:00
Robert Griesemer
448246adff cmd/compile: don't exit early because of hidden error messages
Non-syntax errors are always counted to determine if to exit
early, but then deduplication eliminates them. This can lead
to situations which report "too many errors" and only one
error is shown.

De-duplicate non-syntax errors early, at least the ones that
appear consecutively, and only count the ones actually being
shown. This doesn't work perfectly as they may not appear in
sequence, but it's cheap and good enough.

Fixes #14136.

Change-Id: I7b11ebb2e1e082f0d604b88e544fe5ba967af1d7
Reviewed-on: https://go-review.googlesource.com/23259
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-05-19 23:17:54 +00:00
Ian Lance Taylor
79ba1e44c7 cmd/cgo: mark stub functions as no_sanitize_thread
When the generated stub functions write back the results to the stack,
they can in some cases be writing to the same memory on the g0 stack.
There is no race here (assuming there is no race in the Go code), but
the thread sanitizer does not know that.  Turn off the thread sanitizer
for the stub functions to prevent false positive warnings.

Current clang suggests the no_sanitize("thread") attribute, but that
does not work with clang 3.6 or GCC.  clang 3.6, GCC, and current clang
all support the no_sanitize_thread attribute, so use that
unconditionally.

The test case and first version of the patch are from Dmitriy Vyukov.

Change-Id: I80ce92824c6c8cf88ea0fe44f21cf50cf62474c9
Reviewed-on: https://go-review.googlesource.com/23252
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-19 17:29:13 +00:00
Keith Randall
d603c27c6b cmd/compile: large ptr literals must escape
They get rewritten to NEWs, and they must be marked as escaping
so walk doesn't try to allocate them back onto the stack.

Fixes #15733

Change-Id: I433033e737c3de51a9e83a5a273168dbc9110b74
Reviewed-on: https://go-review.googlesource.com/23223
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-05-19 15:12:01 +00:00
Cherry Zhang
8357ec37ae [dev.ssa] cmd/compile: implement Zero, Move, Copy for SSA on ARM
Generate load/stores for small zeroing/move, DUFFZERO/DUFFCOPY for
medium zeroing/move, and loops for large zeroing/move.

cmd/compile/internal/gc/testdata/{copy_ssa.go,zero_ssa.go} tests
passed.

Progress on SSA backend for ARM. Still not complete. A few packages
in the standard library compile and tests passed, including
container/list, hash/crc32, unicode/utf8, etc.

Updates #15365.

Change-Id: Ieb4b68b44ee7de66bf7b68f5f33a605349fcc6fa
Reviewed-on: https://go-review.googlesource.com/23097
Reviewed-by: Keith Randall <khr@golang.org>
2016-05-19 02:55:35 +00:00
Cherry Zhang
8f72690711 [dev.ssa] cmd/compile: implement shifts & multiplications for SSA on ARM
Implement shifts and multiplications for up to 32-bit values.

Also handle Exit block.

Progress on SSA backend for ARM. Still not complete.
container/heap, crypto/subtle, hash/adler32 packages compile and
tests passed.

Updates #15365.

Change-Id: I6bee4d5b0051e51d5de97e8a1938c4b87a36cbf8
Reviewed-on: https://go-review.googlesource.com/23096
Reviewed-by: Keith Randall <khr@golang.org>
2016-05-19 02:49:09 +00:00
Cherry Zhang
ccaed50c7b [dev.ssa] cmd/compile: handle boolean values for SSA on ARM
Fix hardcoded flag register mask in ssa/flagalloc.go by auto-generating
the mask.

Also fix a mistake (in previous CL) about conditional branches.

Progress on SSA backend for ARM. Still not complete. Now "container/ring"
package compiles and tests passed.

Updates #15365.

Change-Id: Id7c8805c30dbb8107baedb485ed0f71f59ed6ea8
Reviewed-on: https://go-review.googlesource.com/23093
Reviewed-by: Keith Randall <khr@golang.org>
2016-05-19 02:48:36 +00:00
Keith Randall
075880a8e8 cmd/compile: fix build
Run live vars test only on ssa builds.
We can't just drop KeepAlive ops during regalloc.  We need
to replace them with copies.

Change-Id: Ib4b3b1381415db88fdc2165fc0a9541b73ad9759
Reviewed-on: https://go-review.googlesource.com/23225
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-05-18 20:44:00 +00:00
Keith Randall
3572c6418b cmd/compile: keep pointer input arguments live throughout function
Introduce a KeepAlive op which makes sure that its argument is kept
live until the KeepAlive.  Use KeepAlive to mark pointer input
arguments as live after each function call and at each return.

We do this change only for pointer arguments.  Those are the
critical ones to handle because they might have finalizers.
Doing compound arguments (slices, structs, ...) is more complicated
because we would need to track field liveness individually (we do
that for auto variables now, but inputs requires extra trickery).

Turn off the automatic marking of args as live.  That way, when args
are explicitly nulled, plive will know that the original argument is
dead.

The KeepAlive op will be the eventual implementation of
runtime.KeepAlive.

Fixes #15277

Change-Id: I5f223e65d99c9f8342c03fbb1512c4d363e903e5
Reviewed-on: https://go-review.googlesource.com/22365
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-18 19:25:27 +00:00
Monty Taylor
2ba8fc5b08 vcs: Add support for git.openstack.org
Go is being proposed as an officially supported language for elements of
OpenStack:

  https://review.openstack.org/#/c/312267/

As such, repos that exist in OpenStack's git infrastructure
are likely to become places from which people might want to go get
things. Allow optional .git suffixes to allow writing code that depends
on git.openstack.org repos that will work with older go versions while
we wait for this support to roll out.

Change-Id: Ia64bdb1dafea33b1c3770803230d30ec1059df22
Reviewed-on: https://go-review.googlesource.com/23135
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-18 14:11:33 +00:00
David Chase
d35a4158ab cmd/compile: reduce element size of arrays in sparse{map,set}
sparseSet and sparseMap only need 32 bit integers in their
arrays, since a sparseEntry key is also limited to 32 bits.
This appears to reduce the space allocated for at least
one pathological compilation by 1%, perhaps more.

Not necessarily for 1.7, but it saves a little and is very
low-risk.

Change-Id: Icf1185859e9f5fe1261a206b441e02c34f7d02fd
Reviewed-on: https://go-review.googlesource.com/22972
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-18 14:05:14 +00:00
Matthew Dempsky
c65647d620 cmd/compile: handle unsafe.Pointer(f()) correctly
Previously statements like

    f(unsafe.Pointer(g()), int(h()))

would be reordered into a sequence of statements like

    autotmp_g := g()
    autotmp_h := h()
    f(unsafe.Pointer(autotmp_g), int(autotmp_h))

which can leave g's temporary value on the stack as a uintptr, rather
than an unsafe.Pointer. Instead, recognize uintptr-to-unsafe.Pointer
conversions when reordering function calls to instead produce:

    autotmp_g := unsafe.Pointer(g())
    autotmp_h := h()
    f(autotmp_g, int(autotmp_h))

Fixes #15329.

Change-Id: I2cdbd89d233d0d5c94791513a9fd5fd958d11ed5
Reviewed-on: https://go-review.googlesource.com/22273
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-18 14:01:22 +00:00
David Chase
6b99fb5bea cmd/compile: use sparse algorithm for phis in large program
This adds a sparse method for locating nearest ancestors
in a dominator tree, and checks blocks with more than one
predecessor for differences and inserts phi functions where
there are.

Uses reversed post order to cut number of passes, running
it from first def to last use ("last use" for paramout and
mem is end-of-program; last use for a phi input from a
backedge is the source of the back edge)

Includes a cutover from old algorithm to new to avoid paying
large constant factor for small programs.  This keeps normal
builds running at about the same time, while not running
over-long on large machine-generated inputs.

Add "phase" flags for ssa/build -- ssa/build/stats prints
number of blocks, values (before and after linking references
and inserting phis, so expansion can be measured), and their
product; the product governs the cutover, where a good value
seems to be somewhere between 1 and 5 million.

Among the files compiled by make.bash, this is the shape of
the tail of the distribution for #blocks, #vars, and their
product:

	 #blocks	#vars	    product
 max	6171	28180	173,898,780
99.9%	1641	 6548	 10,401,878
  99%	 463	 1909	    873,721
  95%	 152	  639	     95,235
  90%	  84	  359	     30,021

The old algorithm is indeed usually fastest, for 99%ile
values of usually.

The fix to LookupVarOutgoing
( https://go-review.googlesource.com/#/c/22790/ )
deals with some of the same problems addressed by this CL,
but on at least one bug ( #15537 ) this change is still
a significant help.

With this CL:
/tmp/gopath$ rm -rf pkg bin
/tmp/gopath$ time go get -v -gcflags -memprofile=y.mprof \
   github.com/gogo/protobuf/test/theproto3/combos/...
...
real	4m35.200s
user	13m16.644s
sys	0m36.712s
and pprof reports 3.4GB allocated in one of the larger profiles

With tip:
/tmp/gopath$ rm -rf pkg bin
/tmp/gopath$ time go get -v -gcflags -memprofile=y.mprof \
   github.com/gogo/protobuf/test/theproto3/combos/...
...
real	10m36.569s
user	25m52.286s
sys	4m3.696s
and pprof reports 8.3GB allocated in the same larger profile

With this CL, most of the compilation time on the benchmarked
input is spent in register/stack allocation (cumulative 53%)
and in the sparse lookup algorithm itself (cumulative 20%).

Fixes #15537.

Change-Id: Ia0299dda6a291534d8b08e5f9883216ded677a00
Reviewed-on: https://go-review.googlesource.com/22342
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-16 21:08:05 +00:00
Konstantin Shaposhnikov
094afe0cf1 cmd/vendor: move cmd/internal/unvendor packages to cmd/vendor
Updates #14047

Change-Id: I4b150533393bfb90e840497095ac32bcca4f04c2
Reviewed-on: https://go-review.googlesource.com/23114
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-14 17:21:52 +00:00
Dmitry Vyukov
7ae273923c cmd/trace: split large traces into parts
Trace viewer cannot handle traces larger than 256MB (limit on js string size):
https://github.com/catapult-project/catapult/issues/627
And even that is problematic (chrome hangs and crashes).
Split large traces into 100MB parts. Somewhat clumsy, but I don't see any other
solution (other than rewriting trace viewer). At least it works reliably now.

Fixes #15482

Change-Id: I993b5f43d22072c6f5bd041ab5888ce176f272b2
Reviewed-on: https://go-review.googlesource.com/22731
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-05-12 17:53:59 +00:00
Michael Munday
a8a2b38fb9 cmd/compile/internal/gc: minor cleanup of init.go comments
Step 5 was deleted in f3575a9 however the numbering of the other
steps wasn't adjusted accordingly.

While we're here: clean up the whitespace, add curly braces where
appropriate and delete semicolons.

Change-Id: I4e77b2d3ee8460abe4bfb993674f83e35be8ff17
Reviewed-on: https://go-review.googlesource.com/23066
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-12 16:48:09 +00:00
Aliaksandr Valialkin
376e641540 cmd: fixed certain vet warnings
Updates #11041

Change-Id: I7f2583d08f344d6622027c5e8a5de1f5d2f2881c
Reviewed-on: https://go-review.googlesource.com/23082
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-12 15:58:30 +00:00
Robert Griesemer
21d781070c cmd/compile: use one format for exporting calls of builtin functions
Minor cleanup. Each of these cases appears both during export and
import when running all.bash and thus is tested by all.bash.

Change-Id: Iaa4a5a5b163cefe33e43d08d396e02a02e5c22a5
Reviewed-on: https://go-review.googlesource.com/23060
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-11 22:57:12 +00:00
Robert Griesemer
ef62f641c3 cmd/compile: use ONAME instead of OPACK in binary export format
This is addressing feedback given on golang.org/cl/23052;
we do it in a separate CL to separate the functional from
the rename change.

ONAME was not used in the export data, but it's the natural node op
where we used OPACK instead. Renamed.

Furthermore, OPACK and ONONAME nodes are replaced by the type checker
with ONAME nodes, so OPACK nodes cannot occur when exporting type-checked
code. Removed a special-case for OPACK nodes since they don't appear.

Change-Id: I78b01a1badbf60e9283eaadeca2578a65d28cbd2
Reviewed-on: https://go-review.googlesource.com/23053
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-05-11 20:41:04 +00:00
Robert Griesemer
aff4889089 cmd/compile: clean up encoding of method expressions and add test
Fixes #15646.

Change-Id: Ic13d1adc0a358149209195cdb03811eeee506fb8
Reviewed-on: https://go-review.googlesource.com/23052
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-05-11 19:23:04 +00:00
Joe Tsai
e9407ae514 cmd/pprof: remove tempDir when no longer needed
The pprof tools properly cleans up all files it creates, but forgets
to clean up the temporary directory itself. This CL fixes that.

Fixes #13863

Change-Id: I1151c36cdad5ace7cc97e7e04001cf0149ef0f63
Reviewed-on: https://go-review.googlesource.com/23019
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-11 18:25:07 +00:00
Marc-Antoine Ruel
2ffb3e5d90 os: fix Remove for file with read only attribute on Windows
Include integration test. Confirmed that without the fix, the test case
TestDeleteReadOnly fails.

This permits to revert "cmd/go: reset read-only flag during TestIssue10952"
This reverts commit 3b7841b3af.

Fixes #9606

Change-Id: Ib55c151a8cf1a1da02ab18c34a9b58f615c34254
Reviewed-on: https://go-review.googlesource.com/18235
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-11 17:37:55 +00:00
Ian Lance Taylor
20e362dae7 cmd/cgo: remove //extern for check functions in gccgo Go prologue
The //extern comments are incorrect and cause undefined symbol
errorswhen building cgo code with -compiler=gccgo. The code is already
designed to use weak references, and that support relies on the cgo
check functions being treated as local functions.

Change-Id: Ib38a640cc4ce6eba74cfbf41ba7147ec88769ec0
Reviewed-on: https://go-review.googlesource.com/23014
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-11 17:07:24 +00:00
Cherry Zhang
e2848de9ef [dev.ssa] cmd/compile: implement the following for SSA on ARM
- generic Ops: Phi, CALL variants, NilCheck
- generic Blocks: Plain, Check
- 32-bit arithmetics
- CMP and conditional branches
- load/store
- zero/sign-extensions (8 to 16, 8 to 32, 16 to 32)

Progress on SSA backend for ARM. Still not complete. Now "errors"
package compiles and tests passed.

Updates #15365.

Change-Id: If126fd17f8695cbf55d64085bb3f1a4a53205701
Reviewed-on: https://go-review.googlesource.com/22856
Reviewed-by: Keith Randall <khr@golang.org>
2016-05-10 19:38:11 +00:00
Cherry Zhang
fdc4a964d2 [dev.ssa] cmd/compile/internal/gc, runtime: use 32-bit load for writeBarrier check
Use 32-bit load for writeBarrier check on all architectures.
Padding added to runtime structure.

Updates #15365, #15492.

Change-Id: I5d3dadf8609923fe0fe4fcb384a418b7b9624998
Reviewed-on: https://go-review.googlesource.com/22855
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-10 17:34:30 +00:00
Cherry Zhang
e1a2ea88d0 [dev.ssa] cmd/compile: handle symbolic constant for SSA on ARM
Progress on SSA backend for ARM. Still not complete. Now "helloworld"
function compiles and runs.

Updates #15365.

Change-Id: I02f66983cefdf07a6aed262fb4af8add464d8e9a
Reviewed-on: https://go-review.googlesource.com/22854
Reviewed-by: Keith Randall <khr@golang.org>
2016-05-10 13:30:51 +00:00
Shenghou Ma
5934523e75 cmd/compile: document -l in godoc
Fixes #15607.

Change-Id: I3e68ad00ebe72027d064238d4e77f1ad6a52f533
Reviewed-on: https://go-review.googlesource.com/22940
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-09 19:06:53 +00:00
David Chase
3c09001917 cmd/compile: correct sparseSet probes in regalloc to avoid index error
In regalloc, a sparse map is preallocated for later use by
spill-in-loop sinking.  However, variables (spills) are added
during register allocation before spill sinking, and a map
query involving any of these new variables will index out of
bounds in the map.

To fix:
1) fix the queries to use s.orig[v.ID].ID instead, to ensure
proper indexing.  Note that s.orig will be nil for values
that are not eligible for spilling (like memory and flags).

2) add a test.

Fixes #15585.

Change-Id: I8f2caa93b132a0f2a9161d2178320d5550583075
Reviewed-on: https://go-review.googlesource.com/22911
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-09 18:35:44 +00:00
Russ Cox
feb6131b1a cmd/compile: add -linkobj flag to allow writing object file in two parts
This flag is experimental and the semantics may change
even after Go 1.7 is released. There are no changes to code
not using the flag.

The first part is for reading by future compiles.
The second part is for reading by the final link step.
Splitting the file this way allows distributed build systems
to ship the compile-input part only to compile steps and
the linker-input part only to linker steps.

The first part is basically just the export data,
and the second part is basically everything else.
The overall files still have the same broad structure,
so that existing tools will work with both halves.
It's just that various pieces are empty in the two halves.

This also copies the two bits of data the linker needed from
export data into the object header proper, so that the linker
doesn't need any export data at all. That eliminates a TODO
that was left for switching to the binary export data.
(Now the linker doesn't need to know about the switch.)

The default is still to write out a combined output file.
Nothing changes unless you pass -linkobj to the compiler.
There is no support in the go command for -linkobj,
since the go command doesn't copy objects around.
The expectation is that other build systems (like bazel, say)
might take advantage of this.

The header adjustment and the option for the split output
was intended as part of the zip archives, but the zip archives
have been cut from Go 1.7. Doing this to the current archives
both unblocks one step in the switch to binary export data
and enables alternate build systems to experiment with the
new flag using the Go 1.7 release.

Change-Id: I8b6eab25b8a22b0a266ba0ac6d31e594f3d117f3
Reviewed-on: https://go-review.googlesource.com/22500
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-05-09 17:31:45 +00:00
Robert Griesemer
87a2ae1fa2 cmd/compile: fix binary export of composite literals with implicit types
Also:
- replaced remaining panics with Fatal calls
- more comments

Fixes #15572.

Change-Id: Ifb27e80b66700f5692a84078764a1e928d4b310d
Reviewed-on: https://go-review.googlesource.com/22935
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-05-09 06:16:07 +00:00
Matthew Dempsky
55546efeee Revert "cmd/compile: properly handle map assignments for OAS2DOTTYPE"
This reverts commit 9d7c9b4384.

For #15602.

Change-Id: I464184b05babe4cb8dedab6161efa730cea6ee2d
Reviewed-on: https://go-review.googlesource.com/22930
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-08 20:15:04 +00:00
Joel Sing
0b6e5e3d73 cmd/link: specify correct size for dynamic symbols in 386 elf output
Currently 386 ELF binaries are generated with dynamic symbols that have
a size of zero bytes, even though the symbol in the symbol table has
the correct size. Fix this by specifying the correct size when creating
dynamic symbols.

Issue found on OpenBSD -current, where ld.so is now producing link
warnings due to mismatched symbol sizes.

Fixes #15593.

Change-Id: Ib1a12b23ff9159c61ac980bf48a983b86f3df256
Reviewed-on: https://go-review.googlesource.com/22912
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-08 05:34:56 +00:00
Robert Griesemer
394ac818b0 cmd/compile: add and enable (internal) option to only track named types
The new export format keeps track of all types that are exported.
If a type is seen that was exported before, only a reference to
that type is emitted. The importer maintains a list of all the
seen types and uses that list to resolve type references.

The existing compiler infrastructure's invariants assumes that
only named types are referred to before they are fully set up.
Referring to unnamed incomplete types causes problems. One of
the issues was #15548.

Added a new internal flag 'trackAllTypes' to enable/disable
this type tracking. With this change only named types are
tracked.

Verified that this fix also addresses #15548, even w/o the
prior fix for that issue (in fact that prior fix is turned
off if trackAllTypes is disabled because it's not needed).

The test for #15548 covers also this change.

For #15548.

Change-Id: Id0b3ff983629703d025a442823f99649fd728a56
Reviewed-on: https://go-review.googlesource.com/22839
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-05-07 23:56:02 +00:00
Elias Naur
fa270ad98e cmd/go: add -shared to darwin/arm{,64} default build mode
Buildmode c-archive now supports position independent code for
darwin/arm (in addition to darwin/arm64). Make PIC (-shared) the
default for both platforms in the default buildmode.

Without this change, gomobile will go install the standard library
into its separate package directory without PIC support.

Also add -shared to darwin/arm64 in buildmode c-archive, for
symmetry (darwin/arm64 always generates position independent code).

Fixes #15519

Change-Id: If27d2cbea8f40982e14df25da2703cbba572b5c6
Reviewed-on: https://go-review.googlesource.com/22920
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-07 18:58:39 +00:00
Tal Shprecher
9d7c9b4384 cmd/compile: properly handle map assignments for OAS2DOTTYPE
The boolean destination in an OAS2DOTTYPE expression craps out during
compilation when trying to assign to a map entry because, unlike slice entries,
map entries are not directly addressable in memory. The solution is to
properly order the boolean destination node so that map entries are set
via autotmp variables.

Fixes #14678

Change-Id: If344e8f232b5bdac1b53c0f0d21eeb43ab17d3de
Reviewed-on: https://go-review.googlesource.com/22833
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-07 08:00:39 +00:00
Aliaksandr Valialkin
c81a3532fe cmd/vet: check sync.* types' copying
Embed noLock struct into the following types, so `go vet -copylocks` catches
their copying additionally to types containing sync.Mutex:
  - sync.Cond
  - sync.WaitGroup
  - sync.Pool
  - atomic.Value

Fixes #14582

Change-Id: Icb543ef5ad10524ad239a15eec8a9b334b0e0660
Reviewed-on: https://go-review.googlesource.com/22015
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06 16:43:51 +00:00
Cherry Zhang
bf151cc2aa cmd/compile/internal/mips64: fix large uint -> float conversion
Re-enable TestFP in cmd/compile/internal/gc on mips64.

Fixes #15552.

Change-Id: I5c3a5564b94d28c723358f0862468fb6da371991
Reviewed-on: https://go-review.googlesource.com/22835
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06 16:02:30 +00:00
Ilya Tocar
009c002c92 cmd/internal/obj/x86: add AVX2 instrutions needed for sha1/sha512/sha256 acceleration
This means: VPSHUFB, VPSHUFD, VPERM2F128, VPALIGNR, VPADDQ, VPADDD, VPSRLDQ,
VPSLLDQ, VPSRLQ, VPSLLQ, VPSRLD, VPSLLD, VPOR, VPBLENDD, VINSERTI128,
VPERM2I128, RORXL, RORXQ.

Change-Id: Ief27190ee6acfa86b109262af5d999bc101e923d
Reviewed-on: https://go-review.googlesource.com/22606
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-06 13:48:29 +00:00
Cherry Zhang
ef92857e27 cmd/go, cmd/cgo: pass "-mabi=64" to gcc on mips64
Change-Id: I9ac2ae57a00cee23d6255db02419b0a0f087d4f3
Reviewed-on: https://go-review.googlesource.com/22801
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
2016-05-06 04:08:43 +00:00
Brad Fitzpatrick
b90cb3f471 cmd/go: fail with nice error message on bad GOOS/GOARCH pair
Fixes #12272

Change-Id: I2115ec62ed4061084c482eb385a583a1c1909888
Reviewed-on: https://go-review.googlesource.com/22838
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-06 01:18:07 +00:00
Joe Tsai
acc757f678 all: use SeekStart, SeekCurrent, SeekEnd
CL/19862 (f79b50b8d5) recently introduced the constants
SeekStart, SeekCurrent, and SeekEnd to the io package. We should use these constants
consistently throughout the code base.

Updates #15269

Change-Id: If7fcaca7676e4a51f588528f5ced28220d9639a2
Reviewed-on: https://go-review.googlesource.com/22097
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Joe Tsai <joetsai@digital-static.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-06 00:10:41 +00:00
Robert Griesemer
8650c23034 cmd/compile: verify imported types after they are fully imported
Fixes #15548.

Change-Id: I1dfa9c8739a4b6d5e4c737c1a1e09e80e045b7aa
Reviewed-on: https://go-review.googlesource.com/22803
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-05-05 20:31:30 +00:00
Lynn Boger
eeca3ba92f sync/atomic, runtime/internal/atomic: improve ppc64x atomics
The following performance improvements have been made to the
low-level atomic functions for ppc64le & ppc64:

- For those cases containing a lwarx and stwcx (or other sizes):
sync, lwarx, maybe something, stwcx, loop to sync, sync, isync
The sync is moved before (outside) the lwarx/stwcx loop, and the
 sync after is removed, so it becomes:
sync, lwarx, maybe something, stwcx, loop to lwarx, isync

- For the Or8 and And8, the shifting and manipulation of the
address to the word aligned version were removed and the
instructions were changed to use lbarx, stbcx instead of
register shifting, xor, then lwarx, stwcx.

- New instructions LWSYNC, LBAR, STBCC were tested and added.
runtime/atomic_ppc64x.s was changed to use the LWSYNC opcode
instead of the WORD encoding.

Fixes #15469

Ran some of the benchmarks in the runtime and sync directories.
Some results varied from run to run but the trend was improvement
based on best times for base and new:

runtime.test:
BenchmarkChanNonblocking-128         0.88          0.89          +1.14%
BenchmarkChanUncontended-128         569           511           -10.19%
BenchmarkChanContended-128           63110         53231         -15.65%
BenchmarkChanSync-128                691           598           -13.46%
BenchmarkChanSyncWork-128            11355         11649         +2.59%
BenchmarkChanProdCons0-128           2402          2090          -12.99%
BenchmarkChanProdCons10-128          1348          1363          +1.11%
BenchmarkChanProdCons100-128         1002          746           -25.55%
BenchmarkChanProdConsWork0-128       2554          2720          +6.50%
BenchmarkChanProdConsWork10-128      1909          1804          -5.50%
BenchmarkChanProdConsWork100-128     1624          1580          -2.71%
BenchmarkChanCreation-128            237           212           -10.55%
BenchmarkChanSem-128                 705           667           -5.39%
BenchmarkChanPopular-128             5081190       4497566       -11.49%

BenchmarkCreateGoroutines-128             532           473           -11.09%
BenchmarkCreateGoroutinesParallel-128     35.0          34.7          -0.86%
BenchmarkCreateGoroutinesCapture-128      4923          4200          -14.69%

sync.test:
BenchmarkUncontendedSemaphore-128      112           94.2          -15.89%
BenchmarkContendedSemaphore-128        133           128           -3.76%
BenchmarkMutexUncontended-128          1.90          1.67          -12.11%
BenchmarkMutex-128                     353           310           -12.18%
BenchmarkMutexSlack-128                304           283           -6.91%
BenchmarkMutexWork-128                 554           541           -2.35%
BenchmarkMutexWorkSlack-128            567           556           -1.94%
BenchmarkMutexNoSpin-128               275           242           -12.00%
BenchmarkMutexSpin-128                 1129          1030          -8.77%
BenchmarkOnce-128                      1.08          0.96          -11.11%
BenchmarkPool-128                      29.8          27.4          -8.05%
BenchmarkPoolOverflow-128              40564         36583         -9.81%
BenchmarkSemaUncontended-128           3.14          2.63          -16.24%
BenchmarkSemaSyntNonblock-128          1087          1069          -1.66%
BenchmarkSemaSyntBlock-128             897           893           -0.45%
BenchmarkSemaWorkNonblock-128          1034          1028          -0.58%
BenchmarkSemaWorkBlock-128             949           886           -6.64%

Change-Id: I4403fb29d3cd5254b7b1ce87a216bd11b391079e
Reviewed-on: https://go-review.googlesource.com/22549
Reviewed-by: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-05 18:52:28 +00:00
Josh Bleecher Snyder
bc1989f115 cmd/compile: optimize lookupVarOutgoing
If b has exactly one predecessor, as happens
frequently with static calls, we can make
lookupVarOutgoing generate less garbage.

Instead of generating a value that is just
going to be an OpCopy and then get eliminated,
loop. This can lead to lots of looping.
However, this loop is way cheaper than generating
lots of ssa.Values and then eliminating them.

For a subset of the code in #15537:

Before:

       28.31 real        36.17 user         1.68 sys
2282450944  maximum resident set size

After:

        9.63 real        11.66 user         0.51 sys
 638144512  maximum resident set size

Updates #15537.

Excitingly, it appears that this also helps
regular code:

name       old time/op      new time/op      delta
Template        288ms ± 6%       276ms ± 7%   -4.13%        (p=0.000 n=21+24)
Unicode         143ms ± 8%       141ms ±10%     ~           (p=0.287 n=24+25)
GoTypes         932ms ± 4%       874ms ± 4%   -6.20%        (p=0.000 n=23+22)
Compiler        4.89s ± 4%       4.58s ± 4%   -6.46%        (p=0.000 n=22+23)
MakeBash        40.2s ±13%       39.8s ± 9%     ~           (p=0.648 n=23+23)

name       old user-ns/op   new user-ns/op   delta
Template   388user-ms ±10%  373user-ms ± 5%   -3.80%        (p=0.000 n=24+25)
Unicode    203user-ms ± 6%  202user-ms ± 7%     ~           (p=0.492 n=22+24)
GoTypes    1.29user-s ± 4%  1.17user-s ± 4%   -9.67%        (p=0.000 n=25+23)
Compiler   6.86user-s ± 5%  6.28user-s ± 4%   -8.49%        (p=0.000 n=25+25)

name       old alloc/op     new alloc/op     delta
Template       51.5MB ± 0%      47.6MB ± 0%   -7.47%        (p=0.000 n=22+25)
Unicode        37.2MB ± 0%      37.1MB ± 0%   -0.21%        (p=0.000 n=25+25)
GoTypes         166MB ± 0%       138MB ± 0%  -16.83%        (p=0.000 n=25+25)
Compiler        756MB ± 0%       628MB ± 0%  -16.96%        (p=0.000 n=25+23)

name       old allocs/op    new allocs/op    delta
Template         450k ± 0%        445k ± 0%   -1.02%        (p=0.000 n=25+25)
Unicode          356k ± 0%        356k ± 0%     ~           (p=0.374 n=24+25)
GoTypes         1.31M ± 0%       1.25M ± 0%   -4.18%        (p=0.000 n=25+25)
Compiler        5.29M ± 0%       5.02M ± 0%   -5.15%        (p=0.000 n=25+23)

It also seems to help in other cases in which
phi insertion is a pain point (#14774, #14934).

Change-Id: Ibd05ed7b99d262117ece7bb250dfa8c3d1cc5dd2
Reviewed-on: https://go-review.googlesource.com/22790
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
2016-05-05 17:45:21 +00:00
Cherry Zhang
6ccab441de cmd/compile/internal/gc: skip TestFP on mips64x
The legacy mips64 backend doesn't handle large uint->float conversion
correctly. See #15552.

Change-Id: I84ceeaa95cc4e85f09cc46dfb30ab5d151f6b205
Reviewed-on: https://go-review.googlesource.com/22800
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-05 16:14:47 +00:00
Cherry Zhang
bfa89c3cd4 cmd/compile/internal/gc: remove duplicated TestFP
TestFp and TestFP are same, remove one.

Change-Id: Iffdece634cd4572421974496298925e7c6ac13a9
Reviewed-on: https://go-review.googlesource.com/22799
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-05 16:14:17 +00:00
Keith Randall
4fa050024f cmd/compile: enable constant-time CFG editing
Provide indexes along with block pointers for Preds
and Succs arrays.  This allows us to splice edges in
and out of those arrays in constant time.

Fixes worst-case O(n^2) behavior in deadcode and fuse.

benchmark                     old ns/op      new ns/op     delta
BenchmarkFuse1-8              2065           2057          -0.39%
BenchmarkFuse10-8             9408           9073          -3.56%
BenchmarkFuse100-8            105238         76277         -27.52%
BenchmarkFuse1000-8           3982562        1026750       -74.22%
BenchmarkFuse10000-8          301220329      12824005      -95.74%
BenchmarkDeadCode1-8          1588           1566          -1.39%
BenchmarkDeadCode10-8         4333           4250          -1.92%
BenchmarkDeadCode100-8        32031          32574         +1.70%
BenchmarkDeadCode1000-8       590407         468275        -20.69%
BenchmarkDeadCode10000-8      17822890       5000818       -71.94%
BenchmarkDeadCode100000-8     1388706640     78021127      -94.38%
BenchmarkDeadCode200000-8     5372518479     168598762     -96.86%

Change-Id: Iccabdbb9343fd1c921ba07bbf673330a1c36ee17
Reviewed-on: https://go-review.googlesource.com/22589
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-05 15:58:59 +00:00
Cherry Zhang
3c4ebd2023 cmd/link: fix external linker argument for mips64
I overlooked it when rebasing CL 19803.

Change-Id: Ife9d6bcc6a772715d137af903c64bafac0cdb216
Reviewed-on: https://go-review.googlesource.com/22797
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-05 14:57:45 +00:00
Michael Munday
1f4f2d0d39 cmd/compile: fix uint64 to float casts on ppc64
Adds the FCFIDU instruction and uses it instead of the FCFID
instruction for unsigned integer to float casts. This change means
that unsigned integers do not have to be cast to signed integers
before being cast to a floating point value. Therefore it is no
longer necessary to insert instructions to detect and fix
values that overflow int64.

The previous code generating the uint64 to int64 cast handled
overflow by truncating the uint64 value. This truncation can
change the result of the rounding performed by the integer to
float cast.

The FCFIDU instruction was added in Power ISA 2.06B.

Fixes #15539.

Change-Id: Ia37a9631293eff91032d4cd9a9bec759d2142437
Reviewed-on: https://go-review.googlesource.com/22772
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-04 23:23:58 +00:00
Robert Griesemer
3747c00923 cmd/compile: fix debugFormat for new export format
Change-Id: Ic3415f3ee643636eab4ff7d2351b8ad0dae62895
Reviewed-on: https://go-review.googlesource.com/22792
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-05-04 22:15:54 +00:00
Shenghou Ma
2e2481ed34 cmd/dist: remove the use of debug/elf package
debug/elf is only needed to determine the endianness of the host
machine, which is easy to do without debug/elf.

Fixes #15180.

Change-Id: I21035ed3884871270765a1ca3b812a5d4890a7ee
Reviewed-on: https://go-review.googlesource.com/21662
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-04 21:23:20 +00:00
Josh Bleecher Snyder
24744f6561 cmd/compile: check that SSA memory args are in the right place
Fixes #15510

Change-Id: I2e0568778ef90cf29712753b8c42109ef84a0256
Reviewed-on: https://go-review.googlesource.com/22784
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-05-04 19:54:44 +00:00
Brad Fitzpatrick
0f84afe24b cmd/dist: add flag to build tests only, but not run them
To speed up the ssacheck check builder and make it on by default as a
trybot.

Change-Id: I91a3347491507c84f4878dff744ca426ba3e2e9f
Reviewed-on: https://go-review.googlesource.com/22755
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-04 17:46:37 +00:00
Shenghou Ma
7a964e1df4 cmd/vet: add mips64x assembly check support
Change-Id: I0a6a92604dbfa4b0f9c5ae483b574331f246dcad
Reviewed-on: https://go-review.googlesource.com/22502
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-05-04 16:50:13 +00:00
Cherry Zhang
3b4180c674 cmd/go: enable TestNodeReading on linux/mips64x
external linking is now supported.

Change-Id: I3f552f5f09391205fced509fe8a5a38297ea8153
Reviewed-on: https://go-review.googlesource.com/19810
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-04 16:41:57 +00:00
Cherry Zhang
1cec0fec8c cmd/dist: enable cgo and external linking on linux/mips64x
Fixes #14126

Change-Id: I21c8e06c01d3ef02ee09dc185d4443e2da8fd52b
Reviewed-on: https://go-review.googlesource.com/19809
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-04 16:41:47 +00:00
Cherry Zhang
dcd613862b cmd/link/internal/ld: force external linking for mips64x with cgo
cgo internal linking is not supported yet (issue #14449).

Change-Id: Ic968916383d77b7f449db8f230c928a1e81939e0
Reviewed-on: https://go-review.googlesource.com/19807
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-04 16:41:24 +00:00
Martin Möhrmann
082881daf8 misc/cgo/fortran: fix gfortran compile test
Fixes #14544

Change-Id: I58b0b164ebbfeafe4ab32039a063df53e3018a6d
Reviewed-on: https://go-review.googlesource.com/22730
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Sean Lake <odysseus9672@gmail.com>
2016-05-04 15:08:16 +00:00
Michael Hudson-Doyle
2f41edf120 cmd/link: always read type data for dynimport symbols
Consider three shared libraries:

 libBase.so -- defines a type T
 lib2.so    -- references type T
 lib3.so    -- also references type T, and something from lib2

lib2.so will contain a type symbol for T in its symbol table, but no
definition. If, when linking lib3.so the linker reads the symbols from lib2.so
before libBase.so, the linker didn't read the type data and later crashed.

The fix is trivial but the test change is a bit messy because the order the
linker reads the shared libraries in ends up depending on the order of the
import statements in the file so I had to rename one of the test packages so
that gofmt doesn't fix the test by accident...

Fixes #15516

Change-Id: I124b058f782c900a3a54c15ed66a0d91d0cde5ce
Reviewed-on: https://go-review.googlesource.com/22744
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-04 07:13:01 +00:00
Keith Randall
9f8ecd75fc cmd/compile: use SSA tests on legacy compiler
Why not?  Because the 386 backend can't handle one of them.
But other than that, it should work.

Change-Id: Iaeb9735f8c3c281136a0734376dec5ddba21be3b
Reviewed-on: https://go-review.googlesource.com/22748
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-05-04 00:49:13 +00:00
Brad Fitzpatrick
4d5ac10f69 cmd/vet: fix test's dependence on perl
Change-Id: I774dbd4f90ef271a0969c3c8e65d145669312e3e
Reviewed-on: https://go-review.googlesource.com/22745
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ross Light <light@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-03 23:59:56 +00:00
Keith Randall
b64c7fc683 cmd/compile: never CSE two memories
It never makes sense to CSE two ops that generate memory.
We might as well start those ops off in their own partition.

Fixes #15520

Change-Id: I0091ed51640f2c10cd0117f290b034dde7a86721
Reviewed-on: https://go-review.googlesource.com/22741
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-03 22:45:53 +00:00
Robert Griesemer
15f7a66f36 cmd/compile: use correct packages when exporting/importing _ (blank) names
1) Blank parameters cannot be accessed so the package doesn't matter.
   Do not export it, and consistently use localpkg when importing a
   blank parameter.

2) More accurately replicate fmt.go and parser.go logic when importing
   a blank struct field. Blank struct fields get exported without
   package qualification.
   (This is actually incorrect, even with the old textual export format,
   but we will fix that in a separate change. See also issue 15514.)

Fixes #15491.

Change-Id: I7978e8de163eb9965964942aee27f13bf94a7c3c
Reviewed-on: https://go-review.googlesource.com/22714
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-05-03 14:57:06 +00:00
Dmitry Vyukov
babdbfb826 cmd/trace: make binary argument optional
1.7 traces embed symbol info and we now generate symbolized pprof profiles,
so we don't need the binary. Make binary argument optional as 1.5 traces
still need it.

Change-Id: I65eb13e3d20ec765acf85c42d42a8d7aae09854c
Reviewed-on: https://go-review.googlesource.com/22410
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Austin Clements <austin@google.com>
2016-05-03 12:35:09 +00:00
Michael Hudson-Doyle
499cd33719 cmd/cgo: an approach to tsan that works with gcc
GCC, unlike clang, does not provide any way for code being compiled to tell if
-fsanitize-thread was passed. But cgo can look to see if that flag is being
passed and generate different code in that case.

Fixes #14602

Change-Id: I86cb5318c2e35501ae399618c05af461d1252d2d
Reviewed-on: https://go-review.googlesource.com/22688
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-03 00:49:46 +00:00
David Crawshaw
6b019e216b cmd/link: bump object file version number
The format has been tweaked several times in the latest cycle, so
replace go13ld with go17ld.

Change-Id: I343c49b02b7516fd781bc96ad46640579da68c59
Reviewed-on: https://go-review.googlesource.com/22708
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-02 22:45:29 +00:00
Emmanuel Odeke
53fd522c0d all: make copyright headers consistent with one space after period
Follows suit with https://go-review.googlesource.com/#/c/20111.

Generated by running
$ grep -R 'Go Authors.  All' * | cut -d":" -f1 | while read F;do perl -pi -e 's/Go
Authors.  All/Go Authors. All/g' $F;done

The code in cmd/internal/unvendor wasn't changed.

Fixes #15213

Change-Id: I4f235cee0a62ec435f9e8540a1ec08ae03b1a75f
Reviewed-on: https://go-review.googlesource.com/21819
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-02 13:43:18 +00:00
Ian Lance Taylor
e50346d26a cmd/cgo, misc/cgo/test: make -Wdeclaration-after-statement clean
I got a complaint that cgo output triggers warnings with
-Wdeclaration-after-statement.  I don't think it's worth testing for
this--C has permitted declarations after statements since C99--but it is
easy enough to fix.  It may break again; so it goes.

This CL also fixes errno handling to avoid getting confused if the tsan
functions happen to change the global errno variable.

Change-Id: I0ec7c63a6be5653ef44799d134c8d27cb5efa441
Reviewed-on: https://go-review.googlesource.com/22686
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-02 04:42:12 +00:00
Michael Hudson-Doyle
45f39fb467 cmd/link: pass -Wl,-z,relro to host linker in -buildmode=PIE
Fixes #15485

Change-Id: I8e9314be91db89873130b232b589a284822e6643
Reviewed-on: https://go-review.googlesource.com/22687
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-02 04:38:52 +00:00
Keith Randall
5325fbc7db cmd/compile: don't SSA any variables when -N
Turn SSAing of variables off when compiling with optimizations off.
This helps keep variable names around that would otherwise be
optimized away.

Fixes #14744

Change-Id: I31db8cf269c068c7c5851808f13e5955a09810ca
Reviewed-on: https://go-review.googlesource.com/22681
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-05-02 04:16:45 +00:00
Keith Randall
ade0eb2f06 cmd/compile: fix reslice
:= is the wrong thing here.  The new variable masks the old
variable so we allocate the slice afresh each time around the loop.

Change-Id: I759c30e1bfa88f40decca6dd7d1e051e14ca0844
Reviewed-on: https://go-review.googlesource.com/22679
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-01 22:11:45 +00:00
Cherry Zhang
3b0b30727c cmd/internal/obj/mips, cmd/link: add support TLS relocation for mips64x
a new relocation R_ADDRMIPSTLS is added, which resolves to 16-bit offset
of a TLS address on mips64x.

Change-Id: Ic60d0e1ba49ff1c433cead242f5884677ab227a5
Reviewed-on: https://go-review.googlesource.com/19804
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-01 03:36:19 +00:00
Cherry Zhang
073d292c45 cmd/link, runtime: add external linking support for linux/mips64x
Fixes #12560

Change-Id: Ic2004fc7b09f2dbbf83c41f8c6307757c0e1676d
Reviewed-on: https://go-review.googlesource.com/19803
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-01 02:38:37 +00:00
Frits van Bommel
b13b249f43 cmd/compile: Improve readability of HTML produced by GOSSAFUNC
Factor out the Aux/AuxInt handling in (*Value).LongString() and
use it in (*Value).LongHTML() as well.
This especially improves readability of auxFloat32, auxFloat64,
and auxSymValAndOff values which would otherwise be printed as
opaque integers.
This change also makes LongString() slightly less verbose by
eliding offsets that are zero (as is very often the case).

Additionally, ensure the HTML is interpreted as UTF-8 so that
non-ASCII characters (especially the "middle dots" in some symbols)
show up correctly.

Change-Id: Ie26221df876faa056d322b3e423af63f33cd109d
Reviewed-on: https://go-review.googlesource.com/22641
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Frits van Bommel <fvbommel@gmail.com>
2016-05-01 02:38:17 +00:00
Cherry Zhang
981395103e cmd/internal/obj/mips et al.: introduce SB register on mips64x
SB register (R28) is introduced for access external addresses with shorter
instruction sequences. It is loaded at entry points. External data within
2G of SB can be accessed this way.

cmd/internal/obj: relocaltion R_ADDRMIPS is split into two relocations
R_ADDRMIPS and R_ADDRMIPSU, handling the low 16 bits and the "upper" 16
bits of external addresses, respectively, since the instructios may not
be adjacent. It might be better if relocation Variant could be used.

cmd/link/internal/mips64: support new relocations.

cmd/compile/internal/mips64: reserve SB register.

runtime: initialize SB register at entry points.

Change-Id: I5f34868f88c5a9698c042a8a1f12f76806c187b9
Reviewed-on: https://go-review.googlesource.com/19802
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-01 02:36:46 +00:00
Cherry Zhang
8dc0444a04 cmd/asm, cmd/internal/obj/mips: add an alias of RSB on mips64x
Change-Id: I724ce0a48c1aeed14267c049fa415a6fa2fffbcf
Reviewed-on: https://go-review.googlesource.com/19864
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-01 02:36:37 +00:00
Cherry Zhang
a409fb80b0 cmd/internal/obj/mips, runtime: change REGTMP to R23
Leave R28 to SB register, which will be introduced in CL 19802.

Change-Id: I1cf7a789695c5de664267ec8086bfb0b043ebc14
Reviewed-on: https://go-review.googlesource.com/19863
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-01 02:36:28 +00:00
Cherry Zhang
9bc1e2065c cmd/asm/internal/asm/testdata: remove WORD $foo(SB) from mips64.s
on mips64, address is 64 bit, not a WORD. also it is never used anywhere.

Change-Id: Ic6bf6d6a21c8d2f1eb7bfe9efc5a29186ec2a8ef
Reviewed-on: https://go-review.googlesource.com/19801
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-01 02:36:09 +00:00
Keith Randall
7a60a962b9 cmd/compile: ecx is reserved for PIC, don't let peep work on it
Fixes #15496

Change-Id: Ieb5be1caa4b1c23e23b20d56c1a0a619032a9f5d
Reviewed-on: https://go-review.googlesource.com/22652
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-04-30 05:59:54 +00:00
Ian Lance Taylor
5f9a870bf1 cmd/cgo, runtime, runtime/cgo: use cgo context function
Add support for the context function set by runtime.SetCgoTraceback.
The context function was added in CL 17761, without support.
This CL is the support.

This CL has not been tested for real C code, as a working context
function for C code requires unwind support that does not seem to exist.
I wanted to get the CL out before the freeze.

I apologize for the length of this CL.  It's mostly plumbing, but
unfortunately the plumbing is processor-specific.

Change-Id: I8ce11a0de9b3dafcc29efd2649d776e93bff0e90
Reviewed-on: https://go-review.googlesource.com/22508
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-29 22:07:36 +00:00
Keith Randall
cd956576ae cmd/compile: make vet happy with ssa code
Fixes #15488

Change-Id: I054eb1e1c859de315e3cdbdef5428682bce693fd
Reviewed-on: https://go-review.googlesource.com/22609
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-04-29 18:49:23 +00:00
David Chase
d8d33514f9 cmd/compile: Move divconst_test out of test/bench/go1
This is necessary to avoid disrupting the go1 suite and gives
us a place to put other tests of basic compiler function and
correctness.

Change-Id: I36933819ff2bfe6a2121fff2be9a98efd2123d9a
Reviewed-on: https://go-review.googlesource.com/22597
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-04-29 16:20:18 +00:00
Keith Randall
fa9435cdff cmd/compile: clean up rewrite rules
Break really long lines.
Add spacing to line up columns.

In AMD64, put all the optimization rules after all the
lowering rules.

Change-Id: I45cc7368bf278416e67f89e74358db1bd4326a93
Reviewed-on: https://go-review.googlesource.com/22470
Reviewed-by: David Chase <drchase@google.com>
2016-04-29 16:16:32 +00:00
Dave Cheney
5edcff0134 cmd/compile/internal/gc: bv.go cleanup
Drive by gardening of bv.go.

- Unexport the Bvec type, it is not used outside internal/gc.
  (machine translated with gofmt -r)
- Removed unused constants and functions.
  (driven by cmd/unused)

Change-Id: I3433758ad4e62439f802f4b0ed306e67336d9aba
Reviewed-on: https://go-review.googlesource.com/22602
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-29 13:22:15 +00:00
Russ Cox
af6aa0fd74 cmd/go, go/build: add support for binary-only packages
See https://golang.org/design/2775-binary-only-packages for design.

Fixes #2775.

Change-Id: I33e74eebffadc14d3340bba96083af0dec5172d5
Reviewed-on: https://go-review.googlesource.com/22433
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-04-29 00:23:02 +00:00
Michael Hudson-Doyle
cb97fd7741 cmd/link: fix -no-pie / -race check
golang.org/cl/22453 was supposed to pass -no-pie to the linker when linking a
race-enabled binary if the host toolchain supports it. But I bungled the
supported check as I forgot to pass -c to the host compiler so it tried to
compile a 0 byte .c file into an executable, which will never work. Fix it to
pass -c as it should have all along.

Change-Id: I4801345c7a29cb18d5f22cec5337ce535f92135d
Reviewed-on: https://go-review.googlesource.com/22587
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2016-04-28 23:32:31 +00:00
Keith Randall
6ed79fbd1a cmd/compile: remove BlockDead state
It is unused, remove the clutter.

Change-Id: I51a44326b125ef79241459c463441f76a289cc08
Reviewed-on: https://go-review.googlesource.com/22586
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-28 23:32:24 +00:00
Robert Griesemer
6c11e2710e cmd/compile: use delta encoding for filenames in export data position info
This reduces the export data size significantly (15%-25%) for some packages,
especially where the paths are very long or if there are many files involved.
Slight (2%) reduction on average, with virtually no increases in export data
size.

Selected export data sizes for packages with |delta %| > 3%:

                     package   before    after   delta     %

        cmd/asm/internal/arch   11647    11088    -559   -4%
   cmd/compile/internal/amd64     838      600    -238  -27%
     cmd/compile/internal/arm    7323     6793    -530   -6%
   cmd/compile/internal/arm64   19948    18971    -977   -4%
     cmd/compile/internal/big    9043     8548    -495   -4%
  cmd/compile/internal/mips64     645      482    -163  -24%
   cmd/compile/internal/ppc64     695      497    -198  -27%
   cmd/compile/internal/s390x     553      433    -120  -21%
     cmd/compile/internal/x86     744      555    -189  -24%
                     cmd/dist     145      121     -24  -16%
         cmd/internal/objfile   17359    16474    -885   -4%
   cmd/internal/pprof/symbolz    8346     7941    -405   -4%
      cmd/link/internal/amd64   11178    10604    -574   -4%
        cmd/link/internal/arm     204      171     -33  -15%
      cmd/link/internal/arm64     210      175     -35  -16%
     cmd/link/internal/mips64     213      177     -36  -16%
      cmd/link/internal/ppc64     211      176     -35  -16%
      cmd/link/internal/s390x     210      175     -35  -16%
        cmd/link/internal/x86     203      170     -33  -15%
                    cmd/trace     782      744     -38   -4%
                 compress/lzw     402      383     -19   -4%
                   crypto/aes     311      262     -49  -15%
                crypto/cipher    1138      959    -179  -15%
                   crypto/des     315      288     -27   -8%
              crypto/elliptic    6063     5746    -317   -4%
                   crypto/rc4     317      295     -22   -6%
                crypto/sha256     348      312     -36   -9%
                crypto/sha512     487      451     -36   -6%
                       go/doc    3871     3649    -222   -5%
    go/internal/gccgoimporter    2063     1949    -114   -5%
       go/internal/gcimporter    3253     3096    -157   -4%
                         math    4343     3572    -771  -17%
                   math/cmplx    1580     1274    -306  -18%
                    math/rand     982      926     -56   -5%
        net/internal/socktest    2159     2049    -110   -4%
                      os/exec    7928     7492    -436   -4%
                    os/signal     237      208     -29  -11%
                      os/user     717      682     -35   -4%
      runtime/internal/atomic     728      693     -35   -4%
         runtime/internal/sys    2287     2107    -180   -7%
                         sync    1306     1214     -92   -6%

                 all packages 1509255  1465507  -43748   -2%

Change-Id: I98a11521b552166b7f47f2039a29f106748bf5d4
Reviewed-on: https://go-review.googlesource.com/22580
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-28 20:52:31 +00:00
Matthew Dempsky
f04eb35673 cmd/compile: remove unused Bputname function
Change-Id: Icecbf9bae8c39670d1ceef62dd94b36e90b27b04
Reviewed-on: https://go-review.googlesource.com/22570
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-28 20:29:51 +00:00
Michael Munday
3c8ef0e0c9 cmd/compile: allow 64-bit multiplication with immediates on s390x
MGHI (16-bit signed immediate) is now used where possible for both
MULLW and MULLD. MGHI is 2-bytes shorter than MSGFI.

Change-Id: I5d0648934f28b3403b1126913fd703d8f62b9e9f
Reviewed-on: https://go-review.googlesource.com/22398
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-28 20:27:43 +00:00
Brad Fitzpatrick
2cc27a7de9 os/exec: add Cmd.RunContext and Cmd.WaitContext
Updates #14660

Change-Id: Ifa5c97ba327ad7ceea0a9a252e3dbd9d079dae54
Reviewed-on: https://go-review.googlesource.com/22529
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-28 19:06:41 +00:00
Keith Randall
d610d304f8 cmd/compile: reorg copyelim to avoid O(n^2) problem
Make sure we don't do O(n^2) work to eliminate a chain
of n copies.

benchmark                     old ns/op       new ns/op     delta
BenchmarkCopyElim1-8          1418            1406          -0.85%
BenchmarkCopyElim10-8         5289            5162          -2.40%
BenchmarkCopyElim100-8        52618           41684         -20.78%
BenchmarkCopyElim1000-8       2473878         424339        -82.85%
BenchmarkCopyElim10000-8      269373954       6367971       -97.64%
BenchmarkCopyElim100000-8     31272781165     104357244     -99.67%

Change-Id: I680f906f70f2ee1a8615cb1046bc510c77d59284
Reviewed-on: https://go-review.googlesource.com/22535
Reviewed-by: Alexandru Moșoi <alexandru@mosoi.ro>
2016-04-28 17:40:08 +00:00
David Chase
5ec87ba554 cmd/compile: fix.gc.Type.cmp for map.notBucket cmp map.Bucket
Comparison of certain map types could fail to be antisymmetric.
This corrects that.

Change-Id: I88c6256053ce29950ced4ba4d538e241ee8591fe
Reviewed-on: https://go-review.googlesource.com/22552
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: jcd . <jcd@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-04-28 15:36:34 +00:00
Aliaksandr Valialkin
22db3c5a62 cmd/vet: improve checking unkeyed fields in composite literals
- Simplified the code.

- Removed types for slice aliases from composite literals' whitelist, since they
are properly handled by vet.

Fixes #15408
Updates #9171
Updates #11041

Change-Id: Ia1806c9eb3f327c09d2e28da4ffdb233b5a159b0
Reviewed-on: https://go-review.googlesource.com/22318
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-04-28 13:51:40 +00:00
Robert Griesemer
80e9a7f079 cmd/compile: have all or no parameter named in exported signatures
Binary export format only.

Make sure we don't accidentally export an unnamed parameter
in signatures which expect all named parameters; otherwise
we crash during import. Appears to happen for _ (blank)
parameter names, as observed in method signatures such as
the one at: x/tools/godoc/analysis/analysis.go:76.

Fixes #15470.

TBR=mdempsky

Change-Id: I1b1184bf08c4c09d8a46946539c4b8c341acdb84
Reviewed-on: https://go-review.googlesource.com/22543
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-04-28 05:26:36 +00:00
Robert Griesemer
e8d4ffb766 cmd/compile: use correct (field/method) node for position info
Position info for fields and methods was based on the wrong node
in the new export format, leading to position info for empty
file names and 0 line numbers. Use correct node now.

Due to compact delta encoding, there is no difference in export
format size. In fact, because encoding of "no line changed" is
uncommon and thus a bit more expensive, in many cases the data
is now slightly shorter.

Stats for export data size (pachage, before, after, delta%):

                                         archive/tar     5128     5025  -1%
                                         archive/zip     7672     7515  -1%
                                               bufio     3486     3377  -2%
                                               bytes     4879     4821   0%
                                       cmd/addr2line       66       66   0%
                                             cmd/api    14033    13970   0%
                                             cmd/asm       60       60   0%
                               cmd/asm/internal/arch    11659    11647   0%
                                cmd/asm/internal/asm    13858    13766   0%
                              cmd/asm/internal/flags      306      300  -1%
                                cmd/asm/internal/lex    15684    15623   0%
                                             cmd/cgo    15383    15298   0%
                                         cmd/compile       63       63   0%
                          cmd/compile/internal/amd64      838      838   0%
                            cmd/compile/internal/arm     7333     7323   0%
                          cmd/compile/internal/arm64    19953    19951   0%
                            cmd/compile/internal/big     8943     9043   1%
                             cmd/compile/internal/gc    57465    56801   0%
                         cmd/compile/internal/mips64      645      645   0%
                          cmd/compile/internal/ppc64      695      695   0%
                          cmd/compile/internal/s390x      553      553   0%
                            cmd/compile/internal/ssa    34883    34559   0%
                            cmd/compile/internal/x86      744      744   0%
                                           cmd/cover     4961     4892   0%
                                            cmd/dist      145      145   0%
                                             cmd/doc     8891     8853   0%
                                         cmd/expdump       67       67   0%
                                             cmd/fix      422      406  -3%
                                              cmd/go     9951     9747  -1%
                                           cmd/gofmt       66       66   0%
                                    cmd/internal/bio     6378     6340   0%
                                 cmd/internal/gcprog      684      644  -5%
                                  cmd/internal/goobj     1276     1193  -6%
                                    cmd/internal/obj    12908    12551  -2%
                                cmd/internal/obj/arm    10074    10053   0%
                              cmd/internal/obj/arm64    17723    17699   0%
                               cmd/internal/obj/mips    12573    12530   0%
                              cmd/internal/obj/ppc64    15352    15330   0%
                              cmd/internal/obj/s390x    18785    18769   0%
                                cmd/internal/obj/x86    23586    23551   0%
                                cmd/internal/objfile    17148    17359   1%
                         cmd/internal/pprof/commands     1948     1930   0%
                           cmd/internal/pprof/driver    11123    11095   0%
                            cmd/internal/pprof/fetch     8931     8907   0%
                           cmd/internal/pprof/plugin    15335    15221   0%
                          cmd/internal/pprof/profile     8493     8370   0%
                           cmd/internal/pprof/report     9273     9214   0%
                              cmd/internal/pprof/svg     1589     1589   0%
                       cmd/internal/pprof/symbolizer     8737     8727   0%
                          cmd/internal/pprof/symbolz     8277     8346   1%
                         cmd/internal/pprof/tempfile     4319     4317   0%
                                    cmd/internal/sys      622      603  -2%
  cmd/internal/unvendor/golang.org/x/arch/arm/armasm    79231    79148   0%
  cmd/internal/unvendor/golang.org/x/arch/x86/x86asm    11761    11726   0%
                                            cmd/link       60       60   0%
                             cmd/link/internal/amd64    11190    11178   0%
                               cmd/link/internal/arm      204      204   0%
                             cmd/link/internal/arm64      210      210   0%
                                cmd/link/internal/ld    60670    59758  -1%
                            cmd/link/internal/mips64      213      213   0%
                             cmd/link/internal/ppc64      211      211   0%
                             cmd/link/internal/s390x      210      210   0%
                               cmd/link/internal/x86      203      203   0%
                                              cmd/nm       57       57   0%
                                         cmd/objdump       64       64   0%
                                            cmd/pack     4968     4908   0%
                                           cmd/pprof       63       63   0%
                                           cmd/trace      828      782  -5%
                                             cmd/vet    13485    13503   0%
                          cmd/vet/internal/whitelist      109      109   0%
                                            cmd/yacc     1315     1269  -2%
                                      compress/bzip2     2561     2506  -1%
                                      compress/flate     4906     4748  -2%
                                       compress/gzip     7788     7717   0%
                                        compress/lzw      406      402   0%
                                       compress/zlib     4739     4712   0%
                                      container/heap      265      257  -2%
                                      container/list     1506     1450  -3%
                                      container/ring      556      536  -3%
                                             context     3552     3527   0%
                                              crypto      864      834  -2%
                                          crypto/aes      313      311   0%
                                       crypto/cipher     1139     1138   0%
                                          crypto/des      317      315   0%
                                          crypto/dsa     5326     5304   0%
                                        crypto/ecdsa     6383     6364   0%
                                     crypto/elliptic     5983     6063   1%
                                         crypto/hmac      258      256   0%
                                          crypto/md5      722      700  -2%
                                         crypto/rand     4996     4993   0%
                                          crypto/rc4      327      317  -2%
                                          crypto/rsa     6763     6722   0%
                                         crypto/sha1      767      744  -2%
                                       crypto/sha256      348      348   0%
                                       crypto/sha512      487      487   0%
                                       crypto/subtle      620      620   0%
                                          crypto/tls    24344    24083   0%
                                         crypto/x509    17473    17524   0%
                                    crypto/x509/pkix     9682     9596   0%
                                        database/sql     8099     7831  -2%
                                 database/sql/driver     1556     1500  -3%
                                         debug/dwarf     9358     9010  -3%
                                           debug/elf    28226    27882   0%
                                         debug/gosym     2472     2333  -5%
                                         debug/macho     9032     8830  -1%
                                            debug/pe     8561     8328  -2%
                                      debug/plan9obj     1347     1295  -3%
                                            encoding      275      261  -4%
                                    encoding/ascii85      775      738  -4%
                                       encoding/asn1     1280     1246  -2%
                                     encoding/base32     1207     1146  -4%
                                     encoding/base64     1471     1407  -3%
                                     encoding/binary     2430     2386  -1%
                                        encoding/csv     4347     4280  -1%
                                        encoding/gob    13488    13387   0%
                                        encoding/hex      665      646  -2%
                                       encoding/json    11763    11592   0%
                                        encoding/pem      283      273  -3%
                                        encoding/xml    13804    13631   0%
                                              errors      166      162  -1%
                                              expvar     1193     1139  -4%
                                                flag     6896     6964   1%
                                                 fmt     1247     1213  -2%
                                              go/ast    15797    15473  -1%
                                            go/build     6497     6336  -1%
                                         go/constant     1846     1820   0%
                                              go/doc     3942     3871  -1%
                                           go/format     1854     1850   0%
                                         go/importer     1702     1695   0%
                           go/internal/gccgoimporter     2084     2063   0%
                              go/internal/gcimporter     3236     3253   1%
                                           go/parser     7377     7371   0%
                                          go/printer     2480     2469   0%
                                          go/scanner     3806     3733  -1%
                                            go/token     3579     3523  -1%
                                            go/types    26514    26117   0%
                                                hash      323      295  -8%
                                        hash/adler32      568      554  -1%
                                          hash/crc32      843      825  -1%
                                          hash/crc64      758      739  -2%
                                            hash/fnv     1583     1530  -2%
                                                html      113      113   0%
                                       html/template    16957    16937   0%
                                               image    11470    11045  -3%
                                         image/color     2566     2503  -1%
                                 image/color/palette      165      163   0%
                                          image/draw     2543     2522   0%
                                           image/gif     3467     3439   0%
                            image/internal/imageutil     3481     3479   0%
                                          image/jpeg     2725     2717   0%
                                           image/png     2702     2689   0%
                                   index/suffixarray     5802     5777   0%
                                       internal/race      274      274   0%
                               internal/singleflight      756      718  -4%
                     internal/syscall/windows/sysdll      162      162   0%
                                    internal/testenv     5288     5276   0%
                                      internal/trace     1853     1768  -4%
                                                  io     3425     3349  -1%
                                           io/ioutil     4768     4756   0%
                                                 log     4173     4224   1%
                                          log/syslog     5049     4996   0%
                                                math     4343     4343   0%
                                            math/big     8779     8817   0%
                                          math/cmplx     1580     1580   0%
                                           math/rand      944      982   4%
                                                mime     2313     2298   0%
                                      mime/multipart     5021     4922  -1%
                                mime/quotedprintable     2049     2008  -1%
                                                 net    19332    19090   0%
                                            net/http    50404    49542  -1%
                                        net/http/cgi    22533    22637   0%
                                  net/http/cookiejar     5488     5431   0%
                                       net/http/fcgi    20557    20512   0%
                                   net/http/httptest    30350    30255   0%
                                   net/http/httputil    24045    23964   0%
                                   net/http/internal     2579     2550   0%
                                      net/http/pprof    20307    20258   0%
                               net/internal/socktest     2227     2159  -2%
                                            net/mail     5086     5054   0%
                                             net/rpc    28365    28208   0%
                                     net/rpc/jsonrpc    12805    12722   0%
                                            net/smtp    19975    19887   0%
                                       net/textproto     4558     4466  -1%
                                             net/url     1391     1326  -4%
                                                  os    10372    10195  -1%
                                             os/exec     7814     7928   1%
                                           os/signal      239      237   0%
                                             os/user      735      717  -1%
                                                path      391      391   0%
                                       path/filepath     4136     4136   0%
                                             reflect     6258     5893  -5%
                                              regexp     5808     5623  -2%
                                       regexp/syntax     3118     3077   0%
                                             runtime    11685    10912  -6%
                                         runtime/cgo       18       18   0%
                                       runtime/debug     3320     3304   0%
                             runtime/internal/atomic      728      728   0%
                                runtime/internal/sys     2287     2287   0%
                                       runtime/pprof      611      587  -3%
                                        runtime/race       19       19   0%
                                       runtime/trace      145      143   0%
                                                sort     1229     1206  -1%
                                             strconv     1752     1744   0%
                                             strings     3809     3775   0%
                                                sync     1331     1306  -1%
                                         sync/atomic     1135     1130   0%
                                             syscall    46280    45722   0%
                                             testing     7558     7284  -3%
                                      testing/iotest     1122     1071  -4%
                                       testing/quick     5656     5609   0%
                                        text/scanner     3367     3312  -1%
                                      text/tabwriter     2810     2755  -1%
                                       text/template    15613    15595   0%
                                 text/template/parse     9499     9040  -4%
                                                time     5515     5395  -1%
                                             unicode     4357     4344   0%
                                       unicode/utf16      583      583   0%
                                        unicode/utf8      970      970   0%
                 vendor/golang.org/x/net/http2/hpack     4105     4012  -1%
                                             average  1524284  1509610   0%

Change-Id: Ibe1ce098c7c575965389c1cad368c62c2cea256a
Reviewed-on: https://go-review.googlesource.com/22536
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-28 03:30:09 +00:00
Dave Cheney
2da642a917 cmd/compile/internal/gc: unexport {J,S,F,H,B,V}conv
Updates #15462

Unexport Jconv, Sconv, Fconv, Hconv, Bconv, and VConv as they are
not referenced outside internal/gc.

Econv was only called by EType.String, so merge it into that method.

Change-Id: Iad9b06078eb513b85a03a43cd9eb9366477643d1
Reviewed-on: https://go-review.googlesource.com/22531
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-28 01:38:01 +00:00
Dave Cheney
733f835f30 cmd/compile/internal/gc: remove all uses of oconv(op, FmtSharp)
Updates #15462

Replace all use of oconv(op, FmtSharp) with fmt.Printf("%#v", op).
This removes all the callers of oconv.

Change-Id: Ic3bf22495147f8497c8bada01d681428e2405b0e
Reviewed-on: https://go-review.googlesource.com/22530
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-27 23:40:30 +00:00
Michael Hudson-Doyle
f4d38a8792 cmd/compile: de-dup the gclocals symbols in compiler too
These symbols are de-duplicated in the linker but the compiler generates quite
many duplicates too: 2425 of 13769 total symbols for runtime.a for example.
De-duplicating them in the compiler saves the linker a bit of work.

Fixes #14983

Change-Id: I5f18e5f9743563c795aad8f0a22d17a7ed147711
Reviewed-on: https://go-review.googlesource.com/22293
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-04-27 22:07:17 +00:00
Dave Cheney
d3c79d324a cmd/compile/internal/gc: remove oconv(op, 0) calls
Updates #15462

Automatic refactor with sed -e.

Replace all oconv(op, 0) to string conversion with the raw op value
which fmt's %v verb can print directly.

The remaining oconv(op, FmtSharp) will be replaced with op.GoString and
%#v in the next CL.

Change-Id: I5e2f7ee0bd35caa65c6dd6cb1a866b5e4519e641
Reviewed-on: https://go-review.googlesource.com/22499
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-27 21:39:39 +00:00
Zhongwei Yao
74a9bad638 cmd/compile: enable const division for arm64
performance:
benchmark                   old ns/op     new ns/op     delta
BenchmarkDivconstI64-8      8.28          2.70          -67.39%
BenchmarkDivconstU64-8      8.28          4.69          -43.36%
BenchmarkDivconstI32-8      8.28          6.39          -22.83%
BenchmarkDivconstU32-8      8.28          4.43          -46.50%
BenchmarkDivconstI16-8      5.17          5.17          +0.00%
BenchmarkDivconstU16-8      5.33          5.34          +0.19%
BenchmarkDivconstI8-8       3.50          3.50          +0.00%
BenchmarkDivconstU8-8       3.51          3.50          -0.28%

Fixes #15382

Change-Id: Ibce7b28f0586d593b33c4d4ecc5d5e7e7c905d13
Reviewed-on: https://go-review.googlesource.com/22292
Reviewed-by: Michael Munday <munday@ca.ibm.com>
Reviewed-by: David Chase <drchase@google.com>
2016-04-27 17:47:49 +00:00
Robert Griesemer
7538b1db8e cmd/compile: switch to compact export format by default
builtin.go was auto-generated via go generate; all other
changes were manual.

The new format reduces the export data size by ~65% on average
for the std library packages (and there is still quite a bit of
room for improvement).

The average time to write export data is reduced by (at least)
62% as measured in one run over the std lib, it is likely more.

The average time to read import data is reduced by (at least)
37% as measured in one run over the std lib, it is likely more.
There is also room to improve this time.

The compiler transparently handles both packages using the old
and the new format.

Comparing the -S output of the go build for each package via
the cmp.bash script (added) shows identical assembly code for
all packages, but 6 files show file:line differences:

The following files have differences because they use cgo
and cgo uses different temp. directories for different builds.
Harmless.

	src/crypto/x509
	src/net
	src/os/user
	src/runtime/cgo

The following files have file:line differences that are not yet
fully explained; however the differences exist w/ and w/o new export
format (pre-existing condition). See issue #15453.

	src/go/internal/gccgoimporter
	src/go/internal/gcimporter

In summary, switching to the new export format produces the same
package files as before for all practical purposes.

How can you tell which one you have (if you care): Open a package
(.a) file in an editor. Textual export data starts with a $$ after
the header and is more or less legible; binary export data starts
with a $$B after the header and is mostly unreadable. A stand-alone
decoder (for debugging) is in the works.

In case of a problem, please first try reverting back to the old
textual format to determine if the cause is the new export format:

For a stand-alone compiler invocation:
- go tool compile -newexport=0 <files>

For a single package:
- go build -gcflags="-newexport=0" <pkg>

For make/all.bash:
- (export GO_GCFLAGS="-newexport=0"; sh make.bash)

Fixes #13241.

Change-Id: I2588cb463be80af22446bf80c225e92ab79878b8
Reviewed-on: https://go-review.googlesource.com/22123
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-04-27 16:59:55 +00:00
Cherry Zhang
9629f55fbb cmd/link: remove absolute address for c-archive on darwin/arm
Now it is possible to build a c-archive as PIC on darwin/arm (this is
now the default). Then the system linker can link the binary using
the archive as PIE.

Fixes #12896.

Change-Id: Iad84131572422190f5fa036e7d71910dc155f155
Reviewed-on: https://go-review.googlesource.com/22461
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-04-27 16:22:06 +00:00
Robert Griesemer
86c93c989e cmd/compile: don't write pos info for builtin packages
TestBuiltin will fail if run on Windows and builtin.go was generated
on a non-Windows machine (or vice versa) because path names have
different separators. Avoid problem altogether by not writing pos
info for builtin packages. It's not needed.

Affects -newexport only.

Change-Id: I8944f343452faebaea9a08b5fb62829bed77c148
Reviewed-on: https://go-review.googlesource.com/22498
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-04-27 15:19:37 +00:00
Keith Randall
a19e60b2c3 cmd/compile: don't use line numbers from ONAME and named OLITERALs
The line numbers of ONAMEs are the location of their
declaration, not their use.

The line numbers of named OLITERALs are also the location
of their declaration.

Ignore both of these.  Instead, we will inherit the line number from
the containing syntactic item.

Fixes #14742
Fixes #15430

Change-Id: Ie43b5b9f6321cbf8cead56e37ccc9364d0702f2f
Reviewed-on: https://go-review.googlesource.com/22479
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-04-27 15:03:38 +00:00
Zhongwei Yao
c9389a101b cmd/asm: fix SIMD register name on arm64
Current V-register range is V32~V63 on arm64. This patch changes it to
V0~V31.

fix #15465.

Change-Id: I90dab42dea46825ec5d7a8321ec4f6550735feb8
Reviewed-on: https://go-review.googlesource.com/22520
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Run-TryBot: Aram Hăvărneanu <aram@mgk.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-27 09:17:46 +00:00