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

9802 Commits

Author SHA1 Message Date
Mikio Hara
7d8da7dc4d syscall: add source-specific multicast socket options for FreeBSD
Update #8266

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/104290043
2014-06-24 07:03:44 +09:00
Rui Ueyama
a712e20a1d runtime: speed up amd64 memmove
MOV with SSE registers seems faster than REP MOVSQ if the
size being copied is less than about 2K. Previously we
didn't use MOV if the memory region is larger than 256
byte. This patch improves the performance of 257 ~ 2048
byte non-overlapping copy by using MOV.

Here is the benchmark result on Intel Xeon 3.5GHz (Nehalem).

benchmark               old ns/op    new ns/op    delta
BenchmarkMemmove16              4            4   +0.42%
BenchmarkMemmove32              5            5   -0.20%
BenchmarkMemmove64              6            6   -0.81%
BenchmarkMemmove128             7            7   -0.82%
BenchmarkMemmove256            10           10   +1.92%
BenchmarkMemmove512            29           16  -44.90%
BenchmarkMemmove1024           37           25  -31.55%
BenchmarkMemmove2048           55           44  -19.46%
BenchmarkMemmove4096           92           91   -0.76%

benchmark                old MB/s     new MB/s  speedup
BenchmarkMemmove16        3370.61      3356.88    1.00x
BenchmarkMemmove32        6368.68      6386.99    1.00x
BenchmarkMemmove64       10367.37     10462.62    1.01x
BenchmarkMemmove128      17551.16     17713.48    1.01x
BenchmarkMemmove256      24692.81     24142.99    0.98x
BenchmarkMemmove512      17428.70     31687.72    1.82x
BenchmarkMemmove1024     27401.82     40009.45    1.46x
BenchmarkMemmove2048     36884.86     45766.98    1.24x
BenchmarkMemmove4096     44295.91     44627.86    1.01x

LGTM=khr
R=golang-codereviews, gobot, khr
CC=golang-codereviews
https://golang.org/cl/90500043
2014-06-23 12:06:26 -07:00
Mikio Hara
e3e48cd075 syscall: consolidate, simplify socket options for Unix-like systems
Also exposes common socket option functions on Solaris.

Update #7174
Update #7175

LGTM=aram
R=golang-codereviews, aram
CC=golang-codereviews
https://golang.org/cl/107280044
2014-06-23 18:46:01 +09:00
Mikio Hara
2ca1f7d588 syscall: don't display syscall prototype lines on godoc
LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/110020050
2014-06-23 14:33:33 +09:00
Rui Ueyama
9cddb48643 image/png: remove unnecessary function call
paeth(0, x, 0) == x for any uint8 value.

LGTM=nigeltao
R=golang-codereviews, bradfitz, nigeltao
CC=golang-codereviews
https://golang.org/cl/105290049
2014-06-23 10:29:56 +10:00
Rui Ueyama
a200e0b8fd undo CL 101330053 / c19c9a063fe8
sync.Pool is not supposed to be used everywhere, but is
a last resort.

««« original CL description
strings: use sync.Pool to cache buffer

benchmark                         old ns/op    new ns/op    delta
BenchmarkByteReplacerWriteString       3596         3094  -13.96%

benchmark                        old allocs   new allocs    delta
BenchmarkByteReplacerWriteString          1            0  -100.00%

LGTM=dvyukov
R=bradfitz, dave, dvyukov
CC=golang-codereviews
https://golang.org/cl/101330053
»»»

LGTM=dave
R=r, dave
CC=golang-codereviews
https://golang.org/cl/102610043
2014-06-22 15:26:30 -07:00
Rui Ueyama
3142861ff8 strings: use sync.Pool to cache buffer
benchmark                         old ns/op    new ns/op    delta
BenchmarkByteReplacerWriteString       3596         3094  -13.96%

benchmark                        old allocs   new allocs    delta
BenchmarkByteReplacerWriteString          1            0  -100.00%

LGTM=dvyukov
R=bradfitz, dave, dvyukov
CC=golang-codereviews
https://golang.org/cl/101330053
2014-06-21 22:08:43 -07:00
Dmitriy Vyukov
f1f37f93d0 runtime/race: support freebsd
All tests pass except one test in regexp package.

LGTM=iant
R=golang-codereviews, iant, dave
CC=golang-codereviews
https://golang.org/cl/107270043
2014-06-20 20:20:56 -04:00
Dmitriy Vyukov
348300123f runtime/race: update linux runtime
It was built on an old, bogus revision.

LGTM=minux
TBR=iant
R=iant, minux
CC=golang-codereviews
https://golang.org/cl/101370052
2014-06-21 03:54:16 +04:00
Dmitriy Vyukov
0d72364616 runtime/race: update runtime to tip
This requires minimal changes to the runtime hooks. In particular,
synchronization events must be done only on valid addresses now,
so I've added the additional checks to race.c.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/101000046
2014-06-20 16:36:21 -07:00
Rui Ueyama
382c461a89 strings: speed up byteReplacer.Replace
benchmark                         old ns/op    new ns/op    delta
BenchmarkByteReplacerWriteString       7359         3661  -50.25%

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/102550043
2014-06-20 12:18:33 -07:00
Dmitriy Vyukov
22d46d53ea sync: detect incorrect usages of RWMutex
Fixes #7858.

LGTM=ruiu
R=ruiu
CC=golang-codereviews
https://golang.org/cl/92720045
2014-06-19 22:19:56 -07:00
Dmitriy Vyukov
5ce98da1a2 net: simplify code
Single-case select with a non-nil channel is pointless.

LGTM=mikioh.mikioh
R=mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/103920044
2014-06-19 22:04:37 -07:00
Dmitriy Vyukov
cc81712190 runtime: remove obsolete afterprologue check
Afterprologue check was required when did not know
about return arguments of functions and/or they were not zeroed.
Now 100% precision is required for stacks due to stack copying,
so it must work w/o afterprologue one way or another.
I can limit this change for 1.3 to merely adding a TODO,
but this check is super confusing so I don't want this knowledge to get lost.

LGTM=rsc
R=golang-codereviews, gobot, rsc, khr
CC=golang-codereviews, khr, rsc
https://golang.org/cl/96580045
2014-06-19 22:04:10 -07:00
Rui Ueyama
26282e4093 strings: define byteBitmap.isSet
LGTM=dave
R=golang-codereviews, bradfitz, dave
CC=golang-codereviews
https://golang.org/cl/109090048
2014-06-19 20:10:55 -07:00
Rui Ueyama
24f8919aaf encoding/base64, encoding/base32: speed up Encode
Avoid unnecessary bitwise-OR operations.

benchmark                      old MB/s     new MB/s  speedup
BenchmarkEncodeToStringBase64  179.02       205.74    1.15x
BenchmarkEncodeToStringBase32  155.86       167.82    1.08x

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/109090043
2014-06-19 12:04:59 -07:00
Rui Ueyama
1ca10de35d strings: reduce allocation in byteStringReplacer.WriteString
Use WriteString instead of allocating a byte slice as a
buffer. This was a TODO.

benchmark               old ns/op    new ns/op    delta
BenchmarkWriteString        40139        19991  -50.20%

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/107190044
2014-06-19 11:22:50 -07:00
Bill Thiede
57964db3cb image/jpeg: encode *image.Gray as grayscale JPEGs.
Fixes #8201.

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/105990046
2014-06-19 22:18:24 +10:00
Caleb Spare
705a028d0f testing/quick: brought Check parameter name in line with function doc
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/102830043
2014-06-19 01:49:14 -04:00
Nigel Tao
4ecf0b103a image/jpeg: use a look-up table to speed up Huffman decoding. This
requires a decoder to do its own byte buffering instead of using
bufio.Reader, due to byte stuffing.

benchmark                      old MB/s     new MB/s     speedup
BenchmarkDecodeBaseline        33.40        50.65        1.52x
BenchmarkDecodeProgressive     24.34        31.92        1.31x

On 6g, unsafe.Sizeof(huffman{}) falls from 4872 to 964 bytes, and
the decoder struct contains 8 of those.

LGTM=r
R=r, nightlyone
CC=bradfitz, couchmoney, golang-codereviews, raph
https://golang.org/cl/109050045
2014-06-19 11:39:03 +10:00
ChaiShushan
ca94064104 image: add RGBAAt, Gray16At, etc.
Fixes #7694.

LGTM=nigeltao, rsc, r
R=golang-codereviews, nigeltao, rsc, r
CC=golang-codereviews
https://golang.org/cl/109000049
2014-06-19 10:15:04 +10:00
Rui Ueyama
2fbfe55e63 encoding/base64, encoding/base32: make Encode faster
Storing temporary values to a slice is slower than storing
them to local variables of type byte.

benchmark                         old MB/s     new MB/s  speedup
BenchmarkEncodeToStringBase32       102.21       156.66    1.53x
BenchmarkEncodeToStringBase64       124.25       177.91    1.43x

LGTM=crawshaw
R=golang-codereviews, crawshaw, bradfitz, dave
CC=golang-codereviews
https://golang.org/cl/109820045
2014-06-18 12:05:46 -07:00
Robert Dinu
0e92b538a9 testing: fix timing format inconsistency
Fixes #8175.

LGTM=r
R=golang-codereviews, r, gobot
CC=golang-codereviews
https://golang.org/cl/103320043
2014-06-18 10:59:25 -07:00
Rob Pike
7dcbf4f353 fmt: include ±Inf and NaN in the complex format test
Just to be more thorough.
No need to push this to 1.3; it's just a test change that
worked without any changes to the code being tested.

LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/109080045
2014-06-18 10:57:18 -07:00
David Symonds
5f896ae306 go/build: update doc.go for go1.3 build tag.
LGTM=bradfitz
R=adg, rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/102470045
2014-06-18 08:47:05 -07:00
Rui Ueyama
14950d89e5 strings: add fast path to Replace
genericReplacer.lookup is called for each byte of an input
string. In many (most?) cases, lookup will fail for the first
byte, and it will return immediately. Adding a fast path for
that case seems worth it.

Benchmark on my Xeon 3.5GHz Linux box:

benchmark                        old ns/op    new ns/op    delta
BenchmarkGenericNoMatch               2691          774  -71.24%
BenchmarkGenericMatch1                7920         8151   +2.92%
BenchmarkGenericMatch2               52336        39927  -23.71%
BenchmarkSingleMaxSkipping            1575         1575   +0.00%
BenchmarkSingleLongSuffixFail         1429         1429   +0.00%
BenchmarkSingleMatch                 56228        55444   -1.39%
BenchmarkByteByteNoMatch               568          568   +0.00%
BenchmarkByteByteMatch                 977          972   -0.51%
BenchmarkByteStringMatch              1669         1687   +1.08%
BenchmarkHTMLEscapeNew                 422          422   +0.00%
BenchmarkHTMLEscapeOld                 692          670   -3.18%
BenchmarkByteByteReplaces             8492         8474   -0.21%
BenchmarkByteByteMap                  2817         2808   -0.32%

LGTM=rsc
R=golang-codereviews, bradfitz, dave, rsc
CC=golang-codereviews
https://golang.org/cl/79200044
2014-06-17 22:08:46 -07:00
Keith Randall
14c8143c31 runtime: fix gogetcallerpc.
Make assembly govet-clean.
Clean up fixes for CL 93380044.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/107160047
2014-06-17 21:59:50 -07:00
Rob Pike
b559392e1b fmt: fix signs when zero padding.
Bug was introduced recently. Add more tests, fix the bugs.
Suppress + sign when not required in zero padding.
Do not zero pad infinities.
All old tests still pass.
This time for sure!
Fixes #8217.

LGTM=rsc
R=golang-codereviews, dan.kortschak, rsc
CC=golang-codereviews
https://golang.org/cl/103480043
2014-06-17 14:56:54 -07:00
Robert Griesemer
3d853585b6 text/scanner: fix comment
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/105300044
2014-06-17 09:34:11 -07:00
Keith Randall
2b309c6e22 runtime: fix stringw test.
Null terminate string.  Make it endian-agnostic.

TBR=bradfitz
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/106060044
2014-06-17 09:17:33 -07:00
Robert Griesemer
4f14d15202 go/parser: don't accept trailing explicit semicolon
Fixes #8207.

LGTM=gordon.klaus, bradfitz
R=golang-codereviews, wandakkelly, gordon.klaus, bradfitz
CC=golang-codereviews
https://golang.org/cl/106010046
2014-06-17 08:58:08 -07:00
Keith Randall
f2147cd740 runtime: disable funky wide string test for now.
TBR=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/105280045
2014-06-17 00:45:39 -07:00
Keith Randall
0f4b53c1c2 runtime: reconstitute runetochar for use by gostringw.
Fixes windows builds (hopefully).

LGTM=bradfitz
R=golang-codereviews, bradfitz, alex.brainman
CC=golang-codereviews
https://golang.org/cl/103470045
2014-06-17 00:36:23 -07:00
Keith Randall
61dca94e10 runtime: implement string ops in Go
Also implement go:nosplit annotation.  Not really needed
for now, but we'll definitely need it for other conversions.

benchmark                 old ns/op     new ns/op     delta
BenchmarkRuneIterate      534           474           -11.24%
BenchmarkRuneIterate2     535           470           -12.15%

LGTM=bradfitz
R=golang-codereviews, dave, bradfitz, minux
CC=golang-codereviews
https://golang.org/cl/93380044
2014-06-16 23:03:03 -07:00
Keith Randall
b36ed9056f runtime: implement eqstring in assembly.
BenchmarkCompareStringEqual               10.4          7.33          -29.52%
BenchmarkCompareStringIdentical           3.99          3.67          -8.02%
BenchmarkCompareStringSameLength          9.80          6.84          -30.20%
BenchmarkCompareStringDifferentLength     1.09          0.95          -12.84%
BenchmarkCompareStringBigUnaligned        75220         76071         +1.13%
BenchmarkCompareStringBig                 69843         74746         +7.02%

LGTM=bradfitz, josharian
R=golang-codereviews, bradfitz, josharian, dave, khr
CC=golang-codereviews
https://golang.org/cl/105280044
2014-06-16 21:00:37 -07:00
Rui Ueyama
38eea5b2ad net: avoid array copy when shuffling SRV records
We don't need to shift array elements to shuffle them.
We just have to swap a selected element with 0th element.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/91750044
2014-06-16 18:00:28 -07:00
Robert Griesemer
60c0b3b5cf text/scanner: provide facility for custom identifiers
LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/108030044
2014-06-16 16:32:47 -07:00
Matthew Dempsky
54bc760ad7 bufio: handle excessive white space in ScanWords
LGTM=r
R=golang-codereviews, bradfitz, r
CC=golang-codereviews
https://golang.org/cl/109020043
2014-06-16 12:59:10 -07:00
Rob Pike
311e28636a fmt: don't put 0x on every byte of a compact hex-encoded string
Printf("%x", "abc") was "0x610x620x63"; is now "0x616263", which
is surely better.
Printf("% #x", "abc") is still "0x61 0x62 0x63".

Fixes #8080.

LGTM=bradfitz, gri
R=golang-codereviews, bradfitz, gri
CC=golang-codereviews
https://golang.org/cl/106990043
2014-06-16 10:45:05 -07:00
Alex Brainman
be0079abe1 os: disable TestGetppid on plan9
Fixes build.

LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/105140047
2014-06-14 16:47:40 +10:00
Alan Shreve
6f6f1bd054 syscall: implement syscall.Getppid() on Windows
Also added a test to verify os.Getppid() works across all platforms

LGTM=alex.brainman
R=golang-codereviews, alex.brainman, shreveal, iant
CC=golang-codereviews
https://golang.org/cl/102320044
2014-06-14 15:51:00 +10:00
Ian Lance Taylor
1db4c8dc41 runtime: fix VDSO lookup to use dynamic hash table
Reportedly in the Linux 3.16 kernel the VDSO will not have
section headers or a normal symbol table.

Too late for 1.3 but perhaps for 1.3.1, if there is one.

Fixes #8197.

LGTM=rsc
R=golang-codereviews, mattn.jp, rsc
CC=golang-codereviews
https://golang.org/cl/101260044
2014-06-13 13:29:26 -07:00
Nigel Tao
9f08c5c383 compress/lzw: add commentary that TIFF's LZW differs from the standard
algorithm.

See https://golang.org/cl/105750045/ for an implementation of
TIFF's LZW.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/102940043
2014-06-13 17:44:29 +10:00
Nigel Tao
eb788045d8 image/png: fix compare-to-golden-file test.
bufio.Scanner.Scan returns whether the scan succeeded, not whether it
is done, so the test was mistakenly breaking early.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/93670045
2014-06-13 17:43:02 +10:00
Russ Cox
50365666c7 undo CL 101970047 / 30307cc8bef2
makes windows-amd64-race benchmarks slower

««« original CL description
testing: make benchmarking faster

Allow the number of benchmark iterations to grow faster for fast benchmarks, and don't round up twice.

Using the default benchtime, this CL reduces wall clock time to run benchmarks:

net/http        49s   -> 37s   (-24%)
runtime         8m31s -> 5m55s (-30%)
bytes           2m37s -> 1m29s (-43%)
encoding/json   29s   -> 21s   (-27%)
strings         1m16s -> 53s   (-30%)

LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/101970047
»»»

TBR=josharian
CC=golang-codereviews
https://golang.org/cl/105950044
2014-06-13 02:04:03 -04:00
Russ Cox
060a988011 runtime: revise CL 105140044 (defer nil) to work on Windows
It appears that something about Go on Windows
cannot handle the fault cause by a jump to address 0.
The way Go represents and calls functions, this
never happened at all, until CL 105140044.

This CL changes the code added in CL 105140044
to make jump to 0 impossible once again.

Fixes #8047. (again, on Windows)

TBR=bradfitz
R=golang-codereviews, dave
CC=adg, golang-codereviews, iant, r
https://golang.org/cl/105120044
2014-06-12 21:12:53 -04:00
Rob Pike
ce39b34f36 time: change formatting of microseconds duration to SI modifier
'u' is not micro, µ (U+00B5) is.

LGTM=gri, bradfitz
R=golang-codereviews, bradfitz, gri
CC=golang-codereviews
https://golang.org/cl/105030046
2014-06-12 17:01:13 -07:00
Russ Cox
597f87c997 runtime: do not trace past jmpdefer during pprof traceback on arm
jmpdefer modifies PC, SP, and LR, and not atomically,
so walking past jmpdefer will often end up in a state
where the three are not a consistent execution snapshot.
This was causing warning messages a few frames later
when the traceback realized it was confused, but given
the right memory it could easily crash instead.

Update #8153

LGTM=minux, iant
R=golang-codereviews, minux, iant
CC=golang-codereviews, r
https://golang.org/cl/107970043
2014-06-12 16:34:54 -04:00
Russ Cox
36207a91d3 runtime: fix defer of nil func
Fixes #8047.

LGTM=r, iant
R=golang-codereviews, r, iant
CC=dvyukov, golang-codereviews, khr
https://golang.org/cl/105140044
2014-06-12 16:34:36 -04:00
Rob Pike
83c8140662 time: avoid broken fix for buggy TestOverflowRuntimeTimer
The test requires that timerproc runs, but busy loops and starves
the scheduler so that, with high probability, timerproc doesn't run.
Avoid the issue by expecting the test to succeed; if not, a major
outside timeout will kill it and let us know.

As you can see from the diffs, there have been several attempts to
fix this with chicanery, but none has worked. Don't bother trying
any more.

Fixes #8136.

LGTM=rsc
R=rsc, josharian
CC=golang-codereviews
https://golang.org/cl/105140043
2014-06-12 11:44:55 -07:00
Brad Fitzpatrick
e46be90fec encoding/json: remove unused field from Encoder struct
It should've been removed in https://golang.org/cl/9365044

Thanks to Jacek Masiulaniec for noticing.

LGTM=ruiu
R=ruiu
CC=golang-codereviews
https://golang.org/cl/109880043
2014-06-12 09:44:59 -07:00
Josh Bleecher Snyder
a5bb1af432 testing: make benchmarking faster
Allow the number of benchmark iterations to grow faster for fast benchmarks, and don't round up twice.

Using the default benchtime, this CL reduces wall clock time to run benchmarks:

net/http        49s   -> 37s   (-24%)
runtime         8m31s -> 5m55s (-30%)
bytes           2m37s -> 1m29s (-43%)
encoding/json   29s   -> 21s   (-27%)
strings         1m16s -> 53s   (-30%)

LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/101970047
2014-06-12 07:51:32 -07:00
Rui Ueyama
b93f83f8e1 encoding/ascii85: remove unused field
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/105890044
2014-06-11 22:52:01 -07:00
Rui Ueyama
f7c99f3377 net: efficient text processing
Optimize IP.String, IPMask.String and ParseIP.

benchmark                old ns/op    new ns/op    delta
BenchmarkParseIP              2216         1849  -16.56%
BenchmarkIPString             7828         2486  -68.24%
BenchmarkIPMaskString         3872          659  -82.98%

LGTM=mikioh.mikioh, dave, bradfitz
R=golang-codereviews, mikioh.mikioh, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/95750043
2014-06-11 20:40:00 -07:00
Rui Ueyama
f837078c50 net: do not call time.Now() twice
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/104080043
2014-06-11 20:33:44 -07:00
Rui Ueyama
7bcbb65d78 bytes, strings: optimize Repeat
Call copy with as large buffer as possible to reduce the
number of function calls.

benchmark                 old ns/op    new ns/op    delta
BenchmarkBytesRepeat            540          162  -70.00%
BenchmarkStringsRepeat          563          177  -68.56%

LGTM=josharian
R=golang-codereviews, josharian, dave, dvyukov
CC=golang-codereviews
https://golang.org/cl/90550043
2014-06-11 19:03:59 -07:00
Rui Ueyama
22a5d2cc96 mime/multipart: fix format
Remove unnecessary blank line.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/105040045
2014-06-11 17:39:34 -07:00
Robert Griesemer
3d68dc3325 math: remove Nextafter64 alias in favor of existing Nextafter
LGTM=adonovan
R=rsc, adonovan
CC=golang-codereviews
https://golang.org/cl/104050045
2014-06-11 14:24:16 -07:00
Rui Ueyama
afb7b67ae9 encoding/base64, encoding/base32: make DecodeString faster
Previously, an input string was stripped of newline
characters at the beginning of DecodeString and then passed
to Decode. Decode again tried to strip newline characters.
That's waste of time.

benchmark                 old MB/s     new MB/s  speedup
BenchmarkDecodeString        38.37        65.20    1.70x

LGTM=dave, bradfitz
R=golang-codereviews, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/91770051
2014-06-11 11:22:08 -07:00
Robert Griesemer
be91bc29a4 math/big: implement Rat.Float32
Pending CL 101750048.
For submission after the 1.3 release.

Fixes #8065.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/93550043
2014-06-11 09:10:49 -07:00
Robert Griesemer
a9035ede1b math: implement Nextafter32
Provide Nextafter64 as alias to Nextafter.
For submission after the 1.3 release.

Fixes #8117.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/101750048
2014-06-11 09:09:37 -07:00
Brad Fitzpatrick
1e6a19be64 net/http: fix double Content-Length in response
Fixes #8180

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/105040043
2014-06-10 16:52:37 -07:00
Russ Cox
4534fdb144 runtime: fix panic stack during runtime.Goexit during panic
A runtime.Goexit during a panic-invoked deferred call
left the panic stack intact even though all the stack frames
are gone when the goroutine is torn down.
The next goroutine to reuse that struct will have a
bogus panic stack and can cause the traceback routines
to walk into garbage.

Most likely to happen during tests, because t.Fatal might
be called during a deferred func and uses runtime.Goexit.

This "not enough cleared in Goexit" failure mode has
happened to us multiple times now. Clear all the pointers
that don't make sense to keep, not just gp->panic.

Fixes #8158.

LGTM=iant, dvyukov
R=iant, dvyukov
CC=golang-codereviews
https://golang.org/cl/102220043
2014-06-06 16:52:14 -04:00
Ian Lance Taylor
0e197515b6 debug/elf: support DWARF that needs relocs for 386
It's not clear how widespread this issue is, but we do have a
test case generated by a development version of clang.

I don't know whether this should go into 1.3 or not; happy to
hear arguments either way.

LGTM=rsc
R=golang-codereviews, bradfitz, rsc
CC=golang-codereviews
https://golang.org/cl/96680045
2014-06-03 16:39:40 -07:00
Ian Lance Taylor
68bbf9d464 compress/gzip: allow Reset on Reader without NewReader
Fixes #8126.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/103020044
2014-06-03 15:40:12 -07:00
Brad Fitzpatrick
19fe9a2c72 crypto/tls: fix typo referencing the required Config field
Thanks to Frithjof Schulze for noticing.

LGTM=adg
R=adg
CC=agl, golang-codereviews, r
https://golang.org/cl/107740043
2014-06-03 18:11:17 +10:00
Brad Fitzpatrick
14a75ecf4a time: support version 3 zone records
Fixes #8134

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r, rsc
https://golang.org/cl/100930044
2014-06-03 11:44:17 +09:00
Russ Cox
d646040fd1 runtime: fix 1-byte return during x.(T) for 0-byte T
The 1-byte write was silently clearing a byte on the stack.
If there was another function call with more arguments
in the same stack frame, no harm done.
Otherwise, if the variable at that location was already zero,
no harm done.
Otherwise, problems.

Fixes #8139.

LGTM=dsymonds
R=golang-codereviews, dsymonds
CC=golang-codereviews, iant, r
https://golang.org/cl/100940043
2014-06-02 21:06:30 -04:00
Russ Cox
bcfe519d58 runtime: fix correctness test at end of traceback
We were requiring that the defer stack and the panic stack
be completely processed, thinking that if any were left over
the stack scan and the defer stack/panic stack must be out
of sync. It turns out that the panic stack may well have
leftover entries in some situations, and that's okay.

Fixes #8132.

LGTM=minux, r
R=golang-codereviews, minux, r
CC=golang-codereviews, iant, khr
https://golang.org/cl/100900044
2014-06-01 13:57:46 -04:00
Keith Randall
548b15def6 runtime: mark some C globals as having no pointers.
C globals are conservatively scanned.  This helps
avoid false retention, especially for 32 bit.

LGTM=rsc
R=golang-codereviews, khr, rsc
CC=golang-codereviews
https://golang.org/cl/102040043
2014-05-31 19:21:17 -04:00
Russ Cox
14d2ee1d00 runtime: make continuation pc available to stack walk
The 'continuation pc' is where the frame will continue
execution, if anywhere. For a frame that stopped execution
due to a CALL instruction, the continuation pc is immediately
after the CALL. But for a frame that stopped execution due to
a fault, the continuation pc is the pc after the most recent CALL
to deferproc in that frame, or else 0. That is where execution
will continue, if anywhere.

The liveness information is only recorded for CALL instructions.
This change makes sure that we never look for liveness information
except for CALL instructions.

Using a valid PC fixes crashes when a garbage collection or
stack copying tries to process a stack frame that has faulted.

Record continuation pc in heapdump (format change).

Fixes #8048.

LGTM=iant, khr
R=khr, iant, dvyukov
CC=golang-codereviews, r
https://golang.org/cl/100870044
2014-05-31 10:10:12 -04:00
Russ Cox
e56dc99665 cmd/gc: fix handling of for post-condition in -race mode
Fixes #8102.

LGTM=bradfitz, dvyukov
R=golang-codereviews, bradfitz, dvyukov
CC=golang-codereviews
https://golang.org/cl/100870046
2014-05-31 09:35:54 -04:00
Russ Cox
19c8f67e25 runtime: fix error check in freebsd/386 i386_set_ldt
Update #2675

The code here was using the error check for Linux/386,
not the one for FreeBSD/386. Most of the time it worked.

Thanks to Neel Natu (FreeBSD developer) for finding this.

The s/JCC/JAE/ a few lines later is a no-op but makes the
test match the rest of the file. Why we write JAE instead of JCC
I don't know, but the two are equivalent and the file might
as well be consistent.

LGTM=bradfitz, minux
R=golang-codereviews, bradfitz, minux
CC=golang-codereviews
https://golang.org/cl/99680044
2014-05-31 09:35:37 -04:00
Shenghou Ma
a238973949 runtime/debug: skip TestWriteHeapDumpNonempty on NaCl.
TestWriteHeap is useless on NaCl anyway.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/101980048
2014-05-31 02:30:01 -07:00
Shenghou Ma
a68b9be935 runtime: fix empty heap dump bug on windows.
Fixes #8119.

LGTM=khr, rsc
R=alex.brainman, khr, bradfitz, rsc
CC=golang-codereviews
https://golang.org/cl/93640044
2014-05-31 01:09:48 -07:00
Ian Lance Taylor
aad4609c08 runtime: add zero field to rtype
The rtype struct is meant to be a copy of reflect.rtype.  The
zero field was added to reflect.rtype in 18495:6e50725ac753.

LGTM=rsc
R=khr, rsc
CC=golang-codereviews
https://golang.org/cl/93660045
2014-05-30 07:56:05 -07:00
Russ Cox
6c10e64a90 regexp: hide one-pass code from exported API
Update #8112

Hide one-pass regexp API.

This means moving the code from regexp/syntax to regexp,
but it avoids being locked into the specific API chosen for
the implementation.

It also removes a slice field from the syntax.Inst, which
should avoid bloating the memory footprint of a non-one-pass
regexp unnecessarily.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews, iant
https://golang.org/cl/98610046
2014-05-28 14:08:44 -04:00
Brad Fitzpatrick
ef25861222 mime: sort attributes in FormatMediaType
Map iteration order issue. Go 1.2 and earlier had stable results
for small maps.

Fixes #8115

LGTM=r, rsc
R=golang-codereviews, r
CC=dsymonds, golang-codereviews, iant, rsc
https://golang.org/cl/98580047
2014-05-28 08:16:09 -07:00
Dmitriy Vyukov
b5caa02067 runtime: fix go of nil func value
Currently runtime derefences nil with m->locks>0,
which causes unrecoverable fatal error.
Panic instead.
Fixes #8045.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews, khr
https://golang.org/cl/97620043
2014-05-28 00:00:01 -04:00
Keith Randall
3d1c3e1e26 runtime: stack copier should handle nil defers without faulting.
fixes #8047

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/101800043
2014-05-27 16:26:08 -07:00
Dave Cheney
8a2fb87b99 runtime: skip stack growth test on 32bit platforms
Update #8083

See discussion in https://groups.google.com/forum/#!topic/golang-dev/dh6Ra_xJomc

LGTM=khr
R=golang-codereviews, gobot, khr
CC=golang-codereviews
https://golang.org/cl/99440048
2014-05-25 08:38:59 +10:00
Keith Randall
4b3019b17c doc: mention that reflect.SetMapIndex no longer panics
when deleting from a nil map.  See issue 8051.

LGTM=r
R=golang-codereviews, r, khr
CC=golang-codereviews
https://golang.org/cl/96540051
2014-05-23 17:39:58 -07:00
Alex Brainman
05cc78d8d3 os: document that Interrupt might not work on every os
Fixes #6720.

LGTM=bradfitz
R=golang-codereviews, iant, bradfitz
CC=golang-codereviews
https://golang.org/cl/92340043
2014-05-23 12:29:29 +10:00
Keith Randall
cee8bcabfa runtime: provide gc maps for the reflect.callXX frames.
Update #8030

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/100620045
2014-05-21 14:28:34 -07:00
Rob Pike
4464ae280f fmt: fix floating-point padding once and for all
Rewrite formatFloat to be much simpler and clearer and
avoid the tricky interaction with padding.
The issue refers to complex but the problem is just floating-point.
The new tests added were incorrectly formatted before this fix.
Fixes #8064.

LGTM=jscrockett01, rsc
R=rsc, jscrockett01
CC=golang-codereviews
https://golang.org/cl/99420048
2014-05-21 12:30:43 -07:00
Ian Lance Taylor
7d4cb4d63f database/sql/driver: correct method name in comment
Fixes #8061.

LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/93520046
2014-05-21 06:48:41 -07:00
Keith Randall
cb6cb42ede reflect: don't panic on delete from nil map.
Fixes #8051

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/95560046
2014-05-20 16:26:04 -07:00
Shenghou Ma
ca6be91cbc all: fix "the the" typos.
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/93470043
2014-05-20 14:42:07 -04:00
Shenghou Ma
8aa8348b51 runtime: revise the document of Version()
Fixes #7701. (again, differently)

LGTM=rsc
R=iant, rsc
CC=golang-codereviews
https://golang.org/cl/94560043
2014-05-20 14:41:24 -04:00
David du Colombier
b28aa1f1ec debug/plan9obj: cleanup api
- Don't export Prog structure.
- Remove ProgHeader and ExecTable structures.
- Add Magic, Bss and Entry fields in FileHeader.
- Replace ?_MAGIC variables with constants.
- Ignore final EOF from ReadAt.
- Improve documentation.

Fixes #7989.

LGTM=rsc
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/91400044
2014-05-20 10:56:50 -07:00
Russ Cox
0c2a727477 build: make nacl pass
Add nacl.bash, the NaCl version of all.bash.
It's a separate script because it builds a variant of package syscall
with a large zip file embedded in it, containing all the input files
needed for tests.

Disable various tests new since the last round, mostly the ones using os/exec.

Fixes #7945.

LGTM=dave
R=golang-codereviews, remyoudompheng, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/100590044
2014-05-20 12:10:19 -04:00
Russ Cox
82854d7b39 syscall: fix Write(nil) on NaCl
Fixes #7050.

LGTM=crawshaw, r
R=golang-codereviews, crawshaw, r
CC=golang-codereviews
https://golang.org/cl/91590043
2014-05-20 11:38:34 -04:00
Russ Cox
6aee29648f runtime: switch default stack size back to 8kB
The move from 4kB to 8kB in Go 1.2 was to eliminate many stack split hot spots.

The move back to 4kB was predicated on copying stacks eliminating
the potential for hot spots.

Unfortunately, the fact that stacks do not copy 100% of the time means
that hot spots can still happen under the right conditions, and the slowdown
is worse now than it was in Go 1.2. There is a real program in issue 8030 that
sees about a 30x slowdown: it has a reflect call near the top of the stack
which inhibits any stack copying on that segment.

Go back to 8kB until stack copying can be used 100% of the time.

Fixes #8030.

LGTM=khr, dave, iant
R=iant, khr, r, bradfitz, dave
CC=golang-codereviews
https://golang.org/cl/92540043
2014-05-20 00:30:46 -04:00
Rob Pike
431b96bdbe text/template,html/template: document that partial results may be written on error
Fixes #7445.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/94640043
2014-05-19 14:29:45 -07:00
Brad Fitzpatrick
f0bdee171f net/http: document that ProxyFromEnvironment special-cases localhost
Fixes #7256

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews, rsc
https://golang.org/cl/97590043
2014-05-19 10:12:15 -07:00
Brad Fitzpatrick
7b103c555f database/sql: more docs explaining that DB is a pool
This is the main point of confusion and the emphasis of
a recent Gophercon talk.

Fixes #5886. (mostly fixed in previous commits)

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/100560043
2014-05-19 09:54:47 -07:00
Russ Cox
5aca051494 math/rand: restore Go 1.2 value stream for Float32, Float64
CL 22730043 fixed a bug in these functions: they could
return 1.0 despite documentation saying otherwise.
But the fix changed the values returned in the non-buggy case too,
which might invalidate programs depending on a particular
stream when using rand.Seed(0) or when passing their own
Source to rand.New.

The example test says:
        // These tests serve as an example but also make sure we don't change
        // the output of the random number generator when given a fixed seed.
so I think there is some justification for thinking we have
promised not to change the values. In any case, there's no point in
changing the values gratuitously: we can easily fix this bug without
changing the values, and so we should.

That CL just changed the test values too, which defeats the
stated purpose, but it was just a comment.
Add an explicit regression test, which might be
a clearer signal next time that we don't want to change
the values.

Fixes #6721. (again)
Fixes #8013.

LGTM=r
R=iant, r
CC=golang-codereviews
https://golang.org/cl/95460049
2014-05-19 12:30:25 -04:00
Russ Cox
d54b67df0c reflect: test, fix access to nil maps
Fixes #8010.

LGTM=bradfitz, khr
R=khr, bradfitz, dvyukov
CC=golang-codereviews
https://golang.org/cl/91450048
2014-05-19 09:36:47 -04:00
Dmitriy Vyukov
e893acf184 runtime: fix freeOSMemory to free memory immediately
Currently freeOSMemory makes only marking phase of GC, but not sweeping phase.
So recently memory is not released after freeOSMemory.
Do both marking and sweeping during freeOSMemory.
Fixes #8019.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, rsc
https://golang.org/cl/97550043
2014-05-19 12:06:30 +04:00
Dave Cheney
ae6cbd4fcf syscall: fix arm build
Rename Seek to seek in asm file, was overlooked in CL 99320043.

LGTM=bradfitz, r
R=r, rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/99320044
2014-05-17 00:06:56 +00:00
Brad Fitzpatrick
4c8de36e2b net/http: allow Content-Type on 204 responses
Accidental change from fixing Content-Length on 204s
in http://golang.org/issue/6685 earlier.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/92400047
2014-05-16 15:39:59 -07:00
Rob Pike
86bf6324c1 encoding/xml: fix format in test message
Found by go vet.

LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/100510044
2014-05-16 13:18:28 -07:00
Rob Pike
4cf79eb80c syscall: fix linux amd64 build
TBR=rsc

TBR=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/100500047
2014-05-16 09:30:28 -07:00
Russ Cox
bf68f6623a syscall: fix a few Linux system calls
These functions claimed to return error (an interface)
and be implemented entirely in assembly, but it's not
possible to create an interface from assembly
(at least not easily).

In reality the functions were written to return an errno uintptr
despite the Go prototype saying error.
When the errno was 0, they coincidentally filled out a nil error
by writing the 0 to the type word of the interface.
If the errno was ever non-zero, the functions would
create a non-nil error that would crash when trying to
call err.Error().

Luckily these functions (Seek, Time, Gettimeofday) pretty
much never fail, so it was all kind of working.

Found by go vet.

LGTM=bradfitz, r
R=golang-codereviews, bradfitz, r
CC=golang-codereviews
https://golang.org/cl/99320043
2014-05-16 12:15:32 -04:00
Guillaume J. Charmes
6d63d4f3be archive/tar: Do not panic on Read if uninitialized
Calling tar.Reader.Read() used to work fine, but without this patch it panics.
Simply return EOF to indicate the tar.Reader.Next() needs to be called.

LGTM=iant, bradfitz
R=golang-codereviews, bradfitz, iant, mikioh.mikioh, dominik.honnef
CC=golang-codereviews
https://golang.org/cl/94530043
2014-05-15 15:18:05 -07:00
Mikio Hara
40e7f6493b syscall: regenerate z-files for openbsd
This CL restores dropped constants not supported in OpenBSD 5.5
and tris to keep the promise of API compatibility.

Update #7049

LGTM=jsing, bradfitz, rsc
R=rsc, jsing, robert.hencke, minux.ma, bradfitz, iant
CC=golang-codereviews
https://golang.org/cl/96970043
2014-05-16 06:49:15 +09:00
Robert Griesemer
b2d1a2b513 container/heap: update example code
- use Init to establish heap invariant on
  a non-empty heap
- use Fix to update heap after an element's
  properties have been changed

(The old code used Init where it wasn't needed,
 and didn't use Fix because Fix was added after
 the example was written.)

LGTM=bradfitz
R=adonovan, bradfitz
CC=golang-codereviews
https://golang.org/cl/94520043
2014-05-15 13:58:13 -07:00
Russ Cox
7ad60b7283 syscall: fix stack frame sizes in assembly
for GOOS in darwin freebsd linux nacl netbsd openbsd plan9 solaris windows
do
        for GOARCH in 386 amd64 amd64p32 arm
        do
                go vet
        done
done

These are all real mistakes being corrected, but none
of them should be able to cause problems today
due to the NOSPLIT on the functions.

However, vet has also identified a few important problems.
I'm sending this CL to get rid of the trivial 'go vet' results
before attacking the real ones.

LGTM=r
R=golang-codereviews, r, bradfitz
CC=golang-codereviews
https://golang.org/cl/95460046
2014-05-15 16:47:53 -04:00
Russ Cox
42ea2eda49 sync/atomic: fix unimportant assembly errors found by go vet
None of these are real bugs.
The variable name in the reference is not semantically meaningful,
except that 'go vet' will double check the offset against the name for you.

The stack sizes being corrected really are incorrect but they are also
in NOSPLIT functions so they typically don't matter.

Found by vet.

GOOS=linux GOARCH=amd64 go vet sync/atomic
GOOS=linux GOARCH=amd64p32 go vet sync/atomic
GOOS=linux GOARCH=386 go vet sync/atomic
GOOS=linux GOARCH=arm go vet sync/atomic
GOOS=freebsd GOARCH=arm go vet sync/atomic
GOOS=netbsd GOARCH=arm go vet sync/atomic

LGTM=r
R=r, bradfitz
CC=golang-codereviews
https://golang.org/cl/100500043
2014-05-15 16:31:20 -04:00
Russ Cox
68aaf2ccda runtime: make scan of pointer-in-interface same as scan of pointer
The GC program describing a data structure sometimes trusts the
pointer base type and other times does not (if not, the garbage collector
must fall back on per-allocation type information stored in the heap).
Make the scanning of a pointer in an interface do the same.
This fixes a crash in a particular use of reflect.SliceHeader.

Fixes #8004.

LGTM=khr
R=golang-codereviews, khr
CC=0xe2.0x9a.0x9b, golang-codereviews, iant, r
https://golang.org/cl/100470045
2014-05-15 15:53:36 -04:00
Mikio Hara
27b9897496 net/http: fix nits found by go tool vet
LGTM=ruiu
R=golang-codereviews, ruiu
CC=golang-codereviews
https://golang.org/cl/91480043
2014-05-15 12:41:45 -07:00
Russ Cox
fbd0915008 crypto/sha256, crypto/sha512: fix argument size in assembly
The function takes 32 bytes of arguments: 8 for the *block
and then 3*8 for the slice.

The 24 is not causing a bug (today at least) because the
final word is the cap of the slice, which the assembly
does not use.

Identified by 'go vet std'.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/96360043
2014-05-15 15:34:25 -04:00
Guillaume J. Charmes
bf1d400d1c net: detect changes to /etc/resolv.conf.
Implement the changes as suggested by rsc.
Fixes #6670.

LGTM=josharian, iant
R=golang-codereviews, iant, josharian, mikioh.mikioh, alex, gobot
CC=golang-codereviews, rsc
https://golang.org/cl/83690045
2014-05-14 17:11:00 -07:00
Guillaume J. Charmes
51f3cbabfc archive/tar: Fix bug preventing untar
Do not use ustar format if we need the GNU one.
Change \000 to \x00 for consistency
Check for "ustar\x00" instead of "ustar\x00\x00" for conistency with tar
and compatiblity with archive generated with older code (which was ustar\x00\x20\x00)
Add test for long name + big file.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/99050043
2014-05-14 10:15:43 -07:00
Mikio Hara
d145f0f0f8 net: fix documentation for SetLinger
Fixes #7974.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/95320043
2014-05-14 12:12:01 +09:00
Rob Pike
f54f790a77 regexp/syntax: don't waste time checking for one pass algorithm
The code recurs very deeply in cases like (?:x{1,1000}){1,1000}
Since if much time is spent checking whether one pass is possible, it's not
worth doing at all, a simple fix is proposed: Stop if the check takes too long.
To do this, we simply avoid machines with >1000 instructions.

Benchmarks show a percent or less change either way, effectively zero.

Fixes #7608.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/92290043
2014-05-13 12:17:49 -07:00
Dmitriy Vyukov
5bc1cef869 reflect: fix map type generation
If a map variable is created with reflect.New it has incorrect type (map[unsafe.Pointer]unsafe.Pointer).
If GC follows such pointer, it scans Hmap and buckets with incorrect type.
This can lead to overscan of up to 120 bytes for map[int8]struct{}.
Which in turn can lead to crash if the memory after a bucket object is unaddressable
or false retention (buckets are scanned as arrays of unsafe.Pointer).
I don't see how it can lead to heap corruptions, though.

LGTM=khr
R=rsc, khr
CC=golang-codereviews
https://golang.org/cl/96270044
2014-05-13 09:53:47 +04:00
Dmitriy Vyukov
a12661329b runtime: fix triggering of forced GC
mstats.last_gc is unix time now, it is compared with abstract monotonic time.
On my machine GC is forced every 5 mins regardless of last_gc.

LGTM=rsc
R=golang-codereviews
CC=golang-codereviews, iant, rsc
https://golang.org/cl/91350045
2014-05-13 09:53:03 +04:00
Russ Cox
30b8af98c0 runtime: handle decommit failure gracefully on Windows
I have no test case for this at tip.
The original report included a program crashing at revision 88ac7297d2fa.
I tested this code at that revision and it does fix the crash.
However, at tip the reported code no longer crashes, presumably
because some allocation patterns have changed. I believe the
bug is still present at tip and that this code still fixes it.

Fixes #7143.

LGTM=alex.brainman
R=golang-codereviews, alex.brainman
CC=dvyukov, golang-codereviews
https://golang.org/cl/96300046
2014-05-13 01:09:38 -04:00
Russ Cox
211618c26e io: copy slice argument in MultiReader and MultiWriter
Replaces CL 91240045.
Fixes #7809.

LGTM=bradfitz
R=golang-codereviews, minux.ma
CC=adg, bradfitz, golang-codereviews, iant, r
https://golang.org/cl/94380043
2014-05-12 23:38:35 -04:00
Russ Cox
fc1e5a8acd encoding/json: document what unmarshal of null into non-reference type does
Originally it was an error, which made perfect sense, but in issue 2540
I got talked out of this sensible behavior. I'm not thrilled with the "new"
behavior but it's been there since Go 1.1 so we're stuck with it now.

Fixes #6724.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/100430043
2014-05-12 23:38:26 -04:00
Jason Del Ponte
92440fb5bd encoding/xml: fix to allow xml declaration with EncodeToken
This changes allows the first token encoded to be a xml declaration. A ProcInst with target of xml. Any other ProcInst after that with a target of xml will fail

Fixes #7380.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/72410043
2014-05-12 23:35:56 -04:00
Brad Fitzpatrick
270848509b mime/multipart: add NewReader example
Fixes #7888

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/100420043
2014-05-12 20:26:27 -07:00
Fabrizio Milo
7e8bc474db net/http: fix flaky test
Prevent idle transport on race condition.

Fixes #7847

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/96230044
2014-05-12 09:37:36 -07:00
Brad Fitzpatrick
c91aea6c31 undo CL 92210044 / 5cb21eee2d35
<enter reason for undo>

««« original CL description
net: make use of SO_LINGER_SEC on darwin

Fixes #7971.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/92210044
»»»

TBR=iant
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/96220049
2014-05-12 08:48:19 -07:00
Mikio Hara
900d49bf17 net: make use of SO_LINGER_SEC on darwin
Fixes #7971.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/92210044
2014-05-13 00:38:36 +09:00
Russ Cox
ee7bb07a53 runtime: add copy of math.sqrt for use by arm softfloat
If it's not used (such as on other systems or if softfloat
is disabled) the linker will discard it.

The alternative is to teach cmd/go that every binary
depends on math implicitly on arm. I started down that
path but it's too scary. If we're going to get dependencies
right we should get dependencies right.

Fixes #6994.

LGTM=bradfitz, dave
R=golang-codereviews, bradfitz, dave
CC=golang-codereviews
https://golang.org/cl/95290043
2014-05-12 10:55:33 -04:00
Péter Surányi
176041e4c6 unicode: fix doc typo
LGTM=robert.hencke, iant
R=golang-codereviews, robert.hencke, iant
CC=golang-codereviews
https://golang.org/cl/96230043
2014-05-11 22:06:00 -07:00
David Crawshaw
82ca308743 net/rpc: do not leak client socket on closed connection
Fixes #6897.

LGTM=bradfitz
R=golang-codereviews, bradfitz, r, rsc
CC=golang-codereviews
https://golang.org/cl/91230045
2014-05-11 14:46:44 -07:00
Brad Fitzpatrick
b600de755d undo CL 100330043 / e4248ed0037c
<enter reason for undo>

««« original CL description
runtime/race: fix the link for the race detector.

LGTM=bradfitz
R=golang-dev, bradfitz
CC=golang-codereviews
https://golang.org/cl/100330043

»»»

TBR=minux
R=minux.ma
CC=golang-codereviews
https://golang.org/cl/96200044
2014-05-09 17:31:35 -07:00
Bill Neubauer
42c9eaaa49 runtime/race: fix the link for the race detector.
LGTM=bradfitz
R=golang-dev, bradfitz
CC=golang-codereviews
https://golang.org/cl/100330043
2014-05-09 16:33:23 -07:00
Keith Randall
711d1ad7ee runtime: be a lot more lenient on smhasher avalanche test.
Fixes #7943

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/98170043
2014-05-09 15:50:57 -07:00
Ian Lance Taylor
e3eee85b0d net/url: correct documentation of Values.Add
Fixes #7816.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/98160043
2014-05-09 15:49:21 -07:00
Rui Ueyama
cdabca325e bytes: fix typos
LGTM=mikioh.mikioh
R=golang-codereviews, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/94240045
2014-05-10 07:13:42 +09:00
Ian Lance Taylor
c00804c55c encoding/binary: document that Read requires exported struct fields
Add a test for the current behaviour.

Fixes #7482.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/95160043
2014-05-09 14:19:21 -07:00
Russ Cox
2182d5786b math/cmplx: specify which square root Sqrt returns
Fixes #7851.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/93200043
2014-05-09 16:04:03 -04:00
Russ Cox
3e8ed96c63 crypto/aes: fix overrun in assembly encrypt/decrypt
Fixes #7928.

LGTM=bradfitz
R=golang-codereviews
CC=agl, bradfitz, golang-codereviews
https://golang.org/cl/91320043
2014-05-09 15:40:55 -04:00
Russ Cox
21e75b3251 testing: write profiles on failure
Fixes #7901.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/90930044
2014-05-09 12:18:50 -04:00
Mikio Hara
f40f0b26b6 net: drop flakey TestDialFailPDLeak
TestDialFailPDLeak was created for testing runtime-integrated netwrok
poller stuff and used during Go 1.2 development cycle. Unfortunately
it's still flakey because it depends on MemStats of runtime, not
pollcache directly, and MemStats accounts and revises its own stats
occasionally.

For now the codepaths related to runtime-intergrated network poller
are pretty stable, so removing this test case never suffers us.

Fixes #6553.

LGTM=josharian, iant
R=iant, josharian
CC=golang-codereviews
https://golang.org/cl/98080043
2014-05-09 09:38:29 +09:00
Keith Randall
65c63dc4aa runtime: write memory profile statistics to the heap dump.
LGTM=rsc
R=rsc, khr
CC=golang-codereviews
https://golang.org/cl/97010043
2014-05-08 08:35:49 -07:00
Stephen McQuay
1c2cc125fb encoding/json: add example for Indent, clarify the docs.
There was confusion in the behavior of json.Indent; This change
attempts to clarify the behavior by providing a bit more verbiage
to the documentation as well as provide an example function.

Fixes #7821.

LGTM=robert.hencke, adg
R=golang-codereviews, minux.ma, bradfitz, aram, robert.hencke, r, adg
CC=golang-codereviews
https://golang.org/cl/97840044
2014-05-08 16:52:36 +10:00
Keith Randall
51b72d94de runtime: use duff zero and copy to initialize memory
benchmark                 old ns/op     new ns/op     delta
BenchmarkCopyFat512       1307          329           -74.83%
BenchmarkCopyFat256       666           169           -74.62%
BenchmarkCopyFat1024      2617          671           -74.36%
BenchmarkCopyFat128       343           89.0          -74.05%
BenchmarkCopyFat64        182           48.9          -73.13%
BenchmarkCopyFat32        103           28.8          -72.04%
BenchmarkClearFat128      102           46.6          -54.31%
BenchmarkClearFat512      344           167           -51.45%
BenchmarkClearFat64       50.5          26.5          -47.52%
BenchmarkClearFat256      147           87.2          -40.68%
BenchmarkClearFat32       22.7          16.4          -27.75%
BenchmarkClearFat1024     511           662           +29.55%

Fixes #7624

LGTM=rsc
R=golang-codereviews, khr, bradfitz, josharian, dave, rsc
CC=golang-codereviews
https://golang.org/cl/92760044
2014-05-07 13:17:10 -07:00
Brad Fitzpatrick
ce6b75dab6 database/sql: fix accounting of open connections
Existing test TestMaxOpenConns was failing occasionally, especially
with higher values of GOMAXPROCS.

Fixes #7532

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/95130043
2014-05-07 11:54:29 -07:00
Dmitriy Vyukov
acb03b8028 runtime: optimize markspan
Increases throughput by 2x on a memory hungry program on 8-node NUMA machine.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/100230043
2014-05-07 19:32:34 +04:00
Dmitriy Vyukov
c0bf96e6b1 runtime: fix bug in cpu profiler
Number of lost samples was overcounted (never reset).
Also remove unused variable (it's trivial to restore it for debugging if needed).

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, rsc
https://golang.org/cl/96060043
2014-05-07 18:48:14 +04:00
David Crawshaw
8bc1bfb6bf net/mail: propagate unsupported charset error
Fixes #6807.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/95060043
2014-05-07 05:58:36 -04:00
Mikio Hara
0462d091e2 syscall: add missing TIOCGSID for openbsd/386
The previous syscall constants regeneration on openbsd was conducted
with OpenBSD current 3 months ago and it missed updating openbsd/386.
This CL adds TIOCGSID for fixing the inconsistency between opensbd/amd64
and openbsd/386.

Update #7049

LGTM=iant
R=jsing, rsc, iant
CC=golang-codereviews
https://golang.org/cl/96960044
2014-05-06 07:22:10 +09:00
Tyler Bunnell
be781a72c4 archive/zip: Document ModTime is always UTC
Fixes #7592

LGTM=robert.hencke, adg
R=golang-codereviews, robert.hencke, gobot, adg
CC=golang-codereviews
https://golang.org/cl/90810043
2014-05-04 23:00:47 -04:00
Robert Griesemer
f3913624a7 std lib: fix various typos in comments
Where the spelling changed from British to
US norm (e.g., optimise -> optimize) it follows
the style in that file.

LGTM=adonovan
R=golang-codereviews, adonovan
CC=golang-codereviews
https://golang.org/cl/96980043
2014-05-02 13:17:55 -07:00
Alan Donovan
28c515f40f runtime: fix bug in GOTRACEBACK=crash causing suppression of core dumps.
Because gotraceback is called early and often, its cache commits to the value of getenv("GOTRACEBACK") before getenv is even ready.  So now we reset its cache once getenv becomes ready.  Panicking programs now dump core again.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/97800045
2014-05-02 13:06:58 -04:00
Dmitriy Vyukov
8afa086ce6 runtime: do not set m->locks around memory allocation
If slice append is the only place where a program allocates,
then it will consume all available memory w/o triggering GC.
This was demonstrated in the issue.
Fixes #7922.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews, iant, khr
https://golang.org/cl/91010048
2014-05-02 17:39:25 +01:00
Dmitriy Vyukov
350a8fcde1 runtime: make MemStats.LastGC Unix time again
The monotonic clock patch changed all runtime times
to abstract monotonic time. As the result user-visible
MemStats.LastGC become monotonic time as well.
Restore Unix time for LastGC.

This is the simplest way to expose time.now to runtime that I found.
Another option would be to change time.now to C called
int64 runtime.unixnanotime() and then express time.now in terms of it.
But this would require to introduce 2 64-bit divisions into time.now.
Another option would be to change time.now to C called
void runtime.unixnanotime1(struct {int64 sec, int32 nsec} *now)
and then express both time.now and runtime.unixnanotime in terms of it.

Fixes #7852.

LGTM=minux.ma, iant
R=minux.ma, rsc, iant
CC=golang-codereviews
https://golang.org/cl/93720045
2014-05-02 17:32:42 +01:00
Russ Cox
3879f0abcd os: cut limited read to 1 GB
If systems actually read that much, using 2GB-1 will
result in misaligned subsequent reads. Use 1GB instead,
which will certainly keep reads aligned and which is
plenty large enough.

Update #7812.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/94070044
2014-05-02 12:12:40 -04:00
Robert Hencke
3b3e1a09a9 html: fix small typo
LGTM=dsymonds, adg, crawshaw, r, bradfitz, campoy, nigeltao, sameer, iant, robsc, djd, michael.j.fromberger, gmlewis, adonovan, rsc
R=golang-codereviews, dsymonds, adg, crawshaw, r, nigeltao, sameer, iant, robsc, djd, michael.j.fromberger, gmlewis, adonovan, rsc
CC=golang-codereviews
https://golang.org/cl/98880043
2014-05-01 16:29:34 -04:00
Brad Fitzpatrick
3100088743 go/build: add go1.3 release tag
Fixes #7918

LGTM=dave
R=rsc, dave
CC=golang-codereviews
https://golang.org/cl/91980043
2014-05-01 12:16:03 -04:00
Keith Randall
e9977dad45 runtime: correctly type interface data.
The backing memory for >1 word interfaces was being scanned
conservatively.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/94000043
2014-05-01 09:37:55 -04:00
Rui Ueyama
70f6c43024 time: MeST is a time zone name
Not only ChST but also MeST (America/Metlakatla) is a zone
name containing a lower case letter.

LGTM=robert.hencke, r
R=golang-codereviews, robert.hencke, bradfitz, r
CC=golang-codereviews
https://golang.org/cl/99910043
2014-04-30 11:30:36 -04:00
Mikio Hara
ace8bc35ef net: enable builtin dns resolver tests on solaris
LGTM=aram
R=golang-codereviews, aram
CC=golang-codereviews
https://golang.org/cl/99890045
2014-04-30 23:26:07 +09:00
Robert Hencke
f999e14f02 all: spelling tweaks, A-G
LGTM=ruiu, bradfitz
R=golang-codereviews, bradfitz, ruiu
CC=golang-codereviews
https://golang.org/cl/91840044
2014-04-29 12:44:40 -04:00
Mikio Hara
7e41abbc6b net: make WriteTo, WriteToIP and WriteMsgIP fail when IPConn is already connected
This CL tries to fill the gap between Linux and other Unix-like systems
in the same way UDPConn and UnixConn already did.

Fixes #7887.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/97810043
2014-04-29 12:37:16 +09:00
Shenghou Ma
4cc708ae1d log/syslog: document if network=="" for Dial, it will connect to local syslog server.
Fixes #7828.

LGTM=robert.hencke, iant, bradfitz
R=golang-codereviews, robert.hencke, iant, bradfitz
CC=golang-codereviews
https://golang.org/cl/97780045
2014-04-28 14:29:45 -04:00
Keith Randall
29d1b211fd runtime: clean up scanning of Gs
Use a real type for Gs instead of scanning them conservatively.
Zero the schedlink pointer when it is dead.

Update #7820

LGTM=rsc
R=rsc, dvyukov
CC=golang-codereviews
https://golang.org/cl/89360043
2014-04-28 12:47:09 -04:00
Keith Randall
573cfe9561 runtime: heapdump - make sure spans are swept before dumping.
LGTM=rsc
R=golang-codereviews, adonovan, rsc
CC=golang-codereviews
https://golang.org/cl/90440043
2014-04-28 12:45:00 -04:00
Mikio Hara
6dac550270 syscall: don't display syscall prototype lines on godoc
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/90810045
2014-04-28 13:38:23 +09:00
Mikio Hara
d873e642cd syscall: add missing SendmsgN for NaCl
Update #7645

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/98790044
2014-04-28 11:34:52 +09:00
Robert Hencke
78fbe9020c net/tcp: fix check for openbsd in test
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/98740045
2014-04-27 17:39:13 -07:00
Mikio Hara
d844d6982e syscall: fix handling socket control messages on dragonfly
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/91860043
2014-04-27 22:28:41 +09:00
Brad Fitzpatrick
9f2e1efd72 net/http/httputil: tell people not to use ClientConn and ServerConn
A very smart developer at Gophercon just asked me to help debug
a problem and I was horrified to learn that he was using httputil's
ClientConn. I forgot ClientConn and ServerConn were even included
in Go 1! They should've been deleted.

Scare people away from using them. The net/http package does
not use them and they're unused, unmaintained and untouched in
4+ years.

LGTM=r
R=r, adg
CC=golang-codereviews
https://golang.org/cl/92790043
2014-04-26 22:14:39 -07:00
Robert Obryk
4c129c083b net: Remove an unmatched unlock of ForkLock
Remove an RUnlock of syscall.ForkLock with no matching RLock.
Holding ForkLock in netFD.dup is unnecessary: dupCloseOnExecOld
locks and unlocks the lock on its own and dupCloseOnExec doesn't
need the ForkLock to be held.

LGTM=iant
R=golang-codereviews, bradfitz, iant
CC=golang-codereviews
https://golang.org/cl/99800044
2014-04-26 19:59:00 -07:00
Rui Ueyama
9d7b9fb7d0 encoding/ascii85: handle non-data bytes correctly
Previously Read wouldn't return once its internal input buffer
is filled with non-data bytes.
Fixes #7875.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/90820043
2014-04-26 19:56:06 -07:00
Robert Hencke
d46134830f src: fix issues found by go vet std
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/96850043
2014-04-26 19:54:48 -07:00
Brad Fitzpatrick
8409dea8ee os: cap reads and writes to 2GB on Darwin and FreeBSD
Fixes #7812

LGTM=josharian, iant
R=rsc, iant, adg, ruiu, minux.ma, josharian
CC=golang-codereviews
https://golang.org/cl/89900044
2014-04-26 10:34:33 -07:00
Jonathan Allie
7faf72bd0d encoding/gob: handle interface types in isZero() by returning true for nil interfaces.
Fixes #7741.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/96830044
2014-04-26 10:25:16 -06:00
Brad Fitzpatrick
d0402cb416 net/http/httputil: don't leak goroutines in DumpRequestOut
Fixes #7869

LGTM=dsymonds
R=golang-codereviews
CC=adg, dsymonds, golang-codereviews, rsc
https://golang.org/cl/91770048
2014-04-25 15:19:32 -07:00
Mikio Hara
e419ab6452 net: make WriteMsg{IP,UDP,Unix} return the correct number of bytes transferred
Fixes #7645

LGTM=iant, bradfitz
R=iant, bradfitz
CC=golang-codereviews
https://golang.org/cl/90170046
2014-04-26 06:52:37 +09:00
Robert Griesemer
9144d8752a bufio: make all read functions UnreadByte-friendly
Fixes #7844.

LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/90620045
2014-04-25 09:46:07 -06:00
Brad Fitzpatrick
13ea1fd233 net/http, strings, bytes: fix http race, revert part of Reader behavior change
I fixed this data race regression in two ways: in net/http itself, and also
partially reverting the change from https://golang.org/cl/77580046 .
Previously a Read from a strings.Reader or bytes.Reader returning 0 bytes
would not be a memory write. After 77580046 it was. This reverts that back
in case others depended on that. Also adds tests.

Fixes #7856

LGTM=ruiu, iant
R=iant, ruiu
CC=golang-codereviews, gri
https://golang.org/cl/94740044
2014-04-25 06:44:51 -07:00
Rui Ueyama
f40e574d85 net: fix confusing typo in comment
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/93750043
2014-04-24 12:24:22 -07:00
Rob Pike
59d7aa32ca math/cmpx: change space to tab in the Pow docs for better formatting
Godoc makes it look better this way; before, it all ran together into nonsense.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/90400045
2014-04-22 21:12:15 -07:00
Brad Fitzpatrick
5600572249 os/exec: deflake a test on Linux
Work around buggy(?) Linux /proc filesystem.

Fixes #7808

LGTM=iant
R=golang-codereviews, iant
CC=adg, golang-codereviews
https://golang.org/cl/90400044
2014-04-22 17:13:38 -07:00
Rui Ueyama
7ff8e90eb7 strings: fix off-by-one error in test
Previously it would panic because of out-of-bound access
if s1 is longer than s2.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/90110043
2014-04-21 17:00:27 -07:00
Robert Griesemer
2653386ce8 math/big: fix Int.Exp
Fixes #7814.

LGTM=agl, adonovan
R=agl, adonovan
CC=golang-codereviews
https://golang.org/cl/90080043
2014-04-21 15:54:51 -07:00
Josh Bleecher Snyder
9cddb60d25 net: extend TestVariousDeadlines1Proc timeout
TestVariousDeadlines1Proc was flaky on my system,
failing on about 5% of runs.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/89830045
2014-04-21 13:07:51 -07:00
Mark Zavislak
800d8adf35 runtime: fix typo in error message
LGTM=robert.hencke, iant
R=golang-codereviews, robert.hencke, iant
CC=golang-codereviews
https://golang.org/cl/89760043
2014-04-21 08:55:23 -07:00
Rémy Oudompheng
1332eb5b62 runtime/race: add test for issue 7561.
LGTM=dvyukov
R=rsc, iant, khr, dvyukov
CC=golang-codereviews
https://golang.org/cl/76520045
2014-04-21 17:21:09 +02:00
Shenghou Ma
1bb4f37fce runtime, go/build: re-enable cgo on FreeBSD.
Fixes #7331.

LGTM=dave, iant
R=golang-codereviews, dave, gobot, iant
CC=golang-codereviews
https://golang.org/cl/89150043
2014-04-21 00:09:22 -04:00
Shenghou Ma
d31d19765b runtime, cmd/ld, cmd/5l, run.bash: enable external linking on FreeBSD/ARM.
Update #7331

LGTM=dave, iant
R=golang-codereviews, dave, gobot, iant
CC=golang-codereviews
https://golang.org/cl/89520043
2014-04-21 00:08:59 -04:00
Alex Brainman
6e8c7f5bb2 cmd/nm: print symbol sizes for windows pe executables
Fixes #6973

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/88820043
2014-04-19 14:47:20 +10:00
Lucio De Re
cd4c1f18a1 pkg/reflect/value.go: Correction in comment, the argument is "typ", not "t".
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/89270043
2014-04-18 08:11:31 -07:00
Shenghou Ma
4b9ab7dd69 os: change return variable name for Getwd to avoid confusion
changed (pwd string) to (dir string), as some think pwd means passwd.
Fixes #7811.

LGTM=iant
R=golang-codereviews, iant, bradfitz
CC=golang-codereviews
https://golang.org/cl/89100043
2014-04-17 23:17:15 -04:00
Brad Fitzpatrick
8f76641230 net/http/httputil: include Content-Length in DumpResponse output
Fixes #5357

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/87910050
2014-04-17 14:03:05 -07:00
Brad Fitzpatrick
c45392bae0 net: fix probabilities in DNS SRV shuffleByWeight
Patch from msolo. Just moving it to a CL.
The test fails before and passes with the fix.

Fixes #7098

LGTM=msolo, rsc
R=rsc, iant, msolo
CC=golang-codereviews
https://golang.org/cl/88900044
2014-04-17 13:28:40 -07:00
Volker Dobler
ed88076c64 net/http: allow commas and spaces in cookie values
According to RFC 6265 a cookie value may contain neither
commas nor spaces but such values are very common in the
wild and browsers handle them very well so we'll allow
both commas and spaces.
Values starting or ending in a comma or a space are
sent in the quoted form to prevent missinterpetations.

RFC 6265 conforming values are handled as before and
semicolons, backslashes and double-quotes are still
disallowed.

Fixes #7243

LGTM=nigeltao
R=nigeltao
CC=bradfitz, golang-codereviews
https://golang.org/cl/86050045
2014-04-16 23:01:02 -07:00
Robert Daniel Kortschak
6277cc3df5 compress/gzip: add Reset method to Reader
Fixes #6364.

LGTM=rsc
R=golang-codereviews, bradfitz, rsc, gobot
CC=golang-codereviews
https://golang.org/cl/13512052
2014-04-16 22:43:44 -04:00
Shenghou Ma
6f25f1d4c9 encoding/json: document Encoder will terminate each JSON value with '\n'
Fixes #7767.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/87420043
2014-04-16 22:42:24 -04:00
Alex Brainman
387895f9ac debug/pe: add optional header to File
This information is required by cmd/nm
to calculate absolute symbol addresses.

Update #6936
Update #7738

LGTM=rsc
R=golang-codereviews, bradfitz, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/87500043
2014-04-16 22:10:59 -04:00
Russ Cox
5e8c922625 liblink, cmd/ld: reenable nosplit checking and test
The new code is adapted from the Go 1.2 nosplit code,
but it does not have the bug reported in issue 7623:

g% go run nosplit.go
g% go1.2 run nosplit.go
BUG
rejected incorrectly:
        main 0 call f; f 120

        linker output:
        # _/tmp/go-test-nosplit021064539
        main.main: nosplit stack overflow
                120	guaranteed after split check in main.main
                112	on entry to main.f
                -8	after main.f uses 120

g%

Fixes #6931.
Fixes #7623.

LGTM=iant
R=golang-codereviews, iant, ality
CC=golang-codereviews, r
https://golang.org/cl/88190043
2014-04-16 22:08:00 -04:00
Brad Fitzpatrick
877e0a135f encoding/xml: document NewDecoder buffering
Fixes #7225

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews, rsc
https://golang.org/cl/88710043
2014-04-16 17:16:08 -07:00
Rob Pike
1f40b841b3 flag: document that Bool also accepts "T" and "F"
Fixes #7752.

LGTM=bradfitz, ruiu
R=golang-codereviews, bradfitz, ruiu
CC=golang-codereviews
https://golang.org/cl/88690043
2014-04-16 17:14:48 -07:00
Rui Ueyama
fb91559fbd all: fix typos
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/88670043
2014-04-16 16:57:25 -07:00