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

14971 Commits

Author SHA1 Message Date
Dmitriy Vyukov
a668114834 run.bash: run race tests on freebsd
LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/102580043
2014-06-20 20:54:18 -04: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
5ce6d3e03e undo CL 105260044 / afd6f214cc81
The go:nosplit change wasn't the problem, reinstating.

««« original CL description
undo CL 93380044 / 7f0999348917

Partial undo, just of go:nosplit annotation.  Somehow it
is breaking the windows builders.

TBR=bradfitz

««« original CL description
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
»»»

TBR=bradfitz
CC=golang-codereviews
https://golang.org/cl/105260044
»»»

TBR=bradfitz
R=bradfitz, golang-codereviews
CC=golang-codereviews
https://golang.org/cl/103490043
2014-06-17 08:10:21 -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
ee8e687874 undo CL 93380044 / 7f0999348917
Partial undo, just of go:nosplit annotation.  Somehow it
is breaking the windows builders.

TBR=bradfitz

««« original CL description
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
»»»

TBR=bradfitz
CC=golang-codereviews
https://golang.org/cl/105260044
2014-06-16 23:51:18 -07:00
Shenghou Ma
e9da5fe279 cmd/5c, cmd/6c, cmd/8c, cmd/cc: remove unused global variable retok.
LGTM=bradfitz
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/107160046
2014-06-17 02:05:27 -04: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