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

13884 Commits

Author SHA1 Message Date
Aram Hăvărneanu
901e7bfe53 lib9, libmach, cmd/dist, go/build: add support for GOOS=solaris
This change adds solaris to the list of supported operating
systems and allows cmd/dist to be built on Solaris.

This CL has to come first because we want the tools to ignore
solaris-specific files until the whole port is integrated.

R=golang-codereviews, jsing, rsc, minux.ma
CC=golang-codereviews
https://golang.org/cl/35900045
2014-01-07 23:12:12 +11:00
Joel Sing
8f9844348f syscall: include mmap constants in netbsd zerror* files
Include the <sys/mman.h> header for NetBSD mkerrors.sh. This brings
in constants used with mmap(2), msync(2) and mlockall(2).

The regeneration of the NetBSD zerror* files also picks clone(2)
related constants.

Update #4929.

R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/45510044
2014-01-07 23:04:17 +11:00
Russ Cox
d227d680ec cmd/gc: use 100x less memory for []byte("string")
[]byte("string") was simplifying to
[]byte{0: 0x73, 1: 0x74, 2: 0x72, 3: 0x69, 4: 0x6e, 5: 0x67},
but that latter form takes up much more memory in the compiler.
Preserve the string form and recognize it to turn global variables
initialized this way into linker-initialized data.

Reduces the compiler memory footprint for a large []byte initialized
this way from approximately 10 kB/B to under 100 B/B.

See also issue 6643.

R=golang-codereviews, r, iant, oleku.konko, dave, gobot, bradfitz
CC=golang-codereviews
https://golang.org/cl/15930045
2014-01-06 20:43:44 -05:00
Adam Langley
78c16c9b16 crypto/rsa: support unpadded signatures.
Usually when a message is signed it's first hashed because RSA has low
limits on the size of messages that it can sign. However, some
protocols sign short messages directly. This isn't a great idea because
the messages that can be signed suddenly depend on the size of the RSA
key, but several people on golang-nuts have requested support for
this and it's very easy to do.

R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/44400043
2014-01-06 16:11:58 -05:00
Brad Fitzpatrick
90e9669c50 undo CL 44150043 / 198bdc0984dd
See https://golang.org/cl/44150043/

««« original CL description
regexp: use sync.Pool

For machines, not threads.

Update #4720

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/44150043
»»»

TBR=golang-dev
CC=golang-codereviews
https://golang.org/cl/48190043
2014-01-06 12:38:04 -08:00
Brad Fitzpatrick
02a15e7165 archive/zip: fix bug reading zip64 files
ZIP64 Extra records are variably sized, but we weren't capping
our reading of the extra fields at its previously-declared
size.

No test because I don't know how to easily create such files
and don't feel like manually construction one.  But all
existing tests pass, and this is "obviously correct" (queue
laughter).

Fixes #7069

R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/48150043
2014-01-06 10:43:56 -08:00
Matthew Cottingham
991e9a8331 net/http: Add more call order tests for request form parsing.
Adds tests for branches handling call ordering which
were shown to be untested by the cover tool.

This is part of the refactoring of form parsing discussed
in CL 44040043. These tests may need to be changed later but
should help lock in the current behaviour.

R=golang-codereviews, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/46750043
2014-01-06 10:36:04 -08:00
Bill Thiede
6576757927 hash/fnv: fix overview link currently returning 404.
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/47570043
2014-01-06 10:34:24 -08:00
Shawn Smith
16134060de time: add tests for Tick, NewTicker with negative duration
R=golang-codereviews, gobot, r, bradfitz
CC=golang-codereviews
https://golang.org/cl/37660044
2014-01-06 10:32:07 -08:00
Joel Sing
232a4e89a4 crypto/sha256: block implementation in 386 assembly
Benchmark on Intel(R) Core(TM) i5-2500S CPU @ 2.70GHz (albeit in a VM)

benchmark              old ns/op    new ns/op    delta
BenchmarkHash8Bytes         1606          699  -56.48%
BenchmarkHash1K            21920         7268  -66.84%
BenchmarkHash8K           165696        53756  -67.56%

benchmark               old MB/s     new MB/s  speedup
BenchmarkHash8Bytes         4.98        11.44    2.30x
BenchmarkHash1K            46.72       140.88    3.02x
BenchmarkHash8K            49.44       152.39    3.08x

R=agl, cldorian
CC=golang-codereviews
https://golang.org/cl/44800044
2014-01-06 13:31:22 -05:00
Volker Dobler
939b3fa39e net/http: remove todos from cookie code
The Domain and Path field of a parsed cookie have been
the unprocessed wire data since Go 1.0; this seems to
be okay for most applications so let's keep it.

Returning the unprocessed wire data makes it easy to
handle nonstandard or even broken clients without
consulting Raw or Unparsed of a cookie.

The RFC 6265 parsing rules for domain and path are
currently buried in net/http/cookiejar but could be
exposed in net/http if necessary.

R=bradfitz, nigeltao
CC=golang-codereviews
https://golang.org/cl/48060043
2014-01-06 10:00:58 -08:00
Volker Dobler
eb93f86275 net/http/cookiejar: document format of domain in PublicSuffix
Document what values a PublicSuffixList must accept as
a domain in a call to PublicSuffix.

R=bradfitz, nigeltao
CC=golang-codereviews
https://golang.org/cl/47560044
2014-01-06 10:00:20 -08:00
Emil Hessman
aeeda707ff runtime: Fix panic when trying to stop CPU profiling with profiler turned off
Fixes #7063.

R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/47950043
2014-01-06 09:53:55 -08:00
Joel Sing
29fe067ba7 crypto/sha1, crypto/sha256, crypto/sha512: use copy for partial block
Use copy rather than a hand rolled loop when moving a partial input
block to the scratch area. This results in a reasonable performance
gain when partial blocks are written.

Benchmarks on Intel(R) Xeon(R) CPU X5650  @ 2.67GHz with Go amd64:

       benchmark               old MB/s     new MB/s  speedup
SHA1   BenchmarkHash8Bytes        18.37        22.80    1.24x
SHA256 BenchmarkHash8Bytes        11.86        13.78    1.16x
SHA512 BenchmarkHash8Bytes         4.51         5.24    1.16x

       benchmark              old ns/op    new ns/op    delta
SHA1   BenchmarkHash8Bytes          435          350  -19.54%
SHA256 BenchmarkHash8Bytes          674          580  -13.95%
SHA512 BenchmarkHash8Bytes         1772         1526  -13.88%

R=agl, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/35840044
2014-01-06 01:34:56 +11:00
Shawn Smith
48334e3e91 container/list: improve test coverage
R=golang-codereviews, dave, gobot, bradfitz, gri
CC=golang-codereviews
https://golang.org/cl/46640043
2014-01-05 07:48:32 +11:00
Jeff Sickel
c136197ca8 runtime: plan 9 does have /dev/random
R=golang-codereviews, r, aram
CC=0intro, golang-codereviews, rsc
https://golang.org/cl/43420045
2014-01-04 10:53:22 -08:00
Keith Randall
f59ea4e58b runtime: Fix race detector checks to ignore KindNoPointers bit
when comparing kinds.

R=dvyukov, dave, khr
CC=golang-codereviews
https://golang.org/cl/41660045
2014-01-04 08:43:17 -08:00
Dave Cheney
30ba286c61 os: add tests for operations on nil *File methods
R=shawn.p.smith, gobot, r
CC=golang-codereviews
https://golang.org/cl/46820043
2014-01-04 09:58:04 +11:00
Dave Cheney
f2e946f9ed os: return ErrInvalid if receiver is nil.
Fixes #7043.

Test coming in https://golang.org/cl/46820043

R=r, bradfitz
CC=golang-codereviews
https://golang.org/cl/38330045
2014-01-04 08:25:09 +11:00
Daniel Morsing
f2e94b58a0 cmd/gc: silence assignment errors to undefined symbols
Fixes #6406.

R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/46900043
2014-01-03 21:03:20 +01:00
Emil Hessman
880442f110 encoding/json: Fix missing error when trying to unmarshal null string into int, for successive ,string option
Fixes #7046.

R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/47260043
2014-01-03 10:13:28 -08:00
Joel Sing
d180579170 syscall: handle varied path lengths for unix sockets
Most BSDs include the trailing NUL character of the socket path in the
length, however some do not (such as NetBSD 6.99). Handle this by only
subtracting the family and length bytes from the returned length, then
scanning the path and removing any terminating NUL bytes.

Fixes #6627.

R=golang-codereviews, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/46420044
2014-01-04 00:29:20 +11:00
David Symonds
8778760a7e runtime: increase attempt count for map iteration order test.
Some builders broke on this test; I'm guessing that was because
this test didn't try hard enough to find a different iteration order.

Update #6719

R=dave
CC=golang-codereviews
https://golang.org/cl/47300043
2014-01-03 10:41:56 +11:00
David Symonds
d4c66a35ba runtime: add a test for randomised map iteration order.
Technically the spec does not guarantee that the iteration order is random,
but it is a property that we have consciously pursued, and so it seems
right to verify that our implementation does indeed randomise.

Update #6719.

R=khr, bradfitz
CC=golang-codereviews
https://golang.org/cl/47010043
2014-01-03 10:10:54 +11:00
Shawn Smith
eaff83b98e encoding/hex: add Decode error test case
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/46880043
2014-01-02 10:34:21 -08:00
Shawn Smith
b38da05ab1 time: add tests for Duration.Nanoseconds, Duration.Minutes, and Duration.Hours
R=golang-codereviews, rsc, dave
CC=golang-codereviews
https://golang.org/cl/42440043
2014-01-02 21:01:18 +11:00
Dave Cheney
66730120fa encoding/json: add tests for InvalidUnmarshalError
R=golang-codereviews, shawn.p.smith
CC=golang-codereviews
https://golang.org/cl/41960047
2014-01-02 09:49:55 +11:00
Shawn Smith
4d239bcea2 bufio: improve NewReaderSize, Peek, and UnreadByte test coverage
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/42990045
2014-01-01 22:26:22 +11:00
Shawn Smith
a39f3b29ec encoding/json: improve omitempty test coverage
R=golang-codereviews, dave, bradfitz
CC=golang-codereviews
https://golang.org/cl/46250043
2014-01-01 17:54:06 +11:00
Shawn Smith
3c7d2e6af9 os: improve Readdir and Readdirnames test coverage
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/46450043
2014-01-01 16:40:52 +11:00
Shawn Smith
873271378b encoding/hex: add Decode test case with uppercase hex characters
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/46270043
2014-01-01 16:32:05 +11:00
Michael Stapelberg
592416a387 debug/elf: add C source for testdata executables
This source file, when compiled with gcc 4.4.3 on Ubuntu lucid,
corresponds instruction for instruction to the binaries in the same
directory.

Shipping this source code file resolves http://bugs.debian.org/716853

R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/46780043
2013-12-31 14:36:13 -08:00
Shawn Smith
e3040e2bba crypto/sha256: add tests for Size() and BlockSize()
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/46470043
2014-01-01 07:46:00 +11:00
Shawn Smith
0333e80d63 crypto/sha1: add tests for Size() and BlockSize()
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/46400044
2013-12-31 23:13:05 +11:00
Shawn Smith
a1731ac078 container/ring: add test for Move with empty Ring
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/46630044
2013-12-31 21:18:40 +11:00
Mikio Hara
b4571bdfe8 net: fix typo
R=golang-codereviews, bradfitz, dave
CC=golang-codereviews
https://golang.org/cl/46600043
2013-12-31 18:52:37 +09:00
Shawn Smith
dcf562dfb6 crypto/sha512: add tests for Size() and BlockSize()
R=golang-codereviews, bradfitz, dave
CC=golang-codereviews
https://golang.org/cl/43550047
2013-12-31 19:29:09 +11:00
Josh Bleecher Snyder
ff006982c3 text/template: don't panic when using AddParseTree with an unparsed template
Fixes #7032.

R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/43960045
2013-12-30 17:17:19 -08:00
Keith Randall
0ea20bc981 cmd/6g: inline copies of up to 4 words in length.
This change fixes a serious performance regression
with reflect.Value growing to 4 words instead of 3.
The json benchmark was ~50% slower, with this change
it is ~5% slower (and the binary is 0.5% larger).

Longer term, we probably need to rethink our copy
generation.  Using REP is really expensive time-wise.
But inlining the copy grows the binary.

R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/44990043
2013-12-30 12:14:27 -08:00
Keith Randall
1cc2ff8fc7 runtime: use readrange instead of read to check for races
on map keys and values which are now passed by reference.

R=dvyukov, khr
CC=golang-codereviews
https://golang.org/cl/43490044
2013-12-30 12:03:56 -08:00
Richard Musiol
7ff57e2fa1 reflect: fixed method name in Slice3 error message
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/46500043
2013-12-30 11:41:01 -08:00
Shawn Smith
96ee10fb71 reflect: add DeepEqual slice of slice inequality test
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/46510043
2013-12-30 11:39:47 -08:00
Shawn Smith
c989a0b2f7 reflect: remove length check for arrays in deepValueEqual
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/39910044
2013-12-29 11:05:30 -08:00
Shawn Smith
36c8c5f063 io: add tests for SectionReader ReadAt and Size
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/39200045
2013-12-29 22:38:05 +11:00
Shawn Smith
351caa4b91 crypto/hmac: add tests for Size() and BlockSize()
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/41320044
2013-12-29 20:56:05 +11:00
Dave Cheney
d2fe44d568 runtime: load runtime.goarm as a byte, not a word
Fixes #6952.

runtime.asminit was incorrectly loading runtime.goarm as a word, not a uint8 which made it subject to alignment issues on arm5 platforms.

Alignment aside, this also meant that the top 3 bytes in R11 would have been garbage and could not be assumed to be setting up the FPU reliably.

R=iant, minux.ma
CC=golang-codereviews
https://golang.org/cl/46240043
2013-12-29 15:25:34 +11:00
Ian Lance Taylor
672525a56e net: work around Solaris connect issue when server closes socket
On Solaris, if you do a in-progress connect, and then the
server accepts and closes the socket, the client's later
attempt to complete the connect will fail with EINVAL.  Handle
this case by assuming that the connect succeeded.  This code
is weird enough that it is implemented as Solaris-only so that
it doesn't hide a real error on a different OS.

Update #6828

R=golang-codereviews, bradfitz, dave
CC=golang-codereviews
https://golang.org/cl/46160043
2013-12-28 09:37:54 -08:00
Shawn Smith
872f5ffa09 bytes: add test for Contains
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/46140043
2013-12-28 20:33:05 +11:00
Shawn Smith
42cea1a452 archive/tar: add test case for passing nil to FileInfoHeader
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/44710044
2013-12-28 16:14:49 +11:00
Martin Olsson
5499034a71 all: fix a few spelling errors in source comments
R=golang-codereviews, dave, iant
CC=golang-codereviews
https://golang.org/cl/45750044
2013-12-27 08:59:02 -08:00
Ian Lance Taylor
4aa521a77d net: use DialTimeout in TestSelfConnect
This avoids problems with systems that take a long time to
find out nothing is listening, while still testing for the
self-connect misfeature since a self-connect should be fast.
With this we may be able to remove the test for non-Linux
systems.

Tested (on GNU/Linux) by editing selfConnect in
tcpsock_posix.go to always return false and verifying that
TestSelfConnect then fails with and without this change.

Idea from Uros Bizjak.

R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/39200044
2013-12-27 08:49:47 -08:00
Shawn Smith
d1a9143669 strconv: add tests for FormatBool and AppendBool
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/42480043
2013-12-27 08:40:14 -08:00
Shawn Smith
f485e9859a strconv: remove unused atof32int function
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/44200044
2013-12-27 08:40:03 -08:00
Shawn Smith
4133407061 crypto/cipher: remove unused shift1 function
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/38990045
2013-12-27 08:39:54 -08:00
Brad Fitzpatrick
2ccc9a965b net/http: quiet distracting test spam
Capture log output (and test it while at it),
and quiet unnecessary t.Logf.

R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/45850043
2013-12-26 13:03:30 -08:00
Brad Fitzpatrick
1fa0206024 net/http: fix data race in benchmark
Fixes #7006

R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/44940044
2013-12-26 12:16:11 -08:00
John Newlin
92b5e16147 net/http: Release reference to chunkWriter's bufio.Writer on hijack
When a connection is hijacked, release the reference to the bufio.Writer
that is used with the chunkWriter.  The chunkWriter is not used after
the connection is hijacked.

Also add a test to check that double Hijack calls do something sensible.

benchmark                old ns/op    new ns/op    delta
BenchmarkServerHijack        24137        20629  -14.53%

benchmark               old allocs   new allocs    delta
BenchmarkServerHijack           21           19   -9.52%

benchmark                old bytes    new bytes    delta
BenchmarkServerHijack        11774         9667  -17.90%

R=bradfitz, dave, chris.cahoon
CC=golang-codereviews
https://golang.org/cl/39440044
2013-12-26 11:52:14 -08:00
Marko Tiikkaja
0d12e24ebb database/sql: Use all connections in pool
The last connection in the pool was not being handed out correctly.

R=golang-codereviews, gobot, bradfitz
CC=golang-codereviews
https://golang.org/cl/40410043
2013-12-26 11:27:18 -08:00
Ian Lance Taylor
59583b09f3 runtime/cgo: include <signal.h> to fix build
R=golang-codereviews
TBR=dfc
CC=golang-codereviews
https://golang.org/cl/43120044
2013-12-24 08:24:32 -08:00
Ian Lance Taylor
699dbb60b7 runtime/cgo: always set signal mask before calling pthread_create
This was done correctly for most targets but was missing from
FreeBSD/ARM and Linux/ARM.

R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/45180043
2013-12-24 08:08:15 -08:00
S.Çağlar Onur
41183d015d cgo/runtime: replace sigprocmask with pthread_sigmask.
sigprocmask use in a multithreaded environment is undefined so replace it with pthread_sigmask.

Fixes #6811.

R=jsing, iant
CC=golang-codereviews, golang-dev
https://golang.org/cl/30460043
2013-12-22 08:55:29 -08:00
Shawn Smith
7054890715 bytes, strings: improve Title test coverage by adding cases with underscore and unicode line separator
R=golang-codereviews, gobot, r
CC=golang-codereviews
https://golang.org/cl/42310045
2013-12-20 23:19:32 -08:00
David du Colombier
4237ffe5ea os: reimplement HasPrefix and LastIndex to not depend on strings
R=golang-codereviews, rsc
CC=golang-codereviews, jas
https://golang.org/cl/44790043
2013-12-21 01:22:10 +01:00
Russ Cox
145edc283f cmd/gc: do not compute dead value maps if they will not be used
Reduces 6g big.go memory usage from 251 MB to 242 MB.
Reduces 6g slow.go memory usage from 529 MB to 453 MB.

Mostly a memory savings; 6g slow.go is only about 5% faster.

The test programs are at
https://rsc.googlecode.com/hg/testdata/big.go (36k lines, 276kB)
https://rsc.googlecode.com/hg/testdata/slow.go (7k lines, 352kB)

R=golang-codereviews, bradfitz, iant
CC=golang-codereviews
https://golang.org/cl/42280045
2013-12-20 19:14:42 -05:00
Jakub Ryszard Czarnowicz
57e27a879e net/http: empty contenty-type treated as application/octet-stream
RFC 2616, section 7.2.1 - empty type SHOULD be treated as
application/octet-stream.
Fixes #6616.

R=golang-codereviews, gobot, bradfitz, josharian
CC=golang-codereviews
https://golang.org/cl/31810043
2013-12-20 11:49:42 -08:00
Russ Cox
0e97f4187e cmd/gc: address 1½ liveness bottlenecks
As much as 7x speedup on some programs, cuts all.bash time by 20%.

Change splicebefore function from O(n) to O(1).
The approach was suggested by Carl during the code's review
but apparently did not make it into the tree.
It makes a huge difference on huge programs.

Make twobitwalktype1 slightly faster by using & instead of %.
Really it needs to be cached; left a note to that effect.
(Not a complete fix, hence the ½.)

big.go (output of test/chan/select5.go)
 47.53u   0.50s  48.14r before this CL
  7.09u   0.47s   7.59r with splicebefore change (6.7x speedup)
  6.15u   0.42s   6.59r with twobitwalktype1 change (1.15x speedup; total 7.7x)

slow.go (variant of program in go.text, by mpvl)
 77.75u   2.11s  80.03r before this CL
 24.40u   1.97s  26.44r with splicebefore change (3.2x speedup)
 18.12u   2.19s  20.38r with twobitwalktype1 change (1.35x speedup; total 4.3x)

test/run
150.63u  49.57s  81.08r before this CL
 88.01u  45.60s  46.65r after this CL (1.7x speedup)

all.bash
369.70u 115.64s 256.21r before this CL
298.52u 110.35s 214.67r after this CL (1.24x speedup)

The test programs are at
https://rsc.googlecode.com/hg/testdata/big.go (36k lines, 276kB)
https://rsc.googlecode.com/hg/testdata/slow.go (7k lines, 352kB)

R=golang-codereviews, gobot, r
CC=cshapiro, golang-codereviews
https://golang.org/cl/43210045
2013-12-20 14:24:48 -05:00
Russ Cox
4acb70d377 cmd/gc: bypass DATA instruction for data initialized to integer constant
Eventually we will want to bypass DATA for everything,
but the relocations are not standardized well enough across
architectures to make that possible.

This did not help as much as I expected, but it is definitely better.
It shaves maybe 1-2% off all.bash depending on how much you
trust the timings of a single run:

Before: 241.139r 362.702u 112.967s
After:  234.339r 359.623u 111.045s

R=golang-codereviews, gobot, r, iant
CC=golang-codereviews
https://golang.org/cl/44650043
2013-12-20 14:24:39 -05:00
Rob Pike
dc8572c3fe sync: explain Pool's intentions
Expand the type's doc comment to make its purpose clear
and discourage misuse.

R=golang-codereviews, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/44680043
2013-12-20 11:15:50 -08:00
Brad Fitzpatrick
568a449bd1 io/ioutil: use sync.Pool in Discard
And merge the blackhole.go file back into ioutil,
where it once was. It was only in a separate file
because it used to have race-vs-!race versions.

R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/44060044
2013-12-20 09:38:35 -08:00
Russ Cox
1334b794b7 libmach: remove old object file readers
These no longer work; removing them makes other refactoring easier.
The code for pack P being deleted in this CL does not work either.
I created issue 6989 to track restoring this functionality (probably not
until pack is written in Go).

R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/44300043
2013-12-20 12:10:53 -05:00
Adam Langley
6f149492bf crypto/tls: rework reference tests.
The practice of storing reference connections for testing has worked
reasonably well, but the large blocks of literal data in the .go files
is ugly and updating the tests is a real problem because their number
has grown.

This CL changes the way that reference tests work. It's now possible to
automatically update the tests and the test data is now stored in
testdata/. This should make it easier to implement changes that affect
all connections, like implementing the renegotiation extension.

R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/42060044
2013-12-20 11:37:05 -05:00
Alex A Skinner
487dff1852 net: ParseIP should return nil if :: doesn't expand in an IPv6 address.
Per RFC 4291, 'The use of "::" indicates one or more groups of 16 bits of zeros.'
Fixes #6628

R=golang-dev, rsc, minux.ma, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/15990043
2013-12-20 21:29:28 +09:00
Shenghou Ma
eb7ed0d626 runtime: fix build for OpenBSD
R=golang-dev
CC=golang-dev
https://golang.org/cl/38030045
2013-12-19 21:12:18 -05:00
Shenghou Ma
0097d30c97 runtime: unblock signals when we try to core dump
Fixes #6988.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/44070046
2013-12-19 20:45:05 -05:00
Keith Randall
cbc565a801 reflect: rewrite Value to separate out pointer vs. nonpointer info.
Needed for precise gc and copying stacks.

reflect.Value now takes 4 words instead of 3.

Still to do:
 - un-iword-ify channel ops.
 - un-iword-ify method receivers.

R=golang-dev, iant, rsc, khr
CC=golang-dev
https://golang.org/cl/43040043
2013-12-19 15:15:24 -08:00
Russ Cox
c9f12d2289 liblink: allow either of a pair of conflicting symbols to say dupok
This makes the linker's -X flag work again.

R=iant
CC=bradfitz, golang-codereviews, golang-dev
https://golang.org/cl/44360043
2013-12-19 16:52:47 -05:00
Brad Fitzpatrick
cbf6ff3b90 net/http: add Hihack benchmark
Notably, to show allocs. Currently: 11766 B/op, 21 allocs/op,
at least one alloc of which is in the benchmark loop itself.

R=golang-dev, jnewlin
CC=golang-dev
https://golang.org/cl/40370057
2013-12-19 13:24:42 -08:00
Rémy Oudompheng
e6b023473e runtime: reduce delays in finalizer test.
The runtime tests are executed 4 times in all.bash
and there is currently a 5-second delay each time.

R=golang-dev, minux.ma, khr, bradfitz
CC=golang-dev
https://golang.org/cl/42450043
2013-12-19 21:37:44 +01:00
David du Colombier
16dcef80d4 os: rename only works as part of the same directory on Plan 9
R=golang-dev, lucio.dere, rsc
CC=golang-dev
https://golang.org/cl/44080046
2013-12-19 21:20:03 +01:00
Rob Pike
6f6ff95183 go/build: mention 'tag' as an alias for 'build constraint'
The code is all about tags, and the cmd/go documentation
said to look in the go/build documentation for information
about tags, but the documentation said nothing about tags,
only build constraints. Make things clearer.

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/44100043
2013-12-19 11:43:34 -08:00
Adam Langley
9144ef3321 crypto/x509: import crypto/sha256
Since SHA-256 is now the default hash function, x509 should import it
otherwise some programs may fail because it hasn't been linked in.

R=golang-dev, dave, minux.ma
CC=golang-dev
https://golang.org/cl/44010047
2013-12-19 14:06:28 -05:00
ChaiShushan
0b26ba8af3 cmd/yacc: expr example support windows
1. expr append executable extension.
2. support '\r' character.

Fixes #6851.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/35330043
2013-12-19 12:14:07 -05:00
Joel Sing
0eaabf6452 cmd/ld: make hostobj work on newer openbsd
Make hostobj work on OpenBSD 5.3/5.4/-current - these have PIE
enabled by default and linking fails since the Go linker generates
objects that are neither PIC nor PIE.

Fixes #5067

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7572049
2013-12-20 03:58:27 +11:00
Mikio Hara
efd1d05023 net: rename TestReadConfig to TestDNSReadConfig
To make it possible to type "go test -run=DNS".
Also removes unnecessary parens.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/43470051
2013-12-19 13:02:06 +09:00
Alex Brainman
7f8a5057dd syscall: add NewCallbackCDecl again
Fixes #6338

R=golang-dev, kin.wilson.za, rsc
CC=golang-dev
https://golang.org/cl/36180044
2013-12-19 14:38:50 +11:00
Alex Brainman
f18e2a3271 runtime/pprof: skip tests that fail on windows-amd64-race builder
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/44180043
2013-12-19 14:15:57 +11:00
Brad Fitzpatrick
0594f89489 compress/flate: use io.ByteReader in docs
We did this elsewhere when io.ByteReader was added
but forgot this one.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/43480052
2013-12-18 18:24:55 -08:00
Keith Randall
2d20c0d625 runtime: mark objects in free lists as allocated and unscannable.
On the plus side, we don't need to change the bits when mallocing
pointerless objects.  On the other hand, we need to mark objects in the
free lists during GC.  But the free lists are small at GC time, so it
should be a net win.

benchmark                    old ns/op    new ns/op    delta
BenchmarkMalloc8                    40           33  -17.65%
BenchmarkMalloc16                   45           38  -15.72%
BenchmarkMallocTypeInfo8            58           59   +0.85%
BenchmarkMallocTypeInfo16           63           64   +1.10%

R=golang-dev, rsc, dvyukov
CC=cshapiro, golang-dev
https://golang.org/cl/41040043
2013-12-18 17:13:59 -08:00
Mikio Hara
7eb45d3c4a net: don't return a nested error when happy eyeballs dialing
Also removes an unused variable.

Fixes #6795.

R=adg, dave, bradfitz, gobot
CC=golang-dev
https://golang.org/cl/29440043
2013-12-19 10:00:15 +09:00
Brad Fitzpatrick
b682f6de5a regexp: use sync.Pool
For machines, not threads.

Update #4720

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/44150043
2013-12-18 16:43:19 -08:00
Russ Cox
4890502af6 liblink: use explicit field for globl duplicate detection
Overloading size leads to problems if clients
try to set up an LSym by hand.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/44140043
2013-12-18 19:36:14 -05:00
Russ Cox
2404b7f168 debug/goobj: expand package prefix correctly
R=r, bradfitz
CC=golang-dev
https://golang.org/cl/43480049
2013-12-18 19:00:52 -05:00
David du Colombier
674606503e syscall: disallow slashes in file names on Plan 9
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/43480050
2013-12-19 00:58:23 +01:00
Brad Fitzpatrick
93e4a9d84c net/http: use sync.Pool
Update #4720

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/44080043
2013-12-18 15:52:20 -08:00
Brad Fitzpatrick
46b4ed2cf0 encoding/json: use sync.Pool
Benchmark is within the noise. I had to run this a dozen times
each before & after (on wall power, without a browser running)
before I could get halfway consistent numbers, and even then
they jumped all over the place, with the new one sometimes
being better. But these are the best of a dozen each.

Slowdown is expected anyway, since I imagine channels are
optimized more.

benchmark                 old ns/op    new ns/op    delta
BenchmarkCodeEncoder       26556987     27291072   +2.76%
BenchmarkEncoderEncode         1069         1071   +0.19%

benchmark                  old MB/s     new MB/s  speedup
BenchmarkCodeEncoder          73.07        71.10    0.97x

benchmark                old allocs   new allocs    delta
BenchmarkEncoderEncode            2            2    0.00%

benchmark                 old bytes    new bytes    delta
BenchmarkEncoderEncode          221          221    0.00%

Update #4720

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/37720047
2013-12-18 15:52:05 -08:00
Dave Cheney
3f6dbfc44c liblink, cmd/gc: resolve several shift warnings
Address several warnings generated by clang -fsanitize=undefined

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/43050043
2013-12-19 10:34:33 +11:00
Shenghou Ma
8606b97690 cmd/go: show testflag help for "go test -h"
Fixes #6576.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/14502065
2013-12-18 17:40:31 -05:00
Mikio Hara
2b3ad827a6 net: add test cases for the both of netgo, cgo DNS lookups
Update #4078

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/14638043
2013-12-19 07:40:10 +09:00
Jakob Borg
2b693b7c19 encoding/asn1: Fix parsing of non-printable strings in
sequences.

Use the same criteria for when to modify the tag type when
parsing a string in a sequence as when parsing a bare string
field.

Fixes #6726.

R=golang-dev, bradfitz, gobot, agl
CC=golang-dev
https://golang.org/cl/22460043
2013-12-18 17:06:17 -05:00
Jeff R. Allen
17dc712c18 math/rand: Float32/64 must only return values in [0,1)
Float32 and Float64 are now both created by taking the ratio
of two integers which are chosen to fit entirely into the
precision of the desired float type. The previous code
could cast a Float64 with more than 23 bits of ".99999"
into a Float32 of 1.0, which is not in [0,1).

Float32 went from 15 to 21 ns/op (but is now correct).

Fixes #6721.

R=golang-dev, iant, rsc
CC=golang-dev
https://golang.org/cl/22730043
2013-12-18 15:38:53 -05:00