1
0
mirror of https://github.com/golang/go synced 2024-10-02 22:31:22 -06:00
Commit Graph

12681 Commits

Author SHA1 Message Date
Adam Langley
8590e1bd3c crypto/tls: don't send NPN extension if NextProtos is not set.
This isn't clearly a bug on Go's part, but it triggers a bug in Firefox
which means that crypto/tls and net/http cannot be wired up together
unless NextProtos includes "http/1.1". When net/http sets up the
tls.Config, it does this and so works fine. But anyone setting up the
tls.Config themselves will hit the Firefox bug.

Fixes #5445.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/9539045
2013-05-21 10:47:31 -04:00
Shenghou Ma
f5d06da072 cmd/api: add more platforms
as OpenBSD lacks 4 errno constants, api/go1.txt is updated so that
api check won't fail.

R=golang-dev, iant, bradfitz, r
CC=golang-dev
https://golang.org/cl/9149045
2013-05-21 21:47:32 +08:00
Brad Fitzpatrick
c6c439d7a0 net/http: use WriteString directly when possible
Several places used io.WriteString unnecessarily when the
static type already implemented WriteString. No need to
check for it at runtime.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9608043
2013-05-20 19:26:26 -07:00
Rémy Oudompheng
fc3bec386e cmd/gc: clear n->list of OFOR range loop after walk.
It contains the LHS of the range clause and gets
instrumented by racewalk, but it doesn't have any meaning.

Fixes #5446.

R=golang-dev, dvyukov, daniel.morsing, r
CC=golang-dev
https://golang.org/cl/9560044
2013-05-20 23:45:22 +02:00
Rémy Oudompheng
4b0eb19a05 cmd/gc: eliminate a useless bounds check in inlined append().
R=golang-dev, daniel.morsing, r
CC=golang-dev
https://golang.org/cl/9358043
2013-05-20 23:19:41 +02:00
Adam Langley
b419e2b57c crypto/x509: provide better error messages for X.509 verify failures.
Failures caused by errors like invalid signatures or missing hash
functions cause rather generic, unhelpful error messages because no
trust chain can be constructed: "x509: certificate signed by unknown
authority."

With this change, authority errors may contain the reason why an
arbitary candidate step in the chain was rejected. For example, in the
event of a missing hash function the error looks like:

x509: certificate signed by unknown authority (possibly because of
"crypto/x509: cannot verify signature: algorithm unimplemented" while
trying to verify candidate authority certificate 'Thawte SGC CA')

Fixes 5058.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9104051
2013-05-20 14:20:26 -04:00
Brad Fitzpatrick
27f7427995 net/http: simplify transfer body; reduces allocations too
benchmark                                   old ns/op    new ns/op    delta
BenchmarkServerFakeConnNoKeepAlive              14431        14247   -1.28%
BenchmarkServerFakeConnWithKeepAlive            11618        11357   -2.25%
BenchmarkServerFakeConnWithKeepAliveLite         6735         6427   -4.57%
BenchmarkServerHandlerTypeLen                    8842         8740   -1.15%
BenchmarkServerHandlerNoLen                      8001         7828   -2.16%
BenchmarkServerHandlerNoType                     8270         8227   -0.52%
BenchmarkServerHandlerNoHeader                   6148         5920   -3.71%

benchmark                                  old allocs   new allocs    delta
BenchmarkServerFakeConnNoKeepAlive                 30           29   -3.33%
BenchmarkServerFakeConnWithKeepAlive               25           24   -4.00%
BenchmarkServerFakeConnWithKeepAliveLite           10            9  -10.00%
BenchmarkServerHandlerTypeLen                      18           17   -5.56%
BenchmarkServerHandlerNoLen                        15           14   -6.67%
BenchmarkServerHandlerNoType                       16           15   -6.25%
BenchmarkServerHandlerNoHeader                     10            9  -10.00%

benchmark                                   old bytes    new bytes    delta
BenchmarkServerFakeConnNoKeepAlive               2557         2492   -2.54%
BenchmarkServerFakeConnWithKeepAlive             2260         2194   -2.92%
BenchmarkServerFakeConnWithKeepAliveLite         1092         1026   -6.04%
BenchmarkServerHandlerTypeLen                    1941         1875   -3.40%
BenchmarkServerHandlerNoLen                      1898         1832   -3.48%
BenchmarkServerHandlerNoType                     1906         1840   -3.46%
BenchmarkServerHandlerNoHeader                   1092         1026   -6.04%

Update #5195

R=golang-dev, daniel.morsing
CC=golang-dev
https://golang.org/cl/9492044
2013-05-20 07:23:59 -07:00
Mikio Hara
b98a4d1a10 syscall: prefer PATH environment variable in bootstrap scripts
R=golang-dev, dave, iant
CC=golang-dev
https://golang.org/cl/9575043
2013-05-20 23:18:52 +09:00
Mikio Hara
c5732c8526 runtime: integrated network poller for freebsd/amd64,386, openbsd/amd64,386
Update #5199

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/8825043
2013-05-20 19:25:32 +09:00
Alex Brainman
1a948950f7 net: move system common global variables into fd_unix.go
R=golang-dev, bradfitz
CC=dvyukov, golang-dev, mikioh.mikioh
https://golang.org/cl/9495044
2013-05-20 15:23:45 +10:00
Dmitriy Vyukov
1308194204 runtime: zeroize g->fnstart to not prevent GC of the closure
Fixes #5493.

R=golang-dev, minux.ma, iant
CC=golang-dev
https://golang.org/cl/9557043
2013-05-20 08:17:21 +04:00
Brad Fitzpatrick
d4cbc80d10 net/http: fewer allocations in the server path
Don't allocate for the Date or Content-Length headers.
A custom Date header formatter replaces use of time.Format.

benchmark                                   old ns/op    new ns/op    delta
BenchmarkClientServer                           67791        64424   -4.97%
BenchmarkClientServerParallel4                  62956        58533   -7.03%
BenchmarkClientServerParallel64                 62043        54789  -11.69%
BenchmarkServer                                254609       229060  -10.03%
BenchmarkServerFakeConnNoKeepAlive              17038        16316   -4.24%
BenchmarkServerFakeConnWithKeepAlive            14184        13226   -6.75%
BenchmarkServerFakeConnWithKeepAliveLite         8591         7532  -12.33%
BenchmarkServerHandlerTypeLen                   10750         9961   -7.34%
BenchmarkServerHandlerNoLen                      9535         8935   -6.29%
BenchmarkServerHandlerNoType                     9858         9362   -5.03%
BenchmarkServerHandlerNoHeader                   7754         6856  -11.58%

benchmark                                  old allocs   new allocs    delta
BenchmarkClientServer                              68           66   -2.94%
BenchmarkClientServerParallel4                     68           66   -2.94%
BenchmarkClientServerParallel64                    68           66   -2.94%
BenchmarkServer                                    21           19   -9.52%
BenchmarkServerFakeConnNoKeepAlive                 32           30   -6.25%
BenchmarkServerFakeConnWithKeepAlive               27           25   -7.41%
BenchmarkServerFakeConnWithKeepAliveLite           12           10  -16.67%
BenchmarkServerHandlerTypeLen                      19           18   -5.26%
BenchmarkServerHandlerNoLen                        17           15  -11.76%
BenchmarkServerHandlerNoType                       17           16   -5.88%
BenchmarkServerHandlerNoHeader                     12           10  -16.67%

Update #5195

R=nigeltao
CC=golang-dev
https://golang.org/cl/9432046
2013-05-19 20:15:40 -07:00
Alex Brainman
38abb09a2e runtime: change PollDesc.fd from int32 to uintptr
This is in preparation for netpoll windows version.

R=golang-dev, bradfitz
CC=dvyukov, golang-dev, mikioh.mikioh
https://golang.org/cl/9569043
2013-05-20 12:55:50 +10:00
Dmitriy Vyukov
fee1d1cda0 runtime: properly set G status after syscall
R=golang-dev, r, dave
CC=golang-dev
https://golang.org/cl/9307045
2013-05-19 19:35:09 +04:00
Anthony Martin
2dc751ac21 runtime, cmd/gc: clean up function protoypes
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8652043
2013-05-18 15:49:23 -07:00
Anthony Martin
8b85a3d480 runtime: mark usleep as NOSPLIT on Plan 9
Usleep is called from lockextra, also marked NOSPLIT.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9258043
2013-05-18 15:47:49 -07:00
Anthony Martin
b65271d008 runtime: fix newproc debugging print
R=golang-dev, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/9249044
2013-05-18 15:47:15 -07:00
Keith Randall
28882bbd33 compress/flate: faster version of forwardCopy
benchmark                           old ns/op    new ns/op    delta
BenchmarkDecodeDigitsSpeed1e4          197767       203490   +2.89%
BenchmarkDecodeDigitsSpeed1e5         1873969      1912761   +2.07%
BenchmarkDecodeDigitsSpeed1e6        18922760     19021056   +0.52%
BenchmarkDecodeDigitsDefault1e4        194975       197054   +1.07%
BenchmarkDecodeDigitsDefault1e5       1704262      1719988   +0.92%
BenchmarkDecodeDigitsDefault1e6      16618354     16351957   -1.60%
BenchmarkDecodeDigitsCompress1e4       195281       194626   -0.34%
BenchmarkDecodeDigitsCompress1e5      1694364      1702372   +0.47%
BenchmarkDecodeDigitsCompress1e6     16463347     16492126   +0.17%
BenchmarkDecodeTwainSpeed1e4           200653       200127   -0.26%
BenchmarkDecodeTwainSpeed1e5          1861385      1759632   -5.47%
BenchmarkDecodeTwainSpeed1e6         18255769     17186679   -5.86%
BenchmarkDecodeTwainDefault1e4         189080       185157   -2.07%
BenchmarkDecodeTwainDefault1e5        1559222      1461465   -6.27%
BenchmarkDecodeTwainDefault1e6       14792125     13879051   -6.17%
BenchmarkDecodeTwainCompress1e4        188881       185151   -1.97%
BenchmarkDecodeTwainCompress1e5       1537031      1456945   -5.21%
BenchmarkDecodeTwainCompress1e6      14805972     13405094   -9.46%
BenchmarkPaeth                          4            4   -0.89%
BenchmarkDecodeGray                964679       937244   -2.84%
BenchmarkDecodeNRGBAGradient      3753769      3646416   -2.86%
BenchmarkDecodeNRGBAOpaque        3165856      2981300   -5.83%
BenchmarkDecodePaletted            713950       691984   -3.08%
BenchmarkDecodeRGB                3051718      2924260   -4.18%

R=nigeltao, bradfitz
CC=golang-dev, raph
https://golang.org/cl/9425046
2013-05-18 15:28:27 -07:00
Dominik Honnef
70f3b6097b cmd/go: Update documentation of go run to match current behaviour.
Fixes #5511.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/9530043
2013-05-18 19:22:30 +08:00
Brad Fitzpatrick
b25a53acd7 bufio: make Reader buffer transient
Share garbage between different bufio Readers. When a Reader
has zero buffered data, put its buffer into a pool.

This acknowledges that most bufio.Readers eventually get
read to completion, and their buffers are then no longer
needed.

benchmark               old ns/op    new ns/op    delta
BenchmarkReaderEmpty         2993         1058  -64.65%

benchmark              old allocs   new allocs    delta
BenchmarkReaderEmpty            3            2  -33.33%

benchmark               old bytes    new bytes    delta
BenchmarkReaderEmpty         4278          133  -96.89%

Update #5100

R=r
CC=adg, dvyukov, gobot, golang-dev, rogpeppe
https://golang.org/cl/8819049
2013-05-17 15:16:06 -07:00
Rob Pike
249842c8db cmd/vet: delete; it now lives in the go.tools subrepo
R=golang-dev, dsymonds, rsc, iant, dave
CC=golang-dev
https://golang.org/cl/9496043
2013-05-17 13:53:22 -07:00
Keith Randall
6021449236 runtime: faster x86 memmove (a.k.a. built-in copy())
REP instructions have a high startup cost, so we handle small
sizes with some straightline code.  The REP MOVSx instructions
are really fast for large sizes.  The cutover is approximately
1K.  We implement up to 128/256 because that is the maximum
SSE register load (loading all data into registers before any
stores lets us ignore copy direction).

(on a Sandy Bridge E5-1650 @ 3.20GHz)
benchmark               old ns/op    new ns/op    delta
BenchmarkMemmove0               3            3   +0.86%
BenchmarkMemmove1               5            5   +5.40%
BenchmarkMemmove2              18            8  -56.84%
BenchmarkMemmove3              18            7  -58.45%
BenchmarkMemmove4              36            7  -78.63%
BenchmarkMemmove5              36            8  -77.91%
BenchmarkMemmove6              36            8  -77.76%
BenchmarkMemmove7              36            8  -77.82%
BenchmarkMemmove8              18            8  -56.33%
BenchmarkMemmove9              18            7  -58.34%
BenchmarkMemmove10             18            7  -58.34%
BenchmarkMemmove11             18            7  -58.45%
BenchmarkMemmove12             36            7  -78.51%
BenchmarkMemmove13             36            7  -78.48%
BenchmarkMemmove14             36            7  -78.56%
BenchmarkMemmove15             36            7  -78.56%
BenchmarkMemmove16             18            7  -58.24%
BenchmarkMemmove32             18            8  -54.33%
BenchmarkMemmove64             18            8  -53.37%
BenchmarkMemmove128            20            9  -55.93%
BenchmarkMemmove256            25           11  -55.16%
BenchmarkMemmove512            33           33   -1.19%
BenchmarkMemmove1024           43           44   +2.06%
BenchmarkMemmove2048           61           61   +0.16%
BenchmarkMemmove4096           95           95   +0.00%

R=golang-dev, bradfitz, remyoudompheng, khr, iant, dominik.honnef
CC=golang-dev
https://golang.org/cl/9038048
2013-05-17 12:53:49 -07:00
Shenghou Ma
a848475324 cmd/ld: emit .tbss section when doing dynamic internal linking
Fixes #5200.

R=iant, dave
CC=golang-dev
https://golang.org/cl/9383043
2013-05-18 02:41:49 +08:00
Alex Brainman
fad27ec5d4 os: clarify windows read console code
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9458043
2013-05-17 17:26:44 +10:00
Alex Brainman
c15ca825ad runtime: revert 3c2cddfbdaec
It appears, syscall.NewCallback still
uses heap to store executable code.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/9060046
2013-05-17 14:23:29 +10:00
Alex Brainman
28f74608b5 runtime: do not mark os memory as executable on windows
R=golang-dev, bradfitz, khr
CC=golang-dev
https://golang.org/cl/9235046
2013-05-17 13:37:30 +10:00
Carl Shapiro
50ba6e13b4 runtime: fix scanning of not started goroutines
The stack scanner for not started goroutines ignored the arguments
area when its size was unknown.  With this change, the distance
between the stack pointer and the stack base will be used instead.

Fixes #5486

R=golang-dev, bradfitz, iant, dvyukov
CC=golang-dev
https://golang.org/cl/9440043
2013-05-16 10:42:39 -07:00
Adam Langley
21cf646bfc crypto/tls: fix flakey test.
A test added in b37d2fdcc4d9 didn't work with some values of GOMAXPROCS
because the defer statements were in the wrong order: the Pipe could be
closed before the TLS Client was.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/9187047
2013-05-16 12:29:23 -04:00
Alex Brainman
a65f861bfa os: use small buffer when reading from windows console
Fixes #5481.

R=golang-dev, dominik.honnef, bradfitz
CC=golang-dev
https://golang.org/cl/9437044
2013-05-16 17:20:13 +10:00
Rémy Oudompheng
78f5b616fc cmd/gc: repair make(T) in export data for inlining.
When T was an unexported type it could be forgotten.

Fixes #5470.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/9303050
2013-05-16 09:01:43 +02:00
Brad Fitzpatrick
0af302f507 time: add Time.FormatAppend
This is a version of Time.Format that doesn't require allocation.

Fixes #5192
Update #5195

R=r
CC=gobot, golang-dev
https://golang.org/cl/8478044
2013-05-15 17:23:40 -07:00
Robert Hencke
f7b5a01999 reflect: use visit structure for map key in DeepEqual
R=golang-dev, bradfitz, jonathan, r
CC=golang-dev
https://golang.org/cl/8730044
2013-05-15 14:50:57 -07:00
Dmitriy Vyukov
c6293d2106 runtime: fix GC scanning of slices
If a slice points to an array embedded in a struct,
the whole struct can be incorrectly scanned as the slice buffer.
Fixes #5443.

R=cshapiro, iant, r, cshapiro, minux.ma
CC=bradfitz, gobot, golang-dev
https://golang.org/cl/9372044
2013-05-15 23:50:32 +04:00
Dmitriy Vyukov
915784e11a runtime: add simple malloc benchmarks
Allocs of size 16 can bypass atomic set of the allocated bit, while allocs of size 8 can not.
Allocs with and w/o type info hit different paths inside of malloc.
Current results on linux/amd64:
BenchmarkMalloc8	50000000	        43.6 ns/op
BenchmarkMalloc16	50000000	        46.7 ns/op
BenchmarkMallocTypeInfo8	50000000	        61.3 ns/op
BenchmarkMallocTypeInfo16	50000000	        63.5 ns/op

R=golang-dev, remyoudompheng, minux.ma, bradfitz, iant
CC=golang-dev
https://golang.org/cl/9090045
2013-05-15 21:22:32 +04:00
Keith Randall
ee66972dce runtime: Optimize aeshash a bit. Use a better predicted branch
for checking for page boundary.  Also avoid boundary check
when >=16 bytes are hashed.

benchmark                        old ns/op    new ns/op    delta
BenchmarkHashStringSpeed                23           22   -0.43%
BenchmarkHashBytesSpeed                 44           42   -3.61%
BenchmarkHashStringArraySpeed           71           68   -4.05%

R=iant, khr
CC=gobot, golang-dev, google
https://golang.org/cl/9123046
2013-05-15 09:40:14 -07:00
Dmitriy Vyukov
23ad563119 runtime: transfer whole span from MCentral to MCache
Finer-grained transfers were relevant with per-M caches,
with per-P caches they are not relevant and harmful for performance.
For few small size classes where it makes difference,
it's fine to grab the whole span (4K).

benchmark          old ns/op    new ns/op    delta
BenchmarkMalloc           42           40   -4.45%

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/9374043
2013-05-15 18:35:05 +04:00
Adam Langley
e85e678899 crypto/rsa: check for minimal PKCS#1 v1.5 padding.
The PKCS#1 spec requires that the PS padding in an RSA message be at
least 8 bytes long. We were not previously checking this. This isn't
important in the most common situation (session key encryption), but
the impact is unclear in other cases.

This change enforces the specified minimum size.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/9222045
2013-05-15 10:27:34 -04:00
Adam Langley
a1dbfee15b crypto/tls: ignore empty TLS records.
OpenSSL can be configured to send empty records in order to randomise
the CBC IV. This is an early version of 1/n-1 record splitting (that Go
does) and is quite reasonable, but it results in tls.Conn.Read
returning (0, nil).

This change ignores up to 100 consecutive, empty records to avoid
returning (0, nil) to callers.

Fixes 5309.

R=golang-dev, r, minux.ma
CC=golang-dev
https://golang.org/cl/8852044
2013-05-15 10:25:54 -04:00
Adam Langley
133cdb6707 math/big: save some copies in binaryGCD.
This patch resulted from a bit of quick optimisation in response to a
golang-nuts post. It looks like one could save a couple other copies in
this function, but this addresses the inner loop and is fairly simple.

benchmark                    old ns/op    new ns/op    delta
BenchmarkGCD10x10                 1964         1711  -12.88%
BenchmarkGCD10x100                2019         1736  -14.02%
BenchmarkGCD10x1000               2471         2171  -12.14%
BenchmarkGCD10x10000              6040         5778   -4.34%
BenchmarkGCD10x100000            43204        43025   -0.41%
BenchmarkGCD100x100              11004         8520  -22.57%
BenchmarkGCD100x1000             11820         9446  -20.08%
BenchmarkGCD100x10000            23846        21382  -10.33%
BenchmarkGCD100x100000          133691       131505   -1.64%
BenchmarkGCD1000x1000           120041        95591  -20.37%
BenchmarkGCD1000x10000          136887       113600  -17.01%
BenchmarkGCD1000x100000         295370       273912   -7.26%
BenchmarkGCD10000x10000        2556126      2205198  -13.73%
BenchmarkGCD10000x100000       3159512      2808038  -11.12%
BenchmarkGCD100000x100000    150543094    139986045   -7.01%

R=gri, remyoudompheng
CC=bradfitz, gobot, golang-dev, gri
https://golang.org/cl/9424043
2013-05-15 10:03:22 -04:00
Dmitriy Vyukov
764bb36ea2 runtime: unset m->locks after actual lock unlock
This is needed for preemptive scheduler,
it will preempt only when m->locks==0,
and we do not want to be preempted while
we have not completely unlocked the lock.

R=golang-dev, khr, iant
CC=golang-dev
https://golang.org/cl/9196047
2013-05-15 16:48:41 +04:00
Dmitriy Vyukov
e69012ce2a runtime: use enums instead static vars for debugging
Compiler can detect and delete dead code with enums,
but can not with static vars.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/9377043
2013-05-15 11:10:26 +04:00
Dmitriy Vyukov
5a89b35bca runtime: inline size to class conversion in malloc()
Also change table type from int32[] to int8[] to save space in L1$.

benchmark          old ns/op    new ns/op    delta
BenchmarkMalloc           42           40   -4.68%

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/9199044
2013-05-15 11:02:33 +04:00
Brad Fitzpatrick
d9d8d4c62c cmd/godoc: don't warn about HEAD requests
Fixes #5451

R=gri
CC=dsymonds, gobot, golang-dev
https://golang.org/cl/9388043
2013-05-14 21:21:11 -07:00
Shenghou Ma
2eeab323ad cmd/yacc: don't emit line comment when -l is given
Fixes #5447.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9343045
2013-05-15 12:08:51 +08:00
Alexey Borzenkov
fae362e97e os/user: faster user lookup on Windows
Trying to lookup user's display name with directory services can
take several seconds when user's computer is not in a domain.
As a workaround, check if computer is joined in a domain first,
and don't use directory services if it is not.
Additionally, don't leak tokens in user.Current().
Fixes #5298.

R=golang-dev, bradfitz, alex.brainman, lucio.dere
CC=golang-dev
https://golang.org/cl/8541047
2013-05-15 13:24:54 +10:00
Jonathan Hseu
c691ae6764 testing/quick: fix for aliased types, delete duplicate uint8 test, and fix randFloat64() to give random numbers from (-math.MaxFloat64, math.MaxFloat64).
R=r, agl
CC=agl, bradfitz, golang-dev
https://golang.org/cl/9296046
2013-05-14 17:14:59 -07:00
Carl Shapiro
0e6007e4f9 runtime: enable stack scanning by frames
Update #5134

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/9406046
2013-05-14 16:38:12 -07:00
Brad Fitzpatrick
0bbf0ec0ed database/sql: use method values instead of generating closures
Reduces garbage.

R=adg, r
CC=dsymonds, gobot, golang-dev
https://golang.org/cl/9088045
2013-05-14 16:35:31 -07:00
Rémy Oudompheng
6c4943cb51 cmd/gc: fix race instrumentation of selectors T(v).Field
Fixes #5424.

R=golang-dev, daniel.morsing, dvyukov, r
CC=golang-dev
https://golang.org/cl/9033048
2013-05-15 01:25:20 +02:00
Keith Randall
b3946dc119 runtime/bytes: fast Compare for byte arrays and strings.
Uses SSE instructions to process 16 bytes at a time.

fixes #5354

R=bradfitz, google
CC=golang-dev
https://golang.org/cl/8853048
2013-05-14 16:05:51 -07:00
Brad Fitzpatrick
f1583bb956 encoding/json: allocate less in NewEncoder
The *Encoder is almost always garbage. It doesn't need an
encodeState inside of it (and its bytes.Buffer), since it's
only needed locally inside of Encode.

benchmark                 old ns/op    new ns/op    delta
BenchmarkEncoderEncode         2562         2553   -0.35%

benchmark                 old bytes    new bytes    delta
BenchmarkEncoderEncode          283          102  -63.96%

R=r
CC=gobot, golang-dev
https://golang.org/cl/9365044
2013-05-14 15:50:46 -07:00
Rob Pike
d73452b30f cmd/vet: fix for changes to go/types package
Need to use (or stub) exact.Value.

R=gri
CC=golang-dev
https://golang.org/cl/9126043
2013-05-14 15:49:58 -07:00
Alberto García Hierro
d535bc7af3 net/http: Fix basic authentication with empty password
The encoded string must include the : separating the username
        and the password, even when the latter is empty. See
        http://www.ietf.org/rfc/rfc2617.txt for more information.

R=golang-dev, bradfitz, adg
CC=golang-dev
https://golang.org/cl/8475043
2013-05-14 15:33:46 -07:00
Shenghou Ma
9c94580921 archive/tar: skip NUL-filled unused octal fields
Fixes #5290.

R=golang-dev, dave, bradfitz, r
CC=golang-dev
https://golang.org/cl/8763044
2013-05-15 04:40:42 +08:00
Robin Eklind
392cebea5d image: minor update of comments.
R=golang-dev, iant, bradfitz, nigeltao
CC=golang-dev
https://golang.org/cl/9408044
2013-05-14 13:28:16 -07:00
Shenghou Ma
3ac5d54cf9 cmd/gc: improve syntax error for "import testing"
for this program:
package A
import testing

old diagnostics:
pkg.go:2: syntax error: unexpected semicolon or newline, expecting string literal

now:
pkg.go:2: syntax error: missing import path; require quoted string

Fixes #5332.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9393043
2013-05-15 04:19:19 +08:00
Brad Fitzpatrick
2184282308 cmd/api: don't print out except.txt removed features to stdout
It's just noise. They've already been acknowledged in except.txt.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9392047
2013-05-14 09:43:56 -07:00
Brad Fitzpatrick
67acff0b09 go/token: let FileSet.AddFile take a negative base
Negative base now means "automatic". Fixes a higher
level race.

Fixes #5418

R=gri
CC=golang-dev
https://golang.org/cl/9269043
2013-05-14 09:30:13 -07:00
Dmitriy Vyukov
5a7e14c143 runtime/race: improve public documentation
Move the documentation from race.go to doc.go, because
race.go uses +build race, so it's not normally parsed by go doc.
Rephrase the documentation for end users, provide link to race
detector manual.
Fixes #5444.

R=golang-dev, minux.ma, adg, r
CC=golang-dev
https://golang.org/cl/9144050
2013-05-13 10:28:12 +04:00
Ian Lance Taylor
26d95d8027 runtime: fix crash in select
runtime.park() can access freed select descriptor
due to a racing free in another thread.
See the comment for details.

Slightly modified version of dvyukov's CL 9259045.

No test yet.  Before this CL, the test described in issue 5422
would fail about every 40 times for me.  With this CL, I ran
the test 5900 times with no failures.

Fixes #5422.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9311043
2013-05-08 14:58:34 -07:00
Ian Lance Taylor
8a28085a0f cmd/cgo: pass -Wsystem-headers when looking for errors
This works around a bug in GCC 4.8.0.

Fixes #5118.

R=golang-dev, r, minux.ma
CC=golang-dev
https://golang.org/cl/9120045
2013-05-08 06:28:33 -07:00
Alex Brainman
e1922febbe net: fix dial race on plan9 and windows
Fixes #5349.

R=golang-dev, lucio.dere, dsymonds, bradfitz, iant, adg, dave, r
CC=golang-dev
https://golang.org/cl/9159043
2013-05-08 16:19:02 +10:00
Brad Fitzpatrick
9e93d5014e api: add go1.1.txt; update cmd/api to use it
R=golang-dev, adg, r
CC=golang-dev
https://golang.org/cl/9250043
2013-05-06 17:25:09 -07:00
Dmitriy Vyukov
f322c78692 runtime: fix crash in badsignal()
The linker can generate split stack prolog when a textflag 7 function
makes an indirect function call.  If it happens, badsignal() crashes
trying to dereference g.
Fixes #5337.

R=bradfitz, dave, adg, iant, r, minux.ma
CC=adonovan, golang-dev
https://golang.org/cl/9226043
2013-05-06 16:15:03 -07:00
Shenghou Ma
b3b1efd882 runtime: reduce max arena size on windows/amd64 to 32 GiB
Update #5236
Update #5402
This CL reduces gofmt's committed memory from 545864 KiB to 139568 KiB.
Note: Go 1.0.3 uses about 70MiB.

R=golang-dev, r, iant, nightlyone
CC=golang-dev
https://golang.org/cl/9245043
2013-05-07 06:53:02 +08:00
Brad Fitzpatrick
e85016f81f database/sql: remove an unused field from Rows
Found while debugging memory usage. Nobody accesses this field
anymore.

R=golang-dev, i.caught.air, adg, r
CC=golang-dev
https://golang.org/cl/9108043
2013-05-06 15:16:47 -07:00
Shenghou Ma
6de184b385 syscall: fix prototype of Fchflags (API change)
API change, but the old API is obviously wrong.

R=golang-dev, iant, r, rsc
CC=golang-dev
https://golang.org/cl/9157044
2013-05-07 05:20:00 +08:00
Jeremiah Harmsen
a228e733b9 go/doc/example: Fix bug causing false negatives for Example playability.
Allows Examples with KeyValue expressions to be playable in godoc.

During the traversal of the abstract syntax tree any KeyValueExpr Key.Name was incorrectly being added as an unresolved identifier.
Since this identifier could not be provided the Example was marked as unplayable.
This updates the AST traversal to skip Keys (but continue traversing the Values).

Example of problematic AST now fixed (see L99 where "UpperBound" was being added as a missing identifier):

 81  .  .  .  .  .  .  .  .  .  Values: []ast.Expr (len = 1) {
 82  .  .  .  .  .  .  .  .  .  .  0: *ast.UnaryExpr {
 83  .  .  .  .  .  .  .  .  .  .  .  OpPos: 12:19
 84  .  .  .  .  .  .  .  .  .  .  .  Op: &
 85  .  .  .  .  .  .  .  .  .  .  .  X: *ast.CompositeLit {
 86  .  .  .  .  .  .  .  .  .  .  .  .  Type: *ast.SelectorExpr {
 87  .  .  .  .  .  .  .  .  .  .  .  .  .  X: *ast.Ident {
 88  .  .  .  .  .  .  .  .  .  .  .  .  .  .  NamePos: 12:20
 89  .  .  .  .  .  .  .  .  .  .  .  .  .  .  Name: "t_proto"
 90  .  .  .  .  .  .  .  .  .  .  .  .  .  }
 91  .  .  .  .  .  .  .  .  .  .  .  .  .  Sel: *ast.Ident {
 92  .  .  .  .  .  .  .  .  .  .  .  .  .  .  NamePos: 12:41
 93  .  .  .  .  .  .  .  .  .  .  .  .  .  .  Name: "BConfig"
 94  .  .  .  .  .  .  .  .  .  .  .  .  .  }
 95  .  .  .  .  .  .  .  .  .  .  .  .  }
 96  .  .  .  .  .  .  .  .  .  .  .  .  Lbrace: 12:79
 97  .  .  .  .  .  .  .  .  .  .  .  .  Elts: []ast.Expr (len = 2) {
 98  .  .  .  .  .  .  .  .  .  .  .  .  .  0: *ast.KeyValueExpr {
 99  .  .  .  .  .  .  .  .  .  .  .  .  .  .  Key: *ast.Ident {
100  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  NamePos: 13:3
101  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  Name: "UpperBound"
102  .  .  .  .  .  .  .  .  .  .  .  .  .  .  }
103  .  .  .  .  .  .  .  .  .  .  .  .  .  .  Colon: 13:13
104  .  .  .  .  .  .  .  .  .  .  .  .  .  .  Value: *ast.CallExpr {
105  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  Fun: *ast.SelectorExpr {
106  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  X: *ast.Ident {
107  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  NamePos: 13:15
108  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  Name: "proto"
109  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  }
110  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  Sel: *ast.Ident {
111  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  NamePos: 13:21
112  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  Name: "Float32"
113  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  }

R=adg
CC=gobot, golang-dev, gri
https://golang.org/cl/8569045
2013-05-06 10:15:16 -07:00
Brad Fitzpatrick
1294f14f1f image/png: fix error message to not return width twice
Fixes #5413

R=golang-dev, dave, adg
CC=golang-dev
https://golang.org/cl/9153045
2013-05-06 09:59:33 -07:00
Shenghou Ma
a21b36da1c go/build: document GOOS.go also has implicit GOOS build constraint
R=golang-dev, i.caught.air, alexb, r
CC=golang-dev
https://golang.org/cl/9064044
2013-05-05 02:23:19 +08:00
Keith Randall
4ff48c7f45 text/template: comment fix
R=golang-dev, minux.ma, r
CC=golang-dev
https://golang.org/cl/9086043
2013-05-03 14:22:34 -07:00
Shenghou Ma
988236ba86 runtime/cgo: fix build for ARM
TBR=iant
CC=golang-dev
https://golang.org/cl/9048048
2013-05-03 17:15:43 +08:00
Shenghou Ma
e0db7fae87 cmd/ld: add .note.GNU-stack section for external linking
Fixes #5392.

R=iant, r
CC=golang-dev
https://golang.org/cl/9119043
2013-05-03 16:33:21 +08:00
Brad Fitzpatrick
7cc0581f86 regexp: doc fix
This must have been from when "error" was a good variable
name for an "os.Error". But we use "err" these days.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/9132045
2013-05-02 18:59:39 -07:00
Alex Brainman
3a32367040 cmd/ld: fix SDYNIMPORT symbol test
As advised by iant. Fixes windows build.

R=golang-dev, r
CC=golang-dev, iant
https://golang.org/cl/9110044
2013-05-02 13:02:00 +10:00
Rob Pike
d727d147c0 cmd/ld: fix another unsigned value causing bugs on Plan 9
"The usual conversions" bite again.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/9103044
2013-05-01 17:00:21 -07:00
David du Colombier
c8942f021e libmach: fix build on Plan 9
Include libc.h before bio.h in 8.c, because bio.h uses
the UTFmax enum, which is declared in libc.h, since
the recent switch to 21-bit runes in Plan 9.

The 5.c and 6.c files already includes libc.h.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9040047
2013-05-01 15:48:13 -07:00
Ian Lance Taylor
83feea5af8 cmd/cgo: correct pragma name in comment
R=rsc, alexb, minux.ma, bradfitz, i.caught.air
CC=golang-dev
https://golang.org/cl/9082043
2013-05-01 14:31:42 -07:00
Ian Lance Taylor
9de38d6788 runtime/cgo: export symbols in both internal and external link mode
R=rsc, r
CC=golang-dev
https://golang.org/cl/9060045
2013-05-01 14:30:51 -07:00
Ian Lance Taylor
a555758909 cmd/ld: fix syms that are both cgo_import_static & cgo_import_dynamic
This is needed for SWIG when linking in internal mode.  In
internal mode if a symbol was cgo_import_static we used to
forget that it was also cgo_import_dynamic.

R=rsc, r
CC=golang-dev
https://golang.org/cl/9080043
2013-05-01 14:30:19 -07:00
Alex Brainman
ca6b1f3eeb net: do not call syscall.Bind twice on windows
Fixes #5355.

R=golang-dev, mikioh.mikioh, bradfitz, r
CC=golang-dev
https://golang.org/cl/8966046
2013-04-30 17:47:39 -07:00
Rob Pike
2a1ca145cf cmd/ld: when linking externally, only generate dwarf info for ELF
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9025047
2013-04-30 14:22:28 -07:00
Russ Cox
ed9644fc39 cmd/go: undo CL 8119049
Manual undo due to later changes in doc/go1.1.html; cmd/go/test.bash still passes.

Rationale, from CL 8119049 review log:

This makes the 'go run' command different from every other command.
For example, 'go test' does not mean 'go test *.go'.

If we were going to handle the no arguments case in 'go run', I would hope that
it would scan the current directory to find a package just like 'go build' or
'go test' would, and then it would require that package to be 'package main',
and then it would run that package. This would make it match 'go test' and 'go
build' and 'go install' and so on. It would mean that if you are working on a
command in a directory that is 'go install'able, then 'go run' will run the
binary for you. The current CL does not accomplish that when build constraints
or file name constraints are involved.

For example, if I am working on a program like:

$ ls
main.go
main_386.s
main_arm.s
main_amd64.s
$

Then 'go run' will fail here because the .s files are ignored.

If instead I am working on a program like:

$ ls
main.go
main_386.go
main_arm.go
main_amd64.go
$

then 'go run' will fail because too many files are included.

I would like to see this command implemented so that it is compatible with the
other go subcommands. Since it is too late to do that for Go 1.1, I would like
to see this CL reverted, to preserve the option to do it better later.

R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/8797049
2013-04-30 17:04:58 -04:00
Ian Lance Taylor
825b1e1591 cmd/ld: emit relocs for DWARF info when doing an external link
I would like opinions on whether this is a good idea for 1.1.
On the one hand it's a moderately important issue.  On the
other hand this introduces at least the possibility of
external linker errors due to the additional relocations and
it may be better to wait.

I'm fairly confident that the behaviour is unchanged when not
using an external linker.

Update #5221

This CL is tested lightly on 386 and amd64 and fixes the cases
I tested.  I have not tested it on Darwin or Windows.

R=golang-dev, dave, daniel.morsing, rsc
CC=golang-dev
https://golang.org/cl/8858047
2013-04-30 14:01:05 -07:00
Rob Pike
b461c94cfa os/exec: disable TestExtraFilesFDShuffle
It's too hard to make portable just now.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9057043
2013-04-30 13:17:37 -07:00
Cosmos Nicolaou
b493f0a868 syscall: fix a bug in the shuffling of file descriptors in StartProcess on Linux.
R=iant, iant, r, bradfitz
CC=golang-dev
https://golang.org/cl/8334044
2013-04-30 11:52:23 -07:00
Rob Pike
479b1241b5 syscall: fix exec_bsd.go to accompany exec_linux.go changes
exec_plan9.go too.
Those are in CL 8334044

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9055043
2013-04-30 11:52:15 -07:00
Rob Pike
5c0d782ab8 cmd/ld: another attempt at the relocation overflow fix
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9036046
2013-04-30 09:49:36 -07:00
Rob Pike
700a126c64 cmd/ld: fix check for address wrap in relocation
PC-relative needs a signed offset; others need unsigned.
Also fix signedness of 32-bit relocation on Windows.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9039045
2013-04-30 09:10:10 -07:00
Rob Pike
396d3af8d0 cmd/ld: disable relocation range check so build can go green while we debug the issue.
R=golang-dev, dsymonds, dave
CC=golang-dev
https://golang.org/cl/9038043
2013-04-30 00:19:21 -07:00
Rob Pike
4dcb13bb44 cmd/gc: fix some overflows in the compiler
Some 64-bit fields were run through 32-bit words, some counts were
not checked for overflow, and relocations must fit in 32 bits.
Tests to follow.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/9033043
2013-04-29 22:44:40 -07:00
Rob Pike
e4c4edf681 cmd/ld: fix some 64-bit issues
A few places in the linker pushed 64-bit values through 32-bit holes,
including in relocation.
Clean them up, and check for a few other overflows as well.
Tests to follow.

R=dsymonds
CC=gobot, golang-dev
https://golang.org/cl/9032043
2013-04-29 22:44:20 -07:00
Shenghou Ma
5c20a4f260 encoding/json: document that marshaling invalid utf-8 sequence will return error
Also added docs for InvalidUTF8Error.
Fixes #5360.

R=golang-dev, adg, r
CC=golang-dev
https://golang.org/cl/8926046
2013-04-30 11:21:48 +08:00
Rob Pike
b42c8294eb fmt: fix crash for Printf("%.", 3)
Fixes #5311

R=golang-dev, bradfitz, iant
CC=golang-dev
https://golang.org/cl/8961050
2013-04-29 13:52:07 -07:00
Shenghou Ma
5b78cee376 runtime: fix stack pointer corruption in runtime.cgocallback_gofunc()
runtime.setmg() calls another function (cgo_save_gm), so it must save
LR onto stack.
Re-enabled TestCthread test in misc/cgo/test.

Fixes #4863.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9019043
2013-04-30 04:13:32 +08:00
Ian Lance Taylor
806dea82d4 fmt: document that if String or Error panics, that value is printed
Fixes #5350.

R=r, minux.ma
CC=golang-dev
https://golang.org/cl/8950043
2013-04-29 12:01:32 -07:00
Andrew Gerrand
13721cf688 net/http/httptest: fix incorrectly-named ResponseRecorder example
R=golang-dev, minux.ma, r
CC=golang-dev
https://golang.org/cl/8545047
2013-04-29 17:34:47 +02:00
Brad Fitzpatrick
e9546a01dc math/rand: fix typo and add better crash message
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9000043
2013-04-27 18:50:38 -07:00
Dave Cheney
d09f34cc55 runtime: tune appendCrossover for arm
Turns out the optimal value is 8 on cortex-A9 systems (pandaboard)

benchmark                     old ns/op    new ns/op    delta
BenchmarkAppend                     907          908   +0.11%
BenchmarkAppend1Byte                101          101   +0.00%
BenchmarkAppend4Bytes               116          116   +0.00%
BenchmarkAppend8Bytes               139          138   -0.72%
BenchmarkAppend16Bytes              185          158  -14.59%
BenchmarkAppend32Bytes              131          131   +0.00%
BenchmarkAppendStr1Byte              72           72   +0.00%
BenchmarkAppendStr4Bytes             93           93   -0.21%
BenchmarkAppendStr8Bytes            116          116   +0.00%
BenchmarkAppendStr16Bytes           161          125  -22.36%
BenchmarkAppendStr32Bytes           102          102   +0.00%
BenchmarkAppendSpecialCase          613          613   +0.00%

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8863045
2013-04-28 00:18:11 +10:00
Brad Fitzpatrick
3cef6979ee database/sql/driver: try to unstutter Value docs
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8981043
2013-04-26 11:42:58 -07:00
Dmitriy Vyukov
489addd250 time: stop 1ns timer in test
R=golang-dev, adg, r
CC=golang-dev
https://golang.org/cl/8819046
2013-04-26 11:08:50 +04:00
Brad Fitzpatrick
277047f52a database/sql: fix driver Conn refcounting with prepared statements
The refcounting of driver Conns was completedly busted and
would leak (be held open forever) with any reasonable
load. This was a significant regression from Go 1.0.

The core of this patch is removing one line:

     s.db.addDep(dc, s)

A database conn (dc) is a resource that be re-created any time
(but cached for speed) should not be held open forever with a
dependency refcount just because the Stmt (s) is alive (which
typically last for long periods of time, like forever).

The meat of the patch is new tests. In fixing the real issue,
a lot of tests then failed due to the fakedb_test.go's paranoia
about closing a fakeConn while it has open fakeStmts on it. I
could've ignored that, but that's been a problem in the past for
other bugs.

Instead, I now track per-Conn open statements and close them
when the the conn closes.  The proper way to do this would've
been making *driverStmt a finalCloser and using the dep mechanism,
but it was much more invasive. Added a TODO instead.

I'd like to give a way for drivers to opt-out of caring about
driver.Stmt closes before a driver.Conn close, but that's a TODO
for the future, and that TODO is added in this CL.

I know this is very late for Go 1.1, but database/sql is
currently nearly useless without this.

I'd like to believe all these database/sql bugs in the past
release cycle are the result of increased usage, number of
drivers, and good feedback from increasingly-capable Go
developers, and not the result of me sucking.  It's also hard
with all the real drivers being out-of-tree, so I'm having to
add more and more hooks to fakedb_test.go to simulate things
which real drivers end up doing.

Fixes #5323

R=golang-dev, snaury, gwenn.kahz, google, r
CC=golang-dev
https://golang.org/cl/8836045
2013-04-25 14:45:56 -07:00
Jan Ziak
13cbf41a7f cmd/gc: initialize t->width in dgcsym() if required
Update #5291.

R=golang-dev, daniel.morsing, iant, r
CC=golang-dev
https://golang.org/cl/8663052
2013-04-25 18:47:12 +02:00
Jan Ziak
db1c218d4f undo CL 8954044 / ad3c2ffb16d7
It works on i386, but fails on amd64 and arm.

««« original CL description
runtime: prevent the GC from seeing the content of a frame in runfinq()

Fixes #5348.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/8954044
»»»

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8695051
2013-04-25 18:12:09 +02:00
Jan Ziak
e9bbe3a8da runtime: prevent the GC from seeing the content of a frame in runfinq()
Fixes #5348.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/8954044
2013-04-25 13:39:09 +02:00
Mikio Hara
2bd17bca07 net: deflake raw IP protocol entry test on Windows
Update #5344

R=golang-dev, dave, r, alex.brainman
CC=golang-dev
https://golang.org/cl/8934043
2013-04-25 13:23:24 +09:00
Rob Pike
2c5e477f48 cmd/vet: clean up the test
- clean up the notypes version of the test so it's quiet
- change the package in the buildtag test to avoid confusing godoc

R=golang-dev, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/8671049
2013-04-24 10:40:29 -07:00
Ian Lance Taylor
578dc3a96c cmd/5g, cmd/6g, cmd/8g: more nil ptr to large struct checks
R=r, ken, khr, daniel.morsing
CC=dsymonds, golang-dev, rickyz
https://golang.org/cl/8925043
2013-04-24 08:13:01 -07:00
Mikio Hara
73417e4098 net: add missing File method document
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/8698049
2013-04-24 08:32:11 +09:00
Anthony Martin
d33f09bcc0 cmd/dist: fix line numbers in goc2c generated files
We have to reset the global lineno variable before
processing each file otherwise line numbers will be
offset by the number of lines in the previous file.

The following examples are from the beginning of the
ztime_linux_amd64.c file which is generated from
time.goc in the runtime package.

Before:
    #line 2483 "/home/apm/src/go/src/pkg/runtime/time.goc"
    static Timers timers;
    static void addtimer ( Timer* ) ;
    void
    time·Sleep(int64 ns)
    {
    #line 2492 "/home/apm/src/go/src/pkg/runtime/time.goc"

After:
    #line 16 "/home/apm/src/go/src/pkg/runtime/time.goc"
    static Timers timers;
    static void addtimer ( Timer* ) ;
    void
    time·Sleep(int64 ns)
    {
    #line 25 "/home/apm/src/go/src/pkg/runtime/time.goc"

R=golang-dev, minux.ma, iant, r, adg
CC=golang-dev
https://golang.org/cl/8653045
2013-04-23 16:02:50 -07:00
Shenghou Ma
7bec1a6033 all: fix typos
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8896045
2013-04-24 04:46:14 +08:00
Mikio Hara
3828316b9f net: fix protocol number for IPv6 test
The protocol number of ICMP for IPv6 is 58, not 1.

R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/8663048
2013-04-23 20:30:42 +09:00
Christian Himpel
237cee7834 time: fix typo in comment
R=r
CC=golang-dev
https://golang.org/cl/8889045
2013-04-22 22:09:11 -07:00
Rob Pike
14234c23a8 time: fix typo in comment
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8915043
2013-04-22 15:41:06 -07:00
Shenghou Ma
8c72b81132 misc/cgo/testso: enable test on windows
Depends on CL 8715043 and CL 8676050.
Fixes #5273.

R=alex.brainman, r
CC=gobot, golang-dev
https://golang.org/cl/8764043
2013-04-23 04:42:04 +08:00
Rob Pike
c285789059 time: improve the explanation of the working of Format and Parse
Change the term 'standard time', which already means something,
to 'reference time', and add a couple of sentences and clarifications.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8799047
2013-04-22 11:36:17 -07:00
Brad Fitzpatrick
61ed384a96 net/http: make CloseNotifier channel buffered to not leak goroutines
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8911044
2013-04-22 10:32:10 -07:00
Brad Fitzpatrick
4b091c533e sort: don't depend on math
No reason to pull in math just for x != x.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8886043
2013-04-20 17:20:41 -07:00
Brad Fitzpatrick
8b29f158ad net/http: fix a panic in Redirect
R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/8721045
2013-04-20 17:20:14 -07:00
Alex Brainman
782a57811f cmd/ld: do not relocate ignored PE sections
This should have been part of CL8715043.

Update #5106

R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/8676050
2013-04-20 17:42:14 +10:00
Mikio Hara
41451dd92b net: enable test for runtime.PollDesc leak
Update #5219.

R=golang-dev, dvyukov, r
CC=golang-dev
https://golang.org/cl/8602047
2013-04-20 09:04:20 +09:00
Shenghou Ma
0c2b980c49 cmd/ld: don't show cursym in gcc invocation failure message
before:
fmt.statictmp_0731:/usr/local/go/pkg/tool/linux_amd64/6l: running gcc failed: unsuccessful exit status 0x100
now:
/usr/local/go/pkg/tool/linux_amd64/6l: running gcc failed: unsuccessful exit status 0x100

R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/8827045
2013-04-20 02:44:16 +08:00
Rob Pike
591d4a47ae bufio.Scan: don't stop after Read returns 0, nil
But stop eventually if the reader misbehaves.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8757045
2013-04-18 17:37:21 -07:00
Rob Pike
5fbb54eaca io: explain what (0,nil) means from Read
Also add a new variable ErrNoProgress that io.Readers can use to
report ineffectual Read calls.
Fixes #5310.

R=golang-dev, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/8845043
2013-04-18 17:36:25 -07:00
Robert Griesemer
8457afbe00 builtin: document true and false.
Fixes #5315.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8841048
2013-04-18 14:36:08 -07:00
Rémy Oudompheng
b08a3164c0 crypto/rand: better panic message for invalid Int argument.
Also document the panic to be consistent with math/rand.

Fixes #5187.

R=golang-dev, dave, bradfitz, r
CC=golang-dev
https://golang.org/cl/8303043
2013-04-17 23:21:15 -07:00
Brad Fitzpatrick
24555c7b8c mime/multipart: don't strip leading space/tab in quoted-printable decoding
Late bug fix, but this is arguably a regression from Go 1.0,
since we added this transparent decoding since then. Without
this fix, Go 1.0 users could decode this correctly, but Go 1.1
users would not be able to.

The newly added test is from the RFC itself.

The updated tests had the wrong "want" values before. They
were there to test \r\n vs \n equivalence (which is
unchanged), not leading whitespace.

The skipWhite decoder struct field was added in the battles of
Issue 4771 in revision b3bb265bfecf. It was just a wrong
strategy, from an earlier round of attempts in
https://golang.org/cl/7300092/

Update #4771
Fixes #5295

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8536045
2013-04-17 20:04:58 -07:00
Brad Fitzpatrick
32f2fd15df doc/go1.1.html, mime/multipart: document quoted-printable decoding
Fixes #5293

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8840043
2013-04-17 13:25:28 -07:00
Brad Fitzpatrick
b95c48918c archive/zip: add docs on type of slashes in paths
Fixes #5307

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8676046
2013-04-17 13:25:12 -07:00
Alexei Sholik
d00a646e70 go/token: fix grammar for precedence consts
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8662045
2013-04-17 11:46:30 -07:00
Shenghou Ma
a5fe79ef78 cmd/dist, make.bash: pass -mmacosx-version-min=10.6 to gcc on Darwin
Fixes #5261.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8798044
2013-04-16 13:30:52 -07:00
Ian Lance Taylor
9ad236ab72 runtime: if span was scavenged, mark it as needing to be zeroed
Update #4979.

R=dvyukov, r, bradfitz
CC=golang-dev
https://golang.org/cl/8697045
2013-04-16 09:08:06 -07:00
Brad Fitzpatrick
36d3bef8a3 database/sql: close driver Stmt before releasing Conn
From the issue, which describes it as well as I could:

database/sql assumes that driver.Stmt.Close does not need the
connection.

see database/sql/sql.go:1308:

This puts the Rows' connection back into the idle pool, and
then calls the driver.Stmt.Close method of the Stmt it belongs
to.  In the postgresql driver implementation
(https://github.com/lib/pq), Stmt.Close communicates with the
server (on the connection that was just put back into the idle
pool).  Most of the time, this causes no problems, but if
another goroutine makes a query at the right (wrong?) time,
chaos results.

In any case, traffic is being sent on "free" connections
shortly after they are freed, leading to race conditions that
kill the driver code.

Fixes #5283

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/8633044
2013-04-15 14:06:41 -07:00
Shenghou Ma
83b7b0e24f net/http/cookiejar: mention go.net/publicsuffix.
R=golang-dev, r, gary.burd, dr.volker.dobler
CC=golang-dev
https://golang.org/cl/8660046
2013-04-16 04:29:55 +08:00
Ian Lance Taylor
9ca4a25f4b cmd/ld: ignore PE sections that are not code or data
Update #5106
Update #5273

R=minux.ma, r
CC=golang-dev
https://golang.org/cl/8715043
2013-04-15 10:35:37 -07:00
Joel Sing
804ef381db runtime: fix build on openbsd/386
R=golang-dev, minux.ma, r
CC=golang-dev
https://golang.org/cl/8569043
2013-04-15 10:20:24 -07:00
Brad Fitzpatrick
03640c58e3 crypto/ecdsa: doc cleanup
R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/8592044
2013-04-13 23:09:08 -07:00
Daniel Morsing
7b8e08617e cmd/gc: disable inlining of method values
They caused internal compiler errors and they're expensive enough that inlining them doesn't make sense.

Fixes #5259.

R=golang-dev, r, iant, remyoudompheng
CC=golang-dev
https://golang.org/cl/8636043
2013-04-13 08:22:16 +02:00
Robert Griesemer
968732b677 go/scanner: reject BOMs that are not at the beginning
For compliance with gc. See also issue 5265.
Not Go1.1 critical, but harmless.

R=r
CC=golang-dev
https://golang.org/cl/8736043
2013-04-12 21:28:38 -07:00
Alexei Sholik
d4d063580f testing/iotest: rephrase DataErrReader's description
R=r
CC=golang-dev
https://golang.org/cl/8650044
2013-04-12 16:08:56 -07:00
Volker Dobler
18ff727487 cmd/go: quote command line arguments in debug output
Debug output from go test -x may contain empty arguments.
This CL quotes arguments if needed. E.g. the output of
go test -x is now
  .../6g -o ./_go_.6 -p testmain -complete -D "" -I . -I $WORK ./_testmain.go
which is easier to grasp.

R=golang-dev, bradfitz, minux.ma, r
CC=golang-dev
https://golang.org/cl/8633043
2013-04-12 14:05:14 -07:00
Volker Dobler
ce64f7365f cmd/go: quote command line arguments in debug output
Debug output from go test -x may contain empty arguments.
This CL quotes arguments if needed. E.g. the output of
go test -x is now
  .../6g -o ./_go_.6 -p testmain -complete -D "" -I . -I $WORK ./_testmain.go
which is easier to grasp.

R=golang-dev, bradfitz, minux.ma, r
CC=golang-dev
https://golang.org/cl/8633043
2013-04-12 14:04:00 -07:00
Ian Lance Taylor
696901204f cmd/ld: always do external link for -linkmode=external
There are tests in run.bash for -linkmode=external.

Fixes #5238.

R=golang-dev, bradfitz, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/8716044
2013-04-12 13:21:17 -07:00
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
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