1
0
mirror of https://github.com/golang/go synced 2024-10-03 03:01:21 -06:00
Commit Graph

12373 Commits

Author SHA1 Message Date
Dave Cheney
949ae8cced go/build: disable cgo when cross compiling
Fixes #5141.

R=golang-dev, minux.ma, ality, bradfitz
CC=golang-dev
https://golang.org/cl/8134043
2013-04-03 19:13:37 +11:00
Rémy Oudompheng
4b6ca21271 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
2013-04-03 08:18:30 +02:00
Brad Fitzpatrick
45b54ee7fb 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
2013-04-02 20:58:25 -07:00
Brad Fitzpatrick
3b09ac57ac 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
2013-04-02 17:55:49 -07:00
Brad Fitzpatrick
babbd55e5d 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
2013-04-02 16:27:23 -07:00
Keith Randall
3d5daa2319 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
2013-04-02 16:26:15 -07:00
Brad Fitzpatrick
6ca1fa625c 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
2013-04-02 15:42:06 -07:00
David Symonds
389093feec 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
2013-04-03 08:26:08 +11:00
Carl Shapiro
019c8fc625 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
2013-04-02 13:45:56 -07:00
Brad Fitzpatrick
751a24e86e 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
2013-04-02 13:24:16 -07:00
Robert Griesemer
9115e411f5 cmd/gofmt: handle ... in rewrite of calls
Fixes #5059.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8284043
2013-04-02 13:18:32 -07:00
Shenghou Ma
c5d4196834 cmd/go: fix typo in docs
Fixes #5181.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8277043
2013-04-03 03:34:04 +08:00
Brad Fitzpatrick
5be0dad116 net/http: remove useless named result arguments in type
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/8276043
2013-04-02 12:12:16 -07:00
Robert Griesemer
79682199ce cmd/godoc: don't linkify index entries
Fixes #5186.

R=bradfitz
CC=golang-dev
https://golang.org/cl/8267044
2013-04-02 12:05:14 -07:00
Rob Pike
3a012c02ed 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
2013-04-02 10:25:02 -07:00
Rob Pike
15f276bc53 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
2013-04-02 09:35:30 -07:00
Brad Fitzpatrick
4432be3b28 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
2013-04-02 09:07:43 -07:00
Nigel Tao
4de6687554 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
2013-04-02 21:14:34 +11:00
Keith Randall
0e7144a875 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
2013-04-01 18:59:58 -07:00
Rob Pike
144dd2b21c 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
2013-04-01 15:17:00 -07:00
Robert Griesemer
a23dd4fe4e cmd/godoc: better error message for missing index files
Fixes #5024.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8222045
2013-04-01 15:15:02 -07:00
Rémy Oudompheng
119189c459 cmd/gc: use appropriate verb to print array type length.
Fixes #4730.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8229043
2013-04-02 00:00:16 +02:00
Shenghou Ma
94b7853924 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
2013-04-01 14:34:03 -07:00
Lucio De Re
3467068ef4 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
2013-04-01 14:21:15 -07:00
Ian Lance Taylor
9182c364aa 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
2013-04-01 12:56:18 -07:00
Rémy Oudompheng
df9f4f14b9 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
2013-04-01 21:01:50 +02:00
Brad Fitzpatrick
d76f28fc39 runtime: add concurrent map read test
Currently crashes, so disabled.

Update #5179

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/8222044
2013-04-01 11:49:24 -07:00
Lucio De Re
79a0c17012 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
2013-04-01 10:01:12 -07:00
Ewan Chou
174a17e3c6 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
2013-04-01 22:36:41 +11:00
Lucio De Re
e42bc0df87 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
2013-03-31 12:28:22 -07:00
Mikio Hara
8a448ef950 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
2013-03-31 16:48:18 +09:00
Mikio Hara
e2c453e7a7 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
2013-03-31 16:47:54 +09:00
Mikio Hara
f45339c1f3 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
2013-03-31 16:47:26 +09:00
Mikio Hara
32f88f4ea1 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
2013-03-31 16:46:59 +09:00
Brad Fitzpatrick
b80ce2034b 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
2013-03-30 22:59:08 -07:00
Albert Strasheim
59ae9d9ac9 runtime: TestGcSys: if GOGC=off, skip instead of failing
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8201043
2013-03-30 15:10:53 -07:00
Brad Fitzpatrick
ad7aa83020 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
2013-03-30 11:18:56 -07:00
Brad Fitzpatrick
9905446dc3 net/textproto: report allocs in benchmarks
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/8187045
2013-03-30 10:52:22 -07:00
David du Colombier
c2e06e0188 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
2013-03-30 09:44:52 -07:00
David du Colombier
3a14b42edf 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
2013-03-30 09:31:49 -07:00
Albert Strasheim
0399e76b66 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
2013-03-30 09:22:11 -07:00
Mikio Hara
4b7bf73c4b 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
2013-03-30 15:21:22 +09:00
Brad Fitzpatrick
a79df7bb20 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
2013-03-29 20:25:11 -07:00
Ian Lance Taylor
3197be4807 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
2013-03-29 16:33:35 -07:00
Robert Obryk
461e7b7d40 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
2013-03-29 14:17:09 -07:00
Rob Pike
0359af4fdb 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
2013-03-29 14:09:31 -07:00
Brad Fitzpatrick
ecdcec1df2 runtime: additional map benchmarks for repeated lookups
For the future.

Update #5147

R=khr, r
CC=golang-dev
https://golang.org/cl/8165044
2013-03-29 13:50:44 -07:00
Brad Fitzpatrick
43e38d5def 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
2013-03-29 13:49:14 -07:00
Brad Fitzpatrick
994f59666f 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
2013-03-29 12:39:19 -07:00
Keith Randall
fb3ed166e3 runtime: fix gdb printing of maps
Fixes #5098

R=minux.ma, bradfitz, khr, rsc
CC=golang-dev
https://golang.org/cl/7746045
2013-03-29 11:04:07 -07:00
Brad Fitzpatrick
df885e70d7 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
2013-03-29 08:30:28 -07:00
Keith Randall
871177df6a 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
2013-03-29 00:34:03 -07:00
Mikio Hara
66b797a4f9 net: close TCPListener in example
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/8073044
2013-03-29 15:07:10 +09:00
Mikio Hara
245dc62ca4 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
2013-03-29 15:06:43 +09:00
Mikio Hara
abccf6b692 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
2013-03-29 12:16:24 +09:00
Mikio Hara
0f9b3059bc 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
2013-03-29 11:46:47 +09:00
Brad Fitzpatrick
68130a07af net/http: unflake TestTransportConcurrency
Fixes #5005

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8127043
2013-03-28 18:36:06 -07:00
Robert Griesemer
f38811979c 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
2013-03-28 15:47:39 -07:00
Ian Lance Taylor
47ec6e23d2 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
2013-03-28 15:04:25 -07:00
Brad Fitzpatrick
1b0d04b89f 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
2013-03-28 14:51:21 -07:00
Robert Griesemer
f1b7c140ff cmd/godoc: provide a link from notes to source location
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8122043
2013-03-28 14:40:59 -07:00
Carl Shapiro
c676b8b27b 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
2013-03-28 14:36:23 -07:00
Brad Fitzpatrick
7e7f89933b 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
2013-03-28 14:19:51 -07:00
Brad Fitzpatrick
731dcb7680 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
2013-03-28 13:43:34 -07:00
Robert Griesemer
cb79b2cf22 go/doc: fix typo in comment
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8113043
2013-03-28 13:13:55 -07:00
Brad Fitzpatrick
a891484a4e 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
2013-03-28 13:13:28 -07:00
Brad Fitzpatrick
42a840860f 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
2013-03-28 13:07:14 -07:00
Robert Griesemer
04341b246e 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
2013-03-28 13:05:30 -07:00
Brad Fitzpatrick
972cb4b442 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
2013-03-28 11:35:24 -07:00
Ian Lance Taylor
8877a2dfee cmd/ld: when using host linker pass -r option as -rpath
R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/8070043
2013-03-28 09:37:32 -07:00
Robert Griesemer
1a427a697e 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
2013-03-28 08:46:17 -07:00
Rob Pike
ab962c8da2 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
2013-03-27 16:55:16 -07:00
Rob Pike
99645db926 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
2013-03-27 16:31:14 -07:00
Rob Pike
b06b77b8cf 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
2013-03-27 16:30:20 -07:00
Rob Pike
f3eaaa62a1 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
2013-03-27 16:29:12 -07:00
Brad Fitzpatrick
5b3ff61be6 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
2013-03-27 16:28:51 -07:00
Ian Lance Taylor
b735eeb323 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
2013-03-27 16:00:58 -07:00
Robert Griesemer
611e8dbf52 cmd/godoc: emit id's for constants and variables
Fixes #5077.

R=r
CC=golang-dev
https://golang.org/cl/8021044
2013-03-27 15:14:28 -07:00
Ian Lance Taylor
8d4f381f5c 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
2013-03-27 15:00:11 -07:00
Ian Lance Taylor
e7fc9a5c57 cmd/6l: fix OpenBSD build
Avoid generating TLS relocations on OpenBSD.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7641055
2013-03-27 14:32:51 -07:00
Rémy Oudompheng
e3b767a5a1 cmd/gc: update runtime.go for new map implementation.
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/8051044
2013-03-27 21:51:07 +01:00
Brad Fitzpatrick
393b3b1304 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
2013-03-27 13:35:49 -07:00
Brad Fitzpatrick
584a66b785 net/http: new server-only, single-connection keep-alive benchmark
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8046043
2013-03-27 13:35:41 -07:00
Ian Lance Taylor
30e29ee9b6 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
2013-03-27 13:27:35 -07:00
Rémy Oudompheng
23482db9f1 runtime/race: mark failing test as such.
Fixes race builder.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8055045
2013-03-27 21:15:05 +01:00
Rémy Oudompheng
7c79910cb9 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
2013-03-27 20:33:17 +01:00
Brad Fitzpatrick
40cd845eea 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
2013-03-27 10:07:22 -07:00
Anthony Martin
d1eb9c8e0d 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
2013-03-27 05:59:06 -07:00
Brad Fitzpatrick
8eaa942933 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
2013-03-26 23:08:08 -07:00
Robert Griesemer
12cf2ff00b 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
2013-03-26 18:28:16 -07:00
Rémy Oudompheng
5f9a9433ea 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
2013-03-26 23:35:42 +01:00
Ian Lance Taylor
515353a290 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
2013-03-26 14:01:12 -07:00
Robert Griesemer
2180506169 godoc: internal cleanup: remove a TODO
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8005044
2013-03-26 13:12:38 -07:00
Russ Cox
3660b532ac 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
2013-03-26 11:50:29 -07:00
Carl Shapiro
8480e6f476 runtime: ensure forward progress when unwinding an arm stack frame
The arm gentraceback mishandled frame linkage values pointing
to the assembly return function.  This function is special as
its frame size is zero and it contains only one instruction.
These conditions would preserve the frame pointer and result
in an off by one error when unwinding the caller.

Fixes #5124

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8023043
2013-03-26 11:43:09 -07:00
Robert Griesemer
7cfebf7b1d godoc: link identifiers to declarations
The changes are almost completely self-contained
in the new file linkify.go. The other changes are
minimal and should not disturb the currently
working godoc, in anticipation of Go 1.1.

To disable the feature in case of problems, set
-links=false.

Fixes #2063.

R=adg, r
CC=golang-dev
https://golang.org/cl/7883044
2013-03-26 11:14:30 -07:00
Rob Pike
02b7550817 builtin: add linkable-to declarations for iota and nil
Aids godoc.

R=golang-dev, gri, bradfitz
CC=golang-dev
https://golang.org/cl/7992044
2013-03-26 11:05:06 -07:00
Dmitriy Vyukov
94599ea745 runtime: does not report duplicate errors in netpoll
Prevents storm of error messages if something goes wrong.
In the case of issue 5073 the epoll fd was closed by the test.
Update #5073.

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/7966043
2013-03-26 20:25:43 +04:00
Mikio Hara
9d97b55d38 net: fix test data corruption in repetitive test runs by -cpu
This CL avoids test data sharing in repetitive test runs;
e.g., go test net -cpu=1,1,1

R=golang-dev, fullung, bradfitz
CC=golang-dev
https://golang.org/cl/8011043
2013-03-27 01:06:48 +09:00
Rémy Oudompheng
eb7c51c148 cmd/gc: more race instrumentation.
Handle interface comparison correctly,
add a few more tests, mark more nodes as impossible.

R=dvyukov, golang-dev
CC=golang-dev
https://golang.org/cl/7942045
2013-03-26 08:27:18 +01:00
Rémy Oudompheng
ce99bb2caf cmd/gc: fix nil pointer dereferences.
Fixes #5119.

R=golang-dev, dvyukov, dave, rsc
CC=golang-dev
https://golang.org/cl/7838050
2013-03-26 08:20:10 +01:00
Dave Cheney
adb9d60cd1 image/gif: make test repeatable
Fixes issue with go test -cpu=1,1

R=minux.ma, bradfitz, nigeltao
CC=golang-dev
https://golang.org/cl/7808045
2013-03-26 16:20:17 +11:00
Julien Schmidt
5e74f5029b database/sql: optimized []byte copy + []byte(nil) -> *interface fix
Make the copy directly in the convert switch instead of an extra loop.
Also stops converting nil-[]byte to zero-[]byte when assigning to *interface

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7962044
2013-03-25 17:43:30 -07:00
Brad Fitzpatrick
eee3e63607 database/sql: link to driver wiki page
Fixes #5127

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/8011044
2013-03-25 17:38:51 -07:00
Brad Fitzpatrick
209f6b1d2c database/sql: don't close a driver.Conn until its Stmts are closed
Fixes #5046

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8016044
2013-03-25 16:50:27 -07:00
Adam Langley
f20f8b8b0a crypto/rsa: don't correct private exponent unless needed.
At some point in the past, I believe the GCD algorithm was setting d to
be negative. The RSA code has been correcting that ever since but, now,
it appears to have changed and the correction isn't needed.

Having d be too large is harmless, it's just a little odd and I
happened to notice.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7948044
2013-03-25 19:08:29 -04:00
Ian Lance Taylor
5a529b61aa cmd/ld: permit sym to be both cgo_export_static and cgo_export_dynamic
Fixes SWIG callbacks.  Previously crosscall2 was only
cgo_export_static, despite the use of two #pragma declarations
in runtime/cgo/callbacks.c.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/7817048
2013-03-25 15:37:54 -07:00
Russ Cox
6a70f9d073 runtime: pass setmg function to cgo_init
This keeps the logic about how to set the thread-local variables
m and g in code compiled and linked by the gc toolchain,
an important property for upcoming cgo changes.

It's also just a nice cleanup: one less place to update when
these details change.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7560048
2013-03-25 18:14:02 -04:00
Russ Cox
cb807e7b4a runtime: delete mkasmh.sh
This functionality moved into cmd/dist for Go 1.0.
Changes to this script have no effect.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8020043
2013-03-25 17:46:11 -04:00
Rémy Oudompheng
c0b3c17184 cmd/gc: instrument logical && and ||.
The right operand of a && and || is only executed conditionnally,
so the instrumentation must be more careful. In particular
it should not turn nodes assumed to be cheap after walk into
expensive ones.

Update #4228

R=dvyukov, golang-dev
CC=golang-dev
https://golang.org/cl/7986043
2013-03-25 22:12:47 +01:00
Carl Shapiro
4cb921bbf1 runtime: store asmcgocall return PC where the ARM unwind expects it
The ARM implementation of runtime.cgocallback_gofunc diverged
from the calling convention by leaving a word of garbage at
the top of the stack and storing the return PC above the
locals.  This change stores the return PC at the top of the
stack and removes the save area above the locals.

Update #5124
This CL fixes first part of the ARM issues and added the unwind test.

R=golang-dev, bradfitz, minux.ma, cshapiro, rsc
CC=golang-dev
https://golang.org/cl/7728045
2013-03-25 14:10:28 -07:00
Rémy Oudompheng
d815a14718 cmd/5l, cmd/6l, cmd/8l: fix segfault on reading LOCALS for a duplicate definition.
Fixes #5105.

R=golang-dev, dave, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/7965043
2013-03-25 22:09:55 +01:00
Russ Cox
60a1f54d6b math: make Hypot special cases look like others
The edit makes Hypot's description match the form
used in the other routines in this package.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/8003046
2013-03-25 17:01:40 -04:00
Jan Ziak
bf1f46180e runtime: optionally check all allocations in hashmap.c
Adds the new debugging constant 'checkgc'. If its value is non-zero
all calls to mallocgc() from hashmap.c will start a garbage collection.

Fixes #5074.

R=golang-dev, khr
CC=golang-dev, rsc
https://golang.org/cl/7663051
2013-03-25 21:35:46 +01:00
Dmitriy Vyukov
ea15104110 net: band-aid for windows network poller
Fixes performance of the current windows network poller
with the new scheduler.
Gives runtime a hint when GetQueuedCompletionStatus() will block.
Fixes #5068.

benchmark                    old ns/op    new ns/op    delta
BenchmarkTCP4Persistent        4004000        33906  -99.15%
BenchmarkTCP4Persistent-2        21790        17513  -19.63%
BenchmarkTCP4Persistent-4        44760        34270  -23.44%
BenchmarkTCP4Persistent-6        45280        43000   -5.04%

R=golang-dev, alex.brainman, coocood, rsc
CC=golang-dev
https://golang.org/cl/7612045
2013-03-25 20:57:36 +04:00
Oling Cat
1693e14bc4 math: modify a comment to the convention format.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8012043
2013-03-25 08:43:51 -07:00
Rémy Oudompheng
77e7e4c329 cmd/cc, cmd/ld: do not overflow strings in symbol lookup.
R=golang-dev, dave, minux.ma
CC=golang-dev
https://golang.org/cl/7876044
2013-03-25 08:20:22 +01:00
Rémy Oudompheng
3add0fef1e net/http: deflake BenchmarkServerFakeConnNoKeepAlive.
Fixes #5121.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7814046
2013-03-25 08:17:10 +01:00
Mikio Hara
2f2f9fef90 net: disable tests with controlling network facilities in short mode
Perhaps it would make FreeBSD 10-CURRENT/ARM on Raspberry Pi builders happy.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/8008043
2013-03-25 13:25:28 +09:00
Alex Brainman
77fb0c17df all.bat,make.bat,run.bat: make these work even when directory has space in it
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7510048
2013-03-25 12:13:34 +11:00
Shenghou Ma
976d99b9a8 build, cmd/5l: actually report failures for -linkmode tests
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7938046
2013-03-25 03:18:05 +08:00
Rémy Oudompheng
a909e4ba1e cmd/cc: fix typo leading to index out of range.
Detected by GCC static analysis.

Fixes #5117.

R=golang-dev, ality, minux.ma
CC=golang-dev
https://golang.org/cl/7665047
2013-03-24 11:38:57 +01:00
Shenghou Ma
0a517e458c build: increase timeout for ARM
in an effort to make builder freebsd-arm-pi and netbsd-arm-qemu pass again.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7621050
2013-03-24 16:31:28 +08:00
Rémy Oudompheng
a3c2d62a9a cmd/5l, cmd/6l, cmd/8l: remove declaration on non-existent variables.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7985043
2013-03-24 08:55:08 +01:00
Mikio Hara
bfb32dc6d1 net: use original raddr if getpeername fails
This CL updates CL 7511043;
- adds new test cases for both UDPConn and UnixConn,
- makes sure unnamed UnixAddr handling,
- replaces t.Errorf with t.Fatalf in sockname related test cases.

Fixes #3721 (again).
Fixes #3838 (again).

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7627048
2013-03-23 22:32:19 +09:00
Mikio Hara
aa0dda767a net: support IPv6 scoped addressing zone
This CL provides IPv6 scoped addressing zone support as defined
in RFC 4007 for internet protocol family connection setups.

Follwoing types and functions allow a literal IPv6 address with
zone identifer as theirs parameter.

pkg net, func Dial(string, string) (Conn, error)
pkg net, func DialOpt(string, ...DialOption) (Conn, error)
pkg net, func DialTimeout(string, string, time.Duration) (Conn, error)
pkg net, func Listen(string, string) (Listener, error)
pkg net, func ListenPacket(string, string) (PacketConn, error)
pkg net, func ResolveIPAddr(string, string) (*IPAddr, error)
pkg net, func ResolveTCPAddr(string, string) (*TCPAddr, error)
pkg net, func ResolveUDPAddr(string, string) (*UDPAddr, error)
pkg net, type IPAddr struct, Zone string
pkg net, type TCPAddr struct, Zone string
pkg net, type UDPAddr struct, Zone string

Also follwoing methods return a literal IPv6 address with zone
identifier string if possible.

pkg net, method (*IPAddr) String() string
pkg net, method (*TCPAddr) String() string
pkg net, method (*UDPAddr) String() string

Fixes #4234.
Fixes #4501.
Update #5081.

R=rsc, iant
CC=golang-dev
https://golang.org/cl/6816116
2013-03-23 09:57:40 +09:00
Ian Lance Taylor
c90850277b runtime: remove declaration of non-existent function
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/7577049
2013-03-22 17:52:55 -07:00
Ian Lance Taylor
fb7f217fe7 runtime: correct misplaced right brace in Linux SIGBUS handling
I'm not sure how to write a test for this.  The change in
behaviour is that if you somehow get a SIGBUS signal for an
address >= 0x1000, the program will now crash rather than
calling panic.  As far as I know, on x86 GNU/Linux, the only
way to get a SIGBUS (rather than a SIGSEGV) is to set the
stack pointer to an invalid value.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7906045
2013-03-22 17:32:04 -07:00
Mikio Hara
8b6d501704 net: fix documentation for UnixAddr
Also simplifies ResolveUnixAddr.

R=golang-dev, dave, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7510047
2013-03-23 07:39:43 +09:00
Russ Cox
ba0dd1f139 cmd/gc: fix line number for 'missing return' in closure
R=ken2
CC=golang-dev
https://golang.org/cl/7838048
2013-03-22 17:50:29 -04:00
Russ Cox
228fe9d057 cmd/vet: diagnose unreachable code
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7493048
2013-03-22 17:46:45 -04:00
Russ Cox
f6d0adedb6 build: remove dead code
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7877045
2013-03-22 17:28:22 -04:00
Rob Pike
f29b091110 encoding/gob: delete dead code.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7834047
2013-03-22 14:22:55 -07:00
Shenghou Ma
092b7cfb08 runtime/cgo, go/build: re-enable cgo for FreeBSD/ARM.
R=dave, rsc
CC=golang-dev
https://golang.org/cl/7970043
2013-03-23 03:21:30 +08:00
Julien Schmidt
81d26e3817 database/sql: add missing []byte and RawBytes conversions
E.g conversions from numeric types to RawBytes are missing, what makes RawBytes unusable in some cases.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7783046
2013-03-22 12:19:21 -07:00
Russ Cox
b5cfbda212 cmd/vet: add assembly checker
Fixes #5036.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7531045
2013-03-22 15:14:40 -04:00
Russ Cox
07720b67b3 build: update assembly variable names for vet
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7834046
2013-03-22 12:57:55 -04:00
Russ Cox
dabe51065c crypto/cipher: fix vet warning
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7973043
2013-03-22 12:57:34 -04:00
Jeff R. Allen
87700cf75d image/gif: reject a GIF image if frame bounds larger than image bounds
The GIF89a spec says: "Each image must fit within the
boundaries of the Logical Screen, as defined in the
Logical Screen Descriptor." Also, do not accept
GIFs which have too much data for the image size.

R=nigeltao, jra, r
CC=bradfitz, golang-dev
https://golang.org/cl/7602045
2013-03-22 09:30:31 -07:00
Joel Sing
3b9702c9c8 runtime: correct return value checks for mmap on darwin/freebsd
On Darwin and FreeBSD, the mmap syscall return value is returned
unmodified. This means that the return value will either be a
valid address or a positive error number.

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

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7871043
2013-03-23 02:17:01 +11:00
Joel Sing
28f65bf4a2 runtime: improve mmap return value checking for netbsd/openbsd
Rather than just checking for ENOMEM, check for a return value of less
than 4096, so that we catch other errors such as EACCES and EINVAL.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7942043
2013-03-23 02:15:52 +11:00
Oling Cat
79ae1ad489 math: remove repeated comment.
R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/7835046
2013-03-22 14:54:20 +11:00
Nigel Tao
f308efd869 image/gif: tighten the checks for when the amount of an image's pixel
data does not agree with its bounds.

R=r, jeff.allen
CC=golang-dev
https://golang.org/cl/7938043
2013-03-22 14:42:02 +11:00
Miki Tebeka
0ffdfe42d1 cmd/cgo: fix the cgo example on multiple assignment context.
Change from atoi to strtol since atoi does not set errno.

R=golang-dev, minux.ma, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/7888047
2013-03-21 20:06:25 -07:00
Brad Fitzpatrick
985b0992cd net/http: reuse bufio.Reader and bufio.Writer between conns
Saves over 8KB of allocations per new connection.

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

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

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

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7799047
2013-03-21 20:02:01 -07:00
Brad Fitzpatrick
dc71ace282 bufio: add some tests
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7927044
2013-03-21 19:59:49 -07:00
Rémy Oudompheng
5060dded0f debug/elf: repair GNU version symbols.
After the revert of revision 9ea9e7e6e0c8
the related revision 76ff7da868c6 must be reverted too.

Fixes #5102.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7961044
2013-03-22 01:27:55 +01:00
Rémy Oudompheng
88b98ff791 cmd/gc: accept ideal float as indices.
Fixes #4813.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/7625050
2013-03-22 00:38:23 +01:00
Robert Griesemer
5e6a1a3f48 go/doc: use regexp for -notes instead of comma-sep. list
-notes="BUG|TODO" instead of -notes="BUG,TODO".
Permits -notes=".*" to see all notes.

R=cnicolaou
CC=golang-dev
https://golang.org/cl/7951043
2013-03-21 15:56:15 -07:00
Rob Pike
5bbdf40544 bufio.Scanner: delete obsolete TODO
Also fix the examples to use stderr for errors.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7716052
2013-03-21 14:56:42 -07:00
Brad Fitzpatrick
d7c1f67cb9 net/http/fcgi: fix a shutdown race
If a handler didn't consume all its Request.Body, child.go was
closing the socket while the host was still writing to it,
causing the child to send a RST and the host (at least nginx)
to send an empty response body.

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

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

Fixes #4183

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7939045
2013-03-21 14:07:24 -07:00
Russ Cox
aafc444b74 debug/elf: restore Go 1.0 semantics for (*File).Symbols
Also adjust the implementation of applyRelocationsAMD64
so that the test added in CL 6848044 still passes.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7686049
2013-03-21 17:01:39 -04:00
Russ Cox
3be703665e reflect: implement method values
Fixes #1517.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7906043
2013-03-21 16:59:16 -04:00
Russ Cox
b505ff6279 crypto/rc4: faster amd64 implementation
XOR key into data 128 bits at a time instead of 64 bits
and pipeline half of state loads. Rotate loop to allow
single-register indexing for state[i].

On a MacBookPro10,2 (Core i5):

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

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

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

On an Intel Xeon E5520:

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

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

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

R=agl
CC=golang-dev
https://golang.org/cl/7865046
2013-03-21 16:38:57 -04:00
Shenghou Ma
d04ac4b0b7 cmd/ld: portability fixes
fix code that implicitly assumes little-endian machines.

R=golang-dev, bradfitz, rsc, alex.brainman
CC=golang-dev
https://golang.org/cl/6792043
2013-03-22 04:00:54 +08:00
Shenghou Ma
a891b916bd cmd/ld: don't generate DW_AT_type attr for unsafe.Pointer to match gcc behavior
gcc generates only attr DW_AT_byte_size for DW_TAG_pointer_type of "void *",
but we used to also generate DW_AT_type pointing to imaginary unspecified
type "void", which confuses some gdb.
This change makes old Apple gdb 6.x (specifically, Apple version gdb-1515)
accepts our binary without issue like this:
(gdb) b 'main.main'
Die: DW_TAG_unspecified_type (abbrev = 10, offset = 47079)
    has children: FALSE
    attributes:
        DW_AT_name (DW_FORM_string) string: "void"
Dwarf Error: Cannot find type of die [in module /Users/minux/go/go2.hg/bin/go]

Special thanks to Russ Cox for pointing out the problem in comment #6 of
CL 7891044.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7744051
2013-03-22 03:58:35 +08:00
Shenghou Ma
f74b4d3de3 cmd/ld: fix bad merge
CL 7504044 accidentally reverted part of CL 7891044 and 7552045, this CL
bring those part back.

R=golang-dev
TBR=rsc
CC=golang-dev
https://golang.org/cl/7950045
2013-03-22 03:54:14 +08:00
Jan Ziak
ec8caf696a runtime: mark strings without going through an intermediate buffer
R=rsc
CC=golang-dev
https://golang.org/cl/7949043
2013-03-21 19:00:02 +01:00
Robert Griesemer
e95c41f30b go/format: fix documentation
R=r
CC=golang-dev
https://golang.org/cl/7920048
2013-03-21 08:47:34 -07:00
Russ Cox
2f32138aba crypto/sha1: faster amd64, 386 implementations
-- amd64 --

On a MacBookPro10,2 (Core i5):

benchmark              old ns/op    new ns/op    delta
BenchmarkHash8Bytes          785          592  -24.59%
BenchmarkHash1K             8727         3014  -65.46%
BenchmarkHash8K            64926        20723  -68.08%

benchmark               old MB/s     new MB/s  speedup
BenchmarkHash8Bytes        10.19        13.50    1.32x
BenchmarkHash1K           117.34       339.71    2.90x
BenchmarkHash8K           126.17       395.31    3.13x

For comparison, on the same machine, openssl 0.9.8r reports
its sha1 speed as 341 MB/s for 1K and 404 MB/s for 8K.

On an Intel Xeon E5520:

benchmark              old ns/op    new ns/op    delta
BenchmarkHash8Bytes          984          707  -28.15%
BenchmarkHash1K            11141         3466  -68.89%
BenchmarkHash8K            82435        23411  -71.60%

benchmark               old MB/s     new MB/s  speedup
BenchmarkHash8Bytes         8.13        11.31    1.39x
BenchmarkHash1K            91.91       295.36    3.21x
BenchmarkHash8K            99.37       349.91    3.52x

For comparison, on the same machine, openssl 1.0.1 reports
its sha1 speed as 286 MB/s for 1K and 394 MB/s for 8K.

-- 386 --

On a MacBookPro10,2 (Core i5):

benchmark              old ns/op    new ns/op    delta
BenchmarkHash8Bytes         1041          713  -31.51%
BenchmarkHash1K            15612         3382  -78.34%
BenchmarkHash8K           110152        22733  -79.36%

benchmark               old MB/s     new MB/s  speedup
BenchmarkHash8Bytes         7.68        11.21    1.46x
BenchmarkHash1K            65.59       302.76    4.62x
BenchmarkHash8K            74.37       360.36    4.85x

On an Intel Xeon E5520:

benchmark              old ns/op    new ns/op    delta
BenchmarkHash8Bytes         1221          842  -31.04%
BenchmarkHash1K            14643         4137  -71.75%
BenchmarkHash8K           108722        27394  -74.80%

benchmark               old MB/s     new MB/s  speedup
BenchmarkHash8Bytes         6.55         9.49    1.45x
BenchmarkHash1K            69.93       247.51    3.54x
BenchmarkHash8K            75.35       299.04    3.97x

R=agl, dave
CC=golang-dev
https://golang.org/cl/7763049
2013-03-21 11:32:02 -04:00
Russ Cox
25cbd534df crypto/md5: faster amd64, 386 implementations
-- amd64 --

On a MacBookPro10,2 (Core i5):

benchmark                       old ns/op    new ns/op    delta
BenchmarkHash8Bytes                   471          524  +11.25%
BenchmarkHash1K                      3018         2220  -26.44%
BenchmarkHash8K                     20634        14604  -29.22%
BenchmarkHash8BytesUnaligned          468          523  +11.75%
BenchmarkHash1KUnaligned             3006         2212  -26.41%
BenchmarkHash8KUnaligned            20820        14652  -29.63%

benchmark                        old MB/s     new MB/s  speedup
BenchmarkHash8Bytes                 16.98        15.26    0.90x
BenchmarkHash1K                    339.26       461.19    1.36x
BenchmarkHash8K                    397.00       560.92    1.41x
BenchmarkHash8BytesUnaligned        17.08        15.27    0.89x
BenchmarkHash1KUnaligned           340.65       462.75    1.36x
BenchmarkHash8KUnaligned           393.45       559.08    1.42x

For comparison, on the same machine, openssl 0.9.8r reports
its md5 speed as 350 MB/s for 1K and 410 MB/s for 8K.

On an Intel Xeon E5520:

benchmark                       old ns/op    new ns/op    delta
BenchmarkHash8Bytes                   565          607   +7.43%
BenchmarkHash1K                      3753         2475  -34.05%
BenchmarkHash8K                     25945        16250  -37.37%
BenchmarkHash8BytesUnaligned          559          594   +6.26%
BenchmarkHash1KUnaligned             3754         2474  -34.10%
BenchmarkHash8KUnaligned            26011        16359  -37.11%

benchmark                        old MB/s     new MB/s  speedup
BenchmarkHash8Bytes                 14.15        13.17    0.93x
BenchmarkHash1K                    272.83       413.58    1.52x
BenchmarkHash8K                    315.74       504.11    1.60x
BenchmarkHash8BytesUnaligned        14.31        13.46    0.94x
BenchmarkHash1KUnaligned           272.73       413.78    1.52x
BenchmarkHash8KUnaligned           314.93       500.73    1.59x

For comparison, on the same machine, openssl 1.0.1 reports
its md5 speed as 443 MB/s for 1K and 513 MB/s for 8K.

-- 386 --

On a MacBookPro10,2 (Core i5):

benchmark                       old ns/op    new ns/op    delta
BenchmarkHash8Bytes                   602          670  +11.30%
BenchmarkHash1K                      4038         2549  -36.87%
BenchmarkHash8K                     27879        16690  -40.13%
BenchmarkHash8BytesUnaligned          602          670  +11.30%
BenchmarkHash1KUnaligned             4025         2546  -36.75%
BenchmarkHash8KUnaligned            27844        16692  -40.05%

benchmark                        old MB/s     new MB/s  speedup
BenchmarkHash8Bytes                 13.28        11.93    0.90x
BenchmarkHash1K                    253.58       401.69    1.58x
BenchmarkHash8K                    293.83       490.81    1.67x
BenchmarkHash8BytesUnaligned        13.27        11.94    0.90x
BenchmarkHash1KUnaligned           254.40       402.05    1.58x
BenchmarkHash8KUnaligned           294.21       490.77    1.67x

On an Intel Xeon E5520:

benchmark                       old ns/op    new ns/op    delta
BenchmarkHash8Bytes                   752          716   -4.79%
BenchmarkHash1K                      5307         2799  -47.26%
BenchmarkHash8K                     36993        18042  -51.23%
BenchmarkHash8BytesUnaligned          748          730   -2.41%
BenchmarkHash1KUnaligned             5301         2795  -47.27%
BenchmarkHash8KUnaligned            36983        18085  -51.10%

benchmark                        old MB/s     new MB/s  speedup
BenchmarkHash8Bytes                 10.64        11.16    1.05x
BenchmarkHash1K                    192.93       365.80    1.90x
BenchmarkHash8K                    221.44       454.03    2.05x
BenchmarkHash8BytesUnaligned        10.69        10.95    1.02x
BenchmarkHash1KUnaligned           193.15       366.36    1.90x
BenchmarkHash8KUnaligned           221.51       452.96    2.04x

R=agl
CC=golang-dev
https://golang.org/cl/7621049
2013-03-21 11:26:00 -04:00
Russ Cox
1af960802a crypto/rc4: faster amd64, 386 implementations
-- amd64 --

On a MacBookPro10,2 (Core i5):

benchmark           old ns/op    new ns/op    delta
BenchmarkRC4_128          470          421  -10.43%
BenchmarkRC4_1K          3123         3275   +4.87%
BenchmarkRC4_8K         26351        25866   -1.84%

benchmark            old MB/s     new MB/s  speedup
BenchmarkRC4_128       272.22       303.40    1.11x
BenchmarkRC4_1K        327.80       312.58    0.95x
BenchmarkRC4_8K        307.24       313.00    1.02x

For comparison, on the same machine, openssl 0.9.8r reports
its rc4 speed as somewhat under 350 MB/s for both 1K and 8K.
The Core i5 performance can be boosted another 20%, but only
by making the Xeon performance significantly slower.

On an Intel Xeon E5520:

benchmark           old ns/op    new ns/op    delta
BenchmarkRC4_128          774          417  -46.12%
BenchmarkRC4_1K          6121         3200  -47.72%
BenchmarkRC4_8K         48394        25151  -48.03%

benchmark            old MB/s     new MB/s  speedup
BenchmarkRC4_128       165.18       306.84    1.86x
BenchmarkRC4_1K        167.28       319.92    1.91x
BenchmarkRC4_8K        167.29       321.89    1.92x

For comparison, on the same machine, openssl 1.0.1
(which uses a different implementation than 0.9.8r)
reports its rc4 speed as 587 MB/s for 1K and 601 MB/s for 8K.
It is using SIMD instructions to do more in parallel.

So there's still some improvement to be had, but even so,
this is almost 2x faster than what it replaced.

-- 386 --

On a MacBookPro10,2 (Core i5):

benchmark           old ns/op    new ns/op    delta
BenchmarkRC4_128         3491          421  -87.94%
BenchmarkRC4_1K         28063         3205  -88.58%
BenchmarkRC4_8K        220392        25228  -88.55%

benchmark            old MB/s     new MB/s  speedup
BenchmarkRC4_128        36.66       303.81    8.29x
BenchmarkRC4_1K         36.49       319.42    8.75x
BenchmarkRC4_8K         36.73       320.90    8.74x

On an Intel Xeon E5520:

benchmark           old ns/op    new ns/op    delta
BenchmarkRC4_128         2268          524  -76.90%
BenchmarkRC4_1K         18161         4137  -77.22%
BenchmarkRC4_8K        142396        32350  -77.28%

benchmark            old MB/s     new MB/s  speedup
BenchmarkRC4_128        56.42       244.13    4.33x
BenchmarkRC4_1K         56.38       247.46    4.39x
BenchmarkRC4_8K         56.86       250.26    4.40x

R=agl
CC=golang-dev
https://golang.org/cl/7547050
2013-03-21 11:25:09 -04:00
Dmitriy Vyukov
44840786ae runtime: explicitly remove fd's from epoll waitset before close()
Fixes #5061.

Current code relies on the fact that fd's are automatically removed from epoll set when closed. However, it is not true. Underlying file description is removed from epoll set only when *all* fd's referring to it are closed.

There are 2 bad consequences:
1. Kernel delivers notifications on already closed fd's.
2. The following sequence of events leads to error:
   - add fd1 to epoll
   - dup fd1 = fd2
   - close fd1 (not removed from epoll since we've dup'ed the fd)
   - dup fd2 = fd1 (get the same fd as fd1)
   - add fd1 to epoll = EEXIST

So, if fd can be potentially dup'ed of fork'ed, it's necessary to explicitly remove the fd from epoll set.

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7870043
2013-03-21 12:54:19 +04:00
Dmitriy Vyukov
d4c80d19a8 runtime: faster parallel GC
Use per-thread work buffers instead of global mutex-protected pool. This eliminates contention from parallel scan phase.

benchmark                             old ns/op    new ns/op    delta
garbage.BenchmarkTree2-8               97100768     71417553  -26.45%
garbage.BenchmarkTree2LastPause-8     970931485    714103692  -26.45%
garbage.BenchmarkTree2Pause-8         469127802    345029253  -26.45%
garbage.BenchmarkParser-8            2880950854   2715456901   -5.74%
garbage.BenchmarkParserLastPause-8    137047399    103336476  -24.60%
garbage.BenchmarkParserPause-8         80686028     58922680  -26.97%

R=golang-dev, 0xe2.0x9a.0x9b, dave, adg, rsc, iant
CC=golang-dev
https://golang.org/cl/7816044
2013-03-21 12:48:02 +04:00
Rémy Oudompheng
656bc3eb96 cmd/gc: implement more cases in racewalk.
Add missing CLOSUREVAR in switch.
Mark MAKE, string conversion nodes as impossible.
Control statements do not need instrumentation.
Instrument COM and LROT nodes.
Instrument map length.

Update #4228

R=dvyukov, golang-dev
CC=golang-dev
https://golang.org/cl/7504047
2013-03-21 08:53:52 +01:00
Brad Fitzpatrick
76d5e2ce7d crypto/tls: use method values
Currently fails with a compiler error, though.

R=golang-dev, agl, rsc
CC=golang-dev
https://golang.org/cl/7933043
2013-03-20 23:53:38 -04:00
Russ Cox
38e9b0773d cmd/gc: fix escape analysis of method values
R=ken2
CC=golang-dev
https://golang.org/cl/7518050
2013-03-20 23:53:27 -04:00
Robert Griesemer
0ad265d48f src/pkg: fixed various typos
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7936043
2013-03-20 16:32:37 -07:00
Keith Randall
bcb39a778c runtime: free map structures more aggressively
R=rsc, bradfitz, khr
CC=golang-dev
https://golang.org/cl/7849047
2013-03-20 15:38:51 -07:00
Robert Griesemer
5ae4012b64 go/parser: use method values
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7858045
2013-03-20 15:03:30 -07:00
Keith Randall
db53d97ac4 runtime: Use aligned loads for AES key schedule.
R=rsc, minux.ma, khr
CC=golang-dev
https://golang.org/cl/7763050
2013-03-20 14:34:26 -07:00
Russ Cox
a63d5dd118 cmd/gc: add OCHECKNOTNIL to race walker (fix build)
TBR=dvyukov
CC=golang-dev
https://golang.org/cl/7635046
2013-03-20 17:20:32 -04:00
Daniel Morsing
7c3694c4de cmd/gc: reject methods on non-locals, even if symbol exists
Fixes #5089.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7767044
2013-03-20 22:18:20 +01:00
Russ Cox
d3c758d7d2 cmd/gc: implement method values
R=ken2, ken
CC=golang-dev
https://golang.org/cl/7546052
2013-03-20 17:11:09 -04:00
Keith Randall
00224a356a runtime: faster hashmap implementation.
Hashtable is arranged as an array of
8-entry buckets with chained overflow.
Each bucket has 8 extra hash bits
per key to provide quick lookup within
a bucket.  Table is grown incrementally.

Update #3885
Go time drops from 0.51s to 0.34s.

R=r, rsc, m3b, dave, bradfitz, khr, ugorji, remyoudompheng
CC=golang-dev
https://golang.org/cl/7504044
2013-03-20 13:51:29 -07:00
Jan Ziak
2001f0c28e runtime: prevent garbage collection during hashmap insertion (fix 2)
Fixes #5074 in multi-threaded scenarios.

R=golang-dev, daniel.morsing, dave, dvyukov, bradfitz, rsc
CC=golang-dev, remyoudompheng
https://golang.org/cl/7916043
2013-03-20 20:36:33 +01:00
Brad Fitzpatrick
bd21f7f1b5 net/http/fcgi: Request.Body should always be non-nil
Found this inconsistency from net/http's Server while
debugging Issue 4183

Unfortunately this package lacks testing around this,
or most of child.go. :/

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7735046
2013-03-20 09:06:33 -07:00
Dave Cheney
f701e1c320 cmd/6c, cmd/8c: fix stack allocated Biobuf leaking at exit
Fixes #5085.

{6,8}c/swt.c allocates a third Biobuf in automatic memory which is not terminated at the end of the function. This causes the buffer to be 'in use' when the batexit handler fires, confusing valgrind.

Huge thanks to DMorsing for the diagnosis.

R=golang-dev, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/7844044
2013-03-20 23:42:00 +11:00
Rémy Oudompheng
b35019fe9a cmd/ld: remove remaining occurrence of isobj.
Fixes cgo builds.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7784044
2013-03-20 08:32:11 +01:00
Brad Fitzpatrick
1ce0d72fdf net/http: new benchmark to measure server without network
No net package involved. And with ReportAllocs we can see
how much garbage is created per request.

R=adg, dave
CC=golang-dev
https://golang.org/cl/7913044
2013-03-19 23:32:28 -07:00
Dave Cheney
85773e6bc2 cmd/5l: fix arm build
Fixes build. One part of ../misc/cgo/test appears to be unhappy but this does not cause the build to fail.

R=rsc, r
CC=golang-dev
https://golang.org/cl/7769047
2013-03-20 12:05:52 +11:00
Rémy Oudompheng
465ff4cfc0 cmd/gc: implement revised rule for shifts in equality.
R=rsc, daniel.morsing
CC=golang-dev
https://golang.org/cl/7613046
2013-03-20 00:19:11 +01:00
Rob Pike
1b6b1bc66e bytes,strings: remove user name from BUG in comment
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7856048
2013-03-19 15:04:18 -07:00
Jan Ziak
54dffda2b6 runtime: prevent garbage collection during hashmap insertion
Inserting a key-value pair into a hashmap storing keys or values
indirectly can cause the garbage collector to find the hashmap in
an inconsistent	state.

Fixes #5074.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7913043
2013-03-19 22:17:39 +01:00
Ian Lance Taylor
b79afe1b71 debug/dwarf: support for DWARF 3
R=rsc
CC=golang-dev
https://golang.org/cl/7662045
2013-03-19 13:59:37 -07:00
Russ Cox
47ce4bd353 cmd/ld: fix typo
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7552045
2013-03-19 16:53:07 -04:00
Russ Cox
40d356e9ab cmd/ld: generate relocated DWARF in hostobj mode
While we're here, downgrade DWARF to version 2.
We're not using any version 3 features, and OS X gdb
only supports version 2.

Fixes #3436.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7891044
2013-03-19 16:31:52 -04:00
Russ Cox
b4f3533c92 cmd/ld: replace -hostobj with -linkmode
Still disabled. Need to fix TLS.

R=golang-dev, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7783044
2013-03-19 15:45:42 -04:00
Jan Ziak
ab08eac5b7 runtime: optimize calls to addroot()
R=golang-dev, rsc
CC=dvyukov, golang-dev
https://golang.org/cl/7879043
2013-03-19 19:57:15 +01:00
Jan Ziak
6e69df6102 cmd/gc: support channel types in the garbage collector
R=golang-dev, dvyukov, rsc
CC=golang-dev
https://golang.org/cl/7473044
2013-03-19 19:51:03 +01:00
Oling Cat
d8714ca49f unicode: modify a comment to the convention format.
R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/7869043
2013-03-19 14:47:41 -04:00
Robert Griesemer
5268119f26 go/doc, godoc: improved note reading
- A note doesn't have to be in the first
comment of a comment group anymore, and
several notes may appear in the same comment
group (e.g., it is fairly common to have a
TODO(uid) note immediately following another
comment).

- Define a doc.Note type which also contains
note uid and position info.

- Better formatting in godoc output. The position
information is not yet used, but could be used to
locate the note in the source text if desired.

Fixes #4843.

R=r, cnicolaou
CC=gobot, golang-dev
https://golang.org/cl/7496048
2013-03-19 11:14:35 -07:00
Oling Cat
a88d82813d unicode: remove an extra space
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7856044
2013-03-19 13:48:07 -04:00
Mikio Hara
4aeb0fc0a4 runtime: add missing copyright
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7884045
2013-03-20 02:40:29 +09:00
Mikio Hara
3560f3b9b8 net: make use of reflect.DeepEqual in IP manipulation tests
Also applies camel style to test case holders.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7884043
2013-03-20 01:07:18 +09:00
Mikio Hara
5ccb769112 cmd/fix: revert IPv6 scoped address zone support of IPNet
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7554051
2013-03-20 01:05:16 +09:00
Rémy Oudompheng
51f14a9fe2 runtime: fix erroneous overflow protection on netbsd/openbsd semasleep.
On NetBSD tv_sec is already an int64 so no need for a test.

On OpenBSD, semasleep expects a Unix time as argument,
and 1<<30 is in 2004.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7810044
2013-03-19 07:08:26 +01:00
Brad Fitzpatrick
646e54106d database/sql: doc cleanup on the DB type
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7865044
2013-03-18 15:54:22 -07:00
Brad Fitzpatrick
3a2fe62f44 database/sql: add DB.SetMaxIdleConns
Update #4805

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7634045
2013-03-18 15:33:04 -07:00
Daniel Morsing
2667dcd113 cmd/gc: steal escape analysis info when inlining
Usually, there is no esc info when inlining, but there will be when generating inlined wrapper functions.

If we don't use this information, we get invalid addresses on the stack.

Fixes #5056.

R=golang-dev, rsc
CC=golang-dev, remyoudompheng
https://golang.org/cl/7850045
2013-03-18 22:22:35 +01:00