]> Cypherpunks repositories - gostls13.git/log
gostls13.git
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

12 years agonet/http: new server-only, single-connection keep-alive benchmark
Brad Fitzpatrick [Wed, 27 Mar 2013 20:35:41 +0000 (13:35 -0700)]
net/http: new server-only, single-connection keep-alive benchmark

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

12 years agocmd/ld: emit TLS relocations during external linking
Ian Lance Taylor [Wed, 27 Mar 2013 20:27:35 +0000 (13:27 -0700)]
cmd/ld: emit TLS relocations during external linking

This CL was written by rsc.  I just tweaked 8l.

This CL adds TLS relocation to the ELF .o file we write during external linking,
so that the host linker (gcc) can decide the final location of m and g.

Similar relocations are not necessary on OS X because we use an alternate
program start-time mechanism to acquire thread-local storage.

Similar relocations are not necessary on ARM or Plan 9 or Windows
because external linking mode is not yet supported on those systems.

On almost all ELF systems, the references we use are like %fs:-0x4 or %gs:-0x4,
which we write in 6a/8a as -0x4(FS) or -0x4(GS). On Linux/ELF, however,
Xen's lack of support for this mode forced us long ago to use a two-instruction
sequence: first we load %gs:0x0 into a register r, and then we use -0x4(r).
(The ELF program loader arranges that %gs:0x0 contains a regular pointer to
that same memory location.) In order to relocate those -0x4(r) references,
the linker must know where they are. This CL adds the equivalent notation
-0x4(r)(GS*1) for this purpose: it assembles to the same encoding as -0x4(r)
but the (GS*1) indicates to the linker that this is one of those thread-local
references that needs relocation.

Thanks to Elias Naur for reminding me about this missing piece and
also for writing the test.

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

12 years agoruntime/race: mark failing test as such.
Rémy Oudompheng [Wed, 27 Mar 2013 20:15:05 +0000 (21:15 +0100)]
runtime/race: mark failing test as such.

Fixes race builder.

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

12 years agocmd/gc: fix race instrumentation of append and type switches.
Rémy Oudompheng [Wed, 27 Mar 2013 19:33:17 +0000 (20:33 +0100)]
cmd/gc: fix race instrumentation of append and type switches.

The remaining issues are about runtime and sync package
instrumentation.

Update #4228

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

12 years agodoc: fix go1.1.html typos
Jonathan Rudenberg [Wed, 27 Mar 2013 18:09:14 +0000 (11:09 -0700)]
doc: fix go1.1.html typos

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

12 years agonet/http: improve test leak checker flakiness
Brad Fitzpatrick [Wed, 27 Mar 2013 17:07:22 +0000 (10:07 -0700)]
net/http: improve test leak checker flakiness

And make it have more useful output on failure.

Update #5005

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

12 years agolibmach: respect symbol table boundaries
Anthony Martin [Wed, 27 Mar 2013 12:59:06 +0000 (05:59 -0700)]
libmach: respect symbol table boundaries

Since fp->symsz includes the size of the header
in the new symbol table format, we were reading
past the end and decoding a few garbage symbols
from data in the pc/line table.

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

12 years agonet/textproto: add "Cookie" to the common headers list
Brad Fitzpatrick [Wed, 27 Mar 2013 06:08:08 +0000 (23:08 -0700)]
net/textproto: add "Cookie" to the common headers list

Seems to have been omitted before.

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

12 years agogodoc: pass *PageInfos instead of *token.FileSets in templates
Robert Griesemer [Wed, 27 Mar 2013 01:28:16 +0000 (18:28 -0700)]
godoc: pass *PageInfos instead of *token.FileSets in templates

- convert all formatters that require a *token.FileSet to
  consistenly use a *PageInfo as first argument instead
- adjust templates correspondingly
- fix outstanding bug from previous CL 8005044

Going forward, with this change the affected functions have
access to the full page "context" (PageInfo), not just the
respective file set. This will permit better context-dependent
formatting in the future.

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

12 years agolib/codereview/codereview.py: fix crash when hg gofmt has no files
Rob Pike [Wed, 27 Mar 2013 00:32:22 +0000 (17:32 -0700)]
lib/codereview/codereview.py: fix crash when hg gofmt has no files
The gofmt function was returning a string, which isn't the right type.
Three cheers for dynamic typing.

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

12 years agocmd/gc: enable racewalk of HMUL nodes.
Rémy Oudompheng [Tue, 26 Mar 2013 22:35:42 +0000 (23:35 +0100)]
cmd/gc: enable racewalk of HMUL nodes.

A HMUL node appears in some constant divisions, but
to observe a false negative in race detector the divisor must be
suitably chosen to make sure the only memory access is
done for HMUL.

R=dvyukov
CC=golang-dev
https://golang.org/cl/7935045

12 years agodoc: consistent path names in example
Dave Cheney [Tue, 26 Mar 2013 22:22:23 +0000 (09:22 +1100)]
doc: consistent path names in example

Always use /home/you for $HOME in examples.

Trivial enough that someone else can integrate this change if they are editing go1.1.html

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

12 years agopkg/runtime: ignore runtime.memlimit when allocating heap
Ian Lance Taylor [Tue, 26 Mar 2013 21:01:12 +0000 (14:01 -0700)]
pkg/runtime: ignore runtime.memlimit when allocating heap

For Go 1.1, stop checking the rlimit, because it broke now
that mheap is allocated using SysAlloc.  See issue 5049.

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

12 years agogodoc: internal cleanup: remove a TODO
Robert Griesemer [Tue, 26 Mar 2013 20:12:38 +0000 (13:12 -0700)]
godoc: internal cleanup: remove a TODO

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

12 years agoreflect: add garbage collection info in ChanOf, MapOf, PtrTo, SliceOf
Russ Cox [Tue, 26 Mar 2013 18:50:29 +0000 (11:50 -0700)]
reflect: add garbage collection info in ChanOf, MapOf, PtrTo, SliceOf

ArrayOf will remain unexported (and therefore unused) for Go 1.1.

Fixes #4375.

R=0xe2.0x9a.0x9b, r, iant
CC=golang-dev
https://golang.org/cl/7716048