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

5882 Commits

Author SHA1 Message Date
Michael Chaten
3fab2a97e4 encoding/json: Fix panic when trying to unmarshal the empty string into an integer
Fixes #3450.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6035050
2012-05-03 17:35:44 -04:00
Francisco Souza
61060acdc1 syscall: add Termios support on darwin
Update #3316.

R=dave, kevlar, devon.odell, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6063053
2012-05-03 17:33:19 -04:00
Adam Langley
c8e1946f33 crypto/x509: fix panic when using unavailable hash function.
crypto.Hash.New() changed to panicking when the hash function isn't
linked in, but crypto/x509 still expects it to return nil.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6175047
2012-05-03 16:39:57 -04:00
Russ Cox
d42495aa80 cmd/cc: add PREFETCH built-in (like SET, USED)
This makes it possible to inline the prefetch of upcoming
memory addresses during garbage collection, instead of
needing to flush registers, make a function call, and
reload registers.  On garbage collection-heavy workloads,
this results in a 5% speedup.

Fixes #3493.

R=dvyukov, ken, r, dave
CC=golang-dev
https://golang.org/cl/5990066
2012-05-02 16:22:56 -04:00
Marcel van Lohuizen
10838165d8 exp/locale/collate: fixed two bugs uncovered by regression tests.
The first bug was that tertiary ignorables had the same colElem as
implicit colElems, yielding unexpected results. The current encoding
ensures that a non-implicit colElem is never 0.  This fix uncovered
another bug of the trie that indexed incorrectly into the null block.
This was caused by an unfinished optimization that would avoid the
need to max out the most-significant bits of continuation bytes.
This bug was also present in the trie used in exp/norm and has been
fixed there as well. The appearence of the bug was rare, as the lower
blocks happened to be nearly nil.

R=r
CC=golang-dev
https://golang.org/cl/6127070
2012-05-02 17:01:41 +02:00
Dmitriy Vyukov
c1c851bbe8 runtime: avoid unnecessary zeroization of huge memory blocks
+move zeroization out of the heap mutex

R=golang-dev, iant, rsc
CC=golang-dev
https://golang.org/cl/6094050
2012-05-02 18:01:11 +04:00
Alex Brainman
0d55d9832f os/signal: run windows TestCtrlBreak during build
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6136054
2012-05-02 17:05:52 +10:00
Anthony Martin
90626864dc os: conform to Go 1 API on Plan 9
R=golang-dev, r, bradfitz, r
CC=golang-dev
https://golang.org/cl/6117062
2012-05-01 22:44:38 -07:00
Dave Cheney
d472d3faf1 bytes: add assembly version of Equal for ARM
BenchmarkEqual32                       662          159  -75.98%
BenchmarkEqual4K                     76545        13719  -82.08%
BenchmarkEqual4M                  90136700     23588870  -73.83%
BenchmarkEqual64M               2147483647   1419616000  -42.63%

BenchmarkEqual32                     48.32       201.15    4.16x
BenchmarkEqual4K                     53.51       298.56    5.58x
BenchmarkEqual4M                     46.53       177.81    3.82x
BenchmarkEqual64M                    27.12        47.27    1.74x

R=golang-dev, qyzhai, minux.ma, rsc, iant, nigeltao
CC=golang-dev
https://golang.org/cl/6118049
2012-05-02 12:10:24 +10:00
Nigel Tao
86a91539b8 compress/flate: add a copy overrun test.
R=rsc, r
CC=golang-dev
https://golang.org/cl/6143043
2012-05-01 14:28:33 +10:00
David Symonds
c3c8e35af2 encoding/json: don't match field name if a JSON struct tag is present.
Fixes #3566.

R=rsc
CC=golang-dev
https://golang.org/cl/6139048
2012-05-01 11:37:44 +10:00
Nigel Tao
4de15a5cda compress/flate: optimize history-copy decoding.
The forwardCopy function could be re-written in asm, and the copyHuff
method could probably be rolled into huffmanBlock and copyHist, but
I'm leaving those changes for future CLs.

compress/flate benchmarks:
benchmark                                 old ns/op    new ns/op    delta
BenchmarkDecoderBestSpeed1K                  385327       435140  +12.93%
BenchmarkDecoderBestSpeed10K                1245190      1062112  -14.70%
BenchmarkDecoderBestSpeed100K               8512365      5833680  -31.47%
BenchmarkDecoderDefaultCompression1K         382225       421301  +10.22%
BenchmarkDecoderDefaultCompression10K        867950       613890  -29.27%
BenchmarkDecoderDefaultCompression100K      5658240      2466726  -56.40%
BenchmarkDecoderBestCompression1K            383760       421634   +9.87%
BenchmarkDecoderBestCompression10K           867743       614671  -29.16%
BenchmarkDecoderBestCompression100K         5660160      2464996  -56.45%

image/png benchmarks:
benchmark                       old ns/op    new ns/op    delta
BenchmarkDecodeGray               2540834      2389624   -5.95%
BenchmarkDecodeNRGBAGradient     10052700      9534565   -5.15%
BenchmarkDecodeNRGBAOpaque        8704710      8163430   -6.22%
BenchmarkDecodePaletted           1458779      1325017   -9.17%
BenchmarkDecodeRGB                7183606      6794668   -5.41%

Wall time for Denis Cheremisov's PNG-decoding program given in
https://groups.google.com/group/golang-nuts/browse_thread/thread/22aa8a05040fdd49
Before: 3.07s
After:  2.32s
Delta:  -24%

Before profile:
Total: 304 samples
         159  52.3%  52.3%      251  82.6% compress/flate.(*decompressor).huffmanBlock
          58  19.1%  71.4%       76  25.0% compress/flate.(*decompressor).huffSym
          32  10.5%  81.9%       32  10.5% hash/adler32.update
          16   5.3%  87.2%       22   7.2% bufio.(*Reader).ReadByte
          16   5.3%  92.4%       37  12.2% compress/flate.(*decompressor).moreBits
           7   2.3%  94.7%        7   2.3% hash/crc32.update
           7   2.3%  97.0%        7   2.3% runtime.memmove
           5   1.6%  98.7%        5   1.6% scanblock
           2   0.7%  99.3%        9   3.0% runtime.copy
           1   0.3%  99.7%        1   0.3% compress/flate.(*huffmanDecoder).init

After profile:
Total: 230 samples
          59  25.7%  25.7%       70  30.4% compress/flate.(*decompressor).huffSym
          45  19.6%  45.2%       45  19.6% hash/adler32.update
          35  15.2%  60.4%       35  15.2% compress/flate.forwardCopy
          20   8.7%  69.1%      151  65.7% compress/flate.(*decompressor).huffmanBlock
          16   7.0%  76.1%       24  10.4% compress/flate.(*decompressor).moreBits
          15   6.5%  82.6%       15   6.5% runtime.memmove
          11   4.8%  87.4%       50  21.7% compress/flate.(*decompressor).copyHist
           7   3.0%  90.4%        7   3.0% hash/crc32.update
           6   2.6%  93.0%        9   3.9% bufio.(*Reader).ReadByte
           4   1.7%  94.8%        4   1.7% runtime.slicearray

R=rsc, rogpeppe, dave
CC=golang-dev, krasin
https://golang.org/cl/6127064
2012-05-01 10:51:34 +10:00
Shenghou Ma
44fd1d1a6a runtime: give proper messages when user defined DYLD_INSERT_LIBRARIES on Darwin
also gives clear error when bsdthread_register fails on Darwin
       Fixes #2992.

R=rsc, krautz
CC=golang-dev
https://golang.org/cl/5966067
2012-04-30 15:55:07 -04:00
Brad Fitzpatrick
ed90fbc747 encoding/base64: don't ignore underlying souce read error in decode
Fixes #3577

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6137054
2012-04-30 17:14:41 +10:00
Brad Fitzpatrick
fe2ce5285e syscall: add a test for passing an fd over a unix socket
Re-submitting previously reverted change 160ec5506cb7.

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/6129052
2012-04-30 15:31:14 +10:00
Dave Cheney
d5b299eda2 compress/flate: add Encoder/Decoder benchmarks
In CL 6127051, nigeltao suggested that further gains
were possible by improving the performance of flate.
This CL adds a set of benchmarks (based on compress/lzw)
that can be used to judge any future improvements.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6128049
2012-04-29 20:41:13 +10:00
Brian Dellisanti
a0f7c6c658 os/exec: close all internal descriptors when Cmd.Start() fails.
This closes any internal descriptors (pipes, etc) that Cmd.Start() had
opened before it failed.

Fixes #3468.

R=golang-dev, iant, bradfitz
CC=golang-dev
https://golang.org/cl/5986044
2012-04-27 15:46:49 -07:00
Dave Cheney
f72c828c67 net: consolidate common socket functions
In resolving 3507, the fix had to be applied individually to
the four *Conn types, tcp, udp, rawip and unix, due to the
duplicate code in each Conn type.

This CL consolidates the common net.Conn methods that all four
*Conn types implement into a base conn type.

Pros:
* The fix for 3507 would have only needed to be applied to one
method. Further improvements, such as possibly removing the
c.fd != nil check in c.ok(), would benefit from this CL.
* Nearly 300 lines removed from the net package.
* The public interface and documentation are not changed.
* I think this is an excellent example of the power of embedding.

Cons:
* The net package is already distributed over many files, this
CL adds another place to look.
* The fix for 3507 was a total of 16 lines changed, this follow
up CL could be considered to be an overreaction as new Conn types
are unlikely to be added in the near future.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6098047
2012-04-27 22:17:08 +10:00
Nigel Tao
dd294fbd5a image/png: speed up PNG decoding for common color models: Gray, NRGBA,
Paletted, RGBA.

benchmark                       old ns/op    new ns/op    delta
BenchmarkDecodeGray               3681144      2536049  -31.11%
BenchmarkDecodeNRGBAGradient     12108660     10020650  -17.24%
BenchmarkDecodeNRGBAOpaque       10699230      8677165  -18.90%
BenchmarkDecodePaletted           2562806      1458798  -43.08%
BenchmarkDecodeRGB                8468175      7180730  -15.20%

benchmark                        old MB/s     new MB/s  speedup
BenchmarkDecodeGray                 17.80        25.84    1.45x
BenchmarkDecodeNRGBAGradient        21.65        26.16    1.21x
BenchmarkDecodeNRGBAOpaque          24.50        30.21    1.23x
BenchmarkDecodePaletted             25.57        44.92    1.76x
BenchmarkDecodeRGB                  30.96        36.51    1.18x

$ file $GOROOT/src/pkg/image/png/testdata/bench*
benchGray.png:           PNG image, 256 x 256, 8-bit grayscale, non-interlaced
benchNRGBA-gradient.png: PNG image, 256 x 256, 8-bit/color RGBA, non-interlaced
benchNRGBA-opaque.png:   PNG image, 256 x 256, 8-bit/color RGBA, non-interlaced
benchPaletted.png:       PNG image, 256 x 256, 8-bit colormap, non-interlaced
benchRGB.png:            PNG image, 256 x 256, 8-bit/color RGB, non-interlaced

R=r
CC=golang-dev
https://golang.org/cl/6127051
2012-04-27 16:03:58 +10:00
David Symonds
9ce770afad old/regexp, old/template: delete.
Both of these have replacements.

R=golang-dev, r, rsc, r, adg
CC=golang-dev
https://golang.org/cl/5979046
2012-04-27 15:12:24 +10:00
Anthony Martin
0bad08cbbb path/filepath: fix typo
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6117063
2012-04-27 10:25:19 +10:00
Joel Sing
e5f2662c25 syscall: remove sysctl workaround for openbsd
Now that Go will no longer work on OpenBSD versions prior to 5.1,
remove the sysctl workaround that was needed for 5.0 and earlier.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6116050
2012-04-27 01:45:15 +10:00
Anthony Martin
5491623406 syscall: fix a number of exec bugs on Plan 9
1. Readdirnames was erroneously returning an
   empty slice on every invocation.

2. The logic for determining which files to
   close before exec was incorrect.  If the
   set of files to be kept open (provided by
   the caller) did not include the files
   opened at startup, those files would be
   accidentally closed.

I also cleaned up readdupdevice while I was
in the vicinity.

R=golang-dev, seed, rsc
CC=golang-dev
https://golang.org/cl/6016044
2012-04-26 02:59:13 -07:00
Andrew Balholm
a09e9811dc exp/html: adjust inTableBodyIM to match spec
Clean up flow of control.

Handle </tbody>, </tfoot>, and </thead>.

Pass 5 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6117057
2012-04-26 11:48:35 +10:00
David Symonds
555ca36c1d time: doc fix.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6127050
2012-04-26 11:28:35 +10:00
Brad Fitzpatrick
61a8eb07f8 net/http: ignore paths on CONNECT requests in ServeMux
Fixes #3538

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/6117058
2012-04-25 12:46:16 -07:00
Brad Fitzpatrick
7f7a70f225 mime: make ParseMediaType return zero results on error
Fixes #3562

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/6119051
2012-04-25 12:01:01 -07:00
Joel Sing
689d5b9163 runtime: use __tfork() syscall on openbsd
Switch from using the rfork() syscall on OpenBSD, to the __tfork()
syscall.  The __tfork() syscall is the preferred way of creating
system threads and the rfork() syscall has recently been removed.

Note: this will break compatibility with OpenBSD releases prior to 5.1.

R=golang-dev, bradfitz, devon.odell, rsc
CC=golang-dev
https://golang.org/cl/6037048
2012-04-26 00:08:02 +10:00
Marcel van Lohuizen
fdce27f7b8 exp/locale/collate: Added Builder type for generating a complete
collation table. At this moment, it only implements the generation of
a root table.

R=r
CC=golang-dev
https://golang.org/cl/6039047
2012-04-25 13:19:35 +02:00
Marcel van Lohuizen
52f0afe0db exp/locale/collate: Added skeleton for the higher-level types to provide
context for change lists of lower-level types. The public APIs are defined
in builder.go and collate.go. Type table is the glue between the lower and
higher level code and might be a good starting point for understanding the
collation code.

R=r, r
CC=golang-dev
https://golang.org/cl/5999053
2012-04-25 13:19:00 +02:00
Marcel van Lohuizen
bcf48c7971 exp/locale/collate: added trie for associating colElems to runes.
The trie code looks a lot like the trie in exp/norm. It uses different
types, however.  Also, there is only a lookup for []byte and the unsafe
lookup methods have been dropped, as well as sparse mode.
There is now a method for generating a trie. To output Go code, one now needs
to first generate a trie and then call print() on it.

R=r, r, mpvl
CC=golang-dev
https://golang.org/cl/5966064
2012-04-25 13:16:57 +02:00
Marcel van Lohuizen
bb3f3c9775 exp/locale/collate: added representation for collation elements
(see http://www.unicode.org/reports/tr10/).

R=r, r
CC=golang-dev
https://golang.org/cl/5981048
2012-04-25 13:16:24 +02:00
Marcel van Lohuizen
e456d015fb exp/locale/collate: implementation of trie that is used for detecting contractions.
(See http://www.unicode.org/reports/tr10/#Contractions.)  Each rune that is at the
start of any contraction is associated a trie. This trie, in turn, may be shared
by other runes that have the same set of suffixes.

R=r, r
CC=golang-dev
https://golang.org/cl/5970066
2012-04-25 13:15:48 +02:00
Gustavo Niemeyer
733b51d996 net/http: revert 97d027b3aa68
Revert the following change set:

        changeset:   13018:97d027b3aa68
        user:        Gustavo Niemeyer <gustavo@niemeyer.net>
        date:        Mon Apr 23 22:00:16 2012 -0300
        summary:     net/http: allow clients to disable keep-alive

This broke a test on Windows 64 and somebody else
will have to check.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6112054
2012-04-25 02:32:51 -03:00
Ian Lance Taylor
990f3af72b crypto/rand: use io.ReadFull in test
On Solaris versions before Solaris 11, the kernel will not
return more than 1040 on a single read from /dev/urandom.

R=golang-dev, agl, bradfitz, rsc, iant, dchest
CC=golang-dev
https://golang.org/cl/6113046
2012-04-24 21:36:42 -07:00
Bobby Powers
52f122d72e encoding/json: allow punctuation in tag names
everything except backslash and the quote chars is fair game.

Fixes #3546.

R=rsc, r
CC=golang-dev
https://golang.org/cl/6048047
2012-04-25 14:33:33 +10:00
Mikio Hara
b252fe7002 net: fix crash of Listen with "" or nil laddr
Fixes #3584.

R=dave, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/6119043
2012-04-25 12:29:14 +09:00
Dave Cheney
0681b13437 bytes: add assembly version of IndexByte for ARM
benchmark                        old ns/op    new ns/op    delta
BenchmarkIndexByte32                   459          126  -72.55%
BenchmarkIndexByte4K                 52404        10939  -79.13%
BenchmarkIndexByte4M              54470800     11177370  -79.48%
BenchmarkIndexByte64M           1010803000    178860500  -82.31%

benchmark                         old MB/s     new MB/s  speedup
BenchmarkIndexByte32                 69.58       252.63    3.63x
BenchmarkIndexByte4K                 78.16       374.42    4.79x
BenchmarkIndexByte4M                 77.00       375.25    4.87x
BenchmarkIndexByte64M                66.39       375.20    5.65x

R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6106044
2012-04-25 13:18:31 +10:00
Rob Pike
459837c86e all: fix errors found by go vet
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6125044
2012-04-25 11:33:27 +10:00
Andrew Balholm
dde8358a1c exp/html: adjust inTableIM to match spec
Don't foster-parent text nodes that consist only of whitespace.
(I implemented this entirely in inTableIM instead of creating an
inTableTextIM, because the sole purpose of inTableTextIM seems to be
to combine character tokens into a string, which our tokenizer does
already.)

Use parseImpliedToken to clarify a couple of cases.

Handle <style>, <script>, <input>, and <form>.

Ignore doctype tokens.

Pass 20 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6117048
2012-04-25 10:49:27 +10:00
Shenghou Ma
0f80050542 runtime: fix runtime.Breakpoint for ARM
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6100053
2012-04-24 23:19:44 +08:00
Andrew Balholm
b885633d62 exp/html: make inBodyIM match spec
This CL corrects the remaining differences that I could find between the
implementation of inBodyIM and the spec:

Handle <rp> and <rt>.

Adjust SVG and MathML attributes.

Reconstruct active formatting elements in the "any other start tag" case.

Pass 7 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6101055
2012-04-24 15:27:48 +10:00
Brad Fitzpatrick
87eaa4cd0c mime/multipart: report io.EOF correctly on part ending without newlines
If a part ends with "--boundary--", without a final "\r\n",
that's also a graceful EOF, and we should return io.EOF instead
of the fmt-wrapped io.EOF from bufio.Reader.ReadSlice.

I found this bug parsing an image attachment from gmail.
Minimal test case stripped down from the original
gmail-generated attachment included.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6118043
2012-04-23 22:26:48 -07:00
Rob Pike
5fc2af1f77 path: document that Clean deletes trailing slashes.
Fixes #3492.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6112044
2012-04-24 13:17:05 +10:00
Rob Pike
11820899a5 text/template: improve the error reporting for unexported fields.
Changes suggested by rsc after last CL.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6117044
2012-04-24 13:11:59 +10:00
Gustavo Niemeyer
cc5cbee1b6 net/http: allow clients to disable keep-alive
Fixes #3540.

R=golang-dev, bradfitz, gustavo
CC=golang-dev
https://golang.org/cl/5996044
2012-04-23 22:00:16 -03:00
Rémy Oudompheng
d1ab10b4ff net: fix typo in Listener.File() documentation
R=golang-dev, dave, rsc
CC=golang-dev, remy
https://golang.org/cl/6097044
2012-04-24 01:27:19 +02:00
Ian Lance Taylor
426bf36131 time: change float expression to ensure it is an integer
When I increased the number of bits that gccgo uses for
untyped floats, the expression 0.52*1e9 was no longer
integral.  This patch fixes that.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6113043
2012-04-23 15:46:54 -07:00
Pascal S. de Kloe
b678c19785 net/http: lex cleanup
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6099043
2012-04-23 10:26:10 -07:00
Shenghou Ma
e7e7b1c55c math: ARM assembly implementation for Abs
Obtained on 700MHz OMAP4460:
benchmark       old ns/op    new ns/op    delta
BenchmarkAbs           61           23  -61.63%

R=dave, remyoudompheng, mtj, rsc
CC=golang-dev
https://golang.org/cl/6094047
2012-04-23 23:47:36 +08:00