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

6249 Commits

Author SHA1 Message Date
Robert Griesemer
f26d61731d go/parser: fix comment grouping (day 1 bug)
Comment groups must end at the end of a line (or the
next non-comment token) if the group started on a line
with non-comment tokens.

This is important for correct computation of "lead"
and "line" comments (Doc and Comment fields in AST nodes).

Without this fix, the "line" comment for F1 in the
following example:

type T struct {
     F1 int // comment1
     // comment2
     F2 int
}

is "// comment1// comment2" rather than just "// comment1".

This bug was present from Day 1 but only visible when
looking at export-filtered ASTs where only comments
associated with AST nodes are printed, and only in rare
cases (e.g, in the case above, if F2 where not exported,
godoc would show "// comment2" anyway because it was
considered part of the "line" comment for F1).

The bug fix is very small (parser.go). The bulk of the
changes are additional test cases (parser_test.go).

The fix exposed a caching bug in go/printer via one of the
existing tests, hence the changes to printer.go.

As an aside, the fix removes the the need for empty lines
before an "// Output" comment for some special cases of
code examples (e.g.: src/pkg/strings/example_test.go, Count
example).

No impact on gofmt formatting of src, misc.

Fixes #3139.

R=rsc
CC=golang-dev
https://golang.org/cl/6209080
2012-05-22 10:04:34 -07:00
Robert Griesemer
f596eb5d8d godoc: slightly smarter synopsis extraction
Ignore synopses that start with
"Copyright", "All rights", and "Author".

R=rsc
CC=golang-dev
https://golang.org/cl/6218047
2012-05-22 10:04:13 -07:00
Robert Griesemer
7b9a6d8dda go/scanner: strip carriage returns from commments
Also:
- cleaned up and simplified TestScan
- added tests for comments containing carriage returns

Fixes #3647.

R=rsc
CC=golang-dev
https://golang.org/cl/6225047
2012-05-22 10:03:53 -07:00
Alexey Borzenkov
f7277dac57 net/url: better parsing of urls with @ symbol in authority
Fixes #3439

R=r, rsc, dsymonds, n13m3y3r
CC=golang-dev
https://golang.org/cl/6206090
2012-05-22 12:44:24 -04:00
Joel Sing
495a9dc2b3 syscall: implement nametomib() on netbsd
Implement nametomib() on NetBSD using the CTL_QUERY node discovery
mechanism.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6211071
2012-05-23 01:33:48 +10:00
Benjamin Black
5c6162cdd1 crypto/x509: Add ECDSA support
R=golang-dev, agl, rsc
CC=golang-dev
https://golang.org/cl/6208087
2012-05-22 11:03:59 -04:00
Adam Langley
5759c6022c crypto/ecdsa: add full set of NIST test vectors.
This includes the NIST test suite for ECDSA and alters the test to
parse and evaluate it.

R=golang-dev, bradfitz, rsc, b
CC=golang-dev
https://golang.org/cl/6219058
2012-05-22 10:33:14 -04:00
Adam Langley
477d7b1663 crypto/ecdsa: fix case where p != 0 mod 8 and the hash length < p.
I made a typo which breaks P-521.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6219057
2012-05-22 10:17:39 -04:00
Andrew Balholm
8f66d7dc32 exp/html: adjust inSelectIM to match spec
Simplify the flow of control.

Handle EOF, null bytes, <html>, <input>, <keygen>, <textarea>, <script>.

Pass 5 more tests.

R=golang-dev, rsc, nigeltao
CC=golang-dev
https://golang.org/cl/6220062
2012-05-22 15:30:13 +10:00
Russ Cox
85266dfd4d runtime: relax TestGcSys
This fixes occasional 64-bit failures.
Maybe it will fix the 32-bit failures too,
so re-enable on 32-bit for now.

R=golang-dev, bradfitz, r, dvyukov
CC=golang-dev
https://golang.org/cl/6218050
2012-05-22 00:07:13 -04:00
Matthew Horsnell
875f34fd49 debug/elf: Expose entry point from Header in File struct.
Fixes #3470.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/6195074
2012-05-21 23:29:30 -04:00
Andrew Balholm
7648f61c7d exp/html: adjust inCellIM to match spec
Clean up flow of control.

Ignore </table>, </tbody>, </tfoot>, </thead>, </tr> if there is not
an appropriate element in table scope.

Pass 3 more tests.

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6206093
2012-05-22 10:31:08 +10:00
Russ Cox
053e4edd80 crypto/rsa: add SHA-224 hash prefix
http://www.rsa.com/rsalabs/node.asp?id=2125:

NOTE: A new OID has been defined for the combination
of the v1.5 signature scheme and the SHA-224 hash function:
        sha224WithRSAEncryption OBJECT IDENTIFIER ::=
Like the other sha*WithRSAEncryption OIDs in PKCS #1 v2.1,
this OID has NULL parameters.
The DigestInfo encoding for SHA-224 (see Section 9.2, Note 1) is:
        (0x)30 2d 30 0d 06 09 60 86 48 01 65 03 04 02 04 05 00 04 1c || H

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/6208076
2012-05-21 14:10:16 -04:00
Brad Fitzpatrick
d45f22e3c8 net/http: fix duplicate status code in Response.Write
Fixes #3636

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6203094
2012-05-21 11:07:27 -07:00
Volker Dobler
b4456df6d2 net/http: add cookies from jar to POST request.
The main content of this CL is a test case checking the reported
issue 3511 and a tiny fix for it.  A subsequent CL will refactor
the fix as proposed issue 3511.

Fixes #3511.

R=golang-dev, steven.hartland, bradfitz
CC=golang-dev
https://golang.org/cl/6013049
2012-05-21 10:57:15 -07:00
Brad Fitzpatrick
30c0d2315e net/http: fix regression and mute known test failure for now
Two tests added in 820ffde8c are expected to fail until the fix
for Issue 3540 goes back in (pending Windows net fixes), so
make those tests just Logf for now, with a TODO to re-enable.

Add a new client test.

Rearrange the transport code to be more readable, and fix the
bug from 820ffde8c where the persistConn was being closed before
the body was fully ready.

Fixes #3644
Updates #1967 (not yet fixed, but should be after Issue 3540)

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6211069
2012-05-21 10:39:31 -07:00
Joel Sing
40b310706b net: reduce dial tests on netbsd
Add NetBSD to the list of operating systems that have a reduced set
of dial tests.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6208083
2012-05-21 00:38:14 +10:00
Joel Sing
67a0c4f7f9 syscall: fix SockaddrDatalink on netbsd
RawSockaddrDatalink and SockaddrDatalink need to match - make Data
have length 12 for both.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6223051
2012-05-21 00:13:22 +10:00
Andrew Balholm
4973c1fc7e exp/html: adjust inRowIM to match spec
Delete cases that just fall down to "anything else" action.

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

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6203061
2012-05-20 14:26:20 +10:00
Mikio Hara
ba57c88003 net: fix leak in test
Also change the Listner variable name from l to ln.

R=golang-dev, rsc, dave
CC=golang-dev
https://golang.org/cl/5918046
2012-05-19 10:42:54 +09:00
Mikio Hara
9cfb845af6 syscall: add comment
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6215046
2012-05-19 08:35:51 +09:00
James Gray
ccd63c3c19 net/http: non-keepalive connections close successfully
Connections did not close if Request.Close or Response.Close was true. This meant that if the user wanted the connection to close, or if the server requested it via "Connection: close", the connection would not be closed.

Fixes #1967.

R=golang-dev, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6201044
2012-05-18 10:34:37 -07:00
Benjamin Black
57557c0d49 tls: add AES256 ciphers
R=golang-dev, rsc, agl
CC=golang-dev
https://golang.org/cl/6188061
2012-05-18 11:06:58 -04:00
Maxim Pimenov
54c9fe88f5 go/build: fix some comments
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6217044
2012-05-17 11:19:19 -07:00
Marcel van Lohuizen
ec099b2bc7 exp/locale/collate: implementation of main collation functionality for
key and simple comparisson. Search is not yet implemented in this CL.
Changed some of the types of table_test.go to allow reuse in the new test.
Also reduced number of primary values for illegal runes to 1 (both map to
the same).

R=r
CC=golang-dev
https://golang.org/cl/6202062
2012-05-17 19:48:56 +02:00
Russ Cox
1171dbdd2d net: avoid the Mac firewall (again)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6209072
2012-05-17 02:01:03 -04:00
Gustavo Niemeyer
fdc45367f9 encoding/xml: fix decoding of unknown entities in non-strict mode
Fixes #3447.

R=rsc, gustavo
CC=golang-dev
https://golang.org/cl/6039045
2012-05-17 00:04:00 -03:00
Gustavo Niemeyer
9242a90ab5 encoding/xml: handle anonymous pointer fields
This CL makes

    type T struct { *U }

behave in a similar way to:

    type T struct { U }

Fixes #3108.

R=golang-dev, rsc, gustavo
CC=golang-dev
https://golang.org/cl/5694044
2012-05-16 23:21:31 -03:00
Andrew Gerrand
283a3ddab8 runtime: disable gc test on non-amd64 systems
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6210062
2012-05-17 11:34:28 +10:00
Akshat Kumar
f5752848fd pkg/runtime: Fix semasleep on Plan 9
With the timed semacquire patch
(kernel-tsemacquire) for Plan 9,
we can now properly do a timed
wait for the semaphore, in
semasleep.

R=golang-dev, rsc, rminnich, ality, r
CC=0intro, golang-dev, john, mirtchovski
https://golang.org/cl/6197046
2012-05-16 15:09:28 -07:00
Benny Siegert
c816d8c59f log: fix typo in comment
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6195096
2012-05-16 22:56:18 +10:00
Robert Griesemer
03e1d4bc22 go/printer: don't print newlines for empty statements
Fixes #3466.

gofmt -w src misc causes no changes.

R=rsc
CC=golang-dev
https://golang.org/cl/6206073
2012-05-15 12:21:21 -07:00
Joel Sing
efa67b2c55 runtime: implement getcontext and sigprocmask for netbsd
Implement getcontext and sigprocmask for NetBSD - these will soon be
used by the thread handling code.

Also fix netbsd/386 signal handling - there is no sigreturn, just
return so that we hit the trampoline.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6215049
2012-05-16 04:32:49 +10:00
Joel Sing
0b7bcb84e3 runtime: fix netbsd syscalls
Use correct system calls/syscall numbers for NetBSD.

R=golang-dev, for.go.yong, rsc
CC=golang-dev
https://golang.org/cl/6200070
2012-05-16 03:33:37 +10:00
Joel Sing
4a5a5b20a5 runtime: fix netbsd signal handling
Update/correct NetBSD signal handling - most of this is needed due to
the correctly generated runtime definitions.

R=golang-dev, m4dh4tt3r, rsc
CC=golang-dev
https://golang.org/cl/6195079
2012-05-16 01:53:26 +10:00
Joel Sing
8a9edcf790 runtime: fix netbsd runtime defs
Fix and regenerate runtime defs for NetBSD.

Whilst the mcontext struct can be handled across architectures,
the registers are provided as defines that index an array, rather
than as members of the struct. Since these are architecture
dependent, include them via a defs_netbsd_<arch>.go file.

R=golang-dev, m4dh4tt3r, rsc
CC=golang-dev
https://golang.org/cl/6190070
2012-05-16 01:52:20 +10:00
Jan Ziak
773685b4a3 runtime: fix counting of free objects
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6206056
2012-05-15 11:48:58 -04:00
Dmitriy Vyukov
01826280eb runtime: refactor helpgc functionality in preparation for parallel GC
Parallel GC needs to know in advance how many helper threads will be there.
Hopefully it's the last patch before I can tackle parallel sweep phase.
The benchmarks are unaffected.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6200064
2012-05-15 19:10:16 +04:00
Joel Sing
b554fb912f os/syscall: correct netbsd types/names
Fix types/names so that these functions work with the generated
syscall/z* files.

R=golang-dev, m4dh4tt3r
CC=golang-dev
https://golang.org/cl/6201078
2012-05-15 12:00:13 +10:00
Joel Sing
b42ebb6fbf runtime: fix TLS handling for netbsd
Set the TLS base using the _lwp_setprivate() syscall, instead of via
sysarch(). NetBSD tracks the pointer passed to _lwp_setprivate() and
restores this value when restoring mcontext. If sysarch() is used
directly, restoring an mcontext trashes the FS/GS value, resulting
in a segfault when we next try to access the TLS.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6206062
2012-05-15 11:26:05 +10:00
Brad Fitzpatrick
e393a8292e mime/multipart: fix handling of empty parts without CRLF before next part
Empty parts can be either of the form:

a) "--separator\r\n", header (w/ trailing 2xCRLF), \r\n "--separator"...
or
b) "--separator\r\n", header (w/ trailing 2xCRLF), "--separator"...

We never handled case b).  In fact the RFC seems kinda vague about
it, but browsers seem to do a), and App Engine's synthetic POST
bodies after blob uploads is of form b).

So handle them both, and add a bunch of tests.

(I can't promise these are the last fixes to multipart, especially
considering its history, but I'm growing increasingly confident at
least, and I've never submitted a multipart CL with known bugs
outstanding, including this time.)

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6212046
2012-05-14 18:16:47 -07:00
Jan Mercl
bd13f6ff8e regexp/syntax: replace internal error on unexpected ) w/ ErrUnexpectedParen
Unbalanced extra right parenthesis produced an internal error instead of
a more descriptive one.

Fixes #3406.

R=r, rsc
CC=golang-dev
https://golang.org/cl/6201063
2012-05-14 11:50:25 -07:00
Joel Sing
2a47e0444c syscall: regenerate z* files for netbsd
Fix mkerrors.sh so that it works on NetBSD.

Remove directory mode bits from types - this already appears in errors.

Regenerate the z* files now that cgo is working.

R=golang-dev, m4dh4tt3r, r
CC=golang-dev
https://golang.org/cl/6201077
2012-05-14 10:40:13 -07:00
Michael Gehring
99142f5537 crypto/tls: fix decoding of certLen in certificateMsg.unmarshal
certLen was decoded incorrectly if length > 2^16-1.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/6197077
2012-05-14 12:26:29 -04:00
Dmitriy Vyukov
8c4c6c413f sync: use atomic.Store in Once.Do
No perf/semantic changes, merely improves code health.
There were several questions as to why Once.Do uses
atomic.CompareAndSwap to do a store.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6208057
2012-05-14 19:27:29 +04:00
Dmitriy Vyukov
eb0bc8164a runtime: revert MaxGcproc from 16 to 4
The change accidentally come in with this revision:
https://code.google.com/p/go/source/detail?spec=svn345cbca96c5550f2e89bc727703301933802923c&r=14c38c23c819a17021b1808cf4a34ef3a1a17db5

R=golang-dev
CC=golang-dev
https://golang.org/cl/6195073
2012-05-11 13:30:34 +04:00
Dmitriy Vyukov
95643647ae runtime: add parallel for algorithm
This is factored out part of:
https://golang.org/cl/5279048/
(parallel GC)

R=bsiegert, mpimenov, rsc, minux.ma, r
CC=golang-dev
https://golang.org/cl/5986054
2012-05-11 10:50:03 +04:00
Shenghou Ma
aa45e52e74 runtime: fix complex division benchmarks
we can't add the division result to n during iteration, because it might
turn n into NaN or Inf.

R=golang-dev, rsc, iant, iant
CC=golang-dev
https://golang.org/cl/6197045
2012-05-11 03:09:14 +08:00
Joel Sing
5374ded1f3 runtime: fix syscalls for netbsd
Use correct syscall numbers and arguments for NetBSD.
Provide a trampoline for signal returns (using signal API 3).

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6209048
2012-05-11 03:48:43 +10:00
Joel Sing
38445ca089 runtime: fix netbsd sigaction struct
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6198063
2012-05-11 03:48:16 +10:00
Joel Sing
a1bf5207af syscall: repair netbsd z* files
Manually repair/update z* files for netbsd - this allows Go to
compile again on 386.

R=golang-dev, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/6194064
2012-05-11 03:47:27 +10:00
Marcel van Lohuizen
0355a71751 exp/locale/collate: Add maketables tool and generated tables.
Also set maxContractLen automatically.
Note that the table size is much bigger than it needs to be.
Optimization is best done, though, when the language specific
tables are added.

R=r
CC=golang-dev
https://golang.org/cl/6167044
2012-05-09 12:03:55 +02:00
Nigel Tao
738e77aa4f compress/testdata: change {e,pi}.txt from 10k to 100k digits.
These files change from exactly 10003 bytes long to 100003: a digit,
a '.', 100k digits, and a '\n'.

The magic constants in compress/flate/deflate_test.go change since
deflateInflateStringTests checks that the compressed form of e.txt
is not 'too large'. I'm not exactly sure how these numbers were
originally calculated (they were introduced in codereview 5554066
"make lazy matching work"); perhaps krasin@golang.org can comment.
My change was to increase the first one (no compression) to a tight
bound, and multiply all the others by 10.

Benchcmp numbers for compress/flate and compress/lzw below. LZW's
window size of 4096 is less than 10k, so shows no significant change.
Flate's window size is 32768, between 10k and 100k, and so the .*1e5
and .*1e6 benchmarks show a dramatic drop, since the compressed forms
are no longer a trivial forward copy of 10k digits repeated over and
over, but should now be more representative of real world usage.

compress/flate:
benchmark                            old MB/s     new MB/s  speedup
BenchmarkDecodeDigitsSpeed1e4           16.58        16.52    1.00x
BenchmarkDecodeDigitsSpeed1e5           68.09        18.10    0.27x
BenchmarkDecodeDigitsSpeed1e6          124.63        18.35    0.15x
BenchmarkDecodeDigitsDefault1e4         17.21        17.12    0.99x
BenchmarkDecodeDigitsDefault1e5        118.28        19.19    0.16x
BenchmarkDecodeDigitsDefault1e6        295.62        20.52    0.07x
BenchmarkDecodeDigitsCompress1e4        17.22        17.17    1.00x
BenchmarkDecodeDigitsCompress1e5       118.19        19.21    0.16x
BenchmarkDecodeDigitsCompress1e6       295.59        20.55    0.07x
BenchmarkEncodeDigitsSpeed1e4            8.18         8.19    1.00x
BenchmarkEncodeDigitsSpeed1e5           43.22        12.84    0.30x
BenchmarkEncodeDigitsSpeed1e6           80.76        13.48    0.17x
BenchmarkEncodeDigitsDefault1e4          6.29         6.19    0.98x
BenchmarkEncodeDigitsDefault1e5         31.63         3.60    0.11x
BenchmarkEncodeDigitsDefault1e6         52.97         3.24    0.06x
BenchmarkEncodeDigitsCompress1e4         6.20         6.19    1.00x
BenchmarkEncodeDigitsCompress1e5        31.59         3.59    0.11x
BenchmarkEncodeDigitsCompress1e6        53.18         3.25    0.06x

compress/lzw:
benchmark               old MB/s     new MB/s  speedup
BenchmarkDecoder1e4        21.99        22.09    1.00x
BenchmarkDecoder1e5        22.77        22.71    1.00x
BenchmarkDecoder1e6        22.90        22.90    1.00x
BenchmarkEncoder1e4        21.04        21.19    1.01x
BenchmarkEncoder1e5        22.06        22.06    1.00x
BenchmarkEncoder1e6        22.16        22.28    1.01x

R=rsc
CC=golang-dev, krasin
https://golang.org/cl/6207043
2012-05-09 10:02:28 +10:00
Nigel Tao
ffd0d02d09 compress/flate: benchmark some English text, not just the digits of e.
The testdata/e.txt input is repeated on the longer benchmarks, but the
length of that data is less than flate's window size, so the numbers are
essentially measuring the performance of a trivial compression. A follow-up
CL will add more data to testdata/e.txt.

Sample output on my laptop (linux, amd64):

BenchmarkDecodeDigitsSpeed1e4	    5000	    603153 ns/op	  16.58 MB/s
BenchmarkDecodeDigitsSpeed1e5	    1000	   1465602 ns/op	  68.23 MB/s
BenchmarkDecodeDigitsSpeed1e6	     200	   8036050 ns/op	 124.44 MB/s
BenchmarkDecodeDigitsDefault1e4	    5000	    581796 ns/op	  17.19 MB/s
BenchmarkDecodeDigitsDefault1e5	    2000	    846653 ns/op	 118.11 MB/s
BenchmarkDecodeDigitsDefault1e6	     500	   3385782 ns/op	 295.35 MB/s
BenchmarkDecodeDigitsCompress1e4	    5000	    581180 ns/op	  17.21 MB/s
BenchmarkDecodeDigitsCompress1e5	    2000	    846209 ns/op	 118.17 MB/s
BenchmarkDecodeDigitsCompress1e6	     500	   3386174 ns/op	 295.32 MB/s
BenchmarkDecodeTwainSpeed1e4	    5000	    643563 ns/op	  15.54 MB/s
BenchmarkDecodeTwainSpeed1e5	     500	   5418408 ns/op	  18.46 MB/s
BenchmarkDecodeTwainSpeed1e6	      50	  52277520 ns/op	  19.13 MB/s
BenchmarkDecodeTwainDefault1e4	    5000	    583551 ns/op	  17.14 MB/s
BenchmarkDecodeTwainDefault1e5	     500	   4443428 ns/op	  22.51 MB/s
BenchmarkDecodeTwainDefault1e6	      50	  41862080 ns/op	  23.89 MB/s
BenchmarkDecodeTwainCompress1e4	    5000	    583490 ns/op	  17.14 MB/s
BenchmarkDecodeTwainCompress1e5	     500	   4426356 ns/op	  22.59 MB/s
BenchmarkDecodeTwainCompress1e6	      50	  41657940 ns/op	  24.01 MB/s
BenchmarkEncodeDigitsSpeed1e4	    2000	   1230907 ns/op	   8.12 MB/s
BenchmarkEncodeDigitsSpeed1e5	    1000	   2319129 ns/op	  43.12 MB/s
BenchmarkEncodeDigitsSpeed1e6	     100	  12378950 ns/op	  80.78 MB/s
BenchmarkEncodeDigitsDefault1e4	    1000	   1597865 ns/op	   6.26 MB/s
BenchmarkEncodeDigitsDefault1e5	     500	   3163458 ns/op	  31.61 MB/s
BenchmarkEncodeDigitsDefault1e6	     100	  18770240 ns/op	  53.28 MB/s
BenchmarkEncodeDigitsCompress1e4	    1000	   1603461 ns/op	   6.24 MB/s
BenchmarkEncodeDigitsCompress1e5	     500	   3168766 ns/op	  31.56 MB/s
BenchmarkEncodeDigitsCompress1e6	     100	  18855830 ns/op	  53.03 MB/s
BenchmarkEncodeTwainSpeed1e4	    1000	   1338049 ns/op	   7.47 MB/s
BenchmarkEncodeTwainSpeed1e5	     500	   7341622 ns/op	  13.62 MB/s
BenchmarkEncodeTwainSpeed1e6	      50	  67484600 ns/op	  14.82 MB/s
BenchmarkEncodeTwainDefault1e4	    1000	   1778399 ns/op	   5.62 MB/s
BenchmarkEncodeTwainDefault1e5	     100	  23261810 ns/op	   4.30 MB/s
BenchmarkEncodeTwainDefault1e6	      10	 243533600 ns/op	   4.11 MB/s
BenchmarkEncodeTwainCompress1e4	    1000	   1795469 ns/op	   5.57 MB/s
BenchmarkEncodeTwainCompress1e5	      50	  29447140 ns/op	   3.40 MB/s
BenchmarkEncodeTwainCompress1e6	       5	 321686800 ns/op	   3.11 MB/s
ok  	compress/flate	89.246s

R=rsc, r
CC=golang-dev
https://golang.org/cl/6195055
2012-05-09 08:57:54 +10:00
Nigel Tao
32b85baae3 compress/testdata: remove Byte Order Mark from the Tom Sawyer data.
I'm not sure where the BOM came from, originally.
http://www.gutenberg.org/files/74/74.txt doesn't have it, although
a fresh download of that URL gives me "\r\n"s instead of plain "\n"s,
and the extra line "Character set encoding: ASCII". Maybe Project
Gutenberg has changed their server configuration since we added that
file to the Go repo.

Anyway, this change is just manually excising the BOM from the start
of the file, leaving pure ASCII.

R=r, bradfitz
CC=golang-dev, krasin, rsc
https://golang.org/cl/6197061
2012-05-08 10:41:45 +10:00
Russ Cox
36675daa0f crypto/aes: fix comment
Fixes #3589.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/6190044
2012-05-07 16:45:34 -04:00
Marcel van Lohuizen
56a76c88f8 exp/locale/collate: from the regression test we derive that the spec
dictates a CJK rune is only part of a certain specified range if it
is explicitly defined in the Unicode Codepoint Database.
Fixed the code and some of the tests accordingly.

R=r
CC=golang-dev
https://golang.org/cl/6160044
2012-05-07 11:51:40 +02:00
Marcel van Lohuizen
18aded7ab9 exp/norm: It is important that the unicode versions of the various packages align.
Replace hard-coded version strings with unicode.Version.

R=r, r
CC=golang-dev
https://golang.org/cl/6163045
2012-05-07 11:41:40 +02:00
Shenghou Ma
4d724f4c5b sync/atomic: fix 64-bit atomic cas for Linux/ARM
This is a follow-up to CL 5978051.
    Use kernel cas64 helper if we can, fallback to LDREXD/STREXD if
    we are on ARMv6 or higher, and to lock-emulated cas64 if on ARMv5.
    A future CL will fix {Add,Load,Store}{Int,Uint}64 and issue 3331.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6034048
2012-05-05 02:02:36 +08:00
Shenghou Ma
a642ca4930 runtime: get per-process random number from auxv for hash table
Decode AT_RANDOM, AT_HWCAP, and AT_PLATFORM.
This CL only make use of AT_RANDOM, but future CLs will make use of the others.

R=dave, rsc
CC=golang-dev
https://golang.org/cl/5978051
2012-05-05 01:59:14 +08:00
Shenghou Ma
a29304bfb8 runtime: fix c compiler warning
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6185047
2012-05-05 01:39:09 +08:00
Shenghou Ma
018bcc3535 runtime, misc/cgo/test: fix build for Linux/ARM
1. In CL 5989057, I made a mistake in the last minute change.
"MOVW.W R4, -4(SP)" should really be "MOVW.W R4, -4(R13)",
as 5l will rewrite offset for SP.
2. misc/cgo/test/issue1560.go tests for parallel sleep of 1s,
but on ARM, the deadline is frequently missed, so change sleep
time to 2s on ARM.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6202043
2012-05-05 01:35:13 +08:00
Rémy Oudompheng
018c60bd8f math/big: fix superpolynomial complexity in Karatsuba algorithm.
benchmark                     old ns/op    new ns/op    delta
BenchmarkExp3Power0x10              732          734   +0.27%
BenchmarkExp3Power0x40              834          836   +0.24%
BenchmarkExp3Power0x100            1600         1579   -1.31%
BenchmarkExp3Power0x400            3478         3417   -1.75%
BenchmarkExp3Power0x1000          19388        19229   -0.82%
BenchmarkExp3Power0x4000         160274       156881   -2.12%
BenchmarkExp3Power0x10000       1552050      1372058  -11.60%
BenchmarkExp3Power0x40000      27328710     15216920  -44.32%
BenchmarkExp3Power0x100000    612349000    131407100  -78.54%
BenchmarkExp3Power0x400000  44073524000   1122195000  -97.45%

R=golang-dev, mtj, gri, rsc
CC=golang-dev, remy
https://golang.org/cl/6176043
2012-05-04 19:05:26 +02:00
Akshat Kumar
ccdca2cd6b pkg/runtime: Plan 9 signal handling in Go
This adds proper note handling for Plan 9,
and fixes the issue of properly killing go procs.
Without this change, the first go proc that dies
(using runtime·exit()) would kill all the running
go procs. Proper signal handling is needed.

R=golang-dev, ality, rminnich, rsc
CC=golang-dev, john, mirtchovski
https://golang.org/cl/5617048
2012-05-04 03:48:34 -07:00
Anthony Martin
fe5005f721 syscall: remove the Signal type on Plan 9
Instead use a new type, "Note", whose underlying
type is just a string.  This change allows us to
remove the exported os.Plan9Note type.

R=bradfitz, seed, rsc
CC=golang-dev
https://golang.org/cl/6015046
2012-05-04 03:44:41 -07:00
Shenghou Ma
2bed8a7e95 go/build: cgo is supported on Linux/ARM
Last Part of CL 5601044 (cgo: Linux/ARM support)
        Fixes #1880.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/5988057
2012-05-04 18:34:04 +08:00
Shenghou Ma
5cffce611a runtime: cgo support for Linux/ARM
Part 2 of CL 5601044 (cgo: Linux/ARM support)

R=dave, rsc
CC=golang-dev
https://golang.org/cl/5989057
2012-05-04 18:20:09 +08:00
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
Rob Pike
a8098cbcfd text/template: detect unexported fields better
Moves the error detection back into execution, where it used to be,
and improves the error message.
Rolls back most of 6009048, which broke lower-case keys in maps.
If it weren't for maps we could detect this at compile time rather than
execution time.

Fixes #3542.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6098051
2012-04-23 15:39:02 +10:00
Rob Pike
53372903c7 reflect: document and test TypeOf(nil)
Fixes #3549.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6107047
2012-04-23 12:07:02 +10:00
Andrew Balholm
0cc8ee9808 exp/html: add more cases to inBodyIM
Don't set framesetOK to false for hidden input elements.

Handle <param>, <source>, <track>, <textarea>, <iframe>, <noembed>,
and <noscript>

Pass 7 additional tests.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6094045
2012-04-22 16:19:21 +10:00
Rémy Oudompheng
cad480440d strconv: 2x-4x speed improvement for atof64.
benchmark                      old ns/op    new ns/op    delta
BenchmarkAtof64Decimal               344           71  -79.22%
BenchmarkAtof64Float                 397           90  -77.15%
BenchmarkAtof64FloatExp              445          241  -45.84%
BenchmarkAtof64Big                   731          324  -55.68%
BenchmarkAtof64RandomBits            761          453  -40.47%
BenchmarkAtof64RandomFloats          690          314  -54.49%

R=dave, rsc
CC=golang-dev, remy
https://golang.org/cl/5988053
2012-04-21 13:56:51 +02:00
Quan Yong Zhai
dd963ddf05 compress/zlib: minor fixes
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6058043
2012-04-21 14:34:42 +10:00
Michael Chaten
32c3a626da runtime: add benchmark for complex128 division
R=golang-dev, dave, rsc
CC=golang-dev, minux.ma
https://golang.org/cl/6070043
2012-04-21 13:24:41 +10:00
Dave Cheney
1f14d45e7d net: fix race between Close and Read
Fixes #3507.

Applied the suggested fix from rsc. If the connection
is in closing state then errClosing will bubble up to
the caller.

The fix has been applied to udp, ip and unix as well as
their code path include nil'ing c.fd on close. Func
tests are available in the linked issue that verified
the bug existed there as well.

R=rsc, fullung, alex.brainman, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/6002053
2012-04-21 10:01:32 +10:00
Andrew Balholm
904c7c8e99 exp/html: more work on inBodyIM
Reorder some cases.
Handle <pre>, <listing>, </form>, </li>, </dd>, </dt>, </h1>, </h2>,
</h3>, </h4>, </h5>, and </h6> tags.

Pass 6 additional tests.

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6089043
2012-04-21 09:20:38 +10:00
Ian Lance Taylor
244706bd0f runtime: disable memory profiler in gc_test
This lets the test pass on PPC64 GNU/Linux, which uses a much
larger page size and thus uses more memory to hold blocks
allocated for memory profiling.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6048054
2012-04-20 11:36:06 -07:00
Colby Ranger
a6d4471b2b net/http/httputil: Made reverseproxy test less flaky.
The reverseproxy test depended on the behavior of
runtime.NumGoroutines(), which makes no guarantee when
goroutines are reaped. Instead, modify the flushLoop()
to invoke a callback when it returns, so the exit
from the loop can be tested, instead of the number
of gorountines running.

R=bradfitz
CC=golang-dev
https://golang.org/cl/6068046
2012-04-20 09:31:23 -07:00
Andrew Balholm
eea5a432cb exp/html: start making inBodyIM match the spec
Reorder some start tags.

Improve handling of </body>.
Handle </html>.

Pass 2 additional tests (by handling </html>).

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6082043
2012-04-20 15:48:13 +10:00
Andrew Balholm
6791057296 exp/html: ignore null bytes in text
pass one additional test

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6048051
2012-04-20 14:25:42 +10:00
Andrew Balholm
7d63ff09a5 exp/html: improve afterHeadIM
Clean up the flow of control.
Fix the TODO for handling <html> tags.
Add a case to ignore doctype declarations.

Pass one additional test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6072047
2012-04-20 10:48:10 +10:00
Akshat Kumar
49a7da2dd9 syscall: cleanly exit all Go procs on Plan 9
syscall.Exit would originally kill only the calling
Go proc, leaving behind other procs in the
same group. This change makes syscall.Exit call
runtime·exit, which due to CL
https://golang.org/cl/5617048
will cleanly exit all the Go procs in the group.

R=golang-dev, rsc, rminnich, remyoudompheng, ality, john
CC=golang-dev, mirtchovski
https://golang.org/cl/6036051
2012-04-19 16:31:26 -07:00
Andrew Balholm
fca32f02e9 exp/html: improve InHeadIM
Clean up the flow of control, and add a case for doctype tokens (to
ignore them).

R=nigeltao
CC=golang-dev
https://golang.org/cl/6069045
2012-04-20 09:08:58 +10:00
Shenghou Ma
acb550504f net/http: add example for FileServer to mention StripPrefix
Fixes #3530.

R=golang-dev, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6032052
2012-04-20 00:41:10 +08:00
Andrew Balholm
c88ca5906c exp/html: add parseImpliedToken method to parser
This method will allow us to be explicit about what we're doing when
we insert an implied token, and avoid repeating the logic involved in
multiple places.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6060048
2012-04-19 11:48:17 +10:00
Colby Ranger
5694ebf057 net/http/httputil: Clean up ReverseProxy maxLatencyWriter goroutines.
When FlushInterval is specified on ReverseProxy, the ResponseWriter is
wrapped with a maxLatencyWriter that periodically flushes in a
goroutine. That goroutine was not being cleaned up at the end of the
request. This resulted in a panic when Flush() was being called on a
ResponseWriter that was closed.

The code was updated to always send the done message to the flushLoop()
goroutine after copying the body. Futhermore, the code was refactored to
allow the test to verify the maxLatencyWriter behavior.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6033043
2012-04-18 11:33:02 -07:00
Adam Langley
6742d0a085 encoding/asn1: allow lengths up to the maximum int value.
Previously we capped lengths at 2**24 rather than 2**31.

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/6050050
2012-04-18 13:41:11 -04:00
Andrew Balholm
b65c9a633e exp/html: improve beforeHeadIM
Add a case to ignore doctype tokens.

Clean up the flow of control to more clearly match the spec.

Pass one more test.

R=nigeltao
CC=golang-dev
https://golang.org/cl/6062047
2012-04-18 22:45:36 +10:00
Andrew Balholm
b39bbf1e5b exp/html: adjust beforeHTMLIM to match spec
Add case for doctype tokens (which are ignored).

This CL does not change the status of any tests.

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/6061047
2012-04-18 13:26:35 +10:00
Brad Fitzpatrick
90aa56f271 os/user: simplify test
Don't require the home directory to exist. Just check
that it returns something.

Fixes #3531

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6056045
2012-04-17 18:46:35 -07:00
Andrew Balholm
9a6cef8bbf exp/html: more comprehensive tests
Currently, the html package only runs a limited subset of the tests
in the testdata directory. This tends to limit development of the
parser to fixing the bug that causes the first failing test.

This CL gives it the ability to run all the tests and produce a
log showing the status of each test. (It does it when tests are run with
'go test --update-logs') The status is listed as PASS, FAIL, or PARSE
(PARSE means that parsing produced the correct tree, but rendering and
re-parsing does not produce the same tree).

When 'go test' is run without --update-logs, it runs the tests marked
'PASS' in the logs (and the parsing portion of the tests marked 'PARSE').
Thus it will fail if there has been a regression since the last
time the logs were updated.

My goal for this CL is to allow develoment of the html package to
be less test-driven, while still having the advantages of regression
tests. In other words, one can work on any portion of the parser
and quickly see whether he is breaking things or improving them.

Current statistics of the tests:
$ grep ^PASS *.log|wc -l
        1017
$ grep ^PARSE *.log|wc -l
          46
$ grep ^FAIL *.log|wc -l
         181

R=nigeltao
CC=golang-dev
https://golang.org/cl/6031049
2012-04-17 17:17:22 +10:00
David Symonds
b20163e9e4 flag: update style.
R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/6051044
2012-04-17 16:37:35 +10:00
Anthony Martin
74607d18c5 os: avoid panic when testing errors on Plan 9
R=golang-dev, bradfitz, akumar
CC=golang-dev
https://golang.org/cl/6017043
2012-04-16 17:36:02 -07:00
Akshat Kumar
4cf577edf9 syscall: fix duplicate fd bug for Plan 9
This change comes from CL 5536043,
created by Andrey Mirtchovski. His
description follows:

"The plan9 exec child handler does not manage
dup-ed fds from the parent correctly: when a
dup-ed file descriptor appears in the child's fd
list it is closed when first encountered and then
subsequent attempt to dup it later in Pass 2 fails,
resulting in 'fork/exec: fd out of range or not
open'."

R=golang-dev, rminnich, ality
CC=golang-dev, mirtchovski, rsc
https://golang.org/cl/6009046
2012-04-16 17:35:15 -07:00
Joel Sing
99fc281743 runtime: update defs for openbsd
Update runtime defs for openbsd. Add struct __tfork, which will be
needed by an upcoming change.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6007050
2012-04-17 02:35:41 +10:00
Robert Hencke
c81705f13a time: parse fractional second with single digit
Fixes #3487.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6011050
2012-04-16 11:56:37 +10:00
Shenghou Ma
3180137b86 text/template/parse: fix doc comment
Fixes #3529.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6037046
2012-04-15 21:50:21 +08:00
Dave Cheney
84ef97b59c strconv: make malloc tests more reliable
Fixes #3495.

I adapted fmt.TestCountMallocs to fix the
existing tests. As the resulting tests did not
appear to belong to either itoa or ftoa I moved
them into their own file.

R=bradfitz, fullung
CC=golang-dev
https://golang.org/cl/5985072
2012-04-14 21:34:08 +10:00
Gustavo Niemeyer
e4389c1d30 time: panic if UnixNano is out of range
R=golang-dev, remyoudompheng, dsymonds, gustavo, dchest, r, rsc
CC=golang-dev
https://golang.org/cl/5985059
2012-04-12 22:16:31 -03:00
Rob Pike
a662d3d9a7 fmt: fix crash of %b on huge negative int64
The buffer had 64 bytes but needs one more for the sign.

Fixes #3510.

R=golang-dev, dave, dsymonds
CC=golang-dev
https://golang.org/cl/6011057
2012-04-13 09:28:37 +10:00
Adam Langley
e6e8b72377 crypto/tls: don't always use the default private key.
When SNI based certificate selection is enabled, we previously used
the default private key even if we selected a non-default certificate.

Fixes #3367.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5987058
2012-04-12 12:35:21 -04:00
Adam Langley
55af51d5c0 encoding/pem: ignore spaces and tabs at the end of header lines.
Fixes #3502.

R=bradfitz
CC=golang-dev
https://golang.org/cl/6011046
2012-04-12 12:33:52 -04:00
Dmitriy Vyukov
4945fc8e40 runtime: speedup GC sweep phase (batch free)
benchmark                             old ns/op    new ns/op    delta
garbage.BenchmarkParser              4370050250   3779668750  -13.51%
garbage.BenchmarkParser-2            3713087000   3628771500   -2.27%
garbage.BenchmarkParser-4            3519755250   3406349750   -3.22%
garbage.BenchmarkParser-8            3386627750   3319144000   -1.99%

garbage.BenchmarkTree                 493585529    408102411  -17.32%
garbage.BenchmarkTree-2               500487176    402285176  -19.62%
garbage.BenchmarkTree-4               473238882    361484058  -23.61%
garbage.BenchmarkTree-8               486977823    368334823  -24.36%

garbage.BenchmarkTree2                 31446600     31203200   -0.77%
garbage.BenchmarkTree2-2               21469000     21077900   -1.82%
garbage.BenchmarkTree2-4               11007600     10899100   -0.99%
garbage.BenchmarkTree2-8                7692400      7032600   -8.58%

garbage.BenchmarkParserPause          241863263    163249450  -32.50%
garbage.BenchmarkParserPause-2        120135418    112981575   -5.95%
garbage.BenchmarkParserPause-4         83411552     64580700  -22.58%
garbage.BenchmarkParserPause-8         51870697     42207244  -18.63%

garbage.BenchmarkTreePause             20940474     13147011  -37.22%
garbage.BenchmarkTreePause-2           20115124     11146715  -44.59%
garbage.BenchmarkTreePause-4           17217584      7486327  -56.52%
garbage.BenchmarkTreePause-8           18258845      7400871  -59.47%

garbage.BenchmarkTree2Pause           174067190    172674190   -0.80%
garbage.BenchmarkTree2Pause-2         131175809    130615761   -0.43%
garbage.BenchmarkTree2Pause-4          95406666     93972047   -1.50%
garbage.BenchmarkTree2Pause-8          86056095     85334952   -0.84%

garbage.BenchmarkParserLastPause      329932000    324790000   -1.56%
garbage.BenchmarkParserLastPause-2    209383000    210456000   +0.51%
garbage.BenchmarkParserLastPause-4    113981000    112921000   -0.93%
garbage.BenchmarkParserLastPause-8     77967000     76625000   -1.72%

garbage.BenchmarkTreeLastPause         29752000     18444000  -38.01%
garbage.BenchmarkTreeLastPause-2       24274000     14766000  -39.17%
garbage.BenchmarkTreeLastPause-4       19565000      8726000  -55.40%
garbage.BenchmarkTreeLastPause-8       21956000     10530000  -52.04%

garbage.BenchmarkTree2LastPause       314411000    311945000   -0.78%
garbage.BenchmarkTree2LastPause-2     214641000    210836000   -1.77%
garbage.BenchmarkTree2LastPause-4     110024000    108943000   -0.98%
garbage.BenchmarkTree2LastPause-8      76873000     70263000   -8.60%

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5991049
2012-04-12 12:01:24 +04:00
Dmitriy Vyukov
a5dc7793c0 runtime: add lock-free stack
This is factored out part of the:
https://golang.org/cl/5279048/
(parallel GC)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5993043
2012-04-12 11:49:25 +04:00
Rob Pike
2d0d3d8f9e text/template: catch unexported fields during parse
It's a common error to reference unexported field names in templates,
especially for newcomers. This catches the error at parse time rather than
execute time so the rare few who check errors will notice right away.

These were always an error, so the net behavior is unchanged.
Should break no existing code, just identify the error earlier.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6009048
2012-04-12 15:57:09 +10:00
Nigel Tao
6277656d69 html, exp/html: escape ' and " as &#39; and &#34;, since IE8 and
below do not support &apos;.

This makes package html consistent with package text/template's
HTMLEscape function.

Fixes #3489.

R=rsc, mikesamuel, dsymonds
CC=golang-dev
https://golang.org/cl/5992071
2012-04-12 09:35:43 +10:00
Adam Langley
772e8ff458 crypto/rsa: fix Verify for multi-prime keys.
The least common multiple is not totient/gcd.

R=remyoudompheng
CC=golang-dev
https://golang.org/cl/5990045
2012-04-11 12:57:38 -04:00
Adam Langley
7247dcab92 crypto/tls: update how we create testing scripts.
crypto/tls is tested, in part, by replaying recorded TLS connections
and checking that the bytes sent by the Go code haven't changed.

Previously we used GnuTLS's debug output and extracted the bytes of
the TLS connection using a Python script. That wasn't great, and I
think GnuTLS removed that level of debugging in a more current
release.

This change records the connection with Go code and adds a test for
ECDHE-AES clients generating using this method.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5988048
2012-04-11 12:55:57 -04:00
Marcel van Lohuizen
98aa4968b7 exp/norm: exposed runeInfo type in API.
For completeness, we also expose the Canonical Combining Class of a rune.
This does not increase the data size.

R=r
CC=golang-dev
https://golang.org/cl/5931043
2012-04-11 16:47:53 +02:00
Dave Cheney
d8e9b04ca6 runtime: add interface microbenchmarks
2011 Mac Mini, Core i5 @ 2.3Ghz

BenchmarkConvT2E        50000000                40.4 ns/op
BenchmarkConvT2EBig     20000000               107 ns/op
BenchmarkConvT2I        100000000               28.9 ns/op
BenchmarkConvI2E        500000000                5.93 ns/op
BenchmarkConvI2I        100000000               19.0 ns/op
BenchmarkAssertE2T      100000000               14.1 ns/op
BenchmarkAssertE2TBig   100000000               17.8 ns/op
BenchmarkAssertE2I      100000000               21.3 ns/op
BenchmarkAssertI2T      100000000               14.3 ns/op
BenchmarkAssertI2I      100000000               20.8 ns/op
BenchmarkAssertI2E      500000000                5.58 ns/op

Pandaboard, 2 x Omap4 @ 1.2Ghz

BenchmarkConvT2E        10000000               215 ns/op
BenchmarkConvT2EBig      1000000              3697 ns/op
BenchmarkConvT2I         5000000               666 ns/op
BenchmarkConvI2E        50000000                42.4 ns/op
BenchmarkConvI2I         5000000               489 ns/op
BenchmarkAssertE2T      20000000                90.0 ns/op
BenchmarkAssertE2TBig   20000000                91.6 ns/op
BenchmarkAssertE2I       5000000               515 ns/op
BenchmarkAssertI2T      20000000               124 ns/op
BenchmarkAssertI2I       5000000               517 ns/op
BenchmarkAssertI2E      50000000                47.2 ns/op
BenchmarkAssertE2E      50000000                42.7 ns/op

R=minux.ma, rsc, fullung, bsiegert, dsymonds
CC=golang-dev
https://golang.org/cl/5777048
2012-04-11 22:45:44 +10:00
Joel Sing
8cea1bf102 runtime: update openbsd thread related syscalls to match kernel
Update the threxit and thrsleep syscalls to match the ABI of the
OpenBSD 5.1 kernel. These changes are backwards compatible with
older kernels.

Fixes #3311.

R=golang-dev, rsc, devon.odell
CC=golang-dev
https://golang.org/cl/5777079
2012-04-11 22:02:08 +10:00
Shenghou Ma
1a59e6239c 5l, runtime: remove softfloat emulation code when not used
This leads to ~30kB improvement on code size for ARM machines with VFP/NEON.
Example: go test -c math
       GOARM=5  GOARM=6
  Old: 1884200  1839144
  New: 1884165  1805245
  -:        35    33899

R=rsc, bradfitz, dave, kai.backman
CC=golang-dev
https://golang.org/cl/5975060
2012-04-11 04:11:27 +08:00
Pascal S. de Kloe
9feddd0bae hash: more efficient memory allocation
Feed append the complete content at once.

BenchmarkAdler32KB       1000000              2534 ns/op         404.05 MB/s
BenchmarkCrc32KB          500000              4757 ns/op         215.26 MB/s
BenchmarkCrc64KB          500000              4769 ns/op         214.70 MB/s
BenchmarkFnv32KB         1000000              2417 ns/op         423.64 MB/s
BenchmarkFnv32aKB        1000000              2408 ns/op         425.23 MB/s
BenchmarkFnv64KB          500000              4262 ns/op         240.21 MB/s
BenchmarkFnv64aKB         500000              4234 ns/op         241.83 MB/s

R=iant, rsc, r, minux.ma
CC=golang-dev
https://golang.org/cl/5937053
2012-04-10 15:15:39 -04:00
Akshat Kumar
7056ec6bfd runtime: fix floating point exception on Plan 9
Change 5660047 moved an FLDCW instruction
that disables invalid operand traps into
runtime·asminit, which is called from
runtime·mstart. Thus, runtime·check is being
called prior to setting the appropriate control bits,
which on any QNaN comparison will cause Plan 9
to take an invalid operand trap. This change loads
the control bits (for Plan 9) prior to runtime·check.
Ideally, this should be done before the QNaN checks
on any system, but possibly other kernels simply
don't ever trap on invalid operands.

R=golang-dev, rminnich
CC=golang-dev, john, rsc
https://golang.org/cl/5939045
2012-04-10 15:14:10 -04:00
Quan Yong Zhai
e133ee9538 runtime: unregister the SIGILL handler after ARM EABI test
Part of issue 3381

R=rsc, minux.ma, dave
CC=golang-dev
https://golang.org/cl/5969064
2012-04-10 15:05:22 -04:00
Shenghou Ma
ae382129f1 syscall: support Getpid() on Windows
Fixes #3379.

R=golang-dev, alex.brainman, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5909043
2012-04-10 22:34:31 +08:00
Russ Cox
3d462449f6 8a, 8l: add PREFETCH instructions
R=ken2
CC=golang-dev
https://golang.org/cl/5992082
2012-04-10 10:09:27 -04:00
Russ Cox
35d260fa4c 6a, 6l: add PREFETCH instructions
R=ken2
CC=golang-dev
https://golang.org/cl/5989073
2012-04-10 10:09:09 -04:00
Joel Sing
098b9dcf2f runtime: block signals during thread creation on openbsd
Block signals during thread creation, otherwise the new thread can
receive a signal prior to initialisation completing.

Fixes #3102.

R=golang-dev, rsc, devon.odell, minux.ma
CC=golang-dev
https://golang.org/cl/5757064
2012-04-10 21:57:05 +10:00
Alex Brainman
8e109af83b os: fix IsPermission on windows
Fixes #3482.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5987070
2012-04-10 10:07:29 +10:00
Rob Pike
6849c4db0c runtime.Callers: make documentation match code
It is a bug that Caller and Callers disagree about the offset of the skip
parameter. Document the bug.

R=rsc, dsymonds, r, iant
CC=golang-dev
https://golang.org/cl/5976064
2012-04-10 09:47:57 +10:00
Brad Fitzpatrick
494fe3b08f debug/gosym: in test, use temp binary name in /tmp, and clean up.
This fixes all.bash on shared machines.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5992078
2012-04-09 11:19:52 -07:00
Dmitriy Vyukov
342658bbb6 runtime: preparation for parallel GC
make MHeap.allspans an array instead on a linked-list,
it's required for parallel for

benchmark                              old ns/op    new ns/op    delta

garbage.BenchmarkTree                  494435529    487962705   -1.31%
garbage.BenchmarkTree-2                499652705    485358000   -2.86%
garbage.BenchmarkTree-4                468482117    454093117   -3.07%
garbage.BenchmarkTree-8                488533235    471872470   -3.41%
garbage.BenchmarkTree-16               507835176    492558470   -3.01%

garbage.BenchmarkTree2                  31453900     31404300   -0.16%
garbage.BenchmarkTree2-2                21440600     21477000   +0.17%
garbage.BenchmarkTree2-4                10982000     11117400   +1.23%
garbage.BenchmarkTree2-8                 7544700      7456700   -1.17%
garbage.BenchmarkTree2-16                7049500      6805700   -3.46%

garbage.BenchmarkParser               4448988000   4453264000   +0.10%
garbage.BenchmarkParser-2             4086045000   4057948000   -0.69%
garbage.BenchmarkParser-4             3677365000   3661246000   -0.44%
garbage.BenchmarkParser-8             3517253000   3540190000   +0.65%
garbage.BenchmarkParser-16            3506562000   3463478000   -1.23%

garbage.BenchmarkTreePause              20969784     21100238   +0.62%
garbage.BenchmarkTreePause-2            20215875     20139572   -0.38%
garbage.BenchmarkTreePause-4            17240709     16683624   -3.23%
garbage.BenchmarkTreePause-8            18196386     17639306   -3.06%
garbage.BenchmarkTreePause-16           20621158     20215056   -1.97%

garbage.BenchmarkTree2Pause            173992142    173872380   -0.07%
garbage.BenchmarkTree2Pause-2          131281904    131366666   +0.06%
garbage.BenchmarkTree2Pause-4           93484952     95109619   +1.74%
garbage.BenchmarkTree2Pause-8           88950523     86533333   -2.72%
garbage.BenchmarkTree2Pause-16          86071238     84089190   -2.30%

garbage.BenchmarkParserPause           135815000    135255952   -0.41%
garbage.BenchmarkParserPause-2          92691523     91451428   -1.34%
garbage.BenchmarkParserPause-4          53392190     51611904   -3.33%
garbage.BenchmarkParserPause-8          36059523     35116666   -2.61%
garbage.BenchmarkParserPause-16         30174300     27340600   -9.39%

garbage.BenchmarkTreeLastPause          28420000     29142000   +2.54%
garbage.BenchmarkTreeLastPause-2        23514000     26779000  +13.89%
garbage.BenchmarkTreeLastPause-4        21773000     18660000  -14.30%
garbage.BenchmarkTreeLastPause-8        24072000     21276000  -11.62%
garbage.BenchmarkTreeLastPause-16       25149000     28541000  +13.49%

garbage.BenchmarkTree2LastPause        314491000    313982000   -0.16%
garbage.BenchmarkTree2LastPause-2      214363000    214715000   +0.16%
garbage.BenchmarkTree2LastPause-4      109778000    111115000   +1.22%
garbage.BenchmarkTree2LastPause-8       75390000     74522000   -1.15%
garbage.BenchmarkTree2LastPause-16      70333000     67880000   -3.49%

garbage.BenchmarkParserLastPause       327247000    326815000   -0.13%
garbage.BenchmarkParserLastPause-2     217039000    212529000   -2.08%
garbage.BenchmarkParserLastPause-4     119722000    111535000   -6.84%
garbage.BenchmarkParserLastPause-8      70806000     69613000   -1.68%
garbage.BenchmarkParserLastPause-16     62813000     48009000  -23.57%

R=rsc, r
CC=golang-dev
https://golang.org/cl/5992055
2012-04-09 13:05:43 +04:00
Dmitriy Vyukov
f09e63a2a0 runtime: add memory prefetching to GC
benchmark                              old ns/op    new ns/op    delta

garbage.BenchmarkParser               4448988000   4370531000   -1.76%
garbage.BenchmarkParser-2             4086045000   4023083000   -1.54%
garbage.BenchmarkParser-4             3677365000   3667020000   -0.28%
garbage.BenchmarkParser-8             3517253000   3543946000   +0.76%
garbage.BenchmarkParser-16            3506562000   3512518000   +0.17%

garbage.BenchmarkTree                  494435529    505784058   +2.30%
garbage.BenchmarkTree-2                499652705    502774823   +0.62%
garbage.BenchmarkTree-4                468482117    465713352   -0.59%
garbage.BenchmarkTree-8                488533235    482287000   -1.28%
garbage.BenchmarkTree-16               507835176    500654882   -1.41%

garbage.BenchmarkTree2                  31453900     28804600   -8.42%
garbage.BenchmarkTree2-2                21440600     19065800  -11.08%
garbage.BenchmarkTree2-4                10982000     10009100   -8.86%
garbage.BenchmarkTree2-8                 7544700      6479800  -14.11%
garbage.BenchmarkTree2-16                7049500      6163200  -12.57%

garbage.BenchmarkParserPause           135815000    125360666   -7.70%
garbage.BenchmarkParserPause-2          92691523     84365476   -8.98%
garbage.BenchmarkParserPause-4          53392190     46995809  -11.98%
garbage.BenchmarkParserPause-8          36059523     30998900  -14.03%
garbage.BenchmarkParserPause-16         30174300     27613350   -8.49%

garbage.BenchmarkTreePause              20969784     22568102   +7.62%
garbage.BenchmarkTreePause-2            20215875     20975130   +3.76%
garbage.BenchmarkTreePause-4            17240709     17180666   -0.35%
garbage.BenchmarkTreePause-8            18196386     18205870   +0.05%
garbage.BenchmarkTreePause-16           20621158     20486867   -0.65%

garbage.BenchmarkTree2Pause            173992142    159995285   -8.04%
garbage.BenchmarkTree2Pause-2          131281904    118013714  -10.11%
garbage.BenchmarkTree2Pause-4           93484952     85092666   -8.98%
garbage.BenchmarkTree2Pause-8           88950523     77340809  -13.05%
garbage.BenchmarkTree2Pause-16          86071238     76557952  -11.05%

garbage.BenchmarkParserLastPause       327247000    288205000  -11.93%
garbage.BenchmarkParserLastPause-2     217039000    187336000  -13.69%
garbage.BenchmarkParserLastPause-4     119722000    105069000  -12.24%
garbage.BenchmarkParserLastPause-8      70806000     64755000   -8.55%
garbage.BenchmarkParserLastPause-16     62813000     53486000  -14.85%

garbage.BenchmarkTreeLastPause          28420000     29735000   +4.63%
garbage.BenchmarkTreeLastPause-2        23514000     25427000   +8.14%
garbage.BenchmarkTreeLastPause-4        21773000     19548000  -10.22%
garbage.BenchmarkTreeLastPause-8        24072000     24046000   -0.11%
garbage.BenchmarkTreeLastPause-16       25149000     25291000   +0.56%

garbage.BenchmarkTree2LastPause        314491000    287988000   -8.43%
garbage.BenchmarkTree2LastPause-2      214363000    190616000  -11.08%
garbage.BenchmarkTree2LastPause-4      109778000    100052000   -8.86%
garbage.BenchmarkTree2LastPause-8       75390000     64753000  -14.11%
garbage.BenchmarkTree2LastPause-16      70333000     61484000  -12.58%

FTR, below are result with the empty prefetch function,
that is, single RET but no real prefetching.
It suggests that inlinable PREFETCH is worth pursuing.

benchmark                              old ns/op    new ns/op    delta

garbage.BenchmarkParser               4448988000   4560488000   +2.51%
garbage.BenchmarkParser-2             4086045000   4129728000   +1.07%
garbage.BenchmarkParser-4             3677365000   3728672000   +1.40%
garbage.BenchmarkParser-8             3517253000   3583968000   +1.90%
garbage.BenchmarkParser-16            3506562000   3591414000   +2.42%

garbage.BenchmarkTree                  494435529    499580882   +1.04%
garbage.BenchmarkTree-4                468482117    467387294   -0.23%
garbage.BenchmarkTree-8                488533235    478311117   -2.09%
garbage.BenchmarkTree-2                499652705    499324235   -0.07%
garbage.BenchmarkTree-16               507835176    502005705   -1.15%

garbage.BenchmarkTree2                  31453900     33296800   +5.86%
garbage.BenchmarkTree2-2                21440600     22466400   +4.78%
garbage.BenchmarkTree2-4                10982000     11402700   +3.83%
garbage.BenchmarkTree2-8                 7544700      7476500   -0.90%
garbage.BenchmarkTree2-16                7049500      7338200   +4.10%

garbage.BenchmarkParserPause           135815000    139529142   +2.73%
garbage.BenchmarkParserPause-2          92691523     95229190   +2.74%
garbage.BenchmarkParserPause-4          53392190     53083476   -0.58%
garbage.BenchmarkParserPause-8          36059523     34594800   -4.06%
garbage.BenchmarkParserPause-16         30174300     30063300   -0.37%

garbage.BenchmarkTreePause              20969784     21866920   +4.28%
garbage.BenchmarkTreePause-2            20215875     20731125   +2.55%
garbage.BenchmarkTreePause-4            17240709     17275837   +0.20%
garbage.BenchmarkTreePause-8            18196386     17898777   -1.64%
garbage.BenchmarkTreePause-16           20621158     20662772   +0.20%

garbage.BenchmarkTree2Pause            173992142    184336857   +5.95%
garbage.BenchmarkTree2Pause-2          131281904    138005714   +5.12%
garbage.BenchmarkTree2Pause-4           93484952     98449238   +5.31%
garbage.BenchmarkTree2Pause-8           88950523     89286095   +0.38%
garbage.BenchmarkTree2Pause-16          86071238     89568666   +4.06%

garbage.BenchmarkParserLastPause       327247000    342189000   +4.57%
garbage.BenchmarkParserLastPause-2     217039000    217224000   +0.09%
garbage.BenchmarkParserLastPause-4     119722000    121327000   +1.34%
garbage.BenchmarkParserLastPause-8      70806000     71941000   +1.60%
garbage.BenchmarkParserLastPause-16     62813000     60166000   -4.21%

garbage.BenchmarkTreeLastPause          28420000     27840000   -2.04%
garbage.BenchmarkTreeLastPause-2        23514000     27390000  +16.48%
garbage.BenchmarkTreeLastPause-4        21773000     21414000   -1.65%
garbage.BenchmarkTreeLastPause-8        24072000     21705000   -9.83%
garbage.BenchmarkTreeLastPause-16       25149000     23932000   -4.84%

garbage.BenchmarkTree2LastPause        314491000    332894000   +5.85%
garbage.BenchmarkTree2LastPause-2      214363000    224611000   +4.78%
garbage.BenchmarkTree2LastPause-4      109778000    113976000   +3.82%
garbage.BenchmarkTree2LastPause-8       75390000     67223000  -10.83%
garbage.BenchmarkTree2LastPause-16      70333000     73216000   +4.10%

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5991057
2012-04-07 17:02:44 +04:00
Bobby Powers
c9529e02c1 time: in Format give buffer an initial capacity
I have a small web server that simply sets several cookies
along with an expires header, and then returns.  In the
cpuprofile for a 200k request benchmark, time.Time.Format()
was showing up as 8.3% of cpu usage.  Giving the buffer an
inital capacity to avoid reallocs on append drops it down to
7.6%.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5992058
2012-04-07 10:51:32 +10:00
Charles L. Dorian
f27348776f math: make function documentation more regular
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5994043
2012-04-06 14:01:12 -04:00
Benny Siegert
559c191b89 syscall: manually fix z* for NetBSD/amd64
Building go currently fails on NetBSD, thus the regeneration
scripts do not run correctly. With these changes, at least
the go_bootstrap tool builds correctly.

R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/5695064
2012-04-06 07:57:05 -07:00
Shenghou Ma
cf1f044251 crypto/aes: add benchmarks for decryption and key expansion
R=agl, rsc, fullung
CC=golang-dev
https://golang.org/cl/5972056
2012-04-06 04:19:35 +08:00
Stéphane Travostino
56024fa64e net/url: Correctly escape URL as per RFC 3986
The shouldEscape function did not correctly escape the reserved characters listed in RFC 3986 §2.2, breaking some strict web servers.
Fixes #3433.

R=rsc
CC=golang-dev
https://golang.org/cl/5970050
2012-04-05 13:23:08 -04:00
Dmitriy Vyukov
9903d6870f runtime: minor refactoring in preparation for parallel GC
factor sweepspan() out of sweep(), no logical changes

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5991047
2012-04-05 21:02:20 +04:00
Dmitriy Vyukov
d839a809b2 runtime: make GC stats per-M
This is factored out part of:
https://golang.org/cl/5279048/
(Parallel GC)

benchmark                             old ns/op    new ns/op    delta
garbage.BenchmarkParser              3999106750   3975026500   -0.60%
garbage.BenchmarkParser-2            3720553750   3719196500   -0.04%
garbage.BenchmarkParser-4            3502857000   3474980500   -0.80%
garbage.BenchmarkParser-8            3375448000   3341310500   -1.01%
garbage.BenchmarkParserLastPause      329401000    324097000   -1.61%
garbage.BenchmarkParserLastPause-2    208953000    214222000   +2.52%
garbage.BenchmarkParserLastPause-4    110933000    111656000   +0.65%
garbage.BenchmarkParserLastPause-8     71969000     78230000   +8.70%
garbage.BenchmarkParserPause          230808842    197237400  -14.55%
garbage.BenchmarkParserPause-2        123674365    125197595   +1.23%
garbage.BenchmarkParserPause-4         80518525     85710333   +6.45%
garbage.BenchmarkParserPause-8         58310243     56940512   -2.35%
garbage.BenchmarkTree2                 31471700     31289400   -0.58%
garbage.BenchmarkTree2-2               21536800     21086300   -2.09%
garbage.BenchmarkTree2-4               11074700     10880000   -1.76%
garbage.BenchmarkTree2-8                7568600      7351400   -2.87%
garbage.BenchmarkTree2LastPause       314664000    312840000   -0.58%
garbage.BenchmarkTree2LastPause-2     215319000    210815000   -2.09%
garbage.BenchmarkTree2LastPause-4     110698000    108751000   -1.76%
garbage.BenchmarkTree2LastPause-8      75635000     73463000   -2.87%
garbage.BenchmarkTree2Pause           174280857    173147571   -0.65%
garbage.BenchmarkTree2Pause-2         131332714    129665761   -1.27%
garbage.BenchmarkTree2Pause-4          93803095     93422904   -0.41%
garbage.BenchmarkTree2Pause-8          86242333     85146761   -1.27%

R=rsc
CC=golang-dev
https://golang.org/cl/5987045
2012-04-05 20:48:28 +04:00
Dmitriy Vyukov
fd04f05f2f runtime: replace XOR AX, AX with MOV $0, AX
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5985048
2012-04-05 18:59:50 +04:00
Dmitriy Vyukov
4667571619 runtime: add 64-bit atomics
This is factored out part of:
https://golang.org/cl/5279048/
(Parallel GC)

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5985047
2012-04-05 18:47:43 +04:00
Dmitriy Vyukov
a28a10e1a2 runtime: remove redundant code
R=rsc
CC=golang-dev
https://golang.org/cl/5987046
2012-04-05 18:37:46 +04:00
Alex Brainman
4b943bded8 path/filepath: move out of temp directory before deleting it in TestAbs
Fixes #3476.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5986045
2012-04-05 15:17:24 +10:00
Ian Lance Taylor
35bc9d17df syscall, net: use native endianness for Linux netlink messages
Tested using 6g and gccgo on x86_64 GNU/Linux and using gccgo
on PowerPC GNU/Linux (which is big-endian).

R=golang-dev, bradfitz, mikioh.mikioh, iant
CC=golang-dev
https://golang.org/cl/5975073
2012-04-04 17:41:36 -07:00
Adam Langley
22690e6621 crypto/rsa: only enforce that de ≡ 1 mod |(ℤ/nℤ)*| in order to load private keys generated by GnuTLS.
Previously we checked that de ≡ 1 mod φ(n). Since φ(n) is a multiple
of |(ℤ/nℤ)*|, this encompassed the new check, but it was too strict as
keys generated by GnuTLS would be rejected when gcd(p-1,q-1)≠1.

(Also updated the error strings in crypto/rsa to contain the package name, which some were missing.)

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5867043
2012-04-04 12:53:59 -04:00
Dmitry Chestnykh
ac51c1384a encoding/ascii85: fix panic caused by special case
Special case for encoding 4 zeros as 'z' didn't
update source slice, causing 'index out of bounds'
panic in destination slice.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5970078
2012-04-04 09:52:42 -04:00
Charles L. Dorian
5496e94187 math: update Gamma special cases
Match new C99 values for special cases.

Fixes #2977.

R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5972058
2012-04-04 09:45:22 -04:00
Michael Lewis
86092b3d45 sql: Propagate error from subsetTypeArgs in Exec
Fixes #3449

R=golang-dev
CC=bradfitz, golang-dev
https://golang.org/cl/5970076
2012-04-03 15:36:48 -07:00
Rob Pike
7a33265ccd time.RFC822: make the string standard-compliant
For mysterious reasons, the existing string was just wrong: it was missing a colon.
There is no apparent reason for this discrepancy.

This should be safe to fix because existing uses would not be RFC822-compliant;
people cannot be depending on it to generate correct mail headers.

Fixes #3444.

R=golang-dev, dsymonds, iant, rsc
CC=golang-dev
https://golang.org/cl/5969072
2012-04-04 06:54:39 +10:00
Dave Cheney
951a97e42f encoding/base64: fix panic when input len is not a multiple of 4
Fixes #3442.

R=for.go.yong, dsymonds, sougou, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/5975052
2012-04-03 12:14:02 +10:00
Rob Pike
065db4ea99 text/template: pipelined arg was not typechecked
Without this fix, an erroneous template causes a panic; should be caught safely.
The bug did not affect correct templates.

Fixes #3267.

R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5900065
2012-04-03 11:44:52 +10:00
Alex Brainman
d3c92b7c90 time: fix handling of locations with no dst on windows
Fixes #3437.

R=rsc
CC=golang-dev
https://golang.org/cl/5967063
2012-04-03 11:39:38 +10:00
Benny Siegert
512aeb305e exp/utf8string: Correct package name in error messages
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5969051
2012-04-02 12:06:05 -04:00
Maxim Pimenov
6727a2ad78 runtime: fix a comment
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5975043
2012-04-02 11:27:50 -04:00
David Symonds
dc640ebd1a exp/terminal: delete.
This is now known as code.google.com/p/go.crypto/ssh/terminal.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5970044
2012-03-30 15:27:39 +11:00
Francisco Souza
18f1a71dc2 doc: added The Go image package article
Orignally published on The Go Programming Language, September 21, 2011.

http://blog.golang.org/2011/09/go-image-package.html

Update #2547

R=adg, nigeltao
CC=golang-dev
https://golang.org/cl/5933049
2012-03-28 14:20:51 +11:00
Alex Brainman
48a2c50a18 path/filepath: correct comment in EvalSymlinks
R=golang-dev, r
CC=golang-dev, hcwfrichter
https://golang.org/cl/5934046
2012-03-28 12:27:36 +11:00
Russ Cox
5eb007dede runtime: work around false negative in deadlock detection
Not a complete fix for issue 3342, but fixes the trivial case.
There may still be a race in the instants before and after
a scavenger-induced garbage collection.

Intended to be "obviously safe": a call to runtime·gosched
before main.main is no different than a call to runtime.Gosched
at the beginning of main.main, and it is (or had better be)
safe to call runtime.Gosched at any point during main.

Update #3342.

R=iant
CC=golang-dev
https://golang.org/cl/5919052
2012-03-27 12:22:19 -04:00
Russ Cox
671862747e go/build: fix import check
When we find a package in DIR/src/foo, we only let it
be known as foo if there is no other foo in an earlier
GOPATH directory or the GOROOT directory.
The GOROOT check was looking in GOROOT/src/foo
instead of GOROOT/src/pkg/foo, which meant that
the import paths "lib9", "libbio", "libmach", and so
on were unavailable, and the import paths "math",
"errors", and so on were available.  Correct this.

Fixes #3390.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/5927050
2012-03-27 11:16:10 -04:00
Alex Brainman
7a39654174 path/filepath: use windows GetShortPathName api to force GetLongPathName to do its work
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5928043
2012-03-27 15:53:08 +11:00
Devon H. O'Dell
a63c37b91e net: ignore ECONNABORTED from syscall.Accept
Fixes #3395.

R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5905063
2012-03-27 00:06:14 -04:00
Mikio Hara
4c2614c57c undo CL 5844051 / 5d0322034aa8
Breaks closure test when GOMAXPROCS=2 or more.

««« original CL description
runtime: restore deadlock detection in the simplest case.

Fixes #3342.

R=iant, r, dave, rsc
CC=golang-dev, remy
https://golang.org/cl/5844051

»»»

R=rsc
CC=golang-dev
https://golang.org/cl/5924045
2012-03-27 13:05:17 +09:00
Rémy Oudompheng
84bb2547fb runtime: restore deadlock detection in the simplest case.
Fixes #3342.

R=iant, r, dave, rsc
CC=golang-dev, remy
https://golang.org/cl/5844051
2012-03-26 23:06:20 -04:00
Alex Brainman
cf13bd3fab path/filepath: convert drive letter to upper case in windows EvalSymlinks
Fixes #3347.

R=golang-dev, aram, r, rsc
CC=golang-dev
https://golang.org/cl/5918043
2012-03-27 12:56:56 +11:00
Robert Griesemer
5390722100 exp/types: generalized GCImporter API.
- Renamed ExportData -> FindGcExportData
  and base it on an a bufio.Reader rather
  than a filename so it can be used in
  environments where object files are
  stored elsewhere.

- Factor former GcImporter into GcImportData
  and GcImport. Implementations with different
  storage locations for object files can build
  a customized GcImport using GcImportData.

This is pkg/exp only - no impact on Go 1.

R=golang-dev, lvd, rsc
CC=golang-dev
https://golang.org/cl/5574069
2012-03-26 11:26:05 -07:00
Shenghou Ma
d1f6e27880 go/build: cgoEnabled is not known to cmd/dist anymore
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5901051
2012-03-26 10:00:06 +08:00
Stefan Nilsson
2dfcbd0a3b os: add missing byte to FileMode buffer
32 bytes is enough for all FileMode bits.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5853044
2012-03-24 08:16:57 +11:00
Robert Griesemer
43ad726f34 text/template: fix typo in package comment
Fixes #3383.

R=iant, bradfitz
CC=golang-dev
https://golang.org/cl/5891045
2012-03-23 11:31:29 -07:00
Adam Langley
1d8ec87135 crypto/tls: don't select ECC ciphersuites with no mutual curve.
The existing code that tried to prevent ECC ciphersuites from being
selected when there were no mutual curves still left |suite| set.
This lead to a panic on a nil pointer when there were no acceptable
ciphersuites at all.

Thanks to George Kadianakis for pointing it out.

R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/5857043
2012-03-23 10:48:51 -04:00
Alex Brainman
f39ff80bea path/filepath: windows drive letter cannot be a digit
R=golang-dev, r
CC=golang-dev, mattn.jp
https://golang.org/cl/5885056
2012-03-23 15:57:19 +11:00
Stefan Nilsson
08959defa8 sort: add time complexity to doc
Let's tell the world that Go's sort is O(n log n).
Surely this is a feature we intend to keep.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5867045
2012-03-22 09:27:02 -07:00
Francisco Souza
289a357104 doc: add JSON and Go article
Originally published on The Go Programming Language Blog, January 25, 2011.

http://blog.golang.org/2011/01/json-and-go.html

R=adg
CC=golang-dev
https://golang.org/cl/5846044
2012-03-22 18:25:40 +11:00
Rob Pike
07e887f433 flag: add examples
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5867049
2012-03-22 11:15:43 +11:00
Robert Griesemer
f5f80368c4 exp/norm/normalize.go: fix typo
R=golang-dev, r, dsymonds
CC=golang-dev
https://golang.org/cl/5874045
2012-03-21 14:55:05 -07:00
Shenghou Ma
7186e56573 go/build: clarify why we exclude files starting with '_' or '.'
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5864053
2012-03-22 03:18:47 +08:00
David Symonds
4a59be0091 html/template: fix typo and make grammar consistent in comments.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5866044
2012-03-21 10:10:44 +11:00
Stefan Nilsson
c5488d4f00 sort: fix computation of maxDepth to avoid infinite loop
The current computation loops indefinitely if n > 1<<30 (for 32-bit ints).

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5848067
2012-03-20 14:23:12 -07:00
Brad Fitzpatrick
65dc7dc90b sort: document two undocumented functions
They looked out of place in godoc.
Includes documenting sort stability.

Fixes #3356

R=golang-dev, gri, trolleriprofessorn
CC=golang-dev
https://golang.org/cl/5855044
2012-03-20 11:40:41 -07:00
Shenghou Ma
4b1933dfb2 runtime: remove unused goc2c.c
Its functionality has been moved into cmd/dist.

R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/5843062
2012-03-21 00:49:45 +08:00
Rob Pike
49be7f7d0d html/template: add Templates and *Escape functions
to bring it in line with text/template's interface.
Fixes #3296.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5843066
2012-03-20 14:38:07 +11:00
Alex Brainman
7fbef930a6 build: do more during windows build
- use GO_GCFLAGS and GO_LDFLAGS if supplied
- build misc\dashboard\builder and misc\goplay
- run tests in test\bench\go1
- check api compatibility

R=golang-dev, r, kardianos, bradfitz
CC=golang-dev
https://golang.org/cl/5847063
2012-03-20 14:04:20 +11:00
Mikio Hara
7905faaee2 net: drop unnecessary type assertions and fix leak in test
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5847064
2012-03-20 10:57:54 +09:00
Adam Langley
aa1d4170a4 crypto/tls: always send a Certificate message if one was requested.
If a CertificateRequest is received we have to reply with a
Certificate message, even if we don't have a certificate to offer.

Fixes #3339.

R=golang-dev, r, ality
CC=golang-dev
https://golang.org/cl/5845067
2012-03-19 12:34:35 -04:00
Alex Brainman
2ef4a84022 path/filepath: implement Match and Glob on windows
As discussed on golang-dev, windows will use
"\" as path separator. No escaping allowed.

R=golang-dev, r, mattn.jp, rsc, rogpeppe, bsiegert, r
CC=golang-dev
https://golang.org/cl/5825044
2012-03-19 16:51:06 +11:00
Rob Pike
1f6fc949f6 sysycall: remove creds_linux_test.go
It is unprecedented to add tests to package syscall, especially
system-specific ones. Not a policy worth changing right before Go 1
is cut.

The sole existing test, passfd_test.go, contains the line
        // +build linux darwin probablyfreebsd probablyopenbsd
which argues that this is not a subject to be undertaking likely.
Note that passfd_test.go also went in just now. It's the only test
in syscall.

Deleting for now, will reconsider after Go 1.

R=golang-dev, bradfitz, r, dsymonds
CC=golang-dev
https://golang.org/cl/5846063
2012-03-19 11:15:28 +11:00
Rob Pike
4161dfc4fe syscall: delete passfd_test.go
We can revisit the issue of testing in syscall after Go 1.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5844057
2012-03-19 11:12:32 +11:00
Albert Strasheim
6a0544091e syscall: Test SCM_CREDENTIALS, SO_PASSCRED on Linux.
R=bradfitz, iant
CC=golang-dev
https://golang.org/cl/5846059
2012-03-18 10:03:00 -07:00
Brad Fitzpatrick
c97cf055d9 syscall: add a test for passing an fd over a unix socket
Updates #1101

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5849057
2012-03-17 22:19:57 -07:00
Rob Pike
883a96d950 spec: delete references to unsafe.Reflect,Typeof,Unreflect
They have been deleted from package unsafe.
Also delete their appearance in exp/types.

Fixes #3338.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5847056
2012-03-17 22:50:59 +11:00
David Symonds
11cc5a26d5 reflect: panic if MakeSlice is given bad len/cap arguments.
Fixes #3330.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5847043
2012-03-16 17:28:16 +11:00
Russ Cox
2e4a035995 runtime: do not handle signals before configuring handler
There was a small window during program initialization
where a signal could come in before the handling mechanisms
were set up to handle it.  Delay the signal-handler installation
until we're ready for the signals.

Fixes #3314.

R=golang-dev, dsymonds, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5833049
2012-03-15 22:17:54 -04:00
Russ Cox
bd6404a4cc runtime: fix arm build
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5832047
2012-03-15 17:40:17 -04:00
Francisco Souza
9e03dcb3fa doc: add Gobs of data article
Originally published on The Go Programming Language Blog, March 24, 2011.

http://blog.golang.org/2011/03/gobs-of-data.html

R=adg
CC=golang-dev
https://golang.org/cl/5834043
2012-03-16 08:21:13 +11:00
Russ Cox
2ed7087c8d reflect: document PkgPath, Method, StructField
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5824053
2012-03-15 17:15:57 -04:00
Russ Cox
9e5db8c90a 5l, 6l, 8l: fix stack split logic for stacks near default segment size
Fixes #3310.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5823051
2012-03-15 15:22:30 -04:00
Russ Cox
b7b3652414 os: do not assume syscall.Write will write everything
Fixes #3323.

R=golang-dev, remyoudompheng, gri
CC=golang-dev
https://golang.org/cl/5837047
2012-03-15 15:10:19 -04:00
Russ Cox
20760e4335 go/build: do not report Target for local imports
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5820064
2012-03-15 15:08:57 -04:00
Brad Fitzpatrick
a4e6197b91 net/http: couple more triv.go modernizations
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5834049
2012-03-15 10:06:25 -07:00
Alex Brainman
4b872d61fe os: return some invented data from Stat(DevNull) on windows
Fixes #3321.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5831043
2012-03-15 16:33:45 +11:00
Robert Hencke
1c224ab9dd net/http: ensure triv.go compiles and runs
R=golang-dev, bradfitz, dsymonds, dave, r
CC=golang-dev
https://golang.org/cl/5795069
2012-03-14 20:25:57 -07:00
Brad Fitzpatrick
c959ebe4d8 archive/zip: move r.zip off disk, into reader_test.go
Makes certain virus scanners happier.

R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/5823053
2012-03-14 14:41:06 -07:00
Robert Griesemer
036731c170 go/build: clearer argument name for Import (src -> srcDir)
R=rsc
CC=golang-dev
https://golang.org/cl/5820052
2012-03-14 13:19:14 -07:00
Russ Cox
70e58a2f9b io/ioutil: fix crash when Stat fails
Fixes #3320.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5824051
2012-03-14 14:47:13 -04:00
Shenghou Ma
b2a9079e54 runtime: manage stack by ourselves for badcallback on windows/amd64
This function uses 48-byte of precious non-split stack for every callback
function, and without this CL, it can easily overflow the non-split stack.
I encountered this when trying to enable misc/cgo/test on windows/amd64.

R=rsc
CC=golang-dev
https://golang.org/cl/5784075
2012-03-15 02:24:49 +08:00
Shenghou Ma
24ed667b33 os: IsNotExist() should also consider ERROR_PATH_NOT_FOUND on Windows
Also update documentation about IsExist() and IsNotExist(), they are not
    about files only.

R=rsc
CC=golang-dev
https://golang.org/cl/5794073
2012-03-14 23:54:40 +08:00
Rob Pike
214a1ca3c5 html/template: fix nil pointer bug
Fixes #3272.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5819046
2012-03-14 15:08:54 +11:00
Mikio Hara
9eeb90945e runtime/cgo: linux signal masking
Fixes #3314.
Fixes #3101 (again).

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5820047
2012-03-14 13:07:25 +09:00
Mikio Hara
1fc9a17c7e runtime/cgo: darwin signal masking
Fixes #3101 (again).

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5825043
2012-03-14 12:49:59 +09:00
Robert Griesemer
d724631a53 all: various typos
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5820045
2012-03-13 17:29:07 -07:00
Johan Euphrosine
fef92cbbac doc: add Go image/draw package article and convert code snippets to Go1.
Originally published on The Go Programming Language Blog, September 29, 2011.

http://blog.golang.org/2011/09/go-imagedraw-package.html

Update #2547.

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/5755057
2012-03-14 11:27:41 +11:00
Brad Fitzpatrick
5f32c8b88b html/template: fix panic on Clone
Fixes #3281

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5819044
2012-03-13 16:55:43 -07:00
Rob Pike
d6ad6f0e61 text/template: variables do not take arguments
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5821044
2012-03-14 10:46:21 +11:00
Robert Griesemer
b5021f3fe0 go/printer, gofmt: fix multi-line logic
A node spans multiple lines if the line difference
between start and end point is > 0 (rather than > 1).
Fixes some odd cases introduced by CL 5706055;
pointed out by dsymonds.

Added corresponding test case. The other change
in the .golden file reverts to the status before
the CL mentioned above and is correct.

gofmt -w src misc changes godoc.go back to where
it was before the CL mentioned above.

Fixes #3304.

R=dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5820044
2012-03-13 16:15:58 -07:00
Shenghou Ma
62bb39e2ba fmt: remove dead code
Also fix a typo in comment.

R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5808043
2012-03-14 04:59:17 +08:00
Rob Pike
8170d81f4f text/template: fix a couple of parse bugs around identifiers.
1) Poor error checking in variable declarations admitted
$x=2 or even $x%2.
2) Need white space or suitable termination character
after identifiers, so $x+2 doesn't parse, in case we want it
to mean something one day.
Number 2 in particular prevents mistakes that we will have
to honor later and so is necessary for Go 1.

Fixes #3270.
Fixes #3271.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5795073
2012-03-14 07:03:11 +11:00
Maxim Pimenov
5361712ab4 go/build: fix match
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5801043
2012-03-13 10:00:43 -04:00
Shenghou Ma
4ca59a010e os: remove document duplication in error predicate functions
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5783092
2012-03-13 13:48:07 +08:00
Alex Brainman
16ade99d9d runtime: fix windows/amd64 exception handler
R=golang-dev, rsc
CC=golang-dev, hectorchu
https://golang.org/cl/5797077
2012-03-12 22:42:55 -04:00
Shenghou Ma
0238cec021 os, syscall: windows really isn't posix compliant, fix os.IsExist()
R=golang-dev, rsc, bradfitz, alex.brainman
CC=golang-dev
https://golang.org/cl/5754083
2012-03-13 12:50:04 +11:00
Fazlul Shahriar
c7cca2756e os/exec: fix typo in documentation
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5797073
2012-03-12 14:08:00 -07:00
Russ Cox
2d3cc97c9c runtime: fix windows/amd64
Maybe.

TBR=bradfitz
CC=golang-dev
https://golang.org/cl/5754091
2012-03-12 16:48:16 -04:00
Russ Cox
0af08d8253 log: fix doc comment for Ldate
Fixes #3303.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5795062
2012-03-12 16:29:33 -04:00
Brad Fitzpatrick
4edd53e47b os: document FileInfo.Size as system-dependent for irregular files
R=rsc, r
CC=golang-dev
https://golang.org/cl/5795059
2012-03-12 13:17:48 -07:00
Russ Cox
b23691148f runtime: print error on receipt of signal on non-Go thread
It's the best we can do before Go 1.

For issue 3250; not a fix but at least less mysterious.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5797068
2012-03-12 15:55:18 -04:00
Russ Cox
4084f08401 html/template: doc nit
Execute's data is untrusted regardless of package.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5797062
2012-03-12 14:26:10 -04:00
Brad Fitzpatrick
e8deb3f828 net/http: return appropriate errors from ReadRequest
Fixes #3298

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5783080
2012-03-12 10:42:25 -07:00
David Symonds
d75abb7ca3 archive/tar: catch short writes.
Also make error messages consistent throughout.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5777064
2012-03-12 17:33:35 +11:00
Robert Hencke
663a7716a1 crypto/tls, fmt: print fixes
R=golang-dev, bradfitz, minux.ma, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5787069
2012-03-12 12:04:45 +09:00
Gwenael Treguier
c3954dd5da database/sql: ensure Stmts are correctly closed.
To make sure that there is no resource leak,
I suggest to fix the 'fakedb' driver such as it fails when any
Stmt is not closed.
First, add a check in fakeConn.Close().
Then, fix all missing Stmt.Close()/Rows.Close().
I am not sure that the strategy choose in fakeConn.Prepare/prepare* is ok.
The weak point in this patch is the change in Tx.Query:
  - Tests pass without this change,
  - I found it by manually analyzing the code,
  - I just try to make Tx.Query look like DB.Query.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5759050
2012-03-10 15:21:44 -08:00
Brad Fitzpatrick
3297fc63d6 database/sql: fix double connection free on Stmt.Query error
In a transaction, on a Stmt.Query error, it was possible for a
connection to be added to a db's freelist twice. Should use
the local releaseConn function instead.

Thanks to Gwenael Treguier for the failing test.

Also in this CL: propagate driver errors through releaseConn
into *DB.putConn, which conditionally ignores the freelist
addition if the driver signaled ErrBadConn, introduced in a
previous CL.

R=golang-dev, gary.burd
CC=golang-dev
https://golang.org/cl/5798049
2012-03-10 10:00:02 -08:00
David Symonds
81a38fbb77 net/mail: close minor TODO that was waiting on a 6g bug fix.
R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5796050
2012-03-10 19:02:52 +11:00
Brad Fitzpatrick
b2e9f425b9 net/http: fix crash with Transport.CloseIdleConnections
Thanks Michael Lore for the bug report!

Fixes #3266

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5754068
2012-03-09 16:27:32 -08:00
Brad Fitzpatrick
98cfe6770d archive/zip: verify CRC32s in non-streamed files
We should check the CRC32s of files on EOF, even if there's no
data descriptor (in streamed files), as long as there's a non-zero
CRC32 in the file header / TOC.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5794045
2012-03-09 14:45:40 -08:00
Alex Brainman
9fffe45c65 crypto/x509: do not forget to free cert context
R=golang-dev, krautz, rsc
CC=golang-dev
https://golang.org/cl/5783059
2012-03-10 09:35:56 +11:00
Brad Fitzpatrick
3cea4131df archive/zip: write data descriptor signature for OS X; fix bugs reading it
We now always write the "optional" streaming data descriptor
signature, which turns out to be required for OS X.

Also, handle reading the data descriptor with or without the
signature, per the spec's recommendation. Fix data descriptor
reading bugs found in the process.

Fixes #3252

R=golang-dev, alex.brainman, nigeltao, rsc
CC=golang-dev
https://golang.org/cl/5787062
2012-03-09 14:12:02 -08:00
Robert Griesemer
ece0d0e7d2 go/printer: example for Fprint
R=golang-dev, dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5785057
2012-03-09 13:53:25 -08:00
Robert Griesemer
49d2d98697 go/printer, gofmt: nicer formatting of multi-line returns
This affects corner (test) cases only; gofmt -w src misc
doesn't cause any changes.

- added additional test cases
- removed doIndent parameter from printer.valueSpec
  (was always false)
- gofmt -w src misc causes no changes

Fixes #1207.

R=dsymonds, rsc
CC=golang-dev
https://golang.org/cl/5786060
2012-03-09 11:05:50 -08:00
Russ Cox
c9e5600f7d runtime: move runtime.write back to C
It may have to switch stacks, since we are calling
a DLL instead of a system call.

badcallback says where it is, because it is being called
on a Windows stack already.

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/5782060
2012-03-09 00:10:34 -05:00
Mikio Hara
26fa1c8248 net: fix typo
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5782063
2012-03-09 11:50:38 +09:00
Russ Cox
6a19ae74d4 go/build: add NoGoError
R=dsymonds
CC=golang-dev
https://golang.org/cl/5781063
2012-03-08 17:30:45 -05:00
Russ Cox
8a1b3d5a57 runtime: fix windows build
Implement runtime·write, like on the other systems,
and also runtime·badcallback, in assembly to reduce
stack footprint.

TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5785055
2012-03-08 15:53:11 -05:00
Russ Cox
36aa7d4d14 runtime: inline calls to notok
When a very low-level system call that should never fail
does fail, we call notok, which crashes the program.
Often, we are then left with only the program counter as
information about the crash, and it is in notok.
Instead, inline calls to notok (it is just one instruction
on most systems) so that the program counter will
tell us which system call is unhappy.

R=golang-dev, gri, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/5792048
2012-03-08 14:03:56 -05:00
Robert Griesemer
56cae1c230 all: gofmt -w -s src misc
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5781058
2012-03-08 10:48:51 -08:00
Brad Fitzpatrick
9fb68a9a0a database/sql{,driver}: add ErrBadConn
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5785043
2012-03-08 10:09:52 -08:00
Russ Cox
9b73238daa cgo, runtime: diagnose callback on non-Go thread
Before:
$ go run x.go
signal 11 (core dumped)
$

After:
$ go run x.go
runtime: cgo callback on thread not created by Go.
signal 11 (core dumped)
$

For issue 3068.
Not a fix, but as much of a fix as we can do before Go 1.

R=golang-dev, rogpeppe, gri
CC=golang-dev
https://golang.org/cl/5781047
2012-03-08 12:12:40 -05:00
Robert Griesemer
9b7b574edc go/parser: use test harness for short tests
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5782044
2012-03-08 08:53:31 -08:00
Mikkel Krautz
3133b14b30 crypto/x509: allow server gated crypto in windows systemVerify
Also factors out some code into functions to make
systemVerify easier to read.

R=rsc, agl
CC=golang-dev
https://golang.org/cl/5781054
2012-03-08 11:28:04 -05:00
Russ Cox
e38c5fb23d net: document ReadMsgUnix, WriteMsgUnix
Fixes #3247.

R=golang-dev, jsing
CC=golang-dev
https://golang.org/cl/5784051
2012-03-08 08:36:40 -05:00
Russ Cox
2ee538bc27 time: mention receiver in Unix, UnixNano docs
Fixes #3248.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5784052
2012-03-08 08:32:52 -05:00
Volker Dobler
d7d1b18a5d fmt: minor tweak of package doc to show headings in godoc
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5781052
2012-03-08 22:22:36 +11:00
Alex Brainman
2b8a7adde8 go/build: do not parse .syso files
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5786049
2012-03-08 17:06:53 +11:00
Robert Griesemer
f3c39d8f2b go/parser: avoid endless loop in case of internal error
Factored the error synchronization code into two functions
syncStmt and syncDecl. Because they may return w/o advancing
the scanner, there is potential for endless loops across
multiple parse functions; typically caused by an incorrect
token list in these functions (e.g., adding token.ELSE to
syncStmt will cause the parser to go into an endless loop
for test/syntax/semi7.go without this mechanism). This would
indicate a compiler bug, exposed only in an error situation
for very specific source files. Added a mechanism to force
scanner advance if an endless loop is detected. As a result,
error recovery will be less good in those cases, but the parser
reported a source error already and at least doesn't get stuck.

R=rsc, rsc
CC=golang-dev
https://golang.org/cl/5784046
2012-03-07 21:28:50 -08:00
Russ Cox
b0996334c1 go/build, cmd/go: add support for .syso files
.syso files are system objects copied directly
into the package archive.

Fixes #1552.

R=alex.brainman, iant, r, minux.ma, remyoudompheng
CC=golang-dev
https://golang.org/cl/5778043
2012-03-07 22:03:18 -05:00
Francisco Souza
686d699ec6 io: minor change in io.WriteAt docs.
R=adg, bradfitz
CC=golang-dev
https://golang.org/cl/5787048
2012-03-08 12:49:13 +11:00
Robert Griesemer
5827dd052c go/scanner: better panic diagnostic
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5787045
2012-03-07 16:57:26 -08:00
Alex Brainman
0029b0d207 path/filepath: retrieve real file name in windows EvalSymlinks
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5756049
2012-03-08 10:00:25 +11:00
Dmitriy Vyukov
c8b1f85493 encoding/gob: fix memory corruption
Fixes #3175.

R=golang-dev, iant, rsc, r
CC=golang-dev
https://golang.org/cl/5758069
2012-03-08 08:53:08 +11:00
Russ Cox
b0beeb1501 runtime: fix freebsd crash
FreeBSD, alone among our supported operating systems,
required that usleep not be interrupted.  Don't require that.

Fixes #3217.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5781045
2012-03-07 15:30:54 -05:00
Robert Griesemer
c8981c718b go/parser: better error synchronization
gofmt reports now a single, accurate error for
the test case of issue 3106.

Also: Added test harness for general error
checking and two test cases for now.

Fixes #3106.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5755062
2012-03-07 12:24:20 -08:00
Russ Cox
babbf941c9 net, net/rpc, reflect, time: document concurrency guarantees
Fixes #1599.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5777043
2012-03-07 14:55:09 -05:00
Russ Cox
291636b99b testing: do not print 'no tests' when there are examples
I am not sure why RunTests and RunExamples are
exported, but I assume that because they are we
should not change the signature, so I added an
unexported global shared by Main and RunTests.

Fixes #3237.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5779043
2012-03-07 14:54:31 -05:00
Rémy Oudompheng
3dcedb620c runtime: try extending arena size in 32-bit allocator.
If it didn't reach the limit, we can try extending the arena
before resorting to random memory mappings and praying for the
kernel to be kind.

Fixes #3173.

R=rsc, rsc
CC=golang-dev
https://golang.org/cl/5725045
2012-03-07 14:21:45 -05:00
Brad Fitzpatrick
0210f4137b io: more docs on WriterAt
Updates #1599

R=golang-dev, gri, rsc
CC=golang-dev
https://golang.org/cl/5774043
2012-03-07 10:54:04 -08:00
Mikkel Krautz
4aab8806e7 deps: allow crypto/x509 to use syscall
Allows the Windows part of CL 5700087 to land.

I had build tested CL 5753060 (which allows
crypto/x509 to use cgo and io/ioutil), and
didn't spot any errors on Windows.

Turns out I was wrong.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5753065
2012-03-07 13:51:05 -05:00
Robert Griesemer
9e8e4a9313 go/parser: better error sync. if commas are missing
This time for sure.
Runs all tests.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5752060
2012-03-07 10:19:32 -08:00
Mikkel Krautz
a324a5ac20 crypto/x509: new home for root fetchers; build chains using Windows API
This moves the various CA root fetchers from crypto/tls into crypto/x509.

The move was brought about by issue 2997. Windows doesn't ship with all
its root certificates, but will instead download them as-needed when using
CryptoAPI for certificate verification.

This CL changes crypto/x509 to verify a certificate using the system root
CAs when VerifyOptions.RootCAs == nil. On Windows, this verification is
now implemented using Windows's CryptoAPI. All other root fetchers are
unchanged, and still use Go's own verification code.

The CL also fixes the hostname matching logic in crypto/tls/tls.go, in
order to be able to test whether hostname mismatches are honored by the
Windows verification code.

The move to crypto/x509 also allows other packages to use the OS-provided
root certificates, instead of hiding them inside the crypto/tls package.

Fixes #2997.

R=agl, golang-dev, alex.brainman, rsc, mikkel
CC=golang-dev
https://golang.org/cl/5700087
2012-03-07 13:12:35 -05:00
Russ Cox
a385f38dfa net: delete usableLocalPort from test
The old way to find a port was to listen :0 and then
look at what port it picked, close the listener, and then
immediately try to listen on that port.

On some Windows 7 machines that sequence fails at
the second listen, because the first one is still lingering
in the TCP/IP stack somewhere.  (Ironically, most of these
are used in tests of a "second listen", which in this case
ends up being the third listen.)

Instead of this race, just return the listener from the
function, replacing usableLocalPort+Listen with
usableListenPort.

Fixes #3219.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5769045
2012-03-07 12:06:22 -05:00
Russ Cox
b37841cc06 runtime/pprof: disable test on Leopard 64-bit
Fixes #3234.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5756078
2012-03-07 11:44:54 -05:00
Mikio Hara
ae7a843471 net: use IANA reserved port to test dial timeout
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5757060
2012-03-07 16:28:40 +09:00
Alex Brainman
5aee1f3a0f exp/wingui: getting relocated to
go get code.google.com/p/gowingui

R=golang-dev, minux.ma, r
CC=golang-dev
https://golang.org/cl/5752067
2012-03-07 17:48:09 +11:00
Mikio Hara
e2b207bc4f sync/atomic: disable store and load test on a single processor machine
Fixes #3226.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5756073
2012-03-07 14:51:20 +09:00
Russ Cox
c804efb5de net: fix TestDialTimeout on windows builder
I don't know what's out there, but something
is answering to 127.0.71.111:80 on our builder,
so use a different port.

Also insert a check that the dial fails, which
would have diagnosed this problem.

Fixes #3016.

R=golang-dev, mikioh.mikioh, r
CC=golang-dev
https://golang.org/cl/5754062
2012-03-07 00:41:24 -05:00
Russ Cox
c10650979f net: disable another external network test
I don't know enough about multicast.
Should this be disabled on all systems, not just Windows?

R=golang-dev
CC=golang-dev
https://golang.org/cl/5754060
2012-03-07 00:02:07 -05:00
Shenghou Ma
881966d2a5 cmd/go, cmd/godoc, net: fix typo
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5757050
2012-03-07 12:41:43 +08:00
Russ Cox
7c7966a426 net: disable use of external listen along with other external network uses
By default the all.bash tests must not ever announce
on an external address.  It's not just an OS X issue.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5753067
2012-03-06 23:35:31 -05:00
Russ Cox
c3f4319a24 misc/cgo: re-enable some tests
The testso directory still needs to be enabled.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5731048
2012-03-06 23:27:30 -05:00
Russ Cox
0bc18811b5 fmt, log: stop using unicode
$ go list -f '{{.ImportPath}} {{.Deps}}' fmt log
fmt [errors io math os reflect runtime strconv sync sync/atomic syscall time unicode/utf8 unsafe]
log [errors fmt io math os reflect runtime strconv sync sync/atomic syscall time unicode/utf8 unsafe]

R=bradfitz, rogpeppe, r, r, rsc
CC=golang-dev
https://golang.org/cl/5753055
2012-03-06 23:27:11 -05:00
Rob Pike
8f61631c74 go/build: delete Makefile
We can write syslist.go by hand.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5757057
2012-03-07 14:10:49 +11:00
Rob Pike
544a72cc86 exp/wingui: remove reference to Make.inc
R=golang-dev, bradfitz, alex.brainman
CC=golang-dev
https://golang.org/cl/5757058
2012-03-07 14:06:16 +11:00
Rob Pike
f91326b7b1 strconv: remove dependence on unicode and strings
We need a compact, reasonably efficient IsPrint. That adds about 2K of data,
plus a modest amount of code, but now strconv is a near-leaf package.

R=r, bradfitz, adg, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/5756050
2012-03-07 13:50:31 +11:00
Brad Fitzpatrick
502e29f485 database/sql: add docs about connection state, pooling
Fixes #3223

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5755063
2012-03-06 17:44:47 -08:00
Alex Brainman
7a3c6c950b os: fix SameFile to work for directories on windows
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5756064
2012-03-07 11:01:23 +11:00
Adam Langley
3ea3a7c9a5 deps: allow crypto/x509 cgo and io/ioutil.
In order to land 5700087 (which moves the knowledge of how to get the
root certificates for the system from crypto/tls to crypto/x509), we
need to relax the restrictions on crypto/x509. Afterwards, we can
probably tighten them up in crypto/tls.

R=golang-dev, rsc, krautz
CC=golang-dev
https://golang.org/cl/5753060
2012-03-06 17:18:09 -05:00
Brad Fitzpatrick
48eacd90a8 database/sql: fix typo bug resulting in double-Prepare
Bug reported by Blake Mizerany found while writing
his new Postgres driver.

R=golang-dev, blake.mizerany
CC=golang-dev
https://golang.org/cl/5754057
2012-03-06 14:10:58 -08:00
Rob Pike
aeefe0fa6e path/filepath: disable AbsTest on windows
SameFile has a bug.

R=golang-dev
TBR=rsc
CC=golang-dev
https://golang.org/cl/5754055
2012-03-07 08:14:12 +11:00
Rob Pike
2184137cf3 path/filepath/path_test.go: repair and enable TestAbs
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5759051
2012-03-07 07:54:56 +11:00
Robert Griesemer
39b186da6c go/parser: fix build (temporarily disable recent change)
R=golang-dev
CC=golang-dev
https://golang.org/cl/5752059
2012-03-06 11:23:27 -08:00
Robert Griesemer
67cbe9431f go/parser: better error sync. if commas are missing
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5756045
2012-03-06 11:05:16 -08:00
Adam Langley
4f25e4be02 crypto/tls: make the package description more accurate and less aspirational.
Fixes #3216.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5755056
2012-03-06 12:49:29 -05:00
Shenghou Ma
db80edde7d time: during short test, do not bother tickers take longer than expected
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5752058
2012-03-07 01:10:55 +08:00
Ian Lance Taylor
aabbcda816 runtime: remove unused runtime·signame and runtime·newError
R=golang-dev
CC=golang-dev
https://golang.org/cl/5756044
2012-03-06 09:07:00 -08:00
Rémy Oudompheng
9eda2b9977 net: do not use reflect for DNS messages.
Fixes #3201.

R=bradfitz, bradfitz, rsc
CC=golang-dev, remy
https://golang.org/cl/5753045
2012-03-06 08:02:39 +01:00
Mikio Hara
9442c4429a net: add skip message to test
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5753048
2012-03-06 15:41:17 +09:00
Russ Cox
347cc981f0 cmd/go: add -compiler
go/build: add Context.Compiler

Fixes #3157.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5756047
2012-03-06 00:36:24 -05:00
Russ Cox
e9d5a641d7 strconv: add table-based isPrint
Not used yet for simpler merge.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5756048
2012-03-06 00:36:12 -05:00
Brad Fitzpatrick
9ff00c8fc9 go/build: fix windows and plan9 builds
Bit of a band-aid fix.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5757045
2012-03-05 21:33:44 -08:00
Rob Pike
eab4261946 strconv: remove dependency on bytes
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5759044
2012-03-06 15:25:42 +11:00
Russ Cox
88e86936be go/build: add dependency test
This exercises the Import function but more importantly
gives us a place to write down the policy for dependencies
within the Go tree.  It also forces us to look at the dependencies,
which may lead to adjustments.

Surprises:
 - go/doc imports text/template, for HTMLEscape (could fix)
 - it is impossible to use math/big without fmt (unfixable)
 - it is impossible to use crypto/rand without math/big (unfixable)

R=golang-dev, bradfitz, gri, r
CC=golang-dev
https://golang.org/cl/5732062
2012-03-05 23:13:00 -05:00
Rob Pike
98c1baff6f unicode/utf16: delete dependence on package unicode
In the test, verify the copied constants are correct.
Also put the test into package utf16 rather than utf16_test;
the old location was probably due creating the test from
utf8, but the separation is not needed here.

R=golang-dev, bradfitz, rsc, rsc, r
CC=golang-dev
https://golang.org/cl/5752047
2012-03-06 14:58:08 +11:00
Russ Cox
4e110af169 runtime: add Compiler
R=iant, r, gri
CC=golang-dev
https://golang.org/cl/5720073
2012-03-05 22:28:02 -05:00
Russ Cox
0a6fdcf63b net: silence another epoll print
R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/5752048
2012-03-05 22:07:22 -05:00
Mikio Hara
195ccd5dac net: fix windows build
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5755045
2012-03-06 10:07:08 +09:00
Mikio Hara
d4e1383285 net: improve server and file tests
* Splits into three server tests.
  - TestStreamConnServer for tcp, tcp4, tcp6 and unix networks
  - TestSeqpacketConnServer for unixpacket networks
  - TestDatagramPacketConnServer for udp, udp4, udp6 and unixgram networks
* Adds both PacketConn and Conn test clients to datagram packet conn tests.
* Fixes wildcard listen test cases on dual IP stack platform.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5701066
2012-03-06 09:43:45 +09:00
Rob Pike
d9832987ba unicode/utf8: remove dependence on unicode.
The dependency was there only to pull in two constants.
Now we define them locally and verify equality in the test.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5754046
2012-03-06 11:14:45 +11:00
Ian Lance Taylor
46031400d0 reflect: fix comment spacing
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5757043
2012-03-05 15:51:58 -08:00
David Symonds
63e383cff8 expvar: add locking to String, and use RWMutex properly throughout.
R=bradfitz
CC=golang-dev
https://golang.org/cl/5754043
2012-03-06 09:13:26 +11:00
Rémy Oudompheng
aa1aaee7fd runtime: wait for main goroutine before setting GOMAXPROCS.
Fixes #3182.

R=golang-dev, dvyukov, rsc
CC=golang-dev, remy
https://golang.org/cl/5732057
2012-03-05 16:40:27 -05:00
Brad Fitzpatrick
610b5b2fd8 net: remove all direct fmt and bytes imports
Once dnsMsg stops using reflect, we lose even more
indirect dependencies.

R=rsc
CC=golang-dev
https://golang.org/cl/5751043
2012-03-05 13:36:05 -08:00
Russ Cox
c0a842e57f runtime/debug: fix test when source cannot be found
This happens with GOROOT_FINAL=/somewhere/else

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5727069
2012-03-05 16:13:15 -05:00