crypto/rc4: faster amd64 implementation

XOR key into data 128 bits at a time instead of 64 bits
and pipeline half of state loads. Rotate loop to allow
single-register indexing for state[i].

On a MacBookPro10,2 (Core i5):

benchmark           old ns/op    new ns/op    delta
BenchmarkRC4_128          412          224  -45.63%
BenchmarkRC4_1K          3179         1613  -49.26%
BenchmarkRC4_8K         25223        12545  -50.26%

benchmark            old MB/s     new MB/s  speedup
BenchmarkRC4_128       310.51       570.42    1.84x
BenchmarkRC4_1K        322.09       634.48    1.97x
BenchmarkRC4_8K        320.97       645.32    2.01x

For comparison, on the same machine, openssl 0.9.8r reports
its rc4 speed as somewhat under 350 MB/s for both 1K and 8K
(it is operating 64 bits at a time).

On an Intel Xeon E5520:

benchmark           old ns/op    new ns/op    delta
BenchmarkRC4_128          418          259  -38.04%
BenchmarkRC4_1K          3200         1884  -41.12%
BenchmarkRC4_8K         25173        14529  -42.28%

benchmark            old MB/s     new MB/s  speedup
BenchmarkRC4_128       306.04       492.48    1.61x
BenchmarkRC4_1K        319.93       543.26    1.70x
BenchmarkRC4_8K        321.61       557.20    1.73x

For comparison, on the same machine, openssl 1.0.1
reports its rc4 speed as 587 MB/s for 1K and 601 MB/s for 8K.

R=agl
CC=golang-dev
https://codereview.appspot.com/7865046
doc/go1.1.html: more TODOs done
Only the net stuff remains as significant work in the "minor changes" section.

R=golang-dev, dave, elias.naur, rsc
CC=golang-dev
https://codereview.appspot.com/7933044
reflect: implement method values

Fixes issue 1517.

R=golang-dev, r
CC=golang-dev
https://codereview.appspot.com/7906043
debug/elf: restore Go 1.0 semantics for (*File).Symbols

Also adjust the implementation of applyRelocationsAMD64
so that the test added in CL 6848044 still passes.

R=golang-dev, minux.ma
CC=golang-dev
https://codereview.appspot.com/7686049
net/http/fcgi: fix a shutdown race

If a handler didn't consume all its Request.Body, child.go was
closing the socket while the host was still writing to it,
causing the child to send a RST and the host (at least nginx)
to send an empty response body.

Now, we tell the host we're done with the request/response
first, and then close our input pipe after consuming a bit of
it. Consuming the body fixes the problem, and flushing to the
host first to tell it that we're done increases the chance
that the host cuts off further data to us, meaning we won't
have much to consume.

No new tests, because this package is lacking in tests.
Tested by hand with nginx.  See issue for testing details.

Fixes issue 4183

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/7939045
bufio.Scanner: delete obsolete TODO
Also fix the examples to use stderr for errors.

R=golang-dev, bradfitz
CC=golang-dev
https://codereview.appspot.com/7716052
go/doc: use regexp for -notes instead of comma-sep. list

-notes="BUG|TODO" instead of -notes="BUG,TODO".
Permits -notes=".*" to see all notes.

R=cnicolaou
CC=golang-dev
https://codereview.appspot.com/7951043
cmd/gc: accept ideal float as indices.

Fixes issue 4813.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://codereview.appspot.com/7625050
test: more systematic shift tests

To be submitted once gc agrees.

R=rsc, iant, remyoudompheng
CC=golang-dev
https://codereview.appspot.com/7861045
debug/elf: repair GNU version symbols.

After the revert of revision 9ea9e7e6e0c8
the related revision 76ff7da868c6 must be reverted too.

Fixes issue 5102.

R=golang-dev, r
CC=golang-dev
https://codereview.appspot.com/7961044
bufio: add some tests

R=golang-dev, adg
CC=golang-dev
https://codereview.appspot.com/7927044
net/http: reuse bufio.Reader and bufio.Writer between conns

Saves over 8KB of allocations per new connection.

benchmark                             old ns/op    new ns/op    delta
BenchmarkServerFakeConnNoKeepAlive        28777        24927  -13.38%

benchmark                            old allocs   new allocs    delta
BenchmarkServerFakeConnNoKeepAlive           52           46  -11.54%

benchmark                             old bytes    new bytes    delta
BenchmarkServerFakeConnNoKeepAlive        13716         5286  -61.46%

R=golang-dev, adg
CC=golang-dev
https://codereview.appspot.com/7799047
misc/emacs: Kill gofmt error buffer if the buffer was formatted correctly already.

R=adonovan, cw, patrick.allen.higgins, bradfitz
CC=golang-dev
https://codereview.appspot.com/7844045

Committer: Brad Fitzpatrick <bradfitz@golang.org>
cmd/cgo: fix the cgo example on multiple assignment context.

Change from atoi to strtol since atoi does not set errno.

R=golang-dev, minux.ma, rsc, bradfitz
CC=golang-dev
https://codereview.appspot.com/7888047

Committer: Brad Fitzpatrick <bradfitz@golang.org>
image/gif: tighten the checks for when the amount of an image's pixel
data does not agree with its bounds.

R=r, jeff.allen
CC=golang-dev
https://codereview.appspot.com/7938043
math: remove repeated comment.

R=golang-dev, nigeltao
CC=golang-dev
https://codereview.appspot.com/7835046

Committer: Nigel Tao <nigeltao@golang.org>
go1.1.html: bufio.Scanner and reflect; more about surrogates

R=golang-dev, adg
CC=golang-dev
https://codereview.appspot.com/7958043
runtime: improve mmap return value checking for netbsd/openbsd

Rather than just checking for ENOMEM, check for a return value of less
than 4096, so that we catch other errors such as EACCES and EINVAL.

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/7942043
runtime: correct return value checks for mmap on darwin/freebsd

On Darwin and FreeBSD, the mmap syscall return value is returned
unmodified. This means that the return value will either be a
valid address or a positive error number.

Also check return value from mmap in SysReserve - the callers of
SysReserve expect nil to be returned if the allocation failed.

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/7871043
image/gif: reject a GIF image if frame bounds larger than image bounds

The GIF89a spec says: "Each image must fit within the
boundaries of the Logical Screen, as defined in the
Logical Screen Descriptor." Also, do not accept
GIFs which have too much data for the image size.

R=nigeltao, jra, r
CC=bradfitz, golang-dev
https://codereview.appspot.com/7602045

Committer: Rob Pike <r@golang.org>