]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agofmt: fix typo in help doc
Mihai Borobocea [Tue, 24 Jun 2014 23:59:33 +0000 (16:59 -0700)]
fmt: fix typo in help doc

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

10 years agoA+C: add Tetsuo Kiso (personal CLA)
Ian Lance Taylor [Tue, 24 Jun 2014 23:33:32 +0000 (16:33 -0700)]
A+C: add Tetsuo Kiso (personal CLA)

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

10 years agospec: receiver declaration is just a parameter declaration
Robert Griesemer [Tue, 24 Jun 2014 23:25:09 +0000 (16:25 -0700)]
spec: receiver declaration is just a parameter declaration

This CL removes the special syntax for method receivers and
makes it just like other parameters. Instead, the crucial
receiver-specific rules (exactly one receiver, receiver type
must be of the form T or *T) are specified verbally instead
of syntactically.

This is a fully backward-compatible (and minor) syntax
relaxation. As a result, the following syntactic restrictions
(which are completely irrelevant) and which were only in place
for receivers are removed:

a) receiver types cannot be parenthesized
b) receiver parameter lists cannot have a trailing comma

The result of this CL is a simplication of the spec and the
implementation, with no impact on existing (or future) code.

Noteworthy:

- gc already permits a trailing comma at the end of a receiver
  declaration:

  func (recv T,) m() {}

  This is technically a bug with the current spec; this CL will
  legalize this notation.

- gccgo produces a misleading error when a trailing comma is used:

  error: method has multiple receivers

  (even though there's only one receiver)

- Compilers and type-checkers won't need to report errors anymore
  if receiver types are parenthesized.

Fixes #4496.

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

10 years agorace.bash: support freebsd
Dmitriy Vyukov [Tue, 24 Jun 2014 22:47:22 +0000 (15:47 -0700)]
race.bash: support freebsd

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

10 years agocmd/go: build test files containing non-runnable examples
Andrew Gerrand [Tue, 24 Jun 2014 22:22:22 +0000 (08:22 +1000)]
cmd/go: build test files containing non-runnable examples

Even if we can't run them, we should at least check that they compile.

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

10 years agosyscall: implement setresuid(2) and setresgid(2) on OpenBSD/FreeBSD/DragonflyBSD
William Orr [Tue, 24 Jun 2014 20:30:30 +0000 (13:30 -0700)]
syscall: implement setresuid(2) and setresgid(2) on OpenBSD/FreeBSD/DragonflyBSD

Fixes #8218.

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

10 years agosyscall: add source-specific multicast socket options for Darwin
Mikio Hara [Tue, 24 Jun 2014 20:01:09 +0000 (05:01 +0900)]
syscall: add source-specific multicast socket options for Darwin

Update #8266

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

10 years agoC: add Glenn Lewis (Google CLA)
Glenn Lewis [Tue, 24 Jun 2014 19:52:48 +0000 (05:52 +1000)]
C: add Glenn Lewis (Google CLA)

For work on goauth2.

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

10 years agodoc/go1.4.txt: text/scanner: IsIdentRune
Rob Pike [Tue, 24 Jun 2014 18:09:13 +0000 (11:09 -0700)]
doc/go1.4.txt: text/scanner: IsIdentRune

R=gri
CC=golang-codereviews
https://golang.org/cl/104340043

10 years agostrings: additional tests
Dave Cheney [Tue, 24 Jun 2014 17:06:07 +0000 (03:06 +1000)]
strings: additional tests

This CL re-applies the tests added in CL 101330053 and subsequently rolled back in CL 102610043.

The original author of this change was Rui Ueyama <ruiu@google.com>

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

10 years agotesting: make benchmarking faster
Josh Bleecher Snyder [Tue, 24 Jun 2014 15:39:30 +0000 (08:39 -0700)]
testing: make benchmarking faster

The number of estimated iterations required to reach the benchtime is multiplied by a safety margin (to avoid falling just short) and then rounded up to a readable number. With an accurate estimate, in the worse case, the resulting number of iterations could be 3.75x more than necessary: 1.5x for safety * 2.5x to round up (e.g. from 2eX+1 to 5eX).

This CL reduces the safety margin to 1.2x. Experimentation showed a diminishing margin of return past 1.2x, although the average case continued to show improvements down to 1.05x.

This CL also reduces the maximum round-up multiplier from 2.5x (from 2eX+1 to 5eX) to 2x, by allowing the number of iterations to be of the form 3eX.

Both changes improve benchmark wall clock times, and the effects are cumulative.

From 1.5x to 1.2x safety margin:

package old s new s delta
bytes 163 125 -23%
encoding/json 27 21 -22%
net/http 42 36 -14%
runtime 463 418 -10%
strings 82 65 -21%

Allowing 3eX iterations:

package old s new s delta
bytes 163 134 -18%
encoding/json 27 23 -15%
net/http 42 36 -14%
runtime 463 422 -9%
strings 82 72 -12%

Combined:

package old s new s delta
bytes 163 112 -31%
encoding/json 27 20 -26%
net/http 42 30 -29%
runtime 463 346 -25%
strings 82 60 -27%

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

10 years agonet/http: remove a duplicated check
Robert Obryk [Tue, 24 Jun 2014 00:38:17 +0000 (17:38 -0700)]
net/http: remove a duplicated check

The previous call to parseRange already checks whether
all the ranges start before the end of file.

LGTM=robert.hencke, bradfitz
R=golang-codereviews, robert.hencke, gobot, bradfitz
CC=golang-codereviews
https://golang.org/cl/91880044

10 years agosyscall: regenerate z-files for darwin
Mikio Hara [Tue, 24 Jun 2014 00:20:42 +0000 (09:20 +0900)]
syscall: regenerate z-files for darwin

Updates z-files from 10.7 kernel-based to 10.9 kernel-based.

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

10 years agodoc/go1.4: add note about Set{uid,gid} change
Dave Cheney [Mon, 23 Jun 2014 23:50:10 +0000 (09:50 +1000)]
doc/go1.4: add note about Set{uid,gid} change

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

10 years agosyscall: disable Setuid/Setgid on linux
Dave Cheney [Mon, 23 Jun 2014 23:16:24 +0000 (09:16 +1000)]
syscall: disable Setuid/Setgid on linux

Update #1435

This proposal disables Setuid and Setgid on all linux platforms.

Issue 1435 has been open for a long time, and it is unlikely to be addressed soon so an argument was made by a commenter

https://code.google.com/p/go/issues/detail?id=1435#c45

That these functions should made to fail rather than succeed in their broken state.

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

10 years agosyscall: add source-specific multicast socket options for FreeBSD
Mikio Hara [Mon, 23 Jun 2014 22:03:44 +0000 (07:03 +0900)]
syscall: add source-specific multicast socket options for FreeBSD

Update #8266

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

10 years agoruntime: speed up amd64 memmove
Rui Ueyama [Mon, 23 Jun 2014 19:06:26 +0000 (12:06 -0700)]
runtime: speed up amd64 memmove

MOV with SSE registers seems faster than REP MOVSQ if the
size being copied is less than about 2K. Previously we
didn't use MOV if the memory region is larger than 256
byte. This patch improves the performance of 257 ~ 2048
byte non-overlapping copy by using MOV.

Here is the benchmark result on Intel Xeon 3.5GHz (Nehalem).

benchmark               old ns/op    new ns/op    delta
BenchmarkMemmove16              4            4   +0.42%
BenchmarkMemmove32              5            5   -0.20%
BenchmarkMemmove64              6            6   -0.81%
BenchmarkMemmove128             7            7   -0.82%
BenchmarkMemmove256            10           10   +1.92%
BenchmarkMemmove512            29           16  -44.90%
BenchmarkMemmove1024           37           25  -31.55%
BenchmarkMemmove2048           55           44  -19.46%
BenchmarkMemmove4096           92           91   -0.76%

benchmark                old MB/s     new MB/s  speedup
BenchmarkMemmove16        3370.61      3356.88    1.00x
BenchmarkMemmove32        6368.68      6386.99    1.00x
BenchmarkMemmove64       10367.37     10462.62    1.01x
BenchmarkMemmove128      17551.16     17713.48    1.01x
BenchmarkMemmove256      24692.81     24142.99    0.98x
BenchmarkMemmove512      17428.70     31687.72    1.82x
BenchmarkMemmove1024     27401.82     40009.45    1.46x
BenchmarkMemmove2048     36884.86     45766.98    1.24x
BenchmarkMemmove4096     44295.91     44627.86    1.01x

LGTM=khr
R=golang-codereviews, gobot, khr
CC=golang-codereviews
https://golang.org/cl/90500043

10 years agosyscall: consolidate, simplify socket options for Unix-like systems
Mikio Hara [Mon, 23 Jun 2014 09:46:01 +0000 (18:46 +0900)]
syscall: consolidate, simplify socket options for Unix-like systems

Also exposes common socket option functions on Solaris.

Update #7174
Update #7175

LGTM=aram
R=golang-codereviews, aram
CC=golang-codereviews
https://golang.org/cl/107280044

10 years agosyscall: don't display syscall prototype lines on godoc
Mikio Hara [Mon, 23 Jun 2014 05:33:33 +0000 (14:33 +0900)]
syscall: don't display syscall prototype lines on godoc

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

10 years agoimage/png: remove unnecessary function call
Rui Ueyama [Mon, 23 Jun 2014 00:29:56 +0000 (10:29 +1000)]
image/png: remove unnecessary function call

paeth(0, x, 0) == x for any uint8 value.

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

10 years agoundo CL 101330053 / c19c9a063fe8
Rui Ueyama [Sun, 22 Jun 2014 22:26:30 +0000 (15:26 -0700)]
undo CL 101330053 / c19c9a063fe8

sync.Pool is not supposed to be used everywhere, but is
a last resort.

««« original CL description
strings: use sync.Pool to cache buffer

benchmark                         old ns/op    new ns/op    delta
BenchmarkByteReplacerWriteString       3596         3094  -13.96%

benchmark                        old allocs   new allocs    delta
BenchmarkByteReplacerWriteString          1            0  -100.00%

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

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

10 years agotest: add test case for issue 8074.
Dave Cheney [Sun, 22 Jun 2014 07:33:00 +0000 (17:33 +1000)]
test: add test case for issue 8074.

Fixes #8074.

The issue was not reproduceable by revision

go version devel +e0ad7e329637 Thu Jun 19 22:19:56 2014 -0700 linux/arm

But include the original test case in case the issue reopens itself.

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

10 years agostrings: use sync.Pool to cache buffer
Rui Ueyama [Sun, 22 Jun 2014 05:08:43 +0000 (22:08 -0700)]
strings: use sync.Pool to cache buffer

benchmark                         old ns/op    new ns/op    delta
BenchmarkByteReplacerWriteString       3596         3094  -13.96%

benchmark                        old allocs   new allocs    delta
BenchmarkByteReplacerWriteString          1            0  -100.00%

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

10 years agodoc: say that race detector is supported on freebsd
Dmitriy Vyukov [Sat, 21 Jun 2014 16:19:49 +0000 (20:19 +0400)]
doc: say that race detector is supported on freebsd

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

10 years agodoc: say that race detector is supported on freebsd
Dmitriy Vyukov [Sat, 21 Jun 2014 16:19:32 +0000 (20:19 +0400)]
doc: say that race detector is supported on freebsd

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

10 years agorun.bash: run race tests on freebsd
Dmitriy Vyukov [Sat, 21 Jun 2014 00:54:18 +0000 (20:54 -0400)]
run.bash: run race tests on freebsd

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

10 years agoruntime/race: support freebsd
Dmitriy Vyukov [Sat, 21 Jun 2014 00:20:56 +0000 (20:20 -0400)]
runtime/race: support freebsd
All tests pass except one test in regexp package.

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

10 years agoruntime/race: update linux runtime
Dmitriy Vyukov [Fri, 20 Jun 2014 23:54:16 +0000 (03:54 +0400)]
runtime/race: update linux runtime
It was built on an old, bogus revision.

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

10 years agoruntime/race: update runtime to tip
Dmitriy Vyukov [Fri, 20 Jun 2014 23:36:21 +0000 (16:36 -0700)]
runtime/race: update runtime to tip
This requires minimal changes to the runtime hooks. In particular,
synchronization events must be done only on valid addresses now,
so I've added the additional checks to race.c.

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

10 years agostrings: speed up byteReplacer.Replace
Rui Ueyama [Fri, 20 Jun 2014 19:18:33 +0000 (12:18 -0700)]
strings: speed up byteReplacer.Replace

benchmark                         old ns/op    new ns/op    delta
BenchmarkByteReplacerWriteString       7359         3661  -50.25%

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

10 years agosync: detect incorrect usages of RWMutex
Dmitriy Vyukov [Fri, 20 Jun 2014 05:19:56 +0000 (22:19 -0700)]
sync: detect incorrect usages of RWMutex
Fixes #7858.

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

10 years agonet: simplify code
Dmitriy Vyukov [Fri, 20 Jun 2014 05:04:37 +0000 (22:04 -0700)]
net: simplify code
Single-case select with a non-nil channel is pointless.

LGTM=mikioh.mikioh
R=mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/103920044

10 years agoruntime: remove obsolete afterprologue check
Dmitriy Vyukov [Fri, 20 Jun 2014 05:04:10 +0000 (22:04 -0700)]
runtime: remove obsolete afterprologue check
Afterprologue check was required when did not know
about return arguments of functions and/or they were not zeroed.
Now 100% precision is required for stacks due to stack copying,
so it must work w/o afterprologue one way or another.
I can limit this change for 1.3 to merely adding a TODO,
but this check is super confusing so I don't want this knowledge to get lost.

LGTM=rsc
R=golang-codereviews, gobot, rsc, khr
CC=golang-codereviews, khr, rsc
https://golang.org/cl/96580045

10 years agostrings: define byteBitmap.isSet
Rui Ueyama [Fri, 20 Jun 2014 03:10:55 +0000 (20:10 -0700)]
strings: define byteBitmap.isSet

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

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