]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agoencoding/base64, encoding/base32: speed up Encode
Rui Ueyama [Thu, 19 Jun 2014 19:04:59 +0000 (12:04 -0700)]
encoding/base64, encoding/base32: speed up Encode
Avoid unnecessary bitwise-OR operations.

benchmark                      old MB/s     new MB/s  speedup
BenchmarkEncodeToStringBase64  179.02       205.74    1.15x
BenchmarkEncodeToStringBase32  155.86       167.82    1.08x

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/109090043

10 years agostrings: reduce allocation in byteStringReplacer.WriteString
Rui Ueyama [Thu, 19 Jun 2014 18:22:50 +0000 (11:22 -0700)]
strings: reduce allocation in byteStringReplacer.WriteString

Use WriteString instead of allocating a byte slice as a
buffer. This was a TODO.

benchmark               old ns/op    new ns/op    delta
BenchmarkWriteString        40139        19991  -50.20%

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/107190044

10 years agoimage/jpeg: encode *image.Gray as grayscale JPEGs.
Bill Thiede [Thu, 19 Jun 2014 12:18:24 +0000 (22:18 +1000)]
image/jpeg: encode *image.Gray as grayscale JPEGs.

Fixes #8201.

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/105990046

10 years agotesting/quick: brought Check parameter name in line with function doc
Caleb Spare [Thu, 19 Jun 2014 05:49:14 +0000 (01:49 -0400)]
testing/quick: brought Check parameter name in line with function doc

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/102830043

10 years agoimage/jpeg: use a look-up table to speed up Huffman decoding. This
Nigel Tao [Thu, 19 Jun 2014 01:39:03 +0000 (11:39 +1000)]
image/jpeg: use a look-up table to speed up Huffman decoding. This
requires a decoder to do its own byte buffering instead of using
bufio.Reader, due to byte stuffing.

benchmark                      old MB/s     new MB/s     speedup
BenchmarkDecodeBaseline        33.40        50.65        1.52x
BenchmarkDecodeProgressive     24.34        31.92        1.31x

On 6g, unsafe.Sizeof(huffman{}) falls from 4872 to 964 bytes, and
the decoder struct contains 8 of those.

LGTM=r
R=r, nightlyone
CC=bradfitz, couchmoney, golang-codereviews, raph
https://golang.org/cl/109050045

10 years agotag go1.3
Andrew Gerrand [Thu, 19 Jun 2014 01:21:35 +0000 (11:21 +1000)]
tag go1.3

LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/107200043

10 years agodoc: document Go 1.3
Andrew Gerrand [Thu, 19 Jun 2014 00:26:57 +0000 (10:26 +1000)]
doc: document Go 1.3

This is a clone of 101370043, which I accidentally applied to the
release branch first.
No big deal, it needed to be applied there anyway.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/108090043

10 years agoimage: add RGBAAt, Gray16At, etc.
ChaiShushan [Thu, 19 Jun 2014 00:15:04 +0000 (10:15 +1000)]
image: add RGBAAt, Gray16At, etc.

Fixes #7694.

LGTM=nigeltao, rsc, r
R=golang-codereviews, nigeltao, rsc, r
CC=golang-codereviews
https://golang.org/cl/109000049

10 years agoencoding/base64, encoding/base32: make Encode faster
Rui Ueyama [Wed, 18 Jun 2014 19:05:46 +0000 (12:05 -0700)]
encoding/base64, encoding/base32: make Encode faster

Storing temporary values to a slice is slower than storing
them to local variables of type byte.

benchmark                         old MB/s     new MB/s  speedup
BenchmarkEncodeToStringBase32       102.21       156.66    1.53x
BenchmarkEncodeToStringBase64       124.25       177.91    1.43x

LGTM=crawshaw
R=golang-codereviews, crawshaw, bradfitz, dave
CC=golang-codereviews
https://golang.org/cl/109820045

10 years agotesting: fix timing format inconsistency
Robert Dinu [Wed, 18 Jun 2014 17:59:25 +0000 (10:59 -0700)]
testing: fix timing format inconsistency

Fixes #8175.

LGTM=r
R=golang-codereviews, r, gobot
CC=golang-codereviews
https://golang.org/cl/103320043

10 years agofmt: include ±Inf and NaN in the complex format test
Rob Pike [Wed, 18 Jun 2014 17:57:18 +0000 (10:57 -0700)]
fmt: include ±Inf and NaN in the complex format test
Just to be more thorough.
No need to push this to 1.3; it's just a test change that
worked without any changes to the code being tested.

LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/109080045

10 years agogo/build: update doc.go for go1.3 build tag.
David Symonds [Wed, 18 Jun 2014 15:47:05 +0000 (08:47 -0700)]
go/build: update doc.go for go1.3 build tag.

LGTM=bradfitz
R=adg, rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/102470045

10 years agostrings: add fast path to Replace
Rui Ueyama [Wed, 18 Jun 2014 05:08:46 +0000 (22:08 -0700)]
strings: add fast path to Replace

genericReplacer.lookup is called for each byte of an input
string. In many (most?) cases, lookup will fail for the first
byte, and it will return immediately. Adding a fast path for
that case seems worth it.

Benchmark on my Xeon 3.5GHz Linux box:

benchmark                        old ns/op    new ns/op    delta
BenchmarkGenericNoMatch               2691          774  -71.24%
BenchmarkGenericMatch1                7920         8151   +2.92%
BenchmarkGenericMatch2               52336        39927  -23.71%
BenchmarkSingleMaxSkipping            1575         1575   +0.00%
BenchmarkSingleLongSuffixFail         1429         1429   +0.00%
BenchmarkSingleMatch                 56228        55444   -1.39%
BenchmarkByteByteNoMatch               568          568   +0.00%
BenchmarkByteByteMatch                 977          972   -0.51%
BenchmarkByteStringMatch              1669         1687   +1.08%
BenchmarkHTMLEscapeNew                 422          422   +0.00%
BenchmarkHTMLEscapeOld                 692          670   -3.18%
BenchmarkByteByteReplaces             8492         8474   -0.21%
BenchmarkByteByteMap                  2817         2808   -0.32%

LGTM=rsc
R=golang-codereviews, bradfitz, dave, rsc
CC=golang-codereviews
https://golang.org/cl/79200044

10 years agoruntime: fix gogetcallerpc.
Keith Randall [Wed, 18 Jun 2014 04:59:50 +0000 (21:59 -0700)]
runtime: fix gogetcallerpc.

Make assembly govet-clean.
Clean up fixes for CL 93380044.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/107160047

10 years agofmt: fix signs when zero padding.
Rob Pike [Tue, 17 Jun 2014 21:56:54 +0000 (14:56 -0700)]
fmt: fix signs when zero padding.
Bug was introduced recently. Add more tests, fix the bugs.
Suppress + sign when not required in zero padding.
Do not zero pad infinities.
All old tests still pass.
This time for sure!
Fixes #8217.

LGTM=rsc
R=golang-codereviews, dan.kortschak, rsc
CC=golang-codereviews
https://golang.org/cl/103480043

10 years agomisc/emacs: add new function godoc-at-point
Dominik Honnef [Tue, 17 Jun 2014 19:52:29 +0000 (15:52 -0400)]
misc/emacs: add new function godoc-at-point

LGTM=adonovan
R=adonovan, ruiu
CC=golang-codereviews
https://golang.org/cl/107160048

10 years agomisc/emacs: replace hacky go--delete-whole-line with own implementation
Dominik Honnef [Tue, 17 Jun 2014 18:43:35 +0000 (14:43 -0400)]
misc/emacs: replace hacky go--delete-whole-line with own implementation

Using flet to replace kill-region with delete-region was a hack,
flet is now (GNU Emacs 24.3) deprecated and at least two people
have reported an issue where using go--delete-whole-line would
permanently break their kill ring. While that issue is probably
caused by faulty third party code (possibly prelude), it's easier
to write a clean implementation than to tweak the hack.

LGTM=ruiu, adonovan
R=adonovan, ruiu
CC=adg, golang-codereviews
https://golang.org/cl/106010043

10 years agotext/scanner: fix comment
Robert Griesemer [Tue, 17 Jun 2014 16:34:11 +0000 (09:34 -0700)]
text/scanner: fix comment

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/105300044

10 years agoruntime: fix stringw test.
Keith Randall [Tue, 17 Jun 2014 16:17:33 +0000 (09:17 -0700)]
runtime: fix stringw test.

Null terminate string.  Make it endian-agnostic.

TBR=bradfitz
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/106060044

10 years agotest: speed up chan/select5
Josh Bleecher Snyder [Tue, 17 Jun 2014 16:07:18 +0000 (09:07 -0700)]
test: speed up chan/select5

No functional changes.

Generating shorter functions improves compilation time. On my laptop, this test's running time goes from 5.5s to 1.5s; the wall clock time to run all tests goes down 1s. On Raspberry Pi, this CL cuts 50s off the wall clock time to run all tests.

Fixes #7503.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/72590045

10 years agogo/parser: don't accept trailing explicit semicolon
Robert Griesemer [Tue, 17 Jun 2014 15:58:08 +0000 (08:58 -0700)]
go/parser: don't accept trailing explicit semicolon

Fixes #8207.

LGTM=gordon.klaus, bradfitz
R=golang-codereviews, wandakkelly, gordon.klaus, bradfitz
CC=golang-codereviews
https://golang.org/cl/106010046

10 years agoundo CL 105260044 / afd6f214cc81
Keith Randall [Tue, 17 Jun 2014 15:10:21 +0000 (08:10 -0700)]
undo CL 105260044 / afd6f214cc81

The go:nosplit change wasn't the problem, reinstating.

««« original CL description
undo CL 93380044 / 7f0999348917

Partial undo, just of go:nosplit annotation.  Somehow it
is breaking the windows builders.

TBR=bradfitz

««« original CL description
runtime: implement string ops in Go

Also implement go:nosplit annotation.  Not really needed
for now, but we'll definitely need it for other conversions.

benchmark                 old ns/op     new ns/op     delta
BenchmarkRuneIterate      534           474           -11.24%
BenchmarkRuneIterate2     535           470           -12.15%

LGTM=bradfitz
R=golang-codereviews, dave, bradfitz, minux
CC=golang-codereviews
https://golang.org/cl/93380044
»»»

TBR=bradfitz
CC=golang-codereviews
https://golang.org/cl/105260044
»»»

TBR=bradfitz
R=bradfitz, golang-codereviews
CC=golang-codereviews
https://golang.org/cl/103490043

10 years agoruntime: disable funky wide string test for now.
Keith Randall [Tue, 17 Jun 2014 07:45:39 +0000 (00:45 -0700)]
runtime: disable funky wide string test for now.

TBR=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/105280045

10 years agoruntime: reconstitute runetochar for use by gostringw.
Keith Randall [Tue, 17 Jun 2014 07:36:23 +0000 (00:36 -0700)]
runtime: reconstitute runetochar for use by gostringw.

Fixes windows builds (hopefully).

LGTM=bradfitz
R=golang-codereviews, bradfitz, alex.brainman
CC=golang-codereviews
https://golang.org/cl/103470045

10 years agoundo CL 93380044 / 7f0999348917
Keith Randall [Tue, 17 Jun 2014 06:51:18 +0000 (23:51 -0700)]
undo CL 93380044 / 7f0999348917

Partial undo, just of go:nosplit annotation.  Somehow it
is breaking the windows builders.

TBR=bradfitz

««« original CL description
runtime: implement string ops in Go

Also implement go:nosplit annotation.  Not really needed
for now, but we'll definitely need it for other conversions.

benchmark                 old ns/op     new ns/op     delta
BenchmarkRuneIterate      534           474           -11.24%
BenchmarkRuneIterate2     535           470           -12.15%

LGTM=bradfitz
R=golang-codereviews, dave, bradfitz, minux
CC=golang-codereviews
https://golang.org/cl/93380044
»»»

TBR=bradfitz
CC=golang-codereviews
https://golang.org/cl/105260044

10 years agocmd/5c, cmd/6c, cmd/8c, cmd/cc: remove unused global variable retok.
Shenghou Ma [Tue, 17 Jun 2014 06:05:27 +0000 (02:05 -0400)]
cmd/5c, cmd/6c, cmd/8c, cmd/cc: remove unused global variable retok.

LGTM=bradfitz
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/107160046

10 years agoruntime: implement string ops in Go
Keith Randall [Tue, 17 Jun 2014 06:03:03 +0000 (23:03 -0700)]
runtime: implement string ops in Go

Also implement go:nosplit annotation.  Not really needed
for now, but we'll definitely need it for other conversions.

benchmark                 old ns/op     new ns/op     delta
BenchmarkRuneIterate      534           474           -11.24%
BenchmarkRuneIterate2     535           470           -12.15%

LGTM=bradfitz
R=golang-codereviews, dave, bradfitz, minux
CC=golang-codereviews
https://golang.org/cl/93380044

10 years agoruntime: implement eqstring in assembly.
Keith Randall [Tue, 17 Jun 2014 04:00:37 +0000 (21:00 -0700)]
runtime: implement eqstring in assembly.

BenchmarkCompareStringEqual               10.4          7.33          -29.52%
BenchmarkCompareStringIdentical           3.99          3.67          -8.02%
BenchmarkCompareStringSameLength          9.80          6.84          -30.20%
BenchmarkCompareStringDifferentLength     1.09          0.95          -12.84%
BenchmarkCompareStringBigUnaligned        75220         76071         +1.13%
BenchmarkCompareStringBig                 69843         74746         +7.02%

LGTM=bradfitz, josharian
R=golang-codereviews, bradfitz, josharian, dave, khr
CC=golang-codereviews
https://golang.org/cl/105280044

10 years agonet: avoid array copy when shuffling SRV records
Rui Ueyama [Tue, 17 Jun 2014 01:00:28 +0000 (18:00 -0700)]
net: avoid array copy when shuffling SRV records

We don't need to shift array elements to shuffle them.
We just have to swap a selected element with 0th element.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/91750044

10 years agotext/scanner: provide facility for custom identifiers
Robert Griesemer [Mon, 16 Jun 2014 23:32:47 +0000 (16:32 -0700)]
text/scanner: provide facility for custom identifiers

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/108030044

10 years agobufio: handle excessive white space in ScanWords
Matthew Dempsky [Mon, 16 Jun 2014 19:59:10 +0000 (12:59 -0700)]
bufio: handle excessive white space in ScanWords

LGTM=r
R=golang-codereviews, bradfitz, r
CC=golang-codereviews
https://golang.org/cl/109020043

10 years agofmt: don't put 0x on every byte of a compact hex-encoded string
Rob Pike [Mon, 16 Jun 2014 17:45:05 +0000 (10:45 -0700)]
fmt: don't put 0x on every byte of a compact hex-encoded string
Printf("%x", "abc") was "0x610x620x63"; is now "0x616263", which
is surely better.
Printf("% #x", "abc") is still "0x61 0x62 0x63".

Fixes #8080.

LGTM=bradfitz, gri
R=golang-codereviews, bradfitz, gri
CC=golang-codereviews
https://golang.org/cl/106990043

10 years agoos: disable TestGetppid on plan9
Alex Brainman [Sat, 14 Jun 2014 06:47:40 +0000 (16:47 +1000)]
os: disable TestGetppid on plan9

Fixes build.

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/105140047

10 years agosyscall: implement syscall.Getppid() on Windows
Alan Shreve [Sat, 14 Jun 2014 05:51:00 +0000 (15:51 +1000)]
syscall: implement syscall.Getppid() on Windows

Also added a test to verify os.Getppid() works across all platforms

LGTM=alex.brainman
R=golang-codereviews, alex.brainman, shreveal, iant
CC=golang-codereviews
https://golang.org/cl/102320044

10 years agoA+C: Alan Shreve (individual CLA)
Ian Lance Taylor [Sat, 14 Jun 2014 04:09:23 +0000 (21:09 -0700)]
A+C: Alan Shreve (individual CLA)

Generated by addca.

R=gobot
CC=golang-codereviews
https://golang.org/cl/102410044

10 years agoruntime: fix VDSO lookup to use dynamic hash table
Ian Lance Taylor [Fri, 13 Jun 2014 20:29:26 +0000 (13:29 -0700)]
runtime: fix VDSO lookup to use dynamic hash table

Reportedly in the Linux 3.16 kernel the VDSO will not have
section headers or a normal symbol table.

Too late for 1.3 but perhaps for 1.3.1, if there is one.

Fixes #8197.

LGTM=rsc
R=golang-codereviews, mattn.jp, rsc
CC=golang-codereviews
https://golang.org/cl/101260044

10 years agocompress/lzw: add commentary that TIFF's LZW differs from the standard
Nigel Tao [Fri, 13 Jun 2014 07:44:29 +0000 (17:44 +1000)]
compress/lzw: add commentary that TIFF's LZW differs from the standard
algorithm.

See https://golang.org/cl/105750045/ for an implementation of
TIFF's LZW.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/102940043

10 years agoimage/png: fix compare-to-golden-file test.
Nigel Tao [Fri, 13 Jun 2014 07:43:02 +0000 (17:43 +1000)]
image/png: fix compare-to-golden-file test.

bufio.Scanner.Scan returns whether the scan succeeded, not whether it
is done, so the test was mistakenly breaking early.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/93670045

10 years agodoc: link to new downloads page
Andrew Gerrand [Fri, 13 Jun 2014 06:34:52 +0000 (16:34 +1000)]
doc: link to new downloads page

LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/102340044

10 years agoundo CL 101970047 / 30307cc8bef2
Russ Cox [Fri, 13 Jun 2014 06:04:03 +0000 (02:04 -0400)]
undo CL 101970047 / 30307cc8bef2

makes windows-amd64-race benchmarks slower

««« original CL description
testing: make benchmarking faster

Allow the number of benchmark iterations to grow faster for fast benchmarks, and don't round up twice.

Using the default benchtime, this CL reduces wall clock time to run benchmarks:

net/http        49s   -> 37s   (-24%)
runtime         8m31s -> 5m55s (-30%)
bytes           2m37s -> 1m29s (-43%)
encoding/json   29s   -> 21s   (-27%)
strings         1m16s -> 53s   (-30%)

LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/101970047
»»»

TBR=josharian
CC=golang-codereviews
https://golang.org/cl/105950044

10 years agotag go1.3rc2
Andrew Gerrand [Fri, 13 Jun 2014 03:30:54 +0000 (13:30 +1000)]
tag go1.3rc2

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/101270043

10 years agoruntime: revise CL 105140044 (defer nil) to work on Windows
Russ Cox [Fri, 13 Jun 2014 01:12:53 +0000 (21:12 -0400)]
runtime: revise CL 105140044 (defer nil) to work on Windows

It appears that something about Go on Windows
cannot handle the fault cause by a jump to address 0.
The way Go represents and calls functions, this
never happened at all, until CL 105140044.

This CL changes the code added in CL 105140044
to make jump to 0 impossible once again.

Fixes #8047. (again, on Windows)

TBR=bradfitz
R=golang-codereviews, dave
CC=adg, golang-codereviews, iant, r
https://golang.org/cl/105120044

10 years agotime: micro symbol for microseconds
Rob Pike [Fri, 13 Jun 2014 00:19:33 +0000 (17:19 -0700)]
time: micro symbol for microseconds

R=rsc
CC=golang-codereviews
https://golang.org/cl/105930043

10 years agolib/codereview: fix doc/go1.*.txt exception
Russ Cox [Fri, 13 Jun 2014 00:12:50 +0000 (20:12 -0400)]
lib/codereview: fix doc/go1.*.txt exception

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/108950046

10 years agodoc: add go1.4.txt
Russ Cox [Fri, 13 Jun 2014 00:06:16 +0000 (20:06 -0400)]
doc: add go1.4.txt

CC=golang-codereviews
https://golang.org/cl/103340046

10 years agotime: change formatting of microseconds duration to SI modifier
Rob Pike [Fri, 13 Jun 2014 00:01:13 +0000 (17:01 -0700)]
time: change formatting of microseconds duration to SI modifier
'u' is not micro, µ (U+00B5) is.

LGTM=gri, bradfitz
R=golang-codereviews, bradfitz, gri
CC=golang-codereviews
https://golang.org/cl/105030046

10 years agocodereview: no LGTM needed for doc/go1.x.txt
Russ Cox [Thu, 12 Jun 2014 20:35:12 +0000 (16:35 -0400)]
codereview: no LGTM needed for doc/go1.x.txt

Rob asked for this change to make maintaining go1.4.txt easier.
If you are not sure of a change, it is still okay to send for review.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/109880044

10 years agoruntime: do not trace past jmpdefer during pprof traceback on arm
Russ Cox [Thu, 12 Jun 2014 20:34:54 +0000 (16:34 -0400)]
runtime: do not trace past jmpdefer during pprof traceback on arm

jmpdefer modifies PC, SP, and LR, and not atomically,
so walking past jmpdefer will often end up in a state
where the three are not a consistent execution snapshot.
This was causing warning messages a few frames later
when the traceback realized it was confused, but given
the right memory it could easily crash instead.

Update #8153

LGTM=minux, iant
R=golang-codereviews, minux, iant
CC=golang-codereviews, r
https://golang.org/cl/107970043

10 years agoruntime: fix defer of nil func
Russ Cox [Thu, 12 Jun 2014 20:34:36 +0000 (16:34 -0400)]
runtime: fix defer of nil func

Fixes #8047.

LGTM=r, iant
R=golang-codereviews, r, iant
CC=dvyukov, golang-codereviews, khr
https://golang.org/cl/105140044

10 years agotime: avoid broken fix for buggy TestOverflowRuntimeTimer
Rob Pike [Thu, 12 Jun 2014 18:44:55 +0000 (11:44 -0700)]
time: avoid broken fix for buggy TestOverflowRuntimeTimer
The test requires that timerproc runs, but busy loops and starves
the scheduler so that, with high probability, timerproc doesn't run.
Avoid the issue by expecting the test to succeed; if not, a major
outside timeout will kill it and let us know.

As you can see from the diffs, there have been several attempts to
fix this with chicanery, but none has worked. Don't bother trying
any more.

Fixes #8136.

LGTM=rsc
R=rsc, josharian
CC=golang-codereviews
https://golang.org/cl/105140043

10 years agoencoding/json: remove unused field from Encoder struct
Brad Fitzpatrick [Thu, 12 Jun 2014 16:44:59 +0000 (09:44 -0700)]
encoding/json: remove unused field from Encoder struct

It should've been removed in https://golang.org/cl/9365044

Thanks to Jacek Masiulaniec for noticing.

LGTM=ruiu
R=ruiu
CC=golang-codereviews
https://golang.org/cl/109880043

10 years agotesting: make benchmarking faster
Josh Bleecher Snyder [Thu, 12 Jun 2014 14:51:32 +0000 (07:51 -0700)]
testing: make benchmarking faster

Allow the number of benchmark iterations to grow faster for fast benchmarks, and don't round up twice.

Using the default benchtime, this CL reduces wall clock time to run benchmarks:

net/http        49s   -> 37s   (-24%)
runtime         8m31s -> 5m55s (-30%)
bytes           2m37s -> 1m29s (-43%)
encoding/json   29s   -> 21s   (-27%)
strings         1m16s -> 53s   (-30%)

LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/101970047

10 years ago doc: add release note for 'godoc -analysis'
Alan Donovan [Thu, 12 Jun 2014 14:08:54 +0000 (10:08 -0400)]
   doc: add release note for 'godoc -analysis'

Contains a link to /lib/godoc/analysis/help.html
       which is not yet live.

LGTM=r
R=r, adg
CC=golang-codereviews
https://golang.org/cl/88560044

10 years agoencoding/ascii85: remove unused field
Rui Ueyama [Thu, 12 Jun 2014 05:52:01 +0000 (22:52 -0700)]
encoding/ascii85: remove unused field

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/105890044

10 years agonet: efficient text processing
Rui Ueyama [Thu, 12 Jun 2014 03:40:00 +0000 (20:40 -0700)]
net: efficient text processing

Optimize IP.String, IPMask.String and ParseIP.

benchmark                old ns/op    new ns/op    delta
BenchmarkParseIP              2216         1849  -16.56%
BenchmarkIPString             7828         2486  -68.24%
BenchmarkIPMaskString         3872          659  -82.98%

LGTM=mikioh.mikioh, dave, bradfitz
R=golang-codereviews, mikioh.mikioh, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/95750043

10 years agonet: do not call time.Now() twice
Rui Ueyama [Thu, 12 Jun 2014 03:33:44 +0000 (20:33 -0700)]
net: do not call time.Now() twice

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/104080043

10 years agodoc: link to release history from /doc/
Andrew Gerrand [Thu, 12 Jun 2014 03:31:13 +0000 (13:31 +1000)]
doc: link to release history from /doc/

Fixes #8168.

TBR=bradfitz
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/107950043

10 years agomisc/makerelease: update default tag to release-branch.go1.3
Andrew Gerrand [Thu, 12 Jun 2014 03:29:22 +0000 (13:29 +1000)]
misc/makerelease: update default tag to release-branch.go1.3

TBR=bradfitz
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/104090044

10 years agobytes, strings: optimize Repeat
Rui Ueyama [Thu, 12 Jun 2014 02:03:59 +0000 (19:03 -0700)]
bytes, strings: optimize Repeat

Call copy with as large buffer as possible to reduce the
number of function calls.

benchmark                 old ns/op    new ns/op    delta
BenchmarkBytesRepeat            540          162  -70.00%
BenchmarkStringsRepeat          563          177  -68.56%

LGTM=josharian
R=golang-codereviews, josharian, dave, dvyukov
CC=golang-codereviews
https://golang.org/cl/90550043

10 years agomime/multipart: fix format
Rui Ueyama [Thu, 12 Jun 2014 00:39:34 +0000 (17:39 -0700)]
mime/multipart: fix format

Remove unnecessary blank line.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/105040045

10 years agoruntime: add test for issue 8047.
Keith Randall [Thu, 12 Jun 2014 00:34:46 +0000 (20:34 -0400)]
runtime: add test for issue 8047.

Make sure stack copier doesn't barf on a nil defer.
Bug was fixed in https://golang.org/cl/101800043
This change just adds a test.

Fixes #8047

LGTM=dvyukov, rsc
R=dvyukov, rsc
CC=golang-codereviews
https://golang.org/cl/108840043

10 years agomath: remove Nextafter64 alias in favor of existing Nextafter
Robert Griesemer [Wed, 11 Jun 2014 21:24:16 +0000 (14:24 -0700)]
math: remove Nextafter64 alias in favor of existing Nextafter

LGTM=adonovan
R=rsc, adonovan
CC=golang-codereviews
https://golang.org/cl/104050045

10 years agoencoding/base64, encoding/base32: make DecodeString faster
Rui Ueyama [Wed, 11 Jun 2014 18:22:08 +0000 (11:22 -0700)]
encoding/base64, encoding/base32: make DecodeString faster

Previously, an input string was stripped of newline
characters at the beginning of DecodeString and then passed
to Decode. Decode again tried to strip newline characters.
That's waste of time.

benchmark                 old MB/s     new MB/s  speedup
BenchmarkDecodeString        38.37        65.20    1.70x

LGTM=dave, bradfitz
R=golang-codereviews, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/91770051

10 years agocmd/gc: fix &result escaping into result
Russ Cox [Wed, 11 Jun 2014 18:21:06 +0000 (14:21 -0400)]
cmd/gc: fix &result escaping into result

There is a hierarchy of location defined by loop depth:

        -1 = the heap
        0 = function results
        1 = local variables (and parameters)
        2 = local variable declared inside a loop
        3 = local variable declared inside a loop inside a loop
        etc

In general if an address from loopdepth n is assigned to
something in loop depth m < n, that indicates an extended
lifetime of some form that requires a heap allocation.

Function results can be local variables too, though, and so
they don't actually fit into the hierarchy very well.
Treat the address of a function result as level 1 so that
if it is written back into a result, the address is treated
as escaping.

Fixes #8185.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/108870044

10 years agomath/big: implement Rat.Float32
Robert Griesemer [Wed, 11 Jun 2014 16:10:49 +0000 (09:10 -0700)]
math/big: implement Rat.Float32

Pending CL 101750048.
For submission after the 1.3 release.

Fixes #8065.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/93550043

10 years agomath: implement Nextafter32
Robert Griesemer [Wed, 11 Jun 2014 16:09:37 +0000 (09:09 -0700)]
math: implement Nextafter32

Provide Nextafter64 as alias to Nextafter.
For submission after the 1.3 release.

Fixes #8117.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/101750048

10 years agocmd/gc: fix escape analysis for &x inside switch x := v.(type)
Russ Cox [Wed, 11 Jun 2014 15:48:47 +0000 (11:48 -0400)]
cmd/gc: fix escape analysis for &x inside switch x := v.(type)

The analysis for &x was using the loop depth on x set
during x's declaration. A type switch creates a list of
implicit declarations that were not getting initialized
with loop depths.

Fixes #8176.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/108860043

10 years agonacltest.bash, misc/nacl/README: update NaCl docs.
Shenghou Ma [Wed, 11 Jun 2014 00:20:49 +0000 (20:20 -0400)]
nacltest.bash, misc/nacl/README: update NaCl docs.

LGTM=rsc
R=dave, rsc
CC=golang-codereviews
https://golang.org/cl/105030043

10 years agonet/http: fix double Content-Length in response
Brad Fitzpatrick [Tue, 10 Jun 2014 23:52:37 +0000 (16:52 -0700)]
net/http: fix double Content-Length in response

Fixes #8180

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/105040043

10 years agocmd/ld: fix PC deltas in DWARF line number table
Ian Lance Taylor [Tue, 10 Jun 2014 21:11:39 +0000 (14:11 -0700)]
cmd/ld: fix PC deltas in DWARF line number table

The putpclcdelta function set the DWARF line number PC to
s->value + pcline->pc, which is correct, but the code then set
the local variable pc to epc, which can be a different value.
This caused the next delta in the DWARF table to be wrong.

Fixes #8098.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/104950045

10 years agodocs: link to the assembler document from the Documents tab
Rob Pike [Tue, 10 Jun 2014 18:19:53 +0000 (11:19 -0700)]
docs: link to the assembler document from the Documents tab

Fixes #8156.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/108840045

10 years agodoc/install.html: fix erroneous HTML annotation
Rob Pike [Tue, 10 Jun 2014 18:19:41 +0000 (11:19 -0700)]
doc/install.html: fix erroneous HTML annotation
align=middle is invalid; use align=center

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/106910044

10 years agoruntime: fix panic stack during runtime.Goexit during panic
Russ Cox [Fri, 6 Jun 2014 20:52:14 +0000 (16:52 -0400)]
runtime: fix panic stack during runtime.Goexit during panic

A runtime.Goexit during a panic-invoked deferred call
left the panic stack intact even though all the stack frames
are gone when the goroutine is torn down.
The next goroutine to reuse that struct will have a
bogus panic stack and can cause the traceback routines
to walk into garbage.

Most likely to happen during tests, because t.Fatal might
be called during a deferred func and uses runtime.Goexit.

This "not enough cleared in Goexit" failure mode has
happened to us multiple times now. Clear all the pointers
that don't make sense to keep, not just gp->panic.

Fixes #8158.

LGTM=iant, dvyukov
R=iant, dvyukov
CC=golang-codereviews
https://golang.org/cl/102220043

10 years agocmd/6g: fix stack zeroing on native client
Russ Cox [Thu, 5 Jun 2014 20:40:23 +0000 (16:40 -0400)]
cmd/6g: fix stack zeroing on native client

I am not sure what the rounding here was
trying to do, but it was skipping the first
pointer on native client.

The code above the rounding already checks
that xoffset is widthptr-aligned, so the rnd
was a no-op everywhere but on Native Client.
And on Native Client it was wrong.

Perhaps it was supposed to be rounding down,
not up, but zerorange handles the extra 32 bits
correctly, so the rnd does not seem to be necessary
at all.

This wouldn't be worth doing for Go 1.3 except
that it can affect code on the playground.

Fixes #8155.

LGTM=r, iant
R=golang-codereviews, r, iant
CC=dvyukov, golang-codereviews, khr
https://golang.org/cl/108740047

10 years agocodereview: do not add defaultcc for private CLs
Russ Cox [Thu, 5 Jun 2014 20:40:09 +0000 (16:40 -0400)]
codereview: do not add defaultcc for private CLs

LGTM=r
R=r, 0xjnml, bradfitz, iant
CC=golang-codereviews
https://golang.org/cl/103070046

10 years agocmd/cgo: for typedef of untagged struct, use typedef name in C code
Ian Lance Taylor [Thu, 5 Jun 2014 17:42:03 +0000 (10:42 -0700)]
cmd/cgo: for typedef of untagged struct, use typedef name in C code

Fixes #8148.

LGTM=cookieo9, rsc
R=rsc, cookieo9
CC=golang-codereviews
https://golang.org/cl/103080043

10 years agodoc: fix happens-before rules for buffered channels
Dmitriy Vyukov [Thu, 5 Jun 2014 17:08:28 +0000 (21:08 +0400)]
doc: fix happens-before rules for buffered channels
The current wording is reversed in 2 places.
Not sure how it got 4 LGTMs (mine was there as well).
Update #6242.

LGTM=dan.kortschak, r, rsc
R=golang-codereviews, 0xjnml, dan.kortschak, r, rsc
CC=golang-codereviews
https://golang.org/cl/101980047

10 years agodoc/install-source.html: document that GO386 will be auto-detected when building...
Shenghou Ma [Wed, 4 Jun 2014 23:53:37 +0000 (19:53 -0400)]
doc/install-source.html: document that GO386 will be auto-detected when building on both 386 and amd64.
Fixes #8152.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/102150046

10 years agodebug/elf: support DWARF that needs relocs for 386
Ian Lance Taylor [Tue, 3 Jun 2014 23:39:40 +0000 (16:39 -0700)]
debug/elf: support DWARF that needs relocs for 386

It's not clear how widespread this issue is, but we do have a
test case generated by a development version of clang.

I don't know whether this should go into 1.3 or not; happy to
hear arguments either way.

LGTM=rsc
R=golang-codereviews, bradfitz, rsc
CC=golang-codereviews
https://golang.org/cl/96680045

10 years agocompress/gzip: allow Reset on Reader without NewReader
Ian Lance Taylor [Tue, 3 Jun 2014 22:40:12 +0000 (15:40 -0700)]
compress/gzip: allow Reset on Reader without NewReader

Fixes #8126.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/103020044

10 years agocmd/gc: fix escape analysis of func returning indirect of parameter
Russ Cox [Tue, 3 Jun 2014 15:35:59 +0000 (11:35 -0400)]
cmd/gc: fix escape analysis of func returning indirect of parameter

I introduced this bug when I changed the escape
analysis to run in phases based on call graph
dependency order, in order to be more precise about
inputs escaping back to outputs (functions returning
their arguments).

Given

        func f(z **int) *int { return *z }

we were tagging the function as 'z does not escape
and is not returned', which is all true, but not
enough information.

If used as:

        var x int
        p := &x
        q := &p
        leak(f(q))

then the compiler might try to keep x, p, and q all
on the stack, since (according to the recorded
information) nothing interesting ends up being
passed to leak.

In fact since f returns *q = p, &x is passed to leak
and x needs to be heap allocated.

To trigger the bug, you need a chain that the
compiler wants to keep on the stack (like x, p, q
above), and you need a function that returns an
indirect of its argument, and you need to pass the
head of the chain to that function. This doesn't
come up very often: this bug has been present since
June 2012 (between Go 1 and Go 1.1) and we haven't
seen it until now. It helps that most functions that
return indirects are getters that are simple enough
to be inlined, avoiding the bug.

Earlier versions of Go also had the benefit that if
&x really wasn't used beyond x's lifetime, nothing
broke if you put &x in a heap-allocated structure
accidentally. With the new stack copying, though,
heap-allocated structures containing &x are not
updated when the stack is copied and x moves,
leading to crashes in Go 1.3 that were not crashes
in Go 1.2 or Go 1.1.

The fix is in two parts.

First, in the analysis of a function, recognize when
a value obtained via indirect of a parameter ends up
being returned. Mark those parameters as having
content escape back to the return results (but we
don't bother to write down which result).

Second, when using the analysis to analyze, say,
f(q), mark parameters with content escaping as
having any indirections escape to the heap. (We
don't bother trying to match the content to the
return value.)

The fix could be less precise (simpler).
In the first part we might mark all content-escaping
parameters as plain escaping, and then the second
part could be dropped. Or we might assume that when
calling f(q) all the things pointed at by q escape
always (for any f and q).

The fix could also be more precise (more complex).
We might record the specific mapping from parameter
to result along with the number of indirects from the
parameter to the thing being returned as the result,
and then at the call sites we could set up exactly the
right graph for the called function. That would make
notleaks(f(q)) be able to keep x on the stack, because
the reuslt of f(q) isn't passed to anything that leaks it.

The less precise the fix, the more stack allocations
become heap allocations.

This fix is exactly as precise as it needs to be so that
none of the current stack allocations in the standard
library turn into heap allocations.

Fixes #8120.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, khr, r
https://golang.org/cl/102040046

10 years agocrypto/tls: fix typo referencing the required Config field
Brad Fitzpatrick [Tue, 3 Jun 2014 08:11:17 +0000 (18:11 +1000)]
crypto/tls: fix typo referencing the required Config field

Thanks to Frithjof Schulze for noticing.

LGTM=adg
R=adg
CC=agl, golang-codereviews, r
https://golang.org/cl/107740043

10 years agotime: support version 3 zone records
Brad Fitzpatrick [Tue, 3 Jun 2014 02:44:17 +0000 (11:44 +0900)]
time: support version 3 zone records

Fixes #8134

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r, rsc
https://golang.org/cl/100930044

10 years agocmd/gc: fix liveness for address-taken variables in inlined functions
Russ Cox [Tue, 3 Jun 2014 01:26:32 +0000 (21:26 -0400)]
cmd/gc: fix liveness for address-taken variables in inlined functions

The 'address taken' bit in a function variable was not
propagating into the inlined copies, causing incorrect
liveness information.

LGTM=dsymonds, bradfitz
R=golang-codereviews, bradfitz
CC=dsymonds, golang-codereviews, iant, khr, r
https://golang.org/cl/96670046

10 years agoruntime: fix 1-byte return during x.(T) for 0-byte T
Russ Cox [Tue, 3 Jun 2014 01:06:30 +0000 (21:06 -0400)]
runtime: fix 1-byte return during x.(T) for 0-byte T

The 1-byte write was silently clearing a byte on the stack.
If there was another function call with more arguments
in the same stack frame, no harm done.
Otherwise, if the variable at that location was already zero,
no harm done.
Otherwise, problems.

Fixes #8139.

LGTM=dsymonds
R=golang-codereviews, dsymonds
CC=golang-codereviews, iant, r
https://golang.org/cl/100940043

10 years agocmd/gc: don't generate zillions of linehists for wrapper functions
Rob Pike [Mon, 2 Jun 2014 23:01:53 +0000 (16:01 -0700)]
cmd/gc: don't generate zillions of linehists for wrapper functions
This is a workaround - the code should be better than this - but the
fix avoids generating large numbers of linehist entries for the wrapper
functions that enable interface conversions. There can be many of
them, they all happen at the end of compilation, and they can all
share a linehist entry.
Avoids bad n^2 behavior in liblink.
Test case in issue 8135 goes from 64 seconds to 2.5 seconds (still bad
but not intolerable).

Fixes #8135.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/104840043

10 years agocmd/cgo: use same Go type for typedef to anonymous struct
Ian Lance Taylor [Mon, 2 Jun 2014 19:55:43 +0000 (12:55 -0700)]
cmd/cgo: use same Go type for typedef to anonymous struct

If we see a typedef to an anonymous struct more than once,
presumably in two different Go files that import "C", use the
same Go type name.

Fixes #8133.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/102080043

10 years agodoc: mention WriteHeapDump in 1.3 release notes
Ian Lance Taylor [Mon, 2 Jun 2014 18:05:46 +0000 (11:05 -0700)]
doc: mention WriteHeapDump in 1.3 release notes

LGTM=r
R=khr, r
CC=golang-codereviews
https://golang.org/cl/103810044

10 years agomisc/makerelease: fix secret
Andrew Gerrand [Mon, 2 Jun 2014 06:26:08 +0000 (16:26 +1000)]
misc/makerelease: fix secret

Not sure how this snuck in undetected.

TBR=bradfitz
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/106760043

10 years agotag go1.3rc1
Andrew Gerrand [Mon, 2 Jun 2014 04:43:51 +0000 (14:43 +1000)]
tag go1.3rc1

LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/106750043

10 years agodoc/contrib.html: update links, mailing lists and link to 1.3 release note.
Shenghou Ma [Mon, 2 Jun 2014 02:48:57 +0000 (22:48 -0400)]
doc/contrib.html: update links, mailing lists and link to 1.3 release note.

LGTM=adg
R=golang-codereviews, r, adg
CC=golang-codereviews
https://golang.org/cl/102020045

10 years agomisc/makerelease: report uploads to the new downloads page
Andrew Gerrand [Mon, 2 Jun 2014 02:46:03 +0000 (12:46 +1000)]
misc/makerelease: report uploads to the new downloads page

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/102040047

10 years agoapi: add go1.3.txt
Brad Fitzpatrick [Mon, 2 Jun 2014 02:45:00 +0000 (11:45 +0900)]
api: add go1.3.txt

Update #8112

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/104790045

10 years agobuild: don't build goplay in run.rc.
Shenghou Ma [Sun, 1 Jun 2014 23:20:46 +0000 (19:20 -0400)]
build: don't build goplay in run.rc.
Fix plan 9 build.

TBR=rsc
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/100880047

10 years agocmd/objdump: add arm disassembler
Russ Cox [Sun, 1 Jun 2014 22:53:59 +0000 (18:53 -0400)]
cmd/objdump: add arm disassembler

Fixes #7452.

LGTM=minux, iant
R=minux, iant
CC=golang-codereviews
https://golang.org/cl/104770046

10 years agocmd/dist: only use beta tag in version string for the exact revision
Andrew Gerrand [Sun, 1 Jun 2014 22:48:20 +0000 (08:48 +1000)]
cmd/dist: only use beta tag in version string for the exact revision

Right now, any revision on the default branch after go1.3beta2 is
described by "go verson" as go1.3beta2 plus some revision.
That's OK for now, but once go1.3 is released, that will seem wrong.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/98650046

10 years agobuild: remove goplay from run.bash and run.bat
Andrew Gerrand [Sun, 1 Jun 2014 22:44:47 +0000 (08:44 +1000)]
build: remove goplay from run.bash and run.bat

TBR=rsc
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/106730043

10 years agomisc/goplay: remove program
Andrew Gerrand [Sun, 1 Jun 2014 22:34:26 +0000 (08:34 +1000)]
misc/goplay: remove program

This program has barely been touched since it was first committed,
and in its current state it opens a code execution vector similar
to the one that was recently fixed in go.tools/playground/socket.

Rather than try to make it secure, remove it.

LGTM=minux, rsc
R=rsc, minux
CC=golang-codereviews
https://golang.org/cl/102030047

10 years agoruntime: fix correctness test at end of traceback
Russ Cox [Sun, 1 Jun 2014 17:57:46 +0000 (13:57 -0400)]
runtime: fix correctness test at end of traceback

We were requiring that the defer stack and the panic stack
be completely processed, thinking that if any were left over
the stack scan and the defer stack/panic stack must be out
of sync. It turns out that the panic stack may well have
leftover entries in some situations, and that's okay.

Fixes #8132.

LGTM=minux, r
R=golang-codereviews, minux, r
CC=golang-codereviews, iant, khr
https://golang.org/cl/100900044

10 years agolib/timezone: update to IANA 2014d
Rob Pike [Sun, 1 Jun 2014 00:15:23 +0000 (00:15 +0000)]
lib/timezone: update to IANA 2014d

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/102040045