]> Cypherpunks repositories - gostls13.git/log
gostls13.git
12 years agobytes: don't leave mprotect-ed pages after unsafe test.
Rémy Oudompheng [Wed, 3 Apr 2013 15:30:20 +0000 (08:30 -0700)]
bytes: don't leave mprotect-ed pages after unsafe test.

Fixes inscrutable GC faults during testing.

R=golang-dev, bradfitz, dave, fullung
CC=golang-dev
https://golang.org/cl/8300044

12 years agogo/parser: ParseExpr must accept type expressions
Robert Griesemer [Wed, 3 Apr 2013 14:41:26 +0000 (07:41 -0700)]
go/parser: ParseExpr must accept type expressions

My old code was trying to be too smart.
Also: Slightly better error message format
for gofmt -r pattern errors.

Fixes #4406.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/8267045

12 years agoA+C: zorion arrizabalaga (individual CLA)
Andrew Gerrand [Wed, 3 Apr 2013 09:32:50 +0000 (20:32 +1100)]
A+C: zorion arrizabalaga (individual CLA)

Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/8305043

12 years agogo/build: disable cgo when cross compiling
Dave Cheney [Wed, 3 Apr 2013 08:13:37 +0000 (19:13 +1100)]
go/build: disable cgo when cross compiling

Fixes #5141.

R=golang-dev, minux.ma, ality, bradfitz
CC=golang-dev
https://golang.org/cl/8134043

12 years agocmd/gc: be more tolerant with recursive types when checking map types.
Rémy Oudompheng [Wed, 3 Apr 2013 06:18:30 +0000 (08:18 +0200)]
cmd/gc: be more tolerant with recursive types when checking map types.

A nested TFORW type would push algtype1 into an impossible case.

Fixes #5125.

R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/8213043

12 years agospec: Go has no 'reference types'
Robert Griesemer [Wed, 3 Apr 2013 06:17:37 +0000 (23:17 -0700)]
spec: Go has no 'reference types'

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8288044

12 years agodoc/go1.1.html: additional tweaks
Dave Cheney [Wed, 3 Apr 2013 05:49:17 +0000 (16:49 +1100)]
doc/go1.1.html: additional tweaks

R=r, adg, minux.ma
CC=golang-dev
https://golang.org/cl/8250043

12 years agodoc: add prominent download button to getting started page
Andrew Gerrand [Wed, 3 Apr 2013 04:59:17 +0000 (15:59 +1100)]
doc: add prominent download button to getting started page

Also remove the introduction, which says what the rest of the
page says anyway.

Fixes #5182.

R=golang-dev, kamil.kisiel, r
CC=golang-dev
https://golang.org/cl/8281044

12 years agoruntime: avoid hashing strings until needed in single-bucket maps
Brad Fitzpatrick [Wed, 3 Apr 2013 03:58:25 +0000 (20:58 -0700)]
runtime: avoid hashing strings until needed in single-bucket maps

This changes the map lookup behavior for string maps with 2-8 keys.

There was already previously a fastpath for 0 items and 1 item.

Now, if a string-keyed map has <= 8 items, first check all the
keys for length first. If only one has the right length, then
just check it for equality and avoid hashing altogether. Once
the map has more than 8 items, always hash like normal.

I don't know why some of the other non-string map benchmarks
got faster. This was with benchtime=2s, multiple times. I haven't
anything else getting slower, though.

benchmark                             old ns/op    new ns/op    delta
BenchmarkHashStringSpeed                     37           34   -8.20%
BenchmarkHashInt32Speed                      32           29  -10.67%
BenchmarkHashInt64Speed                      31           27  -12.82%
BenchmarkHashStringArraySpeed               105           99   -5.43%
BenchmarkMegMap                          274206       255153   -6.95%
BenchmarkMegOneMap                           27           23  -14.80%
BenchmarkMegEqMap                        148332       116089  -21.74%
BenchmarkMegEmptyMap                          4            3  -12.72%
BenchmarkSmallStrMap                         22           22   -0.89%
BenchmarkMapStringKeysEight_32               42           23  -43.71%
BenchmarkMapStringKeysEight_64               55           23  -56.96%
BenchmarkMapStringKeysEight_1M           279688           24  -99.99%
BenchmarkIntMap                              16           15  -10.18%
BenchmarkRepeatedLookupStrMapKey32           40           37   -8.15%
BenchmarkRepeatedLookupStrMapKey1M       287918       272980   -5.19%
BenchmarkNewEmptyMap                        156          130  -16.67%

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/7641057

12 years agoruntime: new map tests and benchmarks
Brad Fitzpatrick [Wed, 3 Apr 2013 00:55:49 +0000 (17:55 -0700)]
runtime: new map tests and benchmarks

Also, move an existing benchmark from map_test.go to
mapspeed_test.go.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/8294043

12 years agolib/time: update time zone to IANA version 2013b
Rob Pike [Tue, 2 Apr 2013 23:49:45 +0000 (16:49 -0700)]
lib/time: update time zone to IANA version 2013b
Update #4553.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8293043

12 years agonet/http: fewer allocations in chunkWriter.WriteHeader
Brad Fitzpatrick [Tue, 2 Apr 2013 23:27:23 +0000 (16:27 -0700)]
net/http: fewer allocations in chunkWriter.WriteHeader

It was unnecessarily cloning and then mutating a map that had
a very short lifetime (just that function).

No new tests, because they were added in revision 833bf2ef1527
(TestHeaderToWire). The benchmarks below are from the earlier
commit, revision 52e3407d.

I noticed this inefficiency when reviewing a change Peter Buhr
is looking into, which will also use these benchmarks.

benchmark                         old ns/op    new ns/op    delta
BenchmarkServerHandlerTypeLen         12547        12325   -1.77%
BenchmarkServerHandlerNoLen           12466        11167  -10.42%
BenchmarkServerHandlerNoType          12699        11800   -7.08%
BenchmarkServerHandlerNoHeader        11901         9210  -22.61%

benchmark                        old allocs   new allocs    delta
BenchmarkServerHandlerTypeLen            21           20   -4.76%
BenchmarkServerHandlerNoLen              20           18  -10.00%
BenchmarkServerHandlerNoType             20           18  -10.00%
BenchmarkServerHandlerNoHeader           17           13  -23.53%

benchmark                         old bytes    new bytes    delta
BenchmarkServerHandlerTypeLen          1930         1913   -0.88%
BenchmarkServerHandlerNoLen            1912         1879   -1.73%
BenchmarkServerHandlerNoType           1912         1878   -1.78%
BenchmarkServerHandlerNoHeader         1491         1086  -27.16%

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/8268046

12 years agoruntime: Implement faster equals for strings and bytes.
Keith Randall [Tue, 2 Apr 2013 23:26:15 +0000 (16:26 -0700)]
runtime: Implement faster equals for strings and bytes.

(amd64)
benchmark           old ns/op    new ns/op    delta
BenchmarkEqual0            16            6  -63.15%
BenchmarkEqual9            22            7  -65.37%
BenchmarkEqual32           36            9  -74.91%
BenchmarkEqual4K         2187          120  -94.51%

benchmark            old MB/s     new MB/s  speedup
BenchmarkEqual9        392.22      1134.38    2.89x
BenchmarkEqual32       866.72      3457.39    3.99x
BenchmarkEqual4K      1872.73     33998.87   18.15x

(386)
benchmark           old ns/op    new ns/op    delta
BenchmarkEqual0            16            5  -63.85%
BenchmarkEqual9            22            7  -67.84%
BenchmarkEqual32           34           12  -64.94%
BenchmarkEqual4K         2196          113  -94.85%

benchmark            old MB/s     new MB/s  speedup
BenchmarkEqual9        405.81      1260.18    3.11x
BenchmarkEqual32       919.55      2631.21    2.86x
BenchmarkEqual4K      1864.85     36072.54   19.34x

Update #3751

R=bradfitz, r, khr, dave, remyoudompheng, fullung, minux.ma, ality
CC=golang-dev
https://golang.org/cl/8056043

12 years agonet/http: new server Handler benchmarks
Brad Fitzpatrick [Tue, 2 Apr 2013 22:42:06 +0000 (15:42 -0700)]
net/http: new server Handler benchmarks

For all the Content-Type & Content-Length cases.

R=golang-dev, pabuhr
CC=golang-dev
https://golang.org/cl/8280046

12 years agocmd/gc: preserve safe annotation of package def.
David Symonds [Tue, 2 Apr 2013 21:26:08 +0000 (08:26 +1100)]
cmd/gc: preserve safe annotation of package def.

A package file may begin as either "package foo" or
"package foo safe". The latter is relevant when using -u.
https://golang.org/cl/6903059 resulted in the distinction
being dropped when a package was read for the second or later time.
This CL records whether that "safe" tag was present,
and includes it in the dummy statement generated for the lexer.

R=golang-dev, r, minux.ma, daniel.morsing, iant
CC=golang-dev
https://golang.org/cl/8255044

12 years agoruntime: fix a comment regarding default floating point precision
Carl Shapiro [Tue, 2 Apr 2013 20:45:56 +0000 (13:45 -0700)]
runtime: fix a comment regarding default floating point precision

The expected precision setting for the x87 on Win32 is 53-bit
but MinGW resets the floating point unit to 64-bit.  Win32
object code generally expects values to be rounded to double,
not double extended, precision.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/8175044

12 years agonet: delete DialOpt and DialOption; add struct Dialer
Brad Fitzpatrick [Tue, 2 Apr 2013 20:24:16 +0000 (13:24 -0700)]
net: delete DialOpt and DialOption; add struct Dialer

Per discussions on golang-nuts and golang-dev:
"Some concerns with DialOpt"
https://groups.google.com/d/msg/golang-nuts/Hfh9aqhXyUw/W3uYi8lOdKcJ
https://groups.google.com/d/msg/golang-dev/37omSQeWv4Y/KASGIfPpXh0J

R=golang-dev, google, r
CC=golang-dev
https://golang.org/cl/8274043

12 years agocmd/gofmt: handle ... in rewrite of calls
Robert Griesemer [Tue, 2 Apr 2013 20:18:32 +0000 (13:18 -0700)]
cmd/gofmt: handle ... in rewrite of calls

Fixes #5059.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8284043

12 years agocmd/go: fix typo in docs
Shenghou Ma [Tue, 2 Apr 2013 19:34:04 +0000 (03:34 +0800)]
cmd/go: fix typo in docs
Fixes #5181.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8277043

12 years agonet/http: remove useless named result arguments in type
Brad Fitzpatrick [Tue, 2 Apr 2013 19:12:16 +0000 (12:12 -0700)]
net/http: remove useless named result arguments in type

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/8276043

12 years agocmd/godoc: don't linkify index entries
Robert Griesemer [Tue, 2 Apr 2013 19:05:14 +0000 (12:05 -0700)]
cmd/godoc: don't linkify index entries

Fixes #5186.

R=bradfitz
CC=golang-dev
https://golang.org/cl/8267044

12 years agosort: be consistent when describing "less: function in the multiKeys example
Rob Pike [Tue, 2 Apr 2013 17:25:02 +0000 (10:25 -0700)]
sort: be consistent when describing "less: function in the multiKeys example
s/ordering/less/g

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8267043

12 years agosort: new example: programmatic sort by multiple keys
Rob Pike [Tue, 2 Apr 2013 16:35:30 +0000 (09:35 -0700)]
sort: new example: programmatic sort by multiple keys
Demonstrates one way to sort a slice of structs according
to different sort criteria, done in sequence.

One possible answer to a question that comes up often.

R=golang-dev, gri, bradfitz, adg, adg, rogpeppe
CC=golang-dev
https://golang.org/cl/8182044

12 years agocompress/gzip: add Writer.Flush to call flate.Writer's Flush
Brad Fitzpatrick [Tue, 2 Apr 2013 16:07:43 +0000 (09:07 -0700)]
compress/gzip: add Writer.Flush to call flate.Writer's Flush

From a discussion on golang-nuts.

R=golang-dev, dsymonds, nigeltao, coocood, adg
CC=golang-dev
https://golang.org/cl/8251043

12 years agocmd/gc: recognize (a.b[0]<<1 | a.b[0]>>31) as a rotate, not just
Nigel Tao [Tue, 2 Apr 2013 10:14:34 +0000 (21:14 +1100)]
cmd/gc: recognize (a.b[0]<<1 | a.b[0]>>31) as a rotate, not just
(x<<1 | x>>31).

Fixes #5084.

On the SHA3 benchmark proposals at
https://golang.org/cl/7760044/

benchmark                       old ns/op    new ns/op    delta
BenchmarkPermutationFunction         1288         1191   -7.53%
BenchmarkSingleByteWrite             5795         5811   +0.28%
BenchmarkBlockWrite512                178          179   +0.56%
BenchmarkBlockWrite384                230          233   +1.30%
BenchmarkBlockWrite256                282          286   +1.42%
BenchmarkBlockWrite224                301          306   +1.66%
BenchmarkBulkHashSHA3_512          326885       304548   -6.83%
BenchmarkBulkHashSHA3_384          234839       220074   -6.29%
BenchmarkBulkHashSHA3_256          186969       175790   -5.98%
BenchmarkBulkHashSHA3_224          178133       167489   -5.98%

For a function like

func g() {
        x = a[3]<<20 | a[3]>>12
}

the asm goes from

0006 (main.go:10) TEXT    g+0(SB),$0-0
0007 (main.go:10) MOVL    a+12(SB),BP
0008 (main.go:10) LOCALS  ,$0
0009 (main.go:11) MOVL    BP,BX
0010 (main.go:11) SHLL    $20,BX
0011 (main.go:11) SHRL    $12,BP
0012 (main.go:11) ORL     BP,BX
0013 (main.go:11) MOVL    BX,x+0(SB)
0014 (main.go:12) RET     ,

to

0006 (main.go:10) TEXT    g+0(SB),$0-0
0007 (main.go:10) LOCALS  ,$0
0008 (main.go:11) MOVL    a+12(SB),BX
0009 (main.go:11) ROLL    $20,BX
0010 (main.go:11) MOVL    BX,x+0(SB)
0011 (main.go:12) RET     ,

R=rsc, iant, remyoudompheng
CC=golang-dev, jcb
https://golang.org/cl/7944043

12 years agodoc/go1.1.html: add a note about additional platforms
Dave Cheney [Tue, 2 Apr 2013 04:08:28 +0000 (15:08 +1100)]
doc/go1.1.html: add a note about additional platforms

Mention support for NetBSD, OpenBSD, and cgo for linux/arm.

R=golang-dev, dvyukov, r, minux.ma, adg, bradfitz, adg
CC=golang-dev
https://golang.org/cl/8152043

12 years agoruntime: make map reads multithreaded safe.
Keith Randall [Tue, 2 Apr 2013 01:59:58 +0000 (18:59 -0700)]
runtime: make map reads multithreaded safe.

Doing grow work on reads is not multithreaded safe.
Changed code to do grow work only on inserts & deletes.

This is a short-term fix, eventually we'll want to do
grow work in parallel to recover the space of the old
table.

Fixes #5120.

R=bradfitz, khr
CC=golang-dev
https://golang.org/cl/8242043

12 years agodoc/codewalk/markov: fix slice error in description
Rob Pike [Mon, 1 Apr 2013 22:52:15 +0000 (15:52 -0700)]
doc/codewalk/markov: fix slice error in description
Fixes #5176.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8118046

12 years agotesting: document that Log and Logf do not usually produce output
Rob Pike [Mon, 1 Apr 2013 22:17:00 +0000 (15:17 -0700)]
testing: document that Log and Logf do not usually produce output
The text is printed only if the test fails or -test.v is set.
Document this behavior in the testing package and 'go help test'.
Also put a 'go install' into mkdoc.sh so I don't get tricked by the
process of updating the documentation ever again.

Fixes #5174.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/8118047

12 years agocmd/godoc: better error message for missing index files
Robert Griesemer [Mon, 1 Apr 2013 22:15:02 +0000 (15:15 -0700)]
cmd/godoc: better error message for missing index files

Fixes #5024.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8222045

12 years agocmd/gc: use appropriate verb to print array type length.
Rémy Oudompheng [Mon, 1 Apr 2013 22:00:16 +0000 (00:00 +0200)]
cmd/gc: use appropriate verb to print array type length.

Fixes #4730.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8229043

12 years agosync/atomic: make unaligned 64-bit atomic operation panic on ARM
Shenghou Ma [Mon, 1 Apr 2013 21:34:03 +0000 (14:34 -0700)]
sync/atomic: make unaligned 64-bit atomic operation panic on ARM
use MOVW.NE instead of BEQ and MOVW.

R=golang-dev, dave, rsc, daniel.morsing
CC=golang-dev
https://golang.org/cl/7718043

12 years agocmd/cc/cc.h: Add a #pragma for %S used (only) in cmd/cc/sub.c.
Lucio De Re [Mon, 1 Apr 2013 21:21:15 +0000 (14:21 -0700)]
cmd/cc/cc.h: Add a #pragma for %S used (only) in cmd/cc/sub.c.
Eliminates a format consistency warning.

R=gloang-dev, r
CC=golang-dev
https://golang.org/cl/8217043

12 years agocmd/ld: add -extld and -extldflags options
Ian Lance Taylor [Mon, 1 Apr 2013 19:56:18 +0000 (12:56 -0700)]
cmd/ld: add -extld and -extldflags options

Permits specifying the linker to use, and trailing flags to
pass to that linker, when linking in external mode.  External
mode linking is used when building a package that uses cgo, as
described in the cgo docs.

Also document -linkmode and -tmpdir.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8225043

12 years agocmd/gc: do not reuse bool temporaries for composite equality.
Rémy Oudompheng [Mon, 1 Apr 2013 19:01:50 +0000 (21:01 +0200)]
cmd/gc: do not reuse bool temporaries for composite equality.

Reusing it when multiple comparisons occurred in the same
function call led to bad overwriting.

Fixes #5162.

R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/8174047

12 years agoruntime: add concurrent map read test
Brad Fitzpatrick [Mon, 1 Apr 2013 18:49:24 +0000 (11:49 -0700)]
runtime: add concurrent map read test

Currently crashes, so disabled.

Update #5179

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/8222044

12 years agocmd/go: prevent packages from being cleaned more than once
Lucio De Re [Mon, 1 Apr 2013 17:01:12 +0000 (10:01 -0700)]
cmd/go: prevent packages from being cleaned more than once

If a package was listed as a dependency from multiple places, it
could have been cleaned repeatedly.

R=golang-dev, dave, rsc, seed, bradfitz
CC=golang-dev, minux.ma
https://golang.org/cl/7482043

12 years agotesting: report test as failed if the test panics.
Ewan Chou [Mon, 1 Apr 2013 11:36:41 +0000 (22:36 +1100)]
testing: report test as failed if the test panics.

Fixes #5149.

R=golang-dev, dave, minux.ma
CC=golang-dev
https://golang.org/cl/8136043

12 years agolib9/utf: Remove superfluous header inclusion.
Lucio De Re [Sun, 31 Mar 2013 19:28:22 +0000 (12:28 -0700)]
lib9/utf: Remove superfluous header inclusion.

<stdint.h> does not seem to be needed.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8178044

12 years agonet: update documentation for UnixConn, UnixListener and related stuff
Mikio Hara [Sun, 31 Mar 2013 07:48:18 +0000 (16:48 +0900)]
net: update documentation for UnixConn, UnixListener and related stuff

Closes the API documentation gap between platforms.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8063044

12 years agonet: update documentation for UDPConn and related stuff
Mikio Hara [Sun, 31 Mar 2013 07:47:54 +0000 (16:47 +0900)]
net: update documentation for UDPConn and related stuff

Closes the API documentation gap between platforms.
Also makes the code textual representation same between platforms.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8148043

12 years agonet: update documentation for TCPConn, TCPListener and related stuff
Mikio Hara [Sun, 31 Mar 2013 07:47:26 +0000 (16:47 +0900)]
net: update documentation for TCPConn, TCPListener and related stuff

Closes the API documentation gap between platforms.
Also makes the code textual representation same between platforms.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8147043

12 years agonet: update documentation for IPConn and related stuff
Mikio Hara [Sun, 31 Mar 2013 07:46:59 +0000 (16:46 +0900)]
net: update documentation for IPConn and related stuff

Closes the API documentation gap between platforms.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8143044

12 years agonet/http: Transport: be paranoid about any non-100 1xx response
Brad Fitzpatrick [Sun, 31 Mar 2013 05:59:08 +0000 (22:59 -0700)]
net/http: Transport: be paranoid about any non-100 1xx response

Since we can't properly handle anything except 100, treat all
1xx informational responses as sketchy and don't reuse the
connection for future requests.

The only other 1xx response code currently in use in the wild
is WebSockets' use of "101 Switching Protocols", but our
code.google.com/p/go.net/websockets doesn't use Client or
Transport: it uses ReadResponse directly, so is unaffected by
this CL.  (and its tests still pass)

So this CL is entirely just future-proofing paranoia.
Also: the Internet is weird.

Update #2184
Update #3665

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/8208043

12 years agoruntime: TestGcSys: if GOGC=off, skip instead of failing
Albert Strasheim [Sat, 30 Mar 2013 22:10:53 +0000 (15:10 -0700)]
runtime: TestGcSys: if GOGC=off, skip instead of failing

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8201043

12 years agonet/http: fix incredibly racy TestTransportReading100Continue
Brad Fitzpatrick [Sat, 30 Mar 2013 18:18:56 +0000 (11:18 -0700)]
net/http: fix incredibly racy TestTransportReading100Continue

Whoops. I'm surprised it even worked before. (Need two pipes,
not one.)

Also, remove the whole pipe registration business, since it
wasn't even required in the previous version. (I'd later fixed
it at the end of send100Response, but forgot to delete it)

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8191044

12 years agodoc/go1.1: mention (*testing.B).ReportAllocs()
Shenghou Ma [Sat, 30 Mar 2013 18:17:25 +0000 (02:17 +0800)]
doc/go1.1: mention (*testing.B).ReportAllocs()

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8198043

12 years agonet/textproto: report allocs in benchmarks
Brad Fitzpatrick [Sat, 30 Mar 2013 17:52:22 +0000 (10:52 -0700)]
net/textproto: report allocs in benchmarks

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/8187045

12 years agomisc/emacs: Enable compilation-mode for gofmt error buffer before displaying it.
Dominik Honnef [Sat, 30 Mar 2013 16:54:08 +0000 (09:54 -0700)]
misc/emacs: Enable compilation-mode for gofmt error buffer before displaying it.

Some packages, like popwin.el, change display behaviour based on
the buffer's mode, so we should enable compilation-mode before
displaying the buffer.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8155043

12 years agocmd/gc, cmd/ld: fix warnings on Plan 9
David du Colombier [Sat, 30 Mar 2013 16:44:52 +0000 (09:44 -0700)]
cmd/gc, cmd/ld: fix warnings on Plan 9

src/cmd/gc/closure.c:133 param declared and not used: nowrap
src/cmd/gc/const.c:1139 set and not used: t1
src/cmd/ld/data.c:652 format mismatch #llx INT, arg 7
src/cmd/ld/data.c:652 format mismatch #llx INT, arg 8
src/cmd/ld/data.c:1230 set and not used: datsize

R=dave, golang-dev, lucio.dere, remyoudompheng, bradfitz
CC=golang-dev
https://golang.org/cl/8182043

12 years agocmd/6g: fix warnings on Plan 9
David du Colombier [Sat, 30 Mar 2013 16:31:49 +0000 (09:31 -0700)]
cmd/6g: fix warnings on Plan 9

src/cmd/6g/peep.c:471 set and not used: r
src/cmd/6g/peep.c:560 overspecified class: regconsttyp GLOBL STATIC
src/cmd/6g/peep.c:761 more arguments than format IND STRUCT Prog
src/cmd/6g/reg.c:185 set and not used: r1
src/cmd/6g/reg.c:786 format mismatch d VLONG, arg 3
src/cmd/6g/reg.c:1064 format mismatch d VLONG, arg 5

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8197044

12 years agoos/exec, syscall: fix tests to pass when GOGCTRACE=1 is set
Albert Strasheim [Sat, 30 Mar 2013 16:22:11 +0000 (09:22 -0700)]
os/exec, syscall: fix tests to pass when GOGCTRACE=1 is set

R=golang-dev, bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/8193043

12 years agoinclude/plan9/libc.h: fix Plan 9 build
David du Colombier [Sat, 30 Mar 2013 11:05:00 +0000 (19:05 +0800)]
include/plan9/libc.h: fix Plan 9 build

Add missing getgoextlinkenabled(void) declaration
in Plan 9 libc.h. This function was added as part
of CL #8183043.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/8191043

12 years agomisc/cgo/gmp: fix typo.
Andrey Mirtchovski [Sat, 30 Mar 2013 11:02:14 +0000 (19:02 +0800)]
misc/cgo/gmp: fix typo.

R=golang-dev, minux
CC=golang-dev
https://golang.org/cl/8174045

12 years agonet: avoid use of listener socket options on active open sockets
Mikio Hara [Sat, 30 Mar 2013 06:21:22 +0000 (15:21 +0900)]
net: avoid use of listener socket options on active open sockets

This CL ensures we use the correct socket options for
passive and active open sockets.

For the passive open sockets created by Listen functions,
additional SO_REUSEADDR, SO_REUSEPORT options are required
for the quick service restart and/or multicasting.

For the active open sockets created by Dial functions, no
additional options are required.

R=golang-dev, dave, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7795050

12 years agomisc/dashboard/codereview: add Rémy to the list of assignees
Dave Cheney [Sat, 30 Mar 2013 04:53:44 +0000 (15:53 +1100)]
misc/dashboard/codereview: add Rémy to the list of assignees

R=dsymonds, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/8094047

12 years agonet/http: ignore 100-continue responses in Transport
Brad Fitzpatrick [Sat, 30 Mar 2013 03:25:11 +0000 (20:25 -0700)]
net/http: ignore 100-continue responses in Transport

"There are only two hard problems in computer science:
cache invalidation, naming things, and off-by-one errors."

The HTTP server code already strips Expect: 100-continue on
requests, so httputil.ReverseProxy should be unaffected, but
some servers send unsolicited HTTP/1.1 100 Continue responses,
so we need to skip over them if they're seen to avoid getting
off-by-one on Transport requests/responses.

This does change the behavior of people who were using Client
or Transport directly and explicitly setting "Expect: 100-continue"
themselves, but it didn't work before anyway. Now instead of the
user code seeing a 100 response and then things blowing up, now
it basically works, except the Transport will still blast away
the full request body immediately.  That's the part that needs
to be finished to close this issue.

This is the safe quick fix.

Update #3665

R=golang-dev, dsymonds, dave, jgrahamc
CC=golang-dev
https://golang.org/cl/8166045

12 years agocmd/dist, cmd/ld: GO_EXTLINK_ENABLED=0 defaults to -linkmode=internal
Ian Lance Taylor [Fri, 29 Mar 2013 23:33:35 +0000 (16:33 -0700)]
cmd/dist, cmd/ld: GO_EXTLINK_ENABLED=0 defaults to -linkmode=internal

Change build system to set GO_EXTLINK_ENABLED=0 by default for
OS X 10.6, since the system linker has a bug and can not
handle the object files generated by 6l.

Fixes #5130.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8183043

12 years agobytes: Benchmark Buffer's compactions
Robert Obryk [Fri, 29 Mar 2013 21:17:09 +0000 (14:17 -0700)]
bytes: Benchmark Buffer's compactions

This benchmark verifies that CL #8173043 reduces time spent
sliding the Buffer's contents.

Results without and with CL #8173043 applied:
benchmark                        old ns/op    new ns/op    delta
BenchmarkBufferFullSmallReads       755336       175054  -76.82%

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8174043

12 years agoA+C: Robert Obryk (individual CLA)
Brad Fitzpatrick [Fri, 29 Mar 2013 21:16:41 +0000 (14:16 -0700)]
A+C: Robert Obryk (individual CLA)

Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/8176043

12 years agobytes: document that Buffer.Write grows the buffer
Rob Pike [Fri, 29 Mar 2013 21:09:31 +0000 (14:09 -0700)]
bytes: document that Buffer.Write grows the buffer
Do a little reformatting too.
Fixes #5152.

R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/8157044

12 years agoruntime: additional map benchmarks for repeated lookups
Brad Fitzpatrick [Fri, 29 Mar 2013 20:50:44 +0000 (13:50 -0700)]
runtime: additional map benchmarks for repeated lookups

For the future.

Update #5147

R=khr, r
CC=golang-dev
https://golang.org/cl/8165044

12 years agobytes: don't compact Buffer so aggressively
Brad Fitzpatrick [Fri, 29 Mar 2013 20:49:14 +0000 (13:49 -0700)]
bytes: don't compact Buffer so aggressively

benchmark                           old ns/op    new ns/op    delta
BenchmarkBufferNotEmptyWriteRead       848416       819983   -3.35%

Update #5154

R=golang-dev, gri, robryk
CC=golang-dev
https://golang.org/cl/8173043

12 years agobytes: don't grow Buffer if capacity is available
Brad Fitzpatrick [Fri, 29 Mar 2013 19:39:19 +0000 (12:39 -0700)]
bytes: don't grow Buffer if capacity is available

Also added a new benchmark from the same test:

benchmark                           old ns/op    new ns/op    delta
BenchmarkBufferNotEmptyWriteRead      2643698       709189  -73.17%

Fixes #5154

R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/8164043

12 years agoruntime: fix gdb printing of maps
Keith Randall [Fri, 29 Mar 2013 18:04:07 +0000 (11:04 -0700)]
runtime: fix gdb printing of maps
Fixes #5098

R=minux.ma, bradfitz, khr, rsc
CC=golang-dev
https://golang.org/cl/7746045

12 years agodoc: fix typo in effective_go.html
Elias Naur [Fri, 29 Mar 2013 17:28:37 +0000 (10:28 -0700)]
doc: fix typo in effective_go.html

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7548045

12 years agonet/http: ignore more uninteresting goroutines
Brad Fitzpatrick [Fri, 29 Mar 2013 15:30:28 +0000 (08:30 -0700)]
net/http: ignore more uninteresting goroutines

These only show up if GOTRACEBACK=2

Update #5005

R=golang-dev, fullung
CC=golang-dev
https://golang.org/cl/8156044

12 years ago8a/8l: add PCMPEQB and PMOVMSKB to 386.
Keith Randall [Fri, 29 Mar 2013 07:34:03 +0000 (00:34 -0700)]
8a/8l: add PCMPEQB and PMOVMSKB to 386.

Used by CL 8056043 for fast string equals.

R=bradfitz
CC=golang-dev
https://golang.org/cl/8102044

12 years agoapi: remove Zone of net.IPNet from next.txt
Mikio Hara [Fri, 29 Mar 2013 06:07:38 +0000 (15:07 +0900)]
api: remove Zone of net.IPNet from next.txt

Update #4234.
Update #4501.

R=golang-dev, dave, bradfitz
CC=golang-dev
https://golang.org/cl/8129043

12 years agonet: close TCPListener in example
Mikio Hara [Fri, 29 Mar 2013 06:07:10 +0000 (15:07 +0900)]
net: close TCPListener in example

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/8073044

12 years agonet: update documentation for ListenTCP, ListenUDP
Mikio Hara [Fri, 29 Mar 2013 06:06:43 +0000 (15:06 +0900)]
net: update documentation for ListenTCP, ListenUDP

Adds the missing wildcard port assignment description to ListenUDP.
Also updates the wildcard port description on ListenTCP.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/8063043

12 years agonet: update documentation for FileConn, FilePacketConn, FileListener
Mikio Hara [Fri, 29 Mar 2013 03:16:24 +0000 (12:16 +0900)]
net: update documentation for FileConn, FilePacketConn, FileListener

Closes the API documentation gap between platforms.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8086043

12 years agonet: enable IPv6 tests on Windows
Mikio Hara [Fri, 29 Mar 2013 02:46:47 +0000 (11:46 +0900)]
net: enable IPv6 tests on Windows

Also removes redundant tests that run Go 1.0 non-IPv6 support
Windows code on IPv6 enabled Windows kernels.

R=alex.brainman, golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7812052

12 years agonet/http: unflake TestTransportConcurrency
Brad Fitzpatrick [Fri, 29 Mar 2013 01:36:06 +0000 (18:36 -0700)]
net/http: unflake TestTransportConcurrency

Fixes #5005

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8127043

12 years agogo/printer: use strings.Split instead of specialized code
Robert Griesemer [Thu, 28 Mar 2013 22:47:39 +0000 (15:47 -0700)]
go/printer: use strings.Split instead of specialized code

With the faster strings package, the difference between
the specialized code and strings.Split is in the noise:

benchmark         old ns/op    new ns/op    delta
BenchmarkPrint     16724291     16686729   -0.22%

(Measured on a Mac Pro, 2.8GHz Quad-core Intel Xeon,
4GB 800 MHz DDR2, Mac OS X 10.8.3)

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8100044

12 years agocmd/ld: only pass -rdynamic to host linker on ELF target
Ian Lance Taylor [Thu, 28 Mar 2013 22:04:25 +0000 (15:04 -0700)]
cmd/ld: only pass -rdynamic to host linker on ELF target

Fixes #5150.

R=golang-dev, franciscossouza
CC=golang-dev
https://golang.org/cl/8120043

12 years agonet/http: reuse textproto.Readers; remove 2 more allocations
Brad Fitzpatrick [Thu, 28 Mar 2013 21:51:21 +0000 (14:51 -0700)]
net/http: reuse textproto.Readers; remove 2 more allocations

Saves both the textproto.Reader allocation, and its internal
scratch buffer growing.

benchmark                                   old ns/op    new ns/op    delta
BenchmarkServerFakeConnWithKeepAliveLite        10324        10149   -1.70%

benchmark                                  old allocs   new allocs    delta
BenchmarkServerFakeConnWithKeepAliveLite           19           17  -10.53%

benchmark                                   old bytes    new bytes    delta
BenchmarkServerFakeConnWithKeepAliveLite         1559         1492   -4.30%

R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/8094046

12 years agocmd/godoc: provide a link from notes to source location
Robert Griesemer [Thu, 28 Mar 2013 21:40:59 +0000 (14:40 -0700)]
cmd/godoc: provide a link from notes to source location

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8122043

12 years agocmd/ld, runtime: restrict stack root scan to locals and arguments
Carl Shapiro [Thu, 28 Mar 2013 21:36:23 +0000 (14:36 -0700)]
cmd/ld, runtime: restrict stack root scan to locals and arguments

Updates #5134

R=golang-dev, bradfitz, cshapiro, daniel.morsing, ality, iant
CC=golang-dev
https://golang.org/cl/8022044

12 years agonet/http: parse Request-Line in a function, remove an allocation
Brad Fitzpatrick [Thu, 28 Mar 2013 21:19:51 +0000 (14:19 -0700)]
net/http: parse Request-Line in a function, remove an allocation

Removes another per-request allocation. Also makes the code more
readable, IMO. And more testable.

benchmark                                   old ns/op    new ns/op    delta
BenchmarkServerFakeConnWithKeepAliveLite        10539        10324   -2.04%

benchmark                                  old allocs   new allocs    delta
BenchmarkServerFakeConnWithKeepAliveLite           20           19   -5.00%

benchmark                                   old bytes    new bytes    delta
BenchmarkServerFakeConnWithKeepAliveLite         1609         1559   -3.11%

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/8118044

12 years agonet/url: use strings.Index instead of a loop
Brad Fitzpatrick [Thu, 28 Mar 2013 20:43:34 +0000 (13:43 -0700)]
net/url: use strings.Index instead of a loop

We already depend on strings in this file, so use it.

Plus strings.Index will be faster than a manual loop
once issue 3751 is finished.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/8116043

12 years agogo/doc: fix typo in comment
Robert Griesemer [Thu, 28 Mar 2013 20:13:55 +0000 (13:13 -0700)]
go/doc: fix typo in comment

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8113043

12 years agonet/http: inline chunkWriter in response
Brad Fitzpatrick [Thu, 28 Mar 2013 20:13:28 +0000 (13:13 -0700)]
net/http: inline chunkWriter in response

A chunkWriter and a response are 1:1. Make them contiguous in
memory and save an allocation.

benchmark                                   old ns/op    new ns/op    delta
BenchmarkServerFakeConnWithKeepAliveLite        10715        10539   -1.64%

benchmark                                  old allocs   new allocs    delta
BenchmarkServerFakeConnWithKeepAliveLite           21           20   -4.76%

benchmark                                   old bytes    new bytes    delta
BenchmarkServerFakeConnWithKeepAliveLite         1626         1609   -1.05%

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/8114043

12 years agonet/http: remove two more server allocations per-request
Brad Fitzpatrick [Thu, 28 Mar 2013 20:07:14 +0000 (13:07 -0700)]
net/http: remove two more server allocations per-request

benchmark                                   old ns/op    new ns/op    delta
BenchmarkServerFakeConnWithKeepAliveLite        11031        10689   -3.10%

benchmark                                  old allocs   new allocs    delta
BenchmarkServerFakeConnWithKeepAliveLite           23           21   -8.70%

benchmark                                   old bytes    new bytes    delta
BenchmarkServerFakeConnWithKeepAliveLite         1668         1626   -2.52%

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/8110044

12 years agocmd/godoc: cleanups
Robert Griesemer [Thu, 28 Mar 2013 20:05:30 +0000 (13:05 -0700)]
cmd/godoc: cleanups

- removed gratuitous empty lines that creeped into command line output
- changed comment color to a dark green so that links don't visually melt into them
- removed some TODOs
- updated doc.go

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8108044

12 years agonet/http: more tests, better comments, remove an allocation
Brad Fitzpatrick [Thu, 28 Mar 2013 18:35:24 +0000 (11:35 -0700)]
net/http: more tests, better comments, remove an allocation

Add more tests around the various orders handlers can access
and flush response headers.

Also clarify the documentation on fields of response and
chunkWriter.

While there, remove an allocation (a header clone) for simple
handlers.

benchmark                                   old ns/op    new ns/op    delta
BenchmarkServerFakeConnWithKeepAliveLite        15245        14966   -1.83%

benchmark                                  old allocs   new allocs    delta
BenchmarkServerFakeConnWithKeepAliveLite           24           23   -4.17%

benchmark                                   old bytes    new bytes    delta
BenchmarkServerFakeConnWithKeepAliveLite         1717         1668   -2.85%

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/8101043

12 years agocmd/ld: when using host linker pass -r option as -rpath
Ian Lance Taylor [Thu, 28 Mar 2013 16:37:32 +0000 (09:37 -0700)]
cmd/ld: when using host linker pass -r option as -rpath

R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/8070043

12 years agocmd/godoc: don't crash if there's no documentation
Robert Griesemer [Thu, 28 Mar 2013 15:46:17 +0000 (08:46 -0700)]
cmd/godoc: don't crash if there's no documentation

Fixes regression introduced by CL 7860049.

R=golang-dev, kamil.kisiel, dave
CC=golang-dev
https://golang.org/cl/8069044

12 years agovet: add a progress message to asmdecl.go
Rob Pike [Wed, 27 Mar 2013 23:55:16 +0000 (16:55 -0700)]
vet: add a progress message to asmdecl.go
Analogous to the one for .go files, it's for .s only and is protected
by the verbose flag.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8030046

12 years agotext/template: fix bug in evaluating a chain starting with a function.
Rob Pike [Wed, 27 Mar 2013 23:31:14 +0000 (16:31 -0700)]
text/template: fix bug in evaluating a chain starting with a function.

R=golang-dev, alberto.garcia.hierro
CC=golang-dev
https://golang.org/cl/7861046

12 years agovet: fix test_deadcode.go's tests
Rob Pike [Wed, 27 Mar 2013 23:30:20 +0000 (16:30 -0700)]
vet: fix test_deadcode.go's tests
This is a totally mechanical change.
Errors are reported for the beginning of the statement, not the end,
so the errchk markers need to be on the opening brace, not the closing
one. It seems this test was never run.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7746050

12 years agocmd/vet: fix assembly test files
Rob Pike [Wed, 27 Mar 2013 23:29:12 +0000 (16:29 -0700)]
cmd/vet: fix assembly test files
They should be build-tagged for vet_test not ignore,
and not have a Go package clause.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8016047

12 years agoruntime: allocate maps' first bucket table lazily
Brad Fitzpatrick [Wed, 27 Mar 2013 23:28:51 +0000 (16:28 -0700)]
runtime: allocate maps' first bucket table lazily

Motivated by garbage profiling in HTTP benchmarks. This
changes means new empty maps are just one small allocation
(the HMap) instead the HMap + the relatively larger h->buckets
allocation. This helps maps which remain empty throughout
their life.

benchmark               old ns/op    new ns/op    delta
BenchmarkNewEmptyMap          196          107  -45.41%

benchmark              old allocs   new allocs    delta
BenchmarkNewEmptyMap            2            1  -50.00%

benchmark               old bytes    new bytes    delta
BenchmarkNewEmptyMap          195           50  -74.36%

R=khr, golang-dev, r
CC=golang-dev
https://golang.org/cl/7722046

12 years agocmd/ld: fix OpenBSD (third try)
Ian Lance Taylor [Wed, 27 Mar 2013 23:00:58 +0000 (16:00 -0700)]
cmd/ld: fix OpenBSD (third try)

On OpenBSD don't mark runtime.{g,m} as STT_TLS symbols.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7867046

12 years agofaq: update with some links and 1.1-specific details
Rob Pike [Wed, 27 Mar 2013 22:26:57 +0000 (15:26 -0700)]
faq: update with some links and 1.1-specific details

R=golang-dev, remyoudompheng, iant
CC=golang-dev
https://golang.org/cl/8038048

12 years agocmd/godoc: emit id's for constants and variables
Robert Griesemer [Wed, 27 Mar 2013 22:14:28 +0000 (15:14 -0700)]
cmd/godoc: emit id's for constants and variables

Fixes #5077.

R=r
CC=golang-dev
https://golang.org/cl/8021044

12 years agocmd/ld, cmd/8l: Fix OpenBSD build.
Ian Lance Taylor [Wed, 27 Mar 2013 22:00:11 +0000 (15:00 -0700)]
cmd/ld, cmd/8l: Fix OpenBSD build.

Don't generate TLS sections on OpenBSD.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8059043

12 years agocmd/6l: fix OpenBSD build
Ian Lance Taylor [Wed, 27 Mar 2013 21:32:51 +0000 (14:32 -0700)]
cmd/6l: fix OpenBSD build

Avoid generating TLS relocations on OpenBSD.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7641055

12 years agocmd/gc: update runtime.go for new map implementation.
Rémy Oudompheng [Wed, 27 Mar 2013 20:51:07 +0000 (21:51 +0100)]
cmd/gc: update runtime.go for new map implementation.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/8051044

12 years agonet/http: server optimization; reduce GCs, generate ~half the garbage
Brad Fitzpatrick [Wed, 27 Mar 2013 20:35:49 +0000 (13:35 -0700)]
net/http: server optimization; reduce GCs, generate ~half the garbage

There was another bufio.Writer not being reused, found with
GOGC=off and -test.memprofile.

benchmark                               old ns/op    new ns/op    delta
BenchmarkServerFakeConnWithKeepAlive        18270        16046  -12.17%

benchmark                              old allocs   new allocs    delta
BenchmarkServerFakeConnWithKeepAlive           38           36   -5.26%

benchmark                               old bytes    new bytes    delta
BenchmarkServerFakeConnWithKeepAlive         4598         2488  -45.89%

Update #5100

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/8038047