cmd/gc: support x[i:j:k]

Design doc at golang.org/s/go12slice.
This is an experimental feature and may not be included in the release.

R=golang-dev, r
CC=golang-dev
https://codereview.appspot.com/10743046
reflect: add Value.Slice3 and Value.SetCap methods, to match x[i:j:k]

Design doc at golang.org/s/go12slice.

R=golang-dev, r, nightlyone
CC=golang-dev
https://codereview.appspot.com/10761045
sort: implement stable sorting

This CL provides stable in-place sorting by use of
bottom up merge sort with in-place merging done by
the SymMerge algorithm from P.-S. Kim and A. Kutzner.

The additional space needed for stable sorting (in the form of
stack space) is logarithmic in the inputs size n.
Number of calls to Less and Swap grow like O(n * log n) and
O(n * log n * log n):
Stable sorting random data uses significantly more calls
to Swap than the unstable quicksort implementation (5 times more
on n=100, 10 times more on n=1e4 and 23 times more on n=1e8).
The number of calls to Less is practically the same for Sort and
Stable.

Stable sorting 1 million random integers takes 5 times longer
than using Sort.

BenchmarkSortString1K      50000       328662 ns/op
BenchmarkStableString1K    50000       380231 ns/op  1.15 slower
BenchmarkSortInt1K         50000       157336 ns/op
BenchmarkStableInt1K       50000       191167 ns/op  1.22 slower
BenchmarkSortInt64K         1000     14466297 ns/op
BenchmarkStableInt64K        500     16190266 ns/op  1.12 slower

BenchmarkSort1e2          200000        64923 ns/op
BenchmarkStable1e2         50000       167128 ns/op  2.57 slower
BenchmarkSort1e4            1000     14540613 ns/op
BenchmarkStable1e4           100     58117289 ns/op  4.00 slower
BenchmarkSort1e6               5   2429631508 ns/op
BenchmarkStable1e6             1  12077036952 ns/op  4.97 slower

R=golang-dev, bradfitz, iant, 0xjnml, rsc
CC=golang-dev
https://codereview.appspot.com/9612044

Committer: Russ Cox <rsc@golang.org>
net/rpc/jsonrpc: remove unused serverCodec.resp field

R=golang-dev, dave, rsc
CC=golang-dev
https://codereview.appspot.com/10458045

Committer: Russ Cox <rsc@golang.org>
time: prevent a panic from leaving the timer mutex held

When deleting a timer, a panic due to nil deref
would leave a lock held, possibly leading to a deadlock
in a defer. Instead return false on a nil timer.

Fixes issue 5745.

R=golang-dev, daniel.morsing, dvyukov, rsc, iant
CC=golang-dev
https://codereview.appspot.com/10373047

Committer: Russ Cox <rsc@golang.org>
sort: fix 32-bit build

TBR=golang-dev
CC=golang-dev
https://codereview.appspot.com/10856043
misc/vim: Allow multiple GOOS/GOARCH.

R=golang-dev, dsymonds, dominik.honnef
CC=golang-dev
https://codereview.appspot.com/9293043

Committer: David Symonds <dsymonds@golang.org>
cmd/gc: fix computation of equality class of types.

A struct with a single field was considered as equivalent to the
field type, which is incorrect is the field is blank.

Fields with padding could make the compiler think some
types are comparable when they are not.

Fixes issue 5698.

R=rsc, golang-dev, daniel.morsing, bradfitz, gri, r
CC=golang-dev
https://codereview.appspot.com/10271046
Merge branch 'master' into gitfix
cmd/gc: fix issue with method wrappers not having escape analysis run on them.

Escape analysis needs the right curfn value on a dclfunc node, otherwise it will not analyze the function.
When generating method value wrappers, we forgot to set the curfn correctly.

Fixes issue 5753.

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/10383048
runtime: fix runtime.sigreturn_tramp for NetBSD/ARM
using m->tls[0] to save ucontext pointer is not re-entry safe, and
the old code didn't set it before the early return when signal is
received on non-Go threads.

so misc/cgo/test used to hang when testing issue 5337.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://codereview.appspot.com/10076045
Merge branch 'master' into gitfix
go/ast: improve doc for FuncDecl's Type field.

R=gri, r
CC=golang-dev
https://codereview.appspot.com/10679047
crypto/tls: implement TLS 1.2.

This does not include AES-GCM yet. Also, it assumes that the handshake and
certificate signature hash are always SHA-256, which is true of the ciphersuites
that we currently support.

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/10762044
net/rpc: remove unnecessary code

Fixes issue 5760.

R=golang-dev, bradfitz
CC=golang-dev
https://codereview.appspot.com/10871043

Committer: Brad Fitzpatrick <bradfitz@golang.org>
doc/go1.2.txt: stable sort

R=golang-dev, dave
CC=golang-dev
https://codereview.appspot.com/10761048
cmd/go: git checkout the correct default branch.

origin/master is always a remote branch, and it doesn't make sense to
switch to a remote branch. master is the default branch that tracks it.

R=adg
CC=golang-dev, matt.jibson
https://codereview.appspot.com/10869046
A+C: Brian Gitonga Marete (individual CLA)

Generated by addca.

R=gobot
CC=golang-dev
https://codereview.appspot.com/10840044
net/textproto: reduce allocations in ReadMIMEHeader

ReadMIMEHeader is used by net/http, net/mail, and
mime/multipart.

Don't do so many small allocations. Calculate up front
how much we'll probably need.

benchmark                  old ns/op    new ns/op    delta
BenchmarkReadMIMEHeader         8433         7467  -11.45%

benchmark                 old allocs   new allocs    delta
BenchmarkReadMIMEHeader           23           14  -39.13%

benchmark                  old bytes    new bytes    delta
BenchmarkReadMIMEHeader         1705         1343  -21.23%

R=golang-dev, r, iant, adg
CC=golang-dev
https://codereview.appspot.com/8179043
Merge branch 'master' into gitfix