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

12388 Commits

Author SHA1 Message Date
Ian Lance Taylor
813590b145 cmd/ld: if we fail from an unexpected PE flags value, print it
R=golang-dev, minux.ma, r
CC=golang-dev
https://golang.org/cl/8709043
2013-04-12 07:58:50 -07:00
Ian Lance Taylor
709e03f43d runtime: add a hook to disable precise GC
This will let us ask people to rebuild the Go system without
precise GC, and then rebuild and retest their program, to see
if precise GC is causing whatever problem they are having.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8700043
2013-04-12 05:23:38 -07:00
Ian Lance Taylor
9fe8681df6 runtime: use UMTX_OP_WAIT_UINT on FreeBSD
UMTX_OP_WAIT expects that the address points to a uintptr, but
the code in lock_futex.c uses a uint32.  UMTX_OP_WAIT_UINT is
just like UMTX_OP_WAIT, but the address points to a uint32.
This almost certainly makes no difference on a little-endian
system, but since the kernel supports it we should do the
right thing.  And, who knows, maybe it matters.

R=golang-dev, bradfitz, r, ality
CC=golang-dev
https://golang.org/cl/8699043
2013-04-12 05:20:15 -07:00
Rob Pike
88f9ab8926 encoding/json: documentation regarding anonymous fields.
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/8545046
2013-04-11 12:46:23 -07:00
Volker Dobler
a9f1569e7b gc: escape unicode BOM in exported string literals
Fixes #5260.

R=golang-dev, minux.ma, 0xjnml, r
CC=golang-dev
https://golang.org/cl/8658043
2013-04-11 11:45:18 -07:00
Andrew Wilkins
d06be395cc cmd/cgo, cmd/go: remove #cgo directive parsing from cmd/cgo
This change removes processing of #cgo directives from cmd/cgo,
pushing the onus back on cmd/go to pass all necessary flags.

Fixes #5224. See comments for rationale.

R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/8610044
2013-04-10 21:41:54 -07:00
Rob Pike
082a4a8a47 bufio/Scan: fix error handling at EOF
Fixes #5268.

R=golang-dev, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/8646045
2013-04-10 20:58:19 -07:00
Anthony Martin
7ac20853fc cmd/ld: fix scope of static objects in symbol table
All symbols are currently marked with global scope.
The correct behavior was lost when the symbol table
format was changed.

R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/8625043
2013-04-10 18:47:58 -07:00
Rob Pike
bb195f6793 fmt: tweak the explanation of Stringer to be more correct and less specific
The String method is called whenever the printing operation wants a string,
not just for %s and %v.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8638043
2013-04-10 14:05:34 -07:00
Robert Griesemer
d06313e8ce go/ast: distinguish between methods and functions in filtering
Go1.1 harmless, but not critical.

Fixes #5249.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8609043
2013-04-10 13:39:20 -07:00
Rob Pike
5fd708c000 encoding/json: different decision on tags and shadowing
If there are no tags, the rules are the same as before.
If there is a tagged field, choose it if there is exactly one
at the top level of all fields.
More tests. The old tests were clearly inadequate, since
they all pass as is. The new tests only work with the new code.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/8617044
2013-04-10 13:05:34 -07:00
Shenghou Ma
f0fc16abd7 cmd/ld: fix argument passing in doc.go
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8622043
2013-04-11 04:04:02 +08:00
Rémy Oudompheng
0e76a943c9 cmd/ld: fix inconsistency in internal linking of common symbols.
Some variables declared in C could end up as undefined symbols
in the final binary and have null address.

Fixes #5114.
Fixes #5227.

R=golang-dev, iant, ajstarks, dave, r
CC=golang-dev
https://golang.org/cl/8602044
2013-04-10 07:15:49 +02:00
Rob Pike
357e37dc94 encoding/json: fix handling of anonymous fields
The old code was incorrect and also broken. It passed the tests by accident.
The new algorithm is:
        1) Sort the fields in order of names.
        2) For all fields with the same name, sort in increasing depth.
        3) Choose the single field with shortest depth.
If any of the fields of a given name has a tag, do the above using
tagged fields of that name only.
Fixes #5245.

R=iant
CC=golang-dev
https://golang.org/cl/8583044
2013-04-09 15:00:21 -07:00
Brad Fitzpatrick
8691f90cc5 io: document non-guarantees of io.Closer
R=r, golang-dev
CC=golang-dev
https://golang.org/cl/8575043
2013-04-09 10:17:35 -07:00
Ian Lance Taylor
0d932d434b lib9: add newline to exec error message
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/8573043
2013-04-09 10:03:14 -07:00
Mikio Hara
e13341edd1 net: fix possible runtime.PollDesc leak when connect or listen fails
Makes it possible to return the spent runtime.PollDesc to
runtime.pollcache descriptor pool when netFD.connect or
syscall.Listen fails.

Fixes #5219.

R=dvyukov, dave, bradfitz, adg
CC=golang-dev
https://golang.org/cl/8318044
2013-04-09 12:41:58 +09:00
Alex Brainman
384b72e94b run.bat: make windows runtime test timeout same as other os
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/8551043
2013-04-09 13:01:09 +10:00
Dmitriy Vyukov
c8b2b725e0 runtime: fix integer overflow in hashmap
The test is problematic, because it requires 8GB+ of RAM.
Fixes #5239.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8550043
2013-04-08 18:56:38 -07:00
Dave Cheney
77a0b96f2f net: add test for runtime.PollDesc leak
See 8318044

R=bradfitz
CC=golang-dev
https://golang.org/cl/8547043
2013-04-09 11:14:22 +10:00
Andrew Wilkins
afb49aada5 cmd/cgo: record CGO_LDFLAGS env var in _cgo_flags
cgo stores cgo LDFLAGS in _cgo_flags and _cgo_defun.c.
The _cgo_defun.c records the flags via
"#pragma cgo_ldflag <flag>", which external linking
relies upon for passing libraries (and search paths)
to the host linker.

The go command will allow LDFLAGS for cgo to be passed
through the environment (CGO_LDFLAGS); cgo ignores
this environment variable, and so its value doesn't
make it into the above mentioned files. This CL changes
cgo to record CGO_LDFLAGS also.

Fixes #5205.

R=iant, minux.ma
CC=golang-dev
https://golang.org/cl/8465043
2013-04-09 07:35:06 +08:00
Rémy Oudompheng
5bb3a66a97 sync, sync/atomic: do not corrupt race detector after a nil dereference.
The race detector uses a global lock to analyze atomic
operations. A panic in the middle of the code leaves the
lock acquired.

Similarly, the sync package may leave the race detectro
inconsistent when methods are called on nil pointers.

R=golang-dev, r, minux.ma, dvyukov, rsc, adg
CC=golang-dev
https://golang.org/cl/7981043
2013-04-08 23:46:54 +02:00
Dmitriy Vyukov
bd1cd1ddea runtime: poor man's heap type info checker
It's not trivial to make a comprehensive check
due to inferior pointers, reflect, gob, etc.
But this is essentially what I've used to debug
the GC issues.
Update #5193.

R=golang-dev, iant, 0xe2.0x9a.0x9b, r
CC=golang-dev
https://golang.org/cl/8455043
2013-04-08 13:36:35 -07:00
Rémy Oudompheng
20e05303fe cmd/gc: properly set variadic flag on method values.
Fixes #5231.

R=golang-dev, daniel.morsing, adg
CC=golang-dev
https://golang.org/cl/8275044
2013-04-08 08:59:33 +02:00
Rob Pike
18ca86ebb3 cmd/go: fix a misleading sentence
Apologies for not reviewing the previous CL; I was on the road.
The text was misleading; execution is no more separate than with
any other test. Rewritten. Dropped the odd adverb.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8439045
2013-04-07 23:27:26 -07:00
Andrew Gerrand
212cb0375a cmd/go: clarify what "pkg.test" means wrt the -c flag
Fixes #5230.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8507043
2013-04-08 16:03:19 +10:00
Andrew Gerrand
bfcd2d1e80 archive/zip: handle trailing data after the end of directory header
The spec doesn't explicitly say that trailing data is okay, but a lot
of people do this and most unzippers will handle it just fine. In any
case, this makes the package more useful, and led me to make the
directory parsing code marginally more robust.

Fixes #5228.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/8504044
2013-04-08 15:38:06 +10:00
Kamil Kisiel
091970c551 cmd/go: document usage of external test packages
Fixes #5144

R=golang-dev, r, dave, adg
CC=golang-dev
https://golang.org/cl/8171044
2013-04-08 14:42:06 +10:00
Rob Pike
092c481c1b reflect: document the unreliability of StringHeader and SliceHeader
R=golang-dev, adg, dvyukov
CC=golang-dev
https://golang.org/cl/8494045
2013-04-07 18:42:47 -07:00
Andrew Gerrand
78c4d50d25 doc: document go1.1 build tag
Fixes #5235.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8426048
2013-04-08 11:41:01 +10:00
Dmitriy Vyukov
b6bfc92df3 runtime: fix race on hashmap flags field
Use atomic operations on flags field to make sure we aren't
losing a flag update during parallel map operations.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/8377046
2013-04-07 18:19:16 -07:00
Alexei Sholik
f4de042e2c go/ast: fix typo in Fprint documentation
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8499043
2013-04-07 16:50:23 -07:00
David Symonds
2be84a8c2b undo CL 8363045 / a3ce42f9748b
It changes an exported API, and breaks the build.

««« original CL description
reflect: use unsafe.Pointer in StringHeader and SliceHeader

Relates to issue 5193.

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

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8357051
2013-04-08 07:59:47 +10:00
Jan Ziak
487721fd0d reflect: use unsafe.Pointer in StringHeader and SliceHeader
Relates to issue 5193.

R=r
CC=golang-dev
https://golang.org/cl/8363045
2013-04-07 23:33:40 +02:00
Albert Strasheim
4235fa8f2a runtime, runtime/debug, runtime/race: deflake tests
R=golang-dev, dvyukov, bradfitz
CC=golang-dev
https://golang.org/cl/8366044
2013-04-07 11:37:37 -07:00
Albert Strasheim
dc7daa550a lib9: handle empty TMPDIR more gracefully.
Before, an empty TMPDIR would lead to:
cannot create <nil>/go.o: No such file or directory

R=golang-dev, iant, dave, bradfitz
CC=golang-dev
https://golang.org/cl/8355045
2013-04-07 11:16:15 -07:00
Albert Strasheim
114f20532e runtime: gofmt -s
R=golang-dev, iant, dave
CC=golang-dev
https://golang.org/cl/8253045
2013-04-07 18:37:32 +10:00
Dmitriy Vyukov
0b5d55984f runtime: fix deadlock in network poller
The invariant is that there must be at least one running P or a thread polling network.
It was broken.
Fixes #5216.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/8459043
2013-04-06 22:27:54 -07:00
Ian Lance Taylor
6732ad94c7 runtime: make CgoMal alloc field void*
This makes it an unsafe.Pointer in Go so the garbage collector
will treat it as a pointer to untyped data, not a pointer to
bytes.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/8286045
2013-04-06 20:18:15 -07:00
Dmitriy Vyukov
58030c541b runtime: change Note from union to struct
Unions can break precise GC.
Update #5193.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/8362046
2013-04-06 20:09:02 -07:00
Dmitriy Vyukov
d617454379 runtime: change Lock from union to struct
Unions can break precise GC.
Update #5193.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/8457043
2013-04-06 20:07:07 -07:00
Dmitriy Vyukov
60682c4f59 runtime: replace unions with structs
Unions can break precise GC.
Update #5193.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/8456043
2013-04-06 20:02:49 -07:00
Dmitriy Vyukov
cfe336770b runtime: replace union in MHeap with a struct
Unions break precise GC.
Update #5193.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/8368044
2013-04-06 20:02:03 -07:00
Dmitriy Vyukov
54340bf56f runtime: reset dangling typed pointer
+untype it because it can point to different types
Update #5193.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/8454043
2013-04-06 20:01:28 -07:00
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
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