]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years ago[dev.ssa] cmd/compile/ssa: add nilcheckelim benchmarks
Josh Bleecher Snyder [Thu, 25 Jun 2015 21:04:55 +0000 (14:04 -0700)]
[dev.ssa] cmd/compile/ssa: add nilcheckelim benchmarks

These benchmarks demonstrate that
the nilcheckelim pass is roughly O(n^2):

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

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

Change-Id: If966b38ec52243a25f355dab871300d29db02e16
Reviewed-on: https://go-review.googlesource.com/11520
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] cmd/compile/ssa: refine type equality in cse
Josh Bleecher Snyder [Wed, 24 Jun 2015 21:34:28 +0000 (14:34 -0700)]
[dev.ssa] cmd/compile/ssa: refine type equality in cse

The correct way to compare gc.Types is Eqtype,
rather than pointer equality.
Introduce an Equal method for ssa.Type to allow
us to use it.

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

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

Change-Id: I0bdbfcf613ca6bc2ec987eb19b6b1217b51f3008
Reviewed-on: https://go-review.googlesource.com/11451
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] cmd/compile/internal/gc: Fix constant shift generation
Keith Randall [Sun, 28 Jun 2015 13:08:50 +0000 (06:08 -0700)]
[dev.ssa] cmd/compile/internal/gc: Fix constant shift generation

Change-Id: Ib142185de3f6e4d2f4983511c063492529d8fb8a
Reviewed-on: https://go-review.googlesource.com/11656
Reviewed-by: Michael Matloob <michaelmatloob@gmail.com>
9 years ago[dev.ssa] cmd/compile/internal/gc: Interpret init list of OFOR conditions
Keith Randall [Fri, 26 Jun 2015 03:01:45 +0000 (20:01 -0700)]
[dev.ssa] cmd/compile/internal/gc: Interpret init list of OFOR conditions

Fixes build.  Some variables are initialized in this list.

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

Change-Id: I96b3f03c291440130303a2b95a651e97e4d8113c
Reviewed-on: https://go-review.googlesource.com/11542
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years ago[dev.ssa] cmd/compile/ssa: fix unit tests
Todd Neal [Thu, 25 Jun 2015 23:03:50 +0000 (18:03 -0500)]
[dev.ssa] cmd/compile/ssa: fix unit tests

Fix out of bounds array panic due to CL 11238.

Change-Id: Id8a46f1ee20cb1f46775d0c04cc4944d729dfceb
Reviewed-on: https://go-review.googlesource.com/11540
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] cmd/compile/internal/ssa: Handle variables correctly
Keith Randall [Sat, 20 Jun 2015 04:02:28 +0000 (21:02 -0700)]
[dev.ssa] cmd/compile/internal/ssa: Handle variables correctly

Use *Node of type ONAME instead of string as the key for variable maps.
This will prevent aliasing between two identically named but
differently scoped variables.

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

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

Allocate space for AUTO variables in stackalloc.

Change-Id: Ibdccdaea4bbc63a1f4882959ac374f2b467e3acd
Reviewed-on: https://go-review.googlesource.com/11238
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years ago[dev.ssa] cmd/compile/ssa: add -f suffix to logging methods
Josh Bleecher Snyder [Wed, 24 Jun 2015 21:03:39 +0000 (14:03 -0700)]
[dev.ssa] cmd/compile/ssa: add -f suffix to logging methods

Requested in CL 11380.

Change-Id: Icf0d23fb8d383c76272401e363cc9b2169d11403
Reviewed-on: https://go-review.googlesource.com/11450
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years ago[dev.ssa] cmd/compile/ssa: improve comments, logging, and debug output
Josh Bleecher Snyder [Tue, 23 Jun 2015 23:44:06 +0000 (16:44 -0700)]
[dev.ssa] cmd/compile/ssa: improve comments, logging, and debug output

Change-Id: Id949db82ddaf802c1aa245a337081d4d46fd914f
Reviewed-on: https://go-review.googlesource.com/11380
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years ago[dev.ssa] cmd/compile/ssa: fix build
Josh Bleecher Snyder [Wed, 24 Jun 2015 20:29:05 +0000 (13:29 -0700)]
[dev.ssa] cmd/compile/ssa: fix build

Somehow I missed this in CL 11160.
Without it, all.bash fails on fixedbugs/bug303.go.

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

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

Change-Id: I679197f780c7a3d3eb7d05e91c86a4cdc3b70131
Reviewed-on: https://go-review.googlesource.com/11440
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years ago[dev.ssa] cmd/compile/ssa: add nilcheckelim pass
Josh Bleecher Snyder [Wed, 3 Jun 2015 19:31:47 +0000 (12:31 -0700)]
[dev.ssa] cmd/compile/ssa: add nilcheckelim pass

The nilcheckelim pass eliminates unnecessary nil checks.
The initial implementation removes redundant nil checks.
See the comments in nilcheck.go for ideas for future
improvements.

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

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

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

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

Change-Id: I13e567a39f5f6909fc33434d55c17a7e3884a704
Reviewed-on: https://go-review.googlesource.com/11430
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years ago[dev.ssa] cmd/compile/ssa: separate logging, work in progress, and fatal errors
Josh Bleecher Snyder [Fri, 12 Jun 2015 18:01:13 +0000 (11:01 -0700)]
[dev.ssa] cmd/compile/ssa: separate logging, work in progress, and fatal errors

The SSA implementation logs for three purposes:

* debug logging
* fatal errors
* unimplemented features

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

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

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

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

The top missing features are:

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

Change-Id: I4ca07951e276714dc13c31de28640aead17a1be7
Reviewed-on: https://go-review.googlesource.com/11160
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] cmd/compile/internal/gc: support CALLFUNC as statement
Michael Matloob [Wed, 17 Jun 2015 00:58:03 +0000 (17:58 -0700)]
[dev.ssa] cmd/compile/internal/gc: support CALLFUNC as statement

I don't have strong understanding of the AST structure, so I'm
not sure if this is the right way to handle function call statements.

Change-Id: Ib526f667ab483b32d9fd17da800b5d6f4b26c4c9
Reviewed-on: https://go-review.googlesource.com/11139
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] cmd/compile/internal/ssa: adds for 8,16,32 bit ints
Michael Matloob [Sun, 14 Jun 2015 18:38:46 +0000 (11:38 -0700)]
[dev.ssa] cmd/compile/internal/ssa: adds for 8,16,32 bit ints

Change-Id: I33025a4a41fd91f6ee317d33a6eebf27fa00ab51
Reviewed-on: https://go-review.googlesource.com/11115
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] cmd/compile/internal/ssa: set line in newValue variants
Michael Matloob [Sun, 14 Jun 2015 16:52:13 +0000 (09:52 -0700)]
[dev.ssa] cmd/compile/internal/ssa: set line in newValue variants

This CL sets line numbers on Values in the newValue variants
introduced in cl/10929.

Change-Id: Ibd15bc90631a1e948177878ea4191d995e8bb19b
Reviewed-on: https://go-review.googlesource.com/11090
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] cmd/compile/ssa: fix string compilation
Josh Bleecher Snyder [Tue, 16 Jun 2015 23:16:23 +0000 (16:16 -0700)]
[dev.ssa] cmd/compile/ssa: fix string compilation

Compilation of f_ssa was broken by CL 10929.

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

package p

func f_ssa() string {
return "ABC"
}

Change-Id: I0ce0e905e4d30ec206cce808da406b9b7f0f38e9
Reviewed-on: https://go-review.googlesource.com/11136
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] cmd/compile/internal/ssa: Fix bootstrap of ssa codegen
Keith Randall [Tue, 16 Jun 2015 20:33:32 +0000 (13:33 -0700)]
[dev.ssa] cmd/compile/internal/ssa: Fix bootstrap of ssa codegen

The cmd/compile/internal/ssa/gen directory can't depend on cmd/internal/gc
because that package doesn't exist in go1.4.  Use strings instead of
constants from that package.

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

Change-Id: I96e8cda44833763951709e2721588fbd34580989
Reviewed-on: https://go-review.googlesource.com/11129
Reviewed-by: Michael Matloob <michaelmatloob@gmail.com>
9 years ago[dev.ssa] cmd/compile/internal/gc: reduce genValue redundancy
Michael Matloob [Tue, 16 Jun 2015 18:11:16 +0000 (11:11 -0700)]
[dev.ssa] cmd/compile/internal/gc: reduce genValue redundancy

Add an asm field to opcodeTable containing the Prog's as field.
Then instructions that fill the Prog the same way can be collapsed
into a single switch case.

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

Change-Id: I0c4a0992741f908bd357ee2707edb82e76e4ce61
Reviewed-on: https://go-review.googlesource.com/11130
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] fix equivalence class after aux/auxint refactor.
Daniel Morsing [Sun, 14 Jun 2015 22:06:39 +0000 (23:06 +0100)]
[dev.ssa] fix equivalence class after aux/auxint refactor.

This caused the following code snippet to be miscompiled

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

Moving the store of 10 above the function call.

Change-Id: Ic6951f5e7781b122cd881df324a38e519d6d66f0
Reviewed-on: https://go-review.googlesource.com/11073
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] initial implementation of PAUTO|PHEAP variables
Daniel Morsing [Fri, 12 Jun 2015 13:23:29 +0000 (14:23 +0100)]
[dev.ssa] initial implementation of PAUTO|PHEAP variables

Call to the runtime to generate escaping variables and use the returned
address when accessing these variables.

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

Change-Id: I2096beff92cca92d648bfb6e8ec0b120f02f44af
Reviewed-on: https://go-review.googlesource.com/11072
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] cmd/compile/internal/gc: fix call to newValue1
Michael Matloob [Sun, 14 Jun 2015 17:27:50 +0000 (10:27 -0700)]
[dev.ssa] cmd/compile/internal/gc: fix call to newValue1

Change-Id: I235a759e4688358adc088cf5a80f8ce7ad12d2f2
Reviewed-on: https://go-review.googlesource.com/11093
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] cmd/compile/internal/ssa: set Line in NewValue funcs
Michael Matloob [Sat, 13 Jun 2015 18:01:16 +0000 (11:01 -0700)]
[dev.ssa] cmd/compile/internal/ssa: set Line in NewValue funcs

In the previous line number CL the NewValue\d? functions took
a line number argument but neglected to set the Line field on
the value struct. Fix that.

Change-Id: I53c79ff93703f66f5f0266178c94803719ae2074
Reviewed-on: https://go-review.googlesource.com/11054
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] cmd/compile/internal/gc: generate TESTQ instruction
Michael Matloob [Sat, 13 Jun 2015 17:22:21 +0000 (10:22 -0700)]
[dev.ssa] cmd/compile/internal/gc: generate TESTQ instruction

TESTQ is produced by the IsNonNil lowering.

Change-Id: I9df8f17e6def7e34d07e3ddf2dd5dd8f0406aa04
Reviewed-on: https://go-review.googlesource.com/11053
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] Protect control value from being moved away from end of block
Daniel Morsing [Sat, 13 Jun 2015 18:27:26 +0000 (19:27 +0100)]
[dev.ssa] Protect control value from being moved away from end of block

If there isn't a value dependency between the control value of a
block and some other value, the schedule pass might move the control
value to a spot that is not EOB. Fix by handling the control value
specially like phis.

Change-Id: Iddaf0924d98c5b3d9515c3ced927b0c85722818c
Reviewed-on: https://go-review.googlesource.com/11071
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] cmd/compiler/internal/ssa: Add auxint field
Keith Randall [Fri, 12 Jun 2015 04:29:25 +0000 (21:29 -0700)]
[dev.ssa] cmd/compiler/internal/ssa: Add auxint field

Add an additional int64 auxiliary field to Value.

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

It also simplifies a bunch of code.

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

Change-Id: I1ca797ff572553986cf90cab3ac0a0c1d01ad241
Reviewed-on: https://go-review.googlesource.com/10929
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years ago[dev.ssa] cmd/compile/internal/gc: Small fixes
Keith Randall [Fri, 12 Jun 2015 23:24:33 +0000 (16:24 -0700)]
[dev.ssa] cmd/compile/internal/gc: Small fixes

Allow labels to be unreachable via fallthrough from above.
Implement OCONVNOP.

Change-Id: I6869993cad8a27ad134dd637de89a40117daf47b
Reviewed-on: https://go-review.googlesource.com/11001
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
9 years ago[dev.ssa] clarify ODCL todo, remove irrelevant colas todo
Daniel Morsing [Thu, 11 Jun 2015 19:37:01 +0000 (20:37 +0100)]
[dev.ssa] clarify ODCL todo, remove irrelevant colas todo

ODCL nodes are used as the point where the variable is allocated in
the old pass. colas is irrelevant at this point of the compile. All
the checks on it happen at parse time and an ODCL node will have been
inserted right before it.

Change-Id: I1aca053aaa4363bacd12e1156de86fa7b6190a55
Reviewed-on: https://go-review.googlesource.com/10901
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] cmd/compile/ssa: print reg names in generated code
Josh Bleecher Snyder [Thu, 11 Jun 2015 22:52:08 +0000 (15:52 -0700)]
[dev.ssa] cmd/compile/ssa: print reg names in generated code

Change-Id: I6c6196449dd3d5e036d420fa7ae90feb0cf8d417
Reviewed-on: https://go-review.googlesource.com/10928
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] Merge remote-tracking branch 'origin/master' into mbranch
Keith Randall [Thu, 11 Jun 2015 17:20:39 +0000 (10:20 -0700)]
[dev.ssa] Merge remote-tracking branch 'origin/master' into mbranch

Semi-regular merge of tip into dev.ssa.

Change-Id: Iec8e4266426bed233892e7dbe4448d16c8b89018

9 years agocmd/vet: skip another test on Android
Brad Fitzpatrick [Thu, 11 Jun 2015 15:22:56 +0000 (08:22 -0700)]
cmd/vet: skip another test on Android

Forgot this one in my previous commit.

Change-Id: Ief089e99bdad24b3bcfb075497dc259d06cc727c
Reviewed-on: https://go-review.googlesource.com/10913
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/go: reject relative paths that don't start with a dot (.)
Chris Broadfoot [Thu, 4 Jun 2015 23:16:14 +0000 (16:16 -0700)]
cmd/go: reject relative paths that don't start with a dot (.)

Change-Id: Idc4a7fdb561ba5b3b52094d895deaf3fcdf475bf
Reviewed-on: https://go-review.googlesource.com/10716
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/go, cmd/vet: skip tests on Android
Brad Fitzpatrick [Thu, 11 Jun 2015 14:26:44 +0000 (07:26 -0700)]
cmd/go, cmd/vet: skip tests on Android

Might get the Android build passing, or at least going further.

Change-Id: I08f97156a687abe5a3d95203922f4ffd84fbb212
Reviewed-on: https://go-review.googlesource.com/10924
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoall: fix misprints in comments
Ainar Garipov [Thu, 11 Jun 2015 13:49:38 +0000 (16:49 +0300)]
all: fix misprints in comments

These were found by grepping the comments from the go code and feeding
the output to aspell.

Change-Id: Id734d6c8d1938ec3c36bd94a4dbbad577e3ad395
Reviewed-on: https://go-review.googlesource.com/10941
Reviewed-by: Aamir Khan <syst3m.w0rm@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: remove Stat workaround for Plan 9
David du Colombier [Thu, 11 Jun 2015 05:50:59 +0000 (07:50 +0200)]
cmd/go: remove Stat workaround for Plan 9

This issue was fixed in CL 10900.

Change-Id: I88f107cb73c8a515f39e02506ddd2ad1e286b1fb
Reviewed-on: https://go-review.googlesource.com/10940
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoos: fix error returned by dirstat on Plan 9
David du Colombier [Wed, 10 Jun 2015 20:32:14 +0000 (22:32 +0200)]
os: fix error returned by dirstat on Plan 9

When the Stat or Fstat system calls return -1,
dirstat incorrectly returns ErrShortStat.

However, the error returned by Stat or Fstat
could be different. For example, when the
file doesn't exist, they return "does not exist".

Dirstat should return the error returned by
the system call.

Fixes #10911.
Fixes #11132.

Change-Id: Icf242d203d256f12366b1e277f99b1458385104a
Reviewed-on: https://go-review.googlesource.com/10900
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years ago[dev.ssa] cmd/compile/internal/ssa: Complete 64-bit shifts
Keith Randall [Wed, 10 Jun 2015 17:39:57 +0000 (10:39 -0700)]
[dev.ssa] cmd/compile/internal/ssa: Complete 64-bit shifts

Implement correct Go shifts.

Allow multi-line rewrite rules.

Fix offset & alignment in stack alloc.

Change-Id: I0ae9e522c83df9205bbe4ab94bc0e43d16dace58
Reviewed-on: https://go-review.googlesource.com/10891
Reviewed-by: Keith Randall <khr@golang.org>
9 years ago[dev.ssa] cmd/compile/internal/ssa: add call opcodes
Keith Randall [Wed, 10 Jun 2015 22:03:06 +0000 (15:03 -0700)]
[dev.ssa] cmd/compile/internal/ssa: add call opcodes

Add calls, particularly closure calls.

Reorg SSAable variable test for converting to SSA.

Change-Id: Ia75c04295e6b0b040122f97e2381836a393b7f42
Reviewed-on: https://go-review.googlesource.com/10912
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agoos: fix a race between Process.signal() and wait() on Windows
Patrick Mezard [Sun, 10 May 2015 13:35:52 +0000 (15:35 +0200)]
os: fix a race between Process.signal() and wait() on Windows

Process.handle was accessed without synchronization while wait() and
signal() could be called concurrently.

A first solution was to add a Mutex in Process but it was probably too
invasive given Process.handle is only used on Windows.

This version uses atomic operations to read the handle value. There is
still a race between isDone() and the value of the handle, but it only
leads to slightly incorrect error codes. The caller may get a:

  errors.New("os: process already finished")

instead of:

  syscall.EINVAL

which sounds harmless.

Fixes #9382

Change-Id: Iefcc687a1166d5961c8f27154647b9b15a0f748a
Reviewed-on: https://go-review.googlesource.com/9904
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/go: rewrite testsuite from bash to Go
Ian Lance Taylor [Tue, 9 Jun 2015 17:30:08 +0000 (10:30 -0700)]
cmd/go: rewrite testsuite from bash to Go

Change-Id: I8473e3f7653d5389d5fcd94862f0831049b8266e
Reviewed-on: https://go-review.googlesource.com/10809
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoarchive/zip: clarify that CreateHeader takes ownership of FileHeader
Brad Fitzpatrick [Wed, 10 Jun 2015 18:19:14 +0000 (11:19 -0700)]
archive/zip: clarify that CreateHeader takes ownership of FileHeader

Fixes #11144

Change-Id: I1da0b72ef00a84c9b5751be0e72ad07d664bc98b
Reviewed-on: https://go-review.googlesource.com/10883
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years ago[dev.ssa] cmd/compile/internal/ssa: add line numbers to Values
Michael Matloob [Sat, 30 May 2015 05:03:06 +0000 (01:03 -0400)]
[dev.ssa] cmd/compile/internal/ssa: add line numbers to Values

Change-Id: I1dfffd75cc1f49307c654f910f7133c03da6c84f
Reviewed-on: https://go-review.googlesource.com/10559
Reviewed-by: Keith Randall <khr@golang.org>
9 years agoencoding/csv: fix comment in parseRecord
Ainar Garipov [Wed, 10 Jun 2015 13:28:51 +0000 (16:28 +0300)]
encoding/csv: fix comment in parseRecord

Change-Id: I82edd9364e1b4634006f5e043202a69f383dcdbe
Reviewed-on: https://go-review.googlesource.com/10826
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/link: stop linker crashing with -s flag on windows
Alex Brainman [Tue, 9 Jun 2015 06:16:42 +0000 (16:16 +1000)]
cmd/link: stop linker crashing with -s flag on windows

Update #10254

Change-Id: I3ddd26607813ca629e3ab62abf87dc5ab453e36f
Reviewed-on: https://go-review.googlesource.com/10835
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: correct a drifted comment in referencing m->locked.
Yongjian Xu [Wed, 10 Jun 2015 05:51:25 +0000 (22:51 -0700)]
runtime: correct a drifted comment in referencing m->locked.

Change-Id: Ida4b98aa63e57594fa6fa0b8178106bac9b3cd19
Reviewed-on: https://go-review.googlesource.com/10837
Reviewed-by: Minux Ma <minux@golang.org>
9 years ago.gitignore: ignore y.output
Josh Bleecher Snyder [Tue, 9 Jun 2015 21:15:41 +0000 (14:15 -0700)]
.gitignore: ignore y.output

Change-Id: I95b72b6be39fbb923b5f0743d17d7f8bd3ee3814
Reviewed-on: https://go-review.googlesource.com/10860
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agomisc/ios: document the external binary and the required env variables
Burcu Dogan [Mon, 4 May 2015 16:41:41 +0000 (12:41 -0400)]
misc/ios: document the external binary and the required env variables

Change-Id: I1ec2460758b19e5315be061033c1bb5ed9ead4a8
Reviewed-on: https://go-review.googlesource.com/9688
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/compile: fix builtin generation
Josh Bleecher Snyder [Tue, 9 Jun 2015 21:12:39 +0000 (14:12 -0700)]
cmd/compile: fix builtin generation

This was a refactoring bug during
'go tool compile', CL 10289.

Change-Id: Ibfd333be39ec72bba331fdf352df619cc21851a9
Reviewed-on: https://go-review.googlesource.com/10849
Reviewed-by: Minux Ma <minux@golang.org>
9 years agodoc/go1.5.txt: mention that 1.5 supports non-standard GCM lengths.
Adam Langley [Tue, 9 Jun 2015 18:47:45 +0000 (11:47 -0700)]
doc/go1.5.txt: mention that 1.5 supports non-standard GCM lengths.

Change-Id: I7cad3f7af2452e29b3dae3da87cbd24013f6dae6
Reviewed-on: https://go-review.googlesource.com/10850
Reviewed-by: Adam Langley <agl@golang.org>
9 years agocrypto/cipher: Support unusual GCM nonce lengths
Carl Jackson [Fri, 17 Apr 2015 07:52:40 +0000 (00:52 -0700)]
crypto/cipher: Support unusual GCM nonce lengths

GCM is traditionally used with a 96-bit nonce, but the standard allows
for nonces of any size. Non-standard nonce sizes are required in some
protocols, so add support for them in crypto/cipher's GCM
implementation.

Change-Id: I7feca7e903eeba557dcce370412b6ffabf1207ab
Reviewed-on: https://go-review.googlesource.com/8946
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>

9 years agodoc: updated language about the AUTHORS/CONTRIBUTORS update
Dmitry Savintsev [Tue, 9 Jun 2015 10:01:38 +0000 (12:01 +0200)]
doc: updated language about the AUTHORS/CONTRIBUTORS update

Reflect the process changes where AUTHORS and CONTRIBUTORS
files are updated automatically based on commit logs
and Google committers no longer need to do it manually
on the first contributors.

The documentation update will help to avoid requests to be
added from new contributors.

Change-Id: I67daae5bd21246cf79fe3724838889b929bc5e66
Reviewed-on: https://go-review.googlesource.com/10824
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile: use generated temps in bool codegen
Josh Bleecher Snyder [Mon, 8 Jun 2015 23:21:50 +0000 (16:21 -0700)]
cmd/compile: use generated temps in bool codegen

Bool codegen was generating a temp for function calls
and other complex expressions, but was not using it.

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

l, r := &n1, &n2

It was changed to:

l, r := nl, nr

But the requisite assignments:

nl, nr = &n1, &n2

were only introduced on one of two code paths.

Fixes #10654.

Change-Id: Ie8de0b3a333842a048d4308e02911bb10c6915ce
Reviewed-on: https://go-review.googlesource.com/10844
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocrypto/tls: don't require an explicit client-auth EKU.
Adam Langley [Mon, 8 Jun 2015 21:24:18 +0000 (14:24 -0700)]
crypto/tls: don't require an explicit client-auth EKU.

Previously we enforced both that the extended key usages of a client
certificate chain allowed for client authentication, and that the
client-auth EKU was in the leaf certificate.

This change removes the latter requirement. It's still the case that the
chain must be compatible with the client-auth EKU (i.e. that a parent
certificate isn't limited to another usage, like S/MIME), but we'll now
accept a leaf certificate with no EKUs for client-auth.

While it would be nice if all client certificates were explicit in their
intended purpose, I no longer feel that this battle is worthwhile.

Fixes #11087.

Change-Id: I777e695101cbeba069b730163533e2977f4dc1fc
Reviewed-on: https://go-review.googlesource.com/10806
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>

9 years ago[dev.ssa] cmd/compile/internal/ssa: delete lowergeneric.go
Michael Matloob [Tue, 9 Jun 2015 02:46:36 +0000 (22:46 -0400)]
[dev.ssa] cmd/compile/internal/ssa: delete lowergeneric.go

It's been replaced by rewritegeneric.go

Change-Id: I2658abbc6201ecfedae4513c6da04ea3cac8bb9c
Reviewed-on: https://go-review.googlesource.com/10846
Reviewed-by: Keith Randall <khr@golang.org>
9 years agogo/build: add big endian variant of arm and arm64 to goarch list
Shenghou Ma [Fri, 5 Jun 2015 19:13:57 +0000 (15:13 -0400)]
go/build: add big endian variant of arm and arm64 to goarch list

Change-Id: Icda8475a7879d49e3b8b873303eb0bed5dd5a238
Reviewed-on: https://go-review.googlesource.com/10792
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: disable dualstack listener tests on dragonfly
Mikio Hara [Tue, 9 Jun 2015 03:10:10 +0000 (12:10 +0900)]
net: disable dualstack listener tests on dragonfly

Change-Id: Ia7914156e4369113dea7c17b3aa51096e25f1901
Reviewed-on: https://go-review.googlesource.com/10834
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/dist: move guts of race.bash into dist
Brad Fitzpatrick [Tue, 9 Jun 2015 00:56:27 +0000 (17:56 -0700)]
cmd/dist: move guts of race.bash into dist

After a little build coordinator change, this will get us sharding of
the race builder.

Update #11074

Change-Id: I4c55267563b6f5e213def7dd6707c837ae2106bf
Reviewed-on: https://go-review.googlesource.com/10845
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/link/internal/ld: include table of contents of c-archive output.
Hyang-Ah (Hana) Kim [Mon, 8 Jun 2015 21:22:17 +0000 (14:22 -0700)]
cmd/link/internal/ld: include table of contents of c-archive output.

Change-Id: If11621985c0a5a1f2133cdc974f37fd944b93e5e
Reviewed-on: https://go-review.googlesource.com/10808
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: early typecheck top level OAS2 nodes
Josh Bleecher Snyder [Fri, 5 Jun 2015 17:39:23 +0000 (10:39 -0700)]
cmd/compile: early typecheck top level OAS2 nodes

Fixes #10977.

Change-Id: I706c953c16daad48595c7fae2d82124614dfc3ad
Reviewed-on: https://go-review.googlesource.com/10780
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>

9 years agodoc/go1.5.txt: mention that testing/quick now generates nil pointers.
Adam Langley [Mon, 8 Jun 2015 21:21:27 +0000 (14:21 -0700)]
doc/go1.5.txt: mention that testing/quick now generates nil pointers.

Change-Id: I358b17304f95fdd8e6c0a64fa29f185c701fe338
Reviewed-on: https://go-review.googlesource.com/10805
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agotesting/quick: probabilistically generate nil pointers
Håvard Haugen [Sun, 7 Jun 2015 19:28:58 +0000 (21:28 +0200)]
testing/quick: probabilistically generate nil pointers

The documentation for quick.Value says that it "returns an arbitrary
value of the given type." In spite of this, nil values for pointers were
never generated, which seems more like an oversight than an intentional
choice.

The lack of nil values meant that testing recursive type like

  type Node struct {
   Next *Node
  }

with testing/quick would lead to a stack overflow since the data
structure would never terminate.

This change may break tests that don't check for nil with pointers
returned from quick.Value. Two such instances were found in the standard
library, one of which was in the testing/quick package itself.

Fixes #8818.

Change-Id: Id390dcce649d12fbbaa801ce6f58f5defed77e60
Reviewed-on: https://go-review.googlesource.com/10821
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>

9 years ago[dev.ssa] cmd/compile/internal/ssa: autogenerate opcodes
Keith Randall [Sat, 6 Jun 2015 23:03:33 +0000 (16:03 -0700)]
[dev.ssa] cmd/compile/internal/ssa: autogenerate opcodes

Revamp autogeneration.  Get rid of gogenerate commands, they are more
trouble than they are worth.  (If the code won't compile, gogenerate
doesn't work.)

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

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

Change-Id: I175d0a89b701b2377bbe699f3756731b7c9f5a9f
Reviewed-on: https://go-review.googlesource.com/10812
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agocmd/vet: remove dependency on types.New
Robert Griesemer [Fri, 5 Jun 2015 20:20:03 +0000 (13:20 -0700)]
cmd/vet: remove dependency on types.New

- remove TODO on non-existing fmt.Formatter type
  (type exists now)
- guard uses of imported types against nil

Change-Id: I9ae8e5a448e73c84dec1606ea9d9ed5ddeee8dc6
Reviewed-on: https://go-review.googlesource.com/10777
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agoruntime: avoid fault in heapBitsBulkBarrier
Russ Cox [Mon, 8 Jun 2015 20:22:01 +0000 (13:22 -0700)]
runtime: avoid fault in heapBitsBulkBarrier

Change-Id: I0512e461de1f25cb2a1cb7f23e7a77d00700667c
Reviewed-on: https://go-review.googlesource.com/10803
Reviewed-by: Russ Cox <rsc@golang.org>
9 years ago[dev.ssa] cmd/compile/internal/ssa: enforce single live mem
Michael Matloob [Sat, 30 May 2015 05:03:40 +0000 (01:03 -0400)]
[dev.ssa] cmd/compile/internal/ssa: enforce single live mem

Change-Id: I21edff280a283895e4f0cbf91a3b4406f2f86788
Reviewed-on: https://go-review.googlesource.com/10558
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
9 years agocmd/vet: fix tests on windows
Alex Brainman [Fri, 5 Jun 2015 01:37:00 +0000 (11:37 +1000)]
cmd/vet: fix tests on windows

Add .exe to exectable name, so it can be executed on windows.
Use proper windows paths when searching vet output.
Replace Skip with Skipf.

Fixes build

Change-Id: Ife40d8f5ab9d7093ca61c50683a358d4d6a3ba34
Reviewed-on: https://go-review.googlesource.com/10742
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Patrick Mézard <patrick@mezard.eu>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: fix write-barrier-enabled phase list in gcmarkwb_m
Austin Clements [Mon, 8 Jun 2015 00:13:21 +0000 (20:13 -0400)]
runtime: fix write-barrier-enabled phase list in gcmarkwb_m

Commit 1303957 was supposed to enable write barriers during the
concurrent scan phase, but it only enabled *calls* to the write
barrier during this phase. It failed to update the redundant list of
write-barrier-enabled phases in gcmarkwb_m, so it still wasn't greying
objects during the scan phase.

This commit fixes this by replacing the redundant list of phases in
gcmarkwb_m with simply checking writeBarrierEnabled. This is almost
certainly redundant with checks already done in callers, but the last
time we tried to remove these redundant checks everything got much
slower, so I'm leaving it alone for now.

Fixes #11105.

Change-Id: I00230a3cb80a008e749553a8ae901b409097e4be
Reviewed-on: https://go-review.googlesource.com/10801
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: unwind stack barriers when writing above the current frame
Austin Clements [Fri, 5 Jun 2015 18:49:27 +0000 (14:49 -0400)]
runtime: unwind stack barriers when writing above the current frame

Stack barriers assume that writes through pointers to frames above the
current frame will get write barriers, and hence these frames do not
need to be re-scanned to pick up these changes. For normal writes,
this is true. However, there are places in the runtime that use
typedmemmove to potentially write through pointers to higher frames
(such as mapassign1). Currently, typedmemmove does not execute write
barriers if the destination is on the stack. If there's a stack
barrier between the current frame and the frame being modified with
typedmemmove, and the stack barrier is not otherwise hit, it's
possible that the garbage collector will never see the updated pointer
and incorrectly reclaim the object.

Fix this by making heapBitsBulkBarrier (which lies behind typedmemmove
and its variants) detect when the destination is in the stack and
unwind stack barriers up to the point, forcing mark termination to
later rescan the effected frame and collect these pointers.

Fixes #11084. Might be related to #10240, #10541, #10941, #11023,
 #11027 and possibly others.

Change-Id: I323d6cd0f1d29fa01f8fc946f4b90e04ef210efd
Reviewed-on: https://go-review.googlesource.com/10791
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: enable write barriers during concurrent scan
Austin Clements [Fri, 5 Jun 2015 21:18:15 +0000 (17:18 -0400)]
runtime: enable write barriers during concurrent scan

Currently, write barriers are only enabled after completion of the
concurrent scan phase, as we enter the concurrent mark phase. However,
stack barriers are installed during the scan phase and assume that
write barriers will track changes to frames above the stack
barriers. Since write barriers aren't enabled until after stack
barriers are installed, we may miss modifications to the stack that
happen after installing the stack barriers and before enabling write
barriers.

Fix this by enabling write barriers during the scan phase.

This commit intentionally makes the minimal change to do this (there's
only one line of code change; the rest are comment changes). At the
very least, we should consider eliminating the ragged barrier that's
intended to synchronize the enabling of write barriers, but now just
wastes time. I've included a large comment about extensions and
alternative designs.

Change-Id: Ib20fede794e4fcb91ddf36f99bd97344d7f96421
Reviewed-on: https://go-review.googlesource.com/10795
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: fix checkmarks to rescan stacks
Austin Clements [Fri, 5 Jun 2015 21:36:00 +0000 (17:36 -0400)]
runtime: fix checkmarks to rescan stacks

Currently checkmarks mode fails to rescan stacks because it sees the
leftover state bits indicating that the stacks haven't changed since
the last scan. As a result, it won't detect lost marks caused by
failing to scan stacks correctly during regular garbage collection.

Fix this by marking all stacks dirty before performing the checkmark
phase.

Change-Id: I1f06882bb8b20257120a4b8e7f95bb3ffc263895
Reviewed-on: https://go-review.googlesource.com/10794
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc/go1.5.txt: correct CL for LookupEnv addition
Dominik Honnef [Sun, 7 Jun 2015 02:33:44 +0000 (04:33 +0200)]
doc/go1.5.txt: correct CL for LookupEnv addition

Change-Id: Ib43b21daef5d8291e03c0f0fbf56999e37e21e21
Reviewed-on: https://go-review.googlesource.com/10820
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agotest: fix build on GOARCH=ppc64/ppc64le
Shenghou Ma [Sat, 6 Jun 2015 19:24:18 +0000 (15:24 -0400)]
test: fix build on GOARCH=ppc64/ppc64le

Change-Id: Ibf2879c0034250c5699e21ecea0eb76340597a2a
Reviewed-on: https://go-review.googlesource.com/10810
Reviewed-by: Austin Clements <austin@google.com>
9 years agodatabase/sql: refer correct issue in TestErrBadConnReconnect comment
Alex Brainman [Fri, 5 Jun 2015 07:02:09 +0000 (17:02 +1000)]
database/sql: refer correct issue in TestErrBadConnReconnect comment

Change-Id: I283ab238b60d3a47e86296e1fbfc73ba121bef19
Reviewed-on: https://go-review.googlesource.com/10745
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/asm: drop legacy RETURN mnemonic on ppc64
Austin Clements [Wed, 3 Jun 2015 19:13:10 +0000 (15:13 -0400)]
cmd/asm: drop legacy RETURN mnemonic on ppc64

Change-Id: I999b57ef5535c18e02cc27c9bc9f896d73126b50
Reviewed-on: https://go-review.googlesource.com/10674
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/compile: use obj.ARET instead of ppc64.ARETURN
Austin Clements [Wed, 3 Jun 2015 19:10:53 +0000 (15:10 -0400)]
cmd/compile: use obj.ARET instead of ppc64.ARETURN

obj.ARET is the portable return mnemonic. ppc64.ARETURN is a legacy
alias.

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

Change-Id: I4d8e83ff411cee764774a40ef4c7c34dcbca4e43
Reviewed-on: https://go-review.googlesource.com/10673
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoall: use RET instead of RETURN on ppc64
Austin Clements [Wed, 3 Jun 2015 18:59:27 +0000 (14:59 -0400)]
all: use RET instead of RETURN on ppc64

All of the architectures except ppc64 have only "RET" for the return
mnemonic. ppc64 used to have only "RETURN", but commit cf06ea6
introduced RET as a synonym for RETURN to make ppc64 consistent with
the other architectures. However, that commit was never followed up to
make the code itself consistent by eliminating uses of RETURN.

This commit replaces all uses of RETURN in the ppc64 assembly with
RET.

This was done with
    sed -i 's/\<RETURN\>/RET/' **/*_ppc64x.s
plus one manual change to syscall/asm.s.

Change-Id: I3f6c8d2be157df8841d48de988ee43f3e3087995
Reviewed-on: https://go-review.googlesource.com/10672
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/go: update documentation: use 'go doc' rather than 'godoc'
Robert Griesemer [Fri, 5 Jun 2015 20:14:06 +0000 (13:14 -0700)]
cmd/go: update documentation: use 'go doc' rather than 'godoc'

Change-Id: I318c1ef75b18d4687f13499ac225dde2d053505e
Reviewed-on: https://go-review.googlesource.com/10776
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: use new vet location
Robert Griesemer [Thu, 4 Jun 2015 23:09:15 +0000 (16:09 -0700)]
cmd/go: use new vet location

Change-Id: I7d96ebcca5954152edb821bb41b6047a1c622949
Reviewed-on: https://go-review.googlesource.com/10731
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agogo/types: remove unused return value
Robert Griesemer [Fri, 5 Jun 2015 18:44:31 +0000 (11:44 -0700)]
go/types: remove unused return value

Port of https://go-review.googlesource.com/10773 from x/tools.

Change-Id: I6aba6a63a5448b8fcbcc7f072c627c27965dbe20
Reviewed-on: https://go-review.googlesource.com/10774
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agoruntime: add blank assignment to defeat "declared but not used" error from go/types
Alan Donovan [Fri, 5 Jun 2015 17:27:49 +0000 (13:27 -0400)]
runtime: add blank assignment to defeat "declared but not used" error from go/types

gc should ideally consider this an error too; see golang/go#8560.

Change-Id: Ieee71c4ecaff493d7f83e15ba8c8a04ee90a4cf1
Reviewed-on: https://go-review.googlesource.com/10757
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agogo/types: remove MethodSetCache - not needed
Robert Griesemer [Fri, 5 Jun 2015 17:35:29 +0000 (10:35 -0700)]
go/types: remove MethodSetCache - not needed

In x/tools, MethodSetCache was moved from x/tools/go/types to
x/tools/go/types/typeutil. Mirror that change.

Change-Id: Ib838a9518371473c83fa4abc2778d42f33947c98
Reviewed-on: https://go-review.googlesource.com/10771
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years ago[dev.ssa] cmd/compile/internal/ssa: add missing copyright notices
Michael Matloob [Fri, 5 Jun 2015 17:04:29 +0000 (13:04 -0400)]
[dev.ssa] cmd/compile/internal/ssa: add missing copyright notices

Change-Id: I9d4e0f3e9afc9920ee0d77b0073ac8597c7c048f
Reviewed-on: https://go-review.googlesource.com/10756
Reviewed-by: Keith Randall <khr@golang.org>
9 years agoruntime: use correct SP when installing stack barriers
Austin Clements [Fri, 5 Jun 2015 15:07:21 +0000 (11:07 -0400)]
runtime: use correct SP when installing stack barriers

Currently the stack barriers are installed at the next frame boundary
after gp.sched.sp + 1024*2^n for n=0,1,2,... However, when a G is in a
system call, we set gp.sched.sp to 0, which causes stack barriers to
be installed at *every* frame. This easily overflows the slice we've
reserved for storing the stack barrier information, and causes a
"slice bounds out of range" panic in gcInstallStackBarrier.

Fix this by using gp.syscallsp instead of gp.sched.sp if it's
non-zero. This is the same logic that gentraceback uses to determine
the current SP.

Fixes #11049.

Change-Id: Ie40eeee5bec59b7c1aa715a7c17aa63b1f1cf4e8
Reviewed-on: https://go-review.googlesource.com/10755
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/dist: add more logging details when go list std cmd fails
Brad Fitzpatrick [Fri, 5 Jun 2015 15:11:34 +0000 (08:11 -0700)]
cmd/dist: add more logging details when go list std cmd fails

Change-Id: I12e6990b46ea9c733a5718dc5ca67f1fcd2dec66
Reviewed-on: https://go-review.googlesource.com/10754
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/vet: skip exec tests on systems that can't exec
Russ Cox [Fri, 5 Jun 2015 14:34:17 +0000 (10:34 -0400)]
cmd/vet: skip exec tests on systems that can't exec

Change-Id: I09257b8f5482cba10b5f4d3813c778d6e9e74d40
Reviewed-on: https://go-review.googlesource.com/10752
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodebug/gosym: avoid calling the shell in test
Alexis Imperial-Legrand [Tue, 2 Jun 2015 15:27:43 +0000 (17:27 +0200)]
debug/gosym: avoid calling the shell in test

Change-Id: I95bf62c0f2d77dd67515921e6aefa511cce8d95d
Reviewed-on: https://go-review.googlesource.com/10633
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: fix detection of ELF binaries
Russ Cox [Fri, 5 Jun 2015 13:58:47 +0000 (09:58 -0400)]
cmd/go: fix detection of ELF binaries

Change-Id: I0e6f1a39b3d6b15d05891c8b25ab6644356bde5f
Reviewed-on: https://go-review.googlesource.com/10751
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoflag: Describe the ErrorHandling enum values.
Aaron Jacobs [Fri, 5 Jun 2015 00:12:34 +0000 (10:12 +1000)]
flag: Describe the ErrorHandling enum values.

ContinueOnError is particularly confusing, because it causes
FlagSet.Parse to return as soon as it sees an error. I gather that the
intent is "continue the program" rather than "continue parsing",
compared to exiting or panicking.

Change-Id: I27370ce1f321ea4debcee5b03faff3532495c71a
Reviewed-on: https://go-review.googlesource.com/10740
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: add -tags option to go vet
Rob Pike [Thu, 4 Jun 2015 21:28:14 +0000 (14:28 -0700)]
cmd/go: add -tags option to go vet

Actually add all build flags, so we also get things like -race.

Fixes #10228.

Change-Id: I5f77dda9d1ee3208e1833702f12f68c2731c4b22
Reviewed-on: https://go-review.googlesource.com/10697
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc/go1.5.txt: mention go test -count
Russ Cox [Fri, 5 Jun 2015 05:31:52 +0000 (01:31 -0400)]
doc/go1.5.txt: mention go test -count

Change-Id: I1d7b728bd161da7bd6dd460862d8be072921e8b9
Reviewed-on: https://go-review.googlesource.com/10763
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/compile: document Node fields used by each Op
Russ Cox [Thu, 4 Jun 2015 03:57:59 +0000 (23:57 -0400)]
cmd/compile: document Node fields used by each Op

Change-Id: If969d7a06c83447ee38da30f1477a6cf4bfa1a03
Reviewed-on: https://go-review.googlesource.com/10691
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/link: delete dead flags
Russ Cox [Thu, 21 May 2015 18:42:14 +0000 (14:42 -0400)]
cmd/link: delete dead flags

Also fix the interaction between -buildmode and -shared.
It's okay for -shared to change the default build mode,
but it's not okay for it to silently override an explicit -buildmode=exe.

Change-Id: Id40f93d140cddf75b19e262b3ba4856ee09a07ba
Reviewed-on: https://go-review.googlesource.com/10315
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agocmd/link: deprecate -X name value in favor of -X name=value
Russ Cox [Thu, 21 May 2015 18:35:02 +0000 (14:35 -0400)]
cmd/link: deprecate -X name value in favor of -X name=value

People invoking the linker directly already have to change their scripts
to use the new "go tool link", so this is a good time to make the -X flag
behave like all other Go flags and take just a single argument.

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

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

Change-Id: I91e8df94f4c22b2186e81d7f1016b8767d777eac
Reviewed-on: https://go-review.googlesource.com/10310
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile, cmd/link: add docs
Russ Cox [Thu, 21 May 2015 18:11:33 +0000 (14:11 -0400)]
cmd/compile, cmd/link: add docs

These are the Go 1.4 docs but refreshed for Go 1.5.
The most sigificant change is that all references to the Plan 9 toolchain are gone.
The tools no longer bear any meaningful resemblance.

Change-Id: I44f5cadb832a982323d7fee0b77673e55d761b35
Reviewed-on: https://go-review.googlesource.com/10298
Reviewed-by: Rob Pike <r@golang.org>
9 years agodoc/go1.5.txt: GOMAXPROCS change
Russ Cox [Fri, 5 Jun 2015 04:37:29 +0000 (00:37 -0400)]
doc/go1.5.txt: GOMAXPROCS change

Change-Id: I5c991cad38c9e2c839314a56d3415a2aa09c1561
Reviewed-on: https://go-review.googlesource.com/10762
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: default GOMAXPROCS to NumCPU(), not 1
Russ Cox [Thu, 28 May 2015 16:35:35 +0000 (12:35 -0400)]
runtime: default GOMAXPROCS to NumCPU(), not 1

See golang.org/s/go15gomaxprocs for details.

Change-Id: I8de5df34fa01d31d78f0194ec78a2474c281243c
Reviewed-on: https://go-review.googlesource.com/10668
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/pprof: use copy of svgpan library instead of link to remote site
Russ Cox [Mon, 27 Apr 2015 18:40:34 +0000 (14:40 -0400)]
cmd/pprof: use copy of svgpan library instead of link to remote site

Fixes #10375.

Change-Id: I78dc3e12035d130c405bdb284b0cceea19f084f6
Reviewed-on: https://go-review.googlesource.com/10690
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agotesting: add -test.count flag to run tests and benchmarks multiple times
Russ Cox [Thu, 4 Jun 2015 02:21:07 +0000 (22:21 -0400)]
testing: add -test.count flag to run tests and benchmarks multiple times

The flag is available from the go test command as -count:

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

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

Original by r (CL 10663).

Change-Id: If3dfbdf21698952daac9249b5dbca66f5301e91b
Reviewed-on: https://go-review.googlesource.com/10669
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agocmd/go: read new non-ELF build ID in binaries
Russ Cox [Thu, 4 Jun 2015 19:20:41 +0000 (15:20 -0400)]
cmd/go: read new non-ELF build ID in binaries

Fixes #11048.
Fixes #11075.

Change-Id: I81f5ef1e1944056ce5494c91aa4a4a63c758f566
Reviewed-on: https://go-review.googlesource.com/10709
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/link: implement -buildid for non-ELF binaries
Russ Cox [Thu, 4 Jun 2015 19:15:48 +0000 (15:15 -0400)]
cmd/link: implement -buildid for non-ELF binaries

Non-ELF binary formats are much less flexible and typically do not
have a good place to store the build ID.

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

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

For #11048.

Change-Id: Iaa7ace703c4cf36392e752eea9b55e2ce49e9826
Reviewed-on: https://go-review.googlesource.com/10708
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: use ELF note instead of binary stamp on ELF systems
Russ Cox [Thu, 4 Jun 2015 18:41:02 +0000 (14:41 -0400)]
cmd/go: use ELF note instead of binary stamp on ELF systems

Other binary formats to follow.

For #11048.

Change-Id: Ia2d8b47c99c99d171c014b7cfd23c1c7ada5231c
Reviewed-on: https://go-review.googlesource.com/10707
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/link: add -buildid flag to write Go build ID to ELF output, same as cmd/compile
Russ Cox [Thu, 4 Jun 2015 18:31:05 +0000 (14:31 -0400)]
cmd/link: add -buildid flag to write Go build ID to ELF output, same as cmd/compile

Other binary formats to follow.

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

For #11048.

Change-Id: Iec7e5a2e49d52b6d3a51b0aface2de7c77a45491
Reviewed-on: https://go-review.googlesource.com/10706
Reviewed-by: Ian Lance Taylor <iant@golang.org>