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

12244 Commits

Author SHA1 Message Date
Dmitriy Vyukov
77354c39f9 runtime: reset typed dangling pointer
If for whatever reason seh points into Go heap region,
the dangling pointer will cause memory corruption during GC.
Update #5193.

R=golang-dev, alex.brainman, iant
CC=golang-dev
https://golang.org/cl/8402045
2013-04-06 20:00:45 -07:00
John Howard Palevich
1142c2f418 cmd/go: fix capitalization of Bitbucket, document Git support
Fixes #5226.

R=golang-dev, minux.ma, iant
CC=golang-dev
https://golang.org/cl/8320044
2013-04-07 04:06:11 +08:00
Jonathan Rudenberg
07c70629c2 net/http: fix typo in ErrMissingBoundary
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8429045
2013-04-05 15:23:03 -07:00
Rémy Oudompheng
2d3216f4a8 cmd/gc: fix Offsetof computation.
The offset of an embedded field s.X must be relative to s
and not to the implicit s.Field of which X is a direct field.
Moreover, no indirections may happen on the path.

Fixes #4909.

R=nigeltao, ality, daniel.morsing, iant, gri, r
CC=golang-dev
https://golang.org/cl/8287043
2013-04-05 21:24:07 +02:00
Volker Dobler
03048ae454 testing: structure package documentation
Makes finding the relevant information much easier.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/8353045
2013-04-05 13:43:18 +11:00
Brad Fitzpatrick
b6a39a2545 strconv: remove some test TODOs and adjust malloc limits lower
These no longer allocate.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/8340047
2013-04-04 17:04:18 -07:00
Carl Shapiro
c80f5b9bf7 runtime: use a distinct pattern to mark free blocks in need of zeroing
R=golang-dev, dvyukov, khr, cshapiro
CC=golang-dev
https://golang.org/cl/8392043
2013-04-04 14:18:52 -07:00
Brad Fitzpatrick
b72325fde4 net/http: remove some obsolete TODOs
We've decided to leave logging to third-parties (there are too
many formats), which others have done.

And we can't change the behavior of the various response
fields at this point anyway. Plus I argue they're correct and
match their documention.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8391043
2013-04-04 13:40:26 -07:00
Brad Fitzpatrick
d97157d382 net/http: better stand-alone FileServer doc example
Motivated by a deletion in the wiki, which had a better
example.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8288045
2013-04-04 13:40:15 -07:00
Carl Shapiro
bcc30aa9e1 cmd/gc: fix a typo
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/8379043
2013-04-04 11:42:01 -07:00
Anthony Martin
272687ec24 cmd/nm: don't add filename elements for m symbols
The compilers used to generate only one 'm' symbol
to record the stack frame size for each function.

In cmd/nm, the 'm' and 'f' symbols are handled in
the same switch case with a special exception for
the symbol described above called ".frame".

Now that the compilers emit additional 'm' symbols
for precise garbage collection of the stack, the
current logic is incorrect. cmd/nm will attempt to
interpret these new 'm' symbols as 'f' symbols and
add them to the file name index table.

This fails with an out-of-memory condition when
zenter encounters an 'm' symbol with a very large
value (usually the .args symbol indicating a
variadic NOSPLIT function).

R=iant
CC=dave, gobot, golang-dev, rsc
https://golang.org/cl/7962045
2013-04-03 18:23:43 -07:00
Jonathan Rudenberg
2a99f2fb2a cmd/go: run main package when no files are listed
Fixes 5164.

R=golang-dev, iant, adg
CC=golang-dev
https://golang.org/cl/8119049
2013-04-04 12:04:35 +11:00
Dmitriy Vyukov
12b7db3d57 runtime: fix data/bss shadow memory mapping for race detector
Fixes #5175.
Race detector runtime expects values passed to MapShadow() to be page-aligned,
because they are used in mmap() call. If they are not aligned mmap() trims
either beginning or end of the mapping.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8325043
2013-04-04 09:11:34 +11:00
Rob Pike
c4e82bb923 doc: link the race detector document into the release notes
Also:
- put GORACE into the go env command
- do minor housekeeping on the race detector article

Fixes #4995.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/8319044
2013-04-03 13:56:24 -07:00
Robert Griesemer
1b37ba931f math/big: minor cleanups
- comment fixes
- s/z/x/ in (*rat).Float64 to match convention for functions
  returning a non-*Rat
- minor test output tweaking

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8327044
2013-04-03 13:24:32 -07:00
James Tucker
4f1ef563cc database/sql: improve standard deviation response time under high concurrency
See https://github.com/raggi/go-and-java for runtime benchmark.

The patch reduces the amount of map key search, moving connection oriented
variables onto the connection structs.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8092045
2013-04-03 11:13:40 -07:00
Brad Fitzpatrick
ca24f9ec00 net/smtp: allow PLAIN auth when advertised
The smtp package originally allowed PLAIN whenever, but then
the TLS check was added for paranoia, but it's too paranoid:
it prevents using PLAIN auth even from localhost to localhost
when the server advertises PLAIN support.

This CL also permits the client to send PLAIN if the server
advertises it.

Fixes #5184

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8279043
2013-04-03 10:52:20 -07:00
Rob Pike
995eb2cf51 bufio: make it a little clearer how the default Scanner splits lines.
Just commentary, no semantic change.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8329043
2013-04-03 10:40:04 -07:00
Brad Fitzpatrick
468851f1d5 net/http: don't allocate 0-byte io.LimitedReaders for GET requests
Save an allocation per GET request and don't call io.LimitedReader(r, 0)
just to read 0 bytes.  There's already an eofReader global variable
for when we just want a non-nil io.Reader to immediately EOF.

(Sorry, I know Rob told me to stop, but I was bored on the plane and
wrote this before I received the recent "please, really stop" email.)

benchmark                         old ns/op    new ns/op    delta
BenchmarkServerHandlerTypeLen         13888        13279   -4.39%
BenchmarkServerHandlerNoLen           12912        12229   -5.29%
BenchmarkServerHandlerNoType          13348        12632   -5.36%
BenchmarkServerHandlerNoHeader        10911        10261   -5.96%

benchmark                        old allocs   new allocs    delta
BenchmarkServerHandlerTypeLen            20           19   -5.00%
BenchmarkServerHandlerNoLen              18           17   -5.56%
BenchmarkServerHandlerNoType             18           17   -5.56%
BenchmarkServerHandlerNoHeader           13           12   -7.69%

benchmark                         old bytes    new bytes    delta
BenchmarkServerHandlerTypeLen          1913         1878   -1.83%
BenchmarkServerHandlerNoLen            1878         1843   -1.86%
BenchmarkServerHandlerNoType           1878         1844   -1.81%
BenchmarkServerHandlerNoHeader         1085         1051   -3.13%

Fixes #5188

R=golang-dev, adg, r
CC=golang-dev
https://golang.org/cl/8297044
2013-04-03 10:31:12 -07:00
Rémy Oudompheng
e42584effe bytes: don't leave mprotect-ed pages after unsafe test.
Fixes inscrutable GC faults during testing.

R=golang-dev, bradfitz, dave, fullung
CC=golang-dev
https://golang.org/cl/8300044
2013-04-03 08:30:20 -07:00
Robert Griesemer
2ba6ecb3e2 go/parser: ParseExpr must accept type expressions
My old code was trying to be too smart.
Also: Slightly better error message format
for gofmt -r pattern errors.

Fixes #4406.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/8267045
2013-04-03 07:41:26 -07:00
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