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

8869 Commits

Author SHA1 Message Date
Nigel Tao
ff6b922361 image/gif: respect local color table transparency.
Fixes #6441.

R=r
CC=andybons, golang-dev
https://golang.org/cl/13829043
2013-12-18 15:10:40 -05:00
Brad Fitzpatrick
0f9311811c fmt: use sync.Pool
Update #4720

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/43990043
2013-12-18 11:09:07 -08:00
Brad Fitzpatrick
8c6ef061e3 sync: add Pool type
Adds the Pool type and docs, and use it in fmt.
This is a temporary implementation, until Dmitry
makes it fast.

Uses the API proposal from Russ in http://goo.gl/cCKeb2 but
adds an optional New field, as used in fmt and elsewhere.
Almost all callers want that.

Update #4720

R=golang-dev, rsc, cshapiro, iant, r, dvyukov, khr
CC=golang-dev
https://golang.org/cl/41860043
2013-12-18 11:08:34 -08:00
Shawn Smith
b758d8703a encoding/csv: remove unused unreadRune function
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/37720046
2013-12-18 13:29:27 -05:00
Shawn Smith
a025e1caac html: add tests for UnescapeString edge cases
R=golang-dev, gobot, bradfitz
CC=golang-dev
https://golang.org/cl/40810044
2013-12-18 10:20:25 -08:00
Shawn Smith
c22e79b37b encoding/asn1: add more test cases for BitString.At and TestUTCTime, add test for ObjectIdentifier.Equal
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/42740043
2013-12-18 10:19:07 -08:00
Shawn Smith
aa20d26292 encoding/json: add test for HTMLEscape
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/38220044
2013-12-18 10:18:35 -08:00
Robert Griesemer
108d35bd8e go/ast: added example illustrating CommentMap use.
R=bradfitz
CC=golang-dev
https://golang.org/cl/43930043
2013-12-18 10:10:40 -08:00
Shawn Smith
9d1832f227 encoding/ascii85: add empty string case for Encode test
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/36830046
2013-12-18 08:33:59 -08:00
Anfernee Yongkun Gui
b3f38b4630 net: test dnsconfig_unix with sample resolv.conf
R=golang-dev, adg, bradfitz, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/21580043
2013-12-18 08:26:36 -08:00
Adam Langley
ca3ff9251d crypto/x509: set default signature hash to SHA256 and allow override.
Previously the hash used when signing an X.509 certificate was fixed
and, for RSA, it was fixed to SHA1. Since Microsoft have announced the
deprecation of SHA1 in X.509 certificates, this change switches the
default to SHA256.

It also allows the hash function to be controlled by the caller by
setting the SignatureAlgorithm field of the template.

[1] http://blogs.technet.com/b/pki/archive/2013/11/12/sha1-deprecation-policy.aspx

Fixes #5302.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/40720047
2013-12-18 10:57:56 -05:00
Josh Bleecher Snyder
4f23481483 crypto/x509: add non-cgo darwin system anchor certs
The set of certs fetched via exec'ing `security` is not quite identical
to the certs fetched via the cgo call. The cgo fetch includes
any trusted root certs that the user may have added; exec does not.
The exec fetch includes an Apple-specific root cert; the cgo fetch
does not. Other than that, they appear to be the same.

Unfortunately, os/exec depends on crypto/x509, via net/http. Break the
circular dependency by moving the exec tests to their own package.

This will not work in iOS; we'll cross that bridge when we get to it.

R=golang-dev, minux.ma, agl
CC=golang-dev
https://golang.org/cl/22020045
2013-12-18 10:57:07 -05:00
Brad Fitzpatrick
626da8d737 encoding/json: speed up decoding
Don't make copies of keys while decoding, and don't use the
expensive strings.EqualFold when it's not necessary. Instead,
note in the existing field cache what algorithm to use to
check fold equality... most keys are just ASCII letters.

benchmark               old ns/op    new ns/op    delta
BenchmarkCodeDecoder    137074314    103974418  -24.15%

benchmark                old MB/s     new MB/s  speedup
BenchmarkCodeDecoder        14.16        18.66    1.32x

Update #6496

R=golang-dev, rsc, adg, r, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/13894045
2013-12-18 07:30:21 -08:00
Andrew Gerrand
9f2b2dfa86 log: fix example (fix build)
R=golang-dev
CC=golang-dev
https://golang.org/cl/43780043
2013-12-18 17:25:23 +11:00
ChaiShushan
8c530becaf log: add example
Fixes #6028.

R=golang-dev, bradfitz, adg, r
CC=golang-dev
https://golang.org/cl/43320043
2013-12-18 16:24:11 +11:00
ChaiShushan
8eb508dd08 flag: remove unused FlagSet.exitOnError field
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/14279043
2013-12-17 23:18:12 -05:00
Mikio Hara
f439e07b1b net: make TestDNSThreadLimit execute at the end of tests
Because TestDNSThreadLimit consumes tons of file descriptors and
makes other tests flaky when CGO_ENABLE=0 or being with netgo tag.

Fixes #6580.

R=golang-dev, bradfitz, adg, minux.ma
CC=golang-dev
https://golang.org/cl/14639044
2013-12-18 13:05:47 +09:00
Alex Brainman
ae9e4db07c runtime: skip broken TestRuntimeGogoBytes on windows
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/43730043
2013-12-18 14:17:47 +11:00
Keith Randall
deb554934c runtime, gc: call interface conversion routines by reference.
Part of getting rid of vararg C calls.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/23310043
2013-12-17 16:55:06 -08:00
David du Colombier
bccf029fc0 net: rewrite toLower more clearly
Rob suggested this change.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/43670044
2013-12-17 16:32:27 -08:00
Keith Randall
9aae6c1a8b runtime: don't store evacuate bit as low bit of hashtable overflow pointer.
Hash tables currently store an evacuated bit in the low bit
of the overflow pointer.  That's probably not sustainable in the
long term as GC wants correctly typed & aligned pointers.  It is
also a pain to move any of this code to Go in the current state.

This change moves the evacuated bit into the tophash entries.

Performance change is negligable.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/14412043
2013-12-17 15:23:31 -08:00
Marko Tiikkaja
ab05a855c6 database/sql: Fix inaccurate comment
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/40370051
2013-12-17 14:53:31 -08:00
Michael Hudson-Doyle
0a6ad46b4f reflect: Add tests for Call with functions taking and returning structs.
gccgo has problems using reflect.Call with functions that take and
return structs with no members.  Prior to fixing that problem there, I
thought it sensible to add some tests of this situation.

Update #6761

First contribution to Go, apologies in advance if I'm doing it wrong.

R=golang-dev, dave, minux.ma, iant, khr, bradfitz
CC=golang-dev
https://golang.org/cl/26570046
2013-12-17 14:49:51 -08:00
Caleb Spare
e9895d92e0 container/list: Add missing period to doc comment for Front
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/38540046
2013-12-17 14:21:11 -08:00
David du Colombier
e87b171013 net: reimplement toLower to not depend on strings
R=golang-dev, r, bradfitz
CC=golang-dev, jas
https://golang.org/cl/43610043
2013-12-17 14:19:11 -08:00
Brad Fitzpatrick
4b76a31c6d runtime: don't crash in SetFinalizer if sizeof *x is zero
And document it explicitly, even though it already said
it wasn't guaranteed.

Fixes #6857

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/43580043
2013-12-17 14:18:58 -08:00
Arne Hormann
a1a3d21355 database/sql: fix typo in comment
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/43300043
2013-12-18 08:17:43 +11:00
Brad Fitzpatrick
ff8e45828c os: avoid a string concat in readdir
R=golang-dev, crawshaw
CC=golang-dev
https://golang.org/cl/37690045
2013-12-17 12:25:32 -08:00
Brad Fitzpatrick
6a1a2170bc os, path/filepath: don't ignore Lstat errors in Readdir
os: don't ignore LStat errors in Readdir. If it's ENOENT,
on the second pass, just treat it as missing. If it's another
error, it's real.

path/filepath: use ReaddirNames instead of Readdir in Walk,
in order to obey the documented WalkFunc contract of returning
each walked item's LStat error, if any.

Fixes #6656
Fixes #6680

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/43530043
2013-12-17 12:19:01 -08:00
Julien Schmidt
762a9d934e database/sql: fix auto-reconnect in prepared statements
This also fixes several connection leaks.
Fixes #5718

R=bradfitz, adg
CC=alberto.garcia.hierro, golang-dev
https://golang.org/cl/14920046
2013-12-17 11:57:30 -08:00
Rob Pike
a075fdbaa6 image: roll back 13239051 (add RGB and RGB48)
They cause too much bloat in the internals as we find ourselves adding
special case code for all the cross-connections. It's better to use RGBA
and just max out the alpha. We lose a little memory but reduce the number
of special cases the encoders, decoders, and drawers need to provide.

R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/42910045
2013-12-17 10:49:45 -08:00
ChaiShushan
64379b854f all: add missing copyright
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/43290043
2013-12-17 06:52:32 -08:00
Shenghou Ma
98f16ad112 time: fix test error in Chinese edition of Windows
On the Chinese Windows XP system that I'm using, GetTimeZoneInformation returns a struct containing "中国标准时间" (China Standard Time in Chinese) in both StandardName and DaylightName (which is correct, because China does not use DST). However, in registry, under key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\China Standard Time, the key Std and Dlt contain "中国标准时间" (China Standard Time in Chinese) and "中国夏季时间" (China Summer Time in Chinese) respectively. This means that time.toEnglishName() cannot determine the abbreviation for the local timezone (CST) and causes test failures (time.Local is empty)

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/43210043
2013-12-17 02:43:14 -05:00
Josh Bleecher Snyder
4a18e0edd9 math/rand: minor optimization to Perm
Instead of writing out 0..n and then reading it
back, just use i when it is needed.

Wikipedia calls this the "inside-out" implementation:
http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle

This yields identical values to the previous
implementation, given the same seed. (Note that the
output from Example_rand is unchanged.)

2.8 GHz Intel Core i7, results very stable:

benchmark          old ns/op    new ns/op    delta
BenchmarkPerm3           138          136   -1.45%
BenchmarkPerm30          825          803   -2.67%

Stock Raspberry Pi, minimum improvement out of three runs:

benchmark          old ns/op    new ns/op    delta
BenchmarkPerm3          5774         5664   -1.91%
BenchmarkPerm30        32582        29381   -9.82%

R=golang-dev, dave, mtj, adg
CC=golang-dev
https://golang.org/cl/21030043
2013-12-17 13:49:34 +11:00
Marko Tiikkaja
1f20ab1116 database/sql: Check errors in QueryRow.Scan
The previous coding did not correctly check for errors from the driver's
Next() or Close(), which could mask genuine errors from the database, as
witnessed in issue #6651.

Even after this change errors from Close() will be ignored if the query
returned no rows (as Rows.Next will have closed the handle already), but it
is a lot easier for the drivers to guard against that.

Fixes #6651.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/41590043
2013-12-16 12:48:35 -08:00
David du Colombier
20dee338c3 net: lookup protocol in lower-case on Plan 9
Protocol keywords are case-insensitive,
but the Ndb database is case-sensitive.

Also use the generic net protocol instead
of tcp in lookupHost.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/40600047
2013-12-16 12:00:23 -08:00
Daniel Lidén
4e23b69314 strings: Add example function for IndexAny
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/42310044
2013-12-16 10:50:56 -08:00
Robin Eklind
ab9b2ae38c strings: Add IndexFunc example
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/42370043
2013-12-16 10:44:23 -08:00
Robin Eklind
7b53e32e0b strings: Update Trim example.
Use an input which better shows that behaviour of the function. Only leading
and trailing runes are trimed, not intermediate ones.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/42390043
2013-12-16 10:40:28 -08:00
Russ Cox
a392cf4fd3 runtime: fix test
Was supposed to be in the nm CL.

TBR=r
CC=golang-dev
https://golang.org/cl/42870043
2013-12-16 12:59:30 -05:00
Russ Cox
08b846b129 debug/goobj: add package for reading new Go object files
R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/40610043
2013-12-16 12:52:21 -05:00
Robin Eklind
a6ebc88bac strings: Add FieldsFunc example.
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/42360043
2013-12-16 09:43:03 -08:00
Dave Cheney
62baae6e57 unicode/utf16: add explicit test for decoding invalid runes.
The EncodeRune test exercises DecodeRune, but only for runes that it can encode. Add an explicit test for invalid utf16 surrogate pairs.

Bonus: coverage is now 100%

unicode/utf16/utf16.go: IsSurrogate     100.0%
unicode/utf16/utf16.go: DecodeRune      100.0%
unicode/utf16/utf16.go: EncodeRune      100.0%
unicode/utf16/utf16.go: Encode          100.0%
unicode/utf16/utf16.go: Decode          100.0%
total:                  (statements)    100.0%

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/39150044
2013-12-16 12:35:25 +11:00
Dave Cheney
fb31a0b1d0 unicode/utf16: add explicit tests for IsSurrogate
Update #6956

Add tests for IsSurrogate.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/42570043
2013-12-16 11:15:23 +11:00
Adam Langley
1dabd71666 crypto/tls: generate random serial numbers.
NSS (used in Firefox and Chrome) won't accept two certificates with the same
issuer and serial. But this causes problems with self-signed certificates
with a fixed serial number.

This change randomises the serial numbers in the certificates generated by
generate_cert.go.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/38290044
2013-12-15 12:57:57 -05:00
Adam Langley
1d546005af crypto/cipher: fix CFB mode.
a073d65e6f8c had a couple of bugs in the CFB mode that I missed in code review:
        1) The loop condition wasn't updated from the old version.
        2) It wasn't safe when src and dst aliased.

Fixes #6950.

R=golang-dev, hanwen
CC=golang-dev
https://golang.org/cl/42110043
2013-12-15 12:55:59 -05:00
Russ Cox
bc135f6492 runtime: fix crash in runtime.GoroutineProfile
This is a possible Go 1.2.1 candidate.

Fixes #6946.

R=iant, r
CC=golang-dev
https://golang.org/cl/41640043
2013-12-13 15:44:57 -05:00
Shenghou Ma
c134ce272f bytes: fix description of FieldsFunc
Similar to CL 3814041 that fixed the same issue in strings.
Fixes #6941.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/41490045
2013-12-12 22:13:19 -05:00
Ian Lance Taylor
52ecd2ce96 debug/dwarf: remove unused field addrsize from Data
The addrsize field is not a constant for an entire executable
file, and is now handled by the dataFormat interface when
reading the data.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/41620043
2013-12-12 18:55:05 -08:00
Ian Lance Taylor
c0946afb9c reflect: correct function name in panic string
R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/36840045
2013-12-12 18:54:48 -08:00
Richard Musiol
9394629b89 crypto/rc4: fix type errors in pure Go implementation
R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/40540049
2013-12-12 14:32:31 -05:00
Nick Craig-Wood
107d18299c crypto/sha1: Optimise FUNC1 with alternate formulation
According to Wikipedia: http://en.wikipedia.org/wiki/SHA-1
there is an alternate formulation for the FUNC1 transform,
namely

f1 = d xor (b and (c xor d))

instead of

f1 = (b and c) or ((not b) and d)

This reduces the instruction count of FUNC1 from 6 to 4 and
makes about 5% speed improvement on amd64 and suprisingly 17%
on 386.

amd64 Intel(R) Core(TM) i7 CPU Q 820 @ 1.73GHz:

benchmark              old ns/op    new ns/op    delta
BenchmarkHash8Bytes          506          499   -1.38%
BenchmarkHash1K             3099         2961   -4.45%
BenchmarkHash8K            22292        21243   -4.71%

benchmark               old MB/s     new MB/s  speedup
BenchmarkHash8Bytes        15.80        16.00    1.01x
BenchmarkHash1K           330.40       345.82    1.05x
BenchmarkHash8K           367.48       385.63    1.05x

i386 Intel(R) Core(TM) i7 CPU Q 820 @ 1.73GHz:

benchmark              old ns/op    new ns/op    delta
BenchmarkHash8Bytes          647          615   -4.95%
BenchmarkHash1K             3673         3161  -13.94%
BenchmarkHash8K            26141        22374  -14.41%

benchmark               old MB/s     new MB/s  speedup
BenchmarkHash8Bytes        12.35        13.01    1.05x
BenchmarkHash1K           278.74       323.94    1.16x
BenchmarkHash8K           313.37       366.13    1.17x

The improvements on an Intel(R) Core(TM) i7-4770K CPU @
3.50GHz were almost identical.

R=golang-dev, r, hanwen
CC=golang-dev, rsc
https://golang.org/cl/19910043
2013-12-12 11:26:36 -08:00
ChaiShushan
e5902fc70f image: add RGB and RGB48
R=golang-dev, r, nigeltao
CC=golang-dev
https://golang.org/cl/13239051
2013-12-12 11:24:27 -08:00
Han-Wen Nienhuys
b2a198ce39 crypto/cipher: speed up gcmInc32.
The counter is not secret, so the code does not need to be
constant time.

benchmark                    old MB/s     new MB/s  speedup
BenchmarkAESGCMSeal1K           89.90        92.84    1.03x
BenchmarkAESGCMOpen1K           89.16        92.30    1.04x

R=agl
CC=golang-dev
https://golang.org/cl/40690046
2013-12-12 11:25:17 -05:00
Felix Geisendörfer
5ad5b7a551 fmt: Fix signed zero-padding for positive floats
Space padding still has the same issue, I will send a separate patch for that
if this one gets accepted.
Fixes #6856.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/35660043
2013-12-12 06:40:16 -08:00
Josh Bleecher Snyder
563d0b62b8 net, text/tabwriter: use cap arg to make
Changes generated by:

gofmt -w -r 'make(a, b)[0:0] -> make(a, 0, b)' src/pkg

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/24820045
2013-12-12 10:13:17 +04:00
Josh Bleecher Snyder
cf51702bba net: don't leave hostsPath unrestored on error in TestLookupStaticHost
If the return was reached, then hostsPath would not be properly restored
to its original value. See the (lengthy) discussion at
https://golang.org/cl/15960047/

I assume that this is not for Go 1.2; mailing now since I promised to do so.
I will plan to ping once Go 1.2 is out.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/16200043
2013-12-12 10:12:06 +04:00
Adam Langley
2f43ce7fb0 crypto/x509: fix typo in comment.
Fixes #6633.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/40720046
2013-12-11 17:27:29 -05:00
Han-Wen Nienhuys
5744be9fe4 crypto/cipher: speed up xor operations in CBC, CFB, OBF, CTR
and GCM on 386 and amd64

Intel(R) Core(TM) i5-2540M CPU @ 2.60GHz:

benchmark                    old MB/s     new MB/s  speedup
BenchmarkAESGCMSeal1K           82.39        92.05    1.12x
BenchmarkAESGCMOpen1K           82.28        91.88    1.12x
BenchmarkAESCFBEncrypt1K       141.54       277.59    1.96x
BenchmarkAESCFBDecrypt1K       133.06       278.07    2.09x
BenchmarkAESOFB1K              160.51       380.24    2.37x
BenchmarkAESCTR1K              164.07       429.25    2.62x
BenchmarkAESCBCEncrypt1K       170.99       263.74    1.54x
BenchmarkAESCBCDecrypt1K       124.96       249.14    1.99x

Fixes #6741.

R=agl, dave, agl
CC=golang-dev
https://golang.org/cl/24250044
2013-12-11 16:05:02 -05:00
Joel Sing
75800a9a28 crypto/sha256: block implementation in amd64 assembly
Benchmark on Intel(R) Xeon(R) CPU X5650  @ 2.67GHz

benchmark              old ns/op    new ns/op    delta
BenchmarkHash8Bytes         1259          677  -46.23%
BenchmarkHash1K            14387         6749  -53.09%
BenchmarkHash8K           106006        50107  -52.73%

benchmark               old MB/s     new MB/s  speedup
BenchmarkHash8Bytes         6.35        11.81    1.86x
BenchmarkHash1K            71.17       151.72    2.13x
BenchmarkHash8K            77.28       163.49    2.12x

R=agl
CC=golang-dev
https://golang.org/cl/28460043
2013-12-11 11:41:30 -05:00
Shenghou Ma
77fe6befb7 net/http: document that body is closed after (*Request).Write.
Fixes #6911.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/38690043
2013-12-10 23:35:50 -05:00
Carl Shapiro
c69402d82b runtime: remove outdated comment and related indentation
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/39810043
2013-12-10 11:17:43 -08:00
Adam Langley
ddbad5ef20 crypto/x509: fix behaviour of KeyUsageAny.
(Reporter wasn't able to provide a certificate chain that uses this
feature for testing.)

Fixes #6831

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/40340043
2013-12-10 14:06:26 -05:00
Joel Sing
517e49eb29 syscall: skip routing messages with mismatched version
Skip routing messages with a mismatched version, rather than failing
and returning EINVAL. Only return EINVAL if we were unable to parse
any of the routing messages (presumably due to a version mismatch).

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/30340043
2013-12-11 00:03:46 +11:00
Alberto García Hierro
c8869e9caf database/sql: Remove redundant condition in if
The final condition (db.maxIdleConnsLocked() > db.freeConn.Len()) can
only be true iff db.maxIdleConnsLocked() is greater than 0, so previously
checking if it's greater than 0 is a waste, specially when that involves
a method call which (ATM) can't be inlined and includes a switch.

Dissasembly follows (test for err == nil has been omitted for clarity):

Before:
43c357: cmp    $0x0,%bl
43c35a: jne    43c3ce <database/sql.(*DB).putConnDBLocked+0x1ce>
43c35c: mov    %rax,(%rsp)
43c360: callq  43aec0 <database/sql.(*DB).maxIdleConnsLocked>
43c365: mov    0x8(%rsp),%rbx
43c36a: cmp    $0x0,%rbx
43c36e: jle    43c3ce <database/sql.(*DB).putConnDBLocked+0x1ce>
43c370: mov    0x30(%rsp),%rbx
43c375: mov    %rbx,(%rsp)
43c379: callq  43aec0 <database/sql.(*DB).maxIdleConnsLocked>
43c37e: mov    0x30(%rsp),%rdx
43c383: mov    0x8(%rsp),%rcx
43c388: mov    0x28(%rdx),%rbp
43c38c: mov    0x28(%rbp),%rbx
43c390: cmp    %rcx,%rbx
43c393: jge    43c3ce <database/sql.(*DB).putConnDBLocked+0x1ce>
43c395: mov    0x28(%rdx),%rbp
43c399: mov    %rbp,(%rsp)
43c39d: mov    0x38(%rsp),%rcx
43c3a2: mov    $0x556c60,%eax
43c3a7: mov    %rax,0x8(%rsp)
43c3ac: mov    %rcx,0x10(%rsp)
43c3b1: callq  4db5b0 <container/list.(*List).PushFront>

After:
43c357: cmp    $0x0,%bl
43c35a: jne    43c3b5 <database/sql.(*DB).putConnDBLocked+0x1b5>
43c35c: mov    %rax,(%rsp)
43c360: callq  43aec0 <database/sql.(*DB).maxIdleConnsLocked>
43c365: mov    0x30(%rsp),%rdx
43c36a: mov    0x8(%rsp),%rcx
43c36f: mov    0x28(%rdx),%rbp
43c373: mov    0x28(%rbp),%rbx
43c377: cmp    %rcx,%rbx
43c37a: jge    43c3b5 <database/sql.(*DB).putConnDBLocked+0x1b5>
43c37c: mov    0x28(%rdx),%rbp
43c380: mov    %rbp,(%rsp)
43c384: mov    0x38(%rsp),%rcx
43c389: mov    $0x556c60,%eax
43c38e: mov    %rax,0x8(%rsp)
43c393: mov    %rcx,0x10(%rsp)
43c398: callq  4db590 <container/list.(*List).PushFront>

R=golang-dev, bradfitz, iant
CC=golang-dev
https://golang.org/cl/14656044
2013-12-10 16:10:09 +04:00
Mikio Hara
e5a7ab8550 net: fix nits found by go tool vet
R=golang-dev, dave, adg
CC=golang-dev
https://golang.org/cl/27430043
2013-12-10 14:30:52 +09:00
Shenghou Ma
a4b66b7703 os: fix build.
CL 36800043 and CL 36930044 have a merge conflict that I overlooked.

R=golang-dev
CC=golang-dev
https://golang.org/cl/39850043
2013-12-09 23:46:21 -05:00
Shenghou Ma
4f2cfdc7f4 crypto/rand: support generation of 2-5 bit primes, also document the error return for Prime
Fixes #6849.
Fixes #6867.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/35870043
2013-12-09 23:25:49 -05:00
Shenghou Ma
aa0ae7554c os: clarify docs for Rename.
Three changes:
1. mention "move" to clarify things up.
2. use {old,new}path instead of {old,new}name, which makes it clear what
   relative path would do here.
3. mention "OS-specific restrictions might apply".

Fixes #6887.

R=golang-dev, alex.brainman, iant, r
CC=golang-dev
https://golang.org/cl/36930044
2013-12-09 23:25:13 -05:00
Shenghou Ma
46d1461ab7 strconv: add example for Unquote.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/38920043
2013-12-09 23:24:58 -05:00
Carl Shapiro
f574726f16 runtime: check for signed zero in printfloat
Fixes #6899

R=golang-dev, r, cshapiro, iant, rsc
CC=golang-dev
https://golang.org/cl/38120043
2013-12-09 17:51:30 -08:00
Russ Cox
4230044bb8 runtime: remove non-extern decls of runtime.goarm
The linker is in charge of providing the one true declaration.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/39560043
2013-12-09 19:35:07 -05:00
Anthony Martin
274a8e3f56 runtime: do not use memmove in the Plan 9 signal handler
Fixes a regression introduced in revision 4cb93e2900d0.

That revision changed runtime·memmove to use SSE MOVOU
instructions for sizes between 17 and 256 bytes. We were
using memmove to save a copy of the note string during
the note handler. The Plan 9 kernel does not allow the
use of floating point in note handlers (which includes
MOVOU since it touches the XMM registers).

Arguably, runtime·memmove should not be using MOVOU when
GO386=387 but that wouldn't help us on amd64. It's very
important that we guard against any future changes so we
use a simple copy loop instead.

This change is extracted from CL 9796043 (since that CL
is still being ironed out).

R=rsc
CC=golang-dev
https://golang.org/cl/34640045
2013-12-09 18:41:48 -05:00
Carl Shapiro
bc9691c465 cmd/gc, runtime: correct a misnomer regarding dead value maps
The funcdata symbol incorrectly named the dead value map the
dead pointer map.  The dead value map identifies all dead
values, including pointers and non-pointers, in a stack frame.
The purpose of this map is to allow the runtime to poison
locations of dead data to catch lost invariants.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/38670043
2013-12-09 14:45:10 -08:00
Russ Cox
7c17982f72 runtime: remove cross-function jump in vlop_arm.s
The new linker will disallow this on arm
(it is already disallowed on amd64 and 386)
in order to be able to lay out each function
separately.

The restriction is only for jumps into the middle
of a function; jumps to the beginning of a function
remain fine.

Prereq for linker cleanup (golang.org/s/go13linker).

R=iant, r, minux.ma
CC=golang-dev
https://golang.org/cl/35800043
2013-12-08 22:52:08 -05:00
Carl Shapiro
76c54c1193 runtime: add GODEBUG option for an electric fence like heap mode
When enabled this new debugging mode will allocate objects on
their own page and never recycle memory addresses.  This is an
essential tool to root cause a broad class of heap corruption.

R=golang-dev, dave, daniel.morsing, dvyukov, rsc, iant, cshapiro
CC=golang-dev
https://golang.org/cl/22060046
2013-12-06 14:40:45 -08:00
Carl Shapiro
f056daf075 cmd/5g, cmd/5l, cmd/6g, cmd/6l, cmd/8g, cmd/8l, cmd/gc, runtime: generate pointer maps by liveness analysis
This change allows the garbage collector to examine stack
slots that are determined as live and containing a pointer
value by the garbage collector.  This results in a mean
reduction of 65% in the number of stack slots scanned during
an invocation of "GOGC=1 all.bash".

Unfortunately, this does not yet allow garbage collection to
be precise for the stack slots computed as live.  Pointers
confound the determination of what definitions reach a given
instruction.  In general, this problem is not solvable without
runtime cost but some advanced cooperation from the compiler
might mitigate common cases.

R=golang-dev, rsc, cshapiro
CC=golang-dev
https://golang.org/cl/14430048
2013-12-05 17:35:22 -08:00
Carl Shapiro
77913e9aab encoding/gob: do not hide an unsafe.Pointer in a uintptr
R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/23320044
2013-12-03 15:24:27 -08:00
Carl Shapiro
48279bd567 runtime: add an allocation and free tracing for gc debugging
Output for an allocation and free (sweep) follows

MProf_Malloc(p=0xc2100210a0, size=0x50, type=0x0 <single object>)
        #0 0x46ee15 runtime.mallocgc /usr/local/google/home/cshapiro/go/src/pkg/runtime/malloc.goc:141
        #1 0x47004f runtime.settype_flush /usr/local/google/home/cshapiro/go/src/pkg/runtime/malloc.goc:612
        #2 0x45f92c gc /usr/local/google/home/cshapiro/go/src/pkg/runtime/mgc0.c:2071
        #3 0x45f89e mgc /usr/local/google/home/cshapiro/go/src/pkg/runtime/mgc0.c:2050
        #4 0x45258b runtime.mcall /usr/local/google/home/cshapiro/go/src/pkg/runtime/asm_amd64.s:179

MProf_Free(p=0xc2100210a0, size=0x50)
        #0 0x46ee15 runtime.mallocgc /usr/local/google/home/cshapiro/go/src/pkg/runtime/malloc.goc:141
        #1 0x47004f runtime.settype_flush /usr/local/google/home/cshapiro/go/src/pkg/runtime/malloc.goc:612
        #2 0x45f92c gc /usr/local/google/home/cshapiro/go/src/pkg/runtime/mgc0.c:2071
        #3 0x45f89e mgc /usr/local/google/home/cshapiro/go/src/pkg/runtime/mgc0.c:2050
        #4 0x45258b runtime.mcall /usr/local/google/home/cshapiro/go/src/pkg/runtime/asm_amd64.s:179

R=golang-dev, dvyukov, rsc, cshapiro
CC=golang-dev
https://golang.org/cl/21990045
2013-12-03 14:42:38 -08:00
Carl Shapiro
0368a7ceb6 runtime: move stack scanning into the parallel mark phase
This change reduces the cost of the stack scanning by frames.
It moves the stack scanning from the serial root enumeration
phase to the parallel tracing phase.  The output that follows
are timings for the issue 6482 benchmark

Baseline

BenchmarkGoroutineSelect	      50	 108027405 ns/op
BenchmarkGoroutineBlocking	      50	  89573332 ns/op
BenchmarkGoroutineForRange	      20	  95614116 ns/op
BenchmarkGoroutineIdle		      20	 122809512 ns/op

Stack scan by frames, non-parallel

BenchmarkGoroutineSelect	      20	 297138929 ns/op
BenchmarkGoroutineBlocking	      20	 301137599 ns/op
BenchmarkGoroutineForRange	      10	 312499469 ns/op
BenchmarkGoroutineIdle		      10	 209428876 ns/op

Stack scan by frames, parallel

BenchmarkGoroutineSelect	      20	 183938431 ns/op
BenchmarkGoroutineBlocking	      20	 170109999 ns/op
BenchmarkGoroutineForRange	      20	 179628882 ns/op
BenchmarkGoroutineIdle		      20	 157541498 ns/op

The remaining performance disparity is due to inefficiencies
in gentraceback and its callees.  The effect was isolated by
using a parallel stack scan where scanstack was modified to do
a conservative scan of the stack segments without gentraceback
followed by a call of gentrackback with a no-op callback.

The output that follows are the top-10 most frequent tops of
stacks as determined by the Linux perf record facility.

Baseline

+  25.19%  gc.test  gc.test            [.] runtime.xchg
+  19.00%  gc.test  gc.test            [.] scanblock
+   8.53%  gc.test  gc.test            [.] scanstack
+   8.46%  gc.test  gc.test            [.] flushptrbuf
+   5.08%  gc.test  gc.test            [.] procresize
+   3.57%  gc.test  gc.test            [.] runtime.chanrecv
+   2.94%  gc.test  gc.test            [.] dequeue
+   2.74%  gc.test  gc.test            [.] addroots
+   2.25%  gc.test  gc.test            [.] runtime.ready
+   1.33%  gc.test  gc.test            [.] runtime.cas64

Gentraceback

+  18.12%  gc.test  gc.test             [.] runtime.xchg
+  14.68%  gc.test  gc.test             [.] scanblock
+   8.20%  gc.test  gc.test             [.] runtime.gentraceback
+   7.38%  gc.test  gc.test             [.] flushptrbuf
+   6.84%  gc.test  gc.test             [.] scanstack
+   5.92%  gc.test  gc.test             [.] runtime.findfunc
+   3.62%  gc.test  gc.test             [.] procresize
+   3.15%  gc.test  gc.test             [.] readvarint
+   1.92%  gc.test  gc.test             [.] addroots
+   1.87%  gc.test  gc.test             [.] runtime.chanrecv

R=golang-dev, dvyukov, rsc
CC=golang-dev
https://golang.org/cl/17410043
2013-12-03 14:12:55 -08:00
Keith Randall
24699fb05c runtime: get rid of concatstring's vararg C argument.
Pass as a slice of strings instead.  For 2-5 strings, implement
dedicated routines so no slices are needed.

static call counts in the go binary:
 2 strings: 342 occurrences
 3 strings:  98
 4 strings:  30
 5 strings:  13
6+ strings:  14

Why?  C varags, bad for stack scanning and copying.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/36380043
2013-12-03 10:39:19 -08:00
Keith Randall
c0f2294577 runtime: fix race detector when map keys/values are passed by pointer.
Now that the map implementation is reading the keys and values from
arbitrary memory (instead of from stack slots), it needs to tell the
race detector when it does so.

Fixes #6875.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/36360043
2013-12-02 18:03:25 -08:00
Keith Randall
742f755a29 reflect: test to make sure big Zero()-obtained objects are really zero.
Update #6876.

R=dave, bradfitz
CC=golang-dev
https://golang.org/cl/36370043
2013-12-02 17:58:19 -08:00
Keith Randall
e7d899cba5 reflect: fix Zero() implementation - not every type has a
zero object allocated, so we still need to allocate a new
zero area every time.

Fixes #6876.

R=golang-dev
CC=golang-dev
https://golang.org/cl/36320043
2013-12-02 16:54:29 -08:00
Keith Randall
85138da832 reflect: prevent the callXX routines from calling makeFuncStub
and methodValueCall directly.  Instead, we inline their behavior
inside of reflect.call.

This change is required because otherwise we have a situation where
reflect.callXX calls makeFuncStub, neither of which knows the
layout of the args passed between them.  That's bad for
precise gc & stack copying.

Fixes #6619.

R=golang-dev, dvyukov, rsc, iant, khr
CC=golang-dev
https://golang.org/cl/26970044
2013-12-02 13:36:50 -08:00
Keith Randall
c792bde9ef runtime: don't use ... formal argument to deferreturn.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/28860043
2013-12-02 13:07:15 -08:00
Keith Randall
3278dc158e runtime: pass key/value to map accessors by reference, not by value.
This change is part of the plan to get rid of all vararg C calls
which are a pain for getting exact stack scanning.

We allocate a chunk of zero memory to return a pointer to when a
map access doesn't find the key.  This is simpler than returning nil
and fixing things up in the caller.  Linker magic allocates a single
zero memory area that is shared by all (non-reflect-generated) map
types.

Passing things by reference gets rid of some copies, so it speeds
up code with big keys/values.

benchmark             old ns/op    new ns/op    delta
BenchmarkBigKeyMap           34           31   -8.48%
BenchmarkBigValMap           37           30  -18.62%
BenchmarkSmallKeyMap         26           23  -11.28%

R=golang-dev, dvyukov, khr, rsc
CC=golang-dev
https://golang.org/cl/14794043
2013-12-02 13:05:04 -08:00
Russ Cox
7dd086e52d encoding/gob: do not use MarshalText, UnmarshalText
This seems to be the best of a long list of bad ways to fix this issue.

Fixes #6760.

R=r
CC=golang-dev
https://golang.org/cl/22770044
2013-11-13 21:29:19 -05:00
Andrew Gerrand
b6c7cc3241 encoding/gob: expose encode/decode example
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/26220045
2013-11-14 09:20:29 +11:00
Olivier Duperray
8f10c76471 cmd/godoc: document package-level examples
Fixes  issue  5807 .

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/23940043
2013-11-11 12:09:24 +11:00
Ato Araki
df03aeb67c go/doc: add full stop of Japanese, Chinese and Korean.
This fix will show a good synopsis on package listings in that languages.

R=adg, r
CC=golang-dev
https://golang.org/cl/21130043
2013-11-05 15:13:50 +11:00
Brad Fitzpatrick
692a14787f net/textproto: fix CanonicalMIMEHeaderKey panic
Fixes #6712

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/21450043
2013-11-04 12:35:11 -05:00
Russ Cox
2c98a3bc2e cmd/5l, runtime: fix divide for profiling tracebacks on ARM
Two bugs:
1. The first iteration of the traceback always uses LR when provided,
which it is (only) during a profiling signal, but in fact LR is correct
only if the stack frame has not been allocated yet. Otherwise an
intervening call may have changed LR, and the saved copy in the stack
frame should be used. Fix in traceback_arm.c.

2. The division runtime call adds 8 bytes to the stack. In order to
keep the traceback routines happy, it must copy the saved LR into
the new 0(SP). Change

        SUB $8, SP

into

        MOVW    0(SP), R11 // r11 is temporary, for use by linker
        MOVW.W  R11, -8(SP)

to update SP and 0(SP) atomically, so that the traceback always
sees a saved LR at 0(SP).

Fixes #6681.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/19910044
2013-10-31 18:15:55 +00:00
Russ Cox
b88148b9a0 undo CL 19810043 / 352f3b7c9664
The CL causes misc/cgo/test to fail randomly.
I suspect that the problem is the use of a division instruction
in usleep, which can be called while trying to acquire an m
and therefore cannot store the denominator in m.
The solution to that would be to rewrite the code to use a
magic multiply instead of a divide, but now we're getting
pretty far off the original code.

Go back to the original in preparation for a different,
less efficient but simpler fix.

««« original CL description
cmd/5l, runtime: make ARM integer division profiler-friendly

The implementation of division constructed non-standard
stack frames that could not be handled by the traceback
routines.

CL 13239052 left the frames non-standard but fixed them
for the specific case of a divide-by-zero panic.
A profiling signal can arrive at any time, so that fix
is not sufficient.

Change the division to store the extra argument in the M struct
instead of in a new stack slot. That keeps the frames bog standard
at all times.

Also fix a related bug in the traceback code: when starting
a traceback, the LR register should be ignored if the current
function has already allocated its stack frame and saved the
original LR on the stack. The stack copy should be used, as the
LR register may have been modified.

Combined, these make the torture test from issue 6681 pass.

Fixes #6681.

R=golang-dev, r, josharian
CC=golang-dev
https://golang.org/cl/19810043
»»»

TBR=r
CC=golang-dev
https://golang.org/cl/20350043
2013-10-31 17:18:57 +00:00
Russ Cox
b0db472ea2 cmd/5l, runtime: make ARM integer division profiler-friendly
The implementation of division constructed non-standard
stack frames that could not be handled by the traceback
routines.

CL 13239052 left the frames non-standard but fixed them
for the specific case of a divide-by-zero panic.
A profiling signal can arrive at any time, so that fix
is not sufficient.

Change the division to store the extra argument in the M struct
instead of in a new stack slot. That keeps the frames bog standard
at all times.

Also fix a related bug in the traceback code: when starting
a traceback, the LR register should be ignored if the current
function has already allocated its stack frame and saved the
original LR on the stack. The stack copy should be used, as the
LR register may have been modified.

Combined, these make the torture test from issue 6681 pass.

Fixes #6681.

R=golang-dev, r, josharian
CC=golang-dev
https://golang.org/cl/19810043
2013-10-30 18:50:34 +00:00
Brad Fitzpatrick
7307ffa7cd database/sql: document Result methods
Fixes #5110

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/19280046
2013-10-29 17:38:43 -07:00
Julien Schmidt
e6c4fa58b5 database/sql: Fix typos in doc
R=golang-dev
CC=bradfitz, golang-dev
https://golang.org/cl/17590043
2013-10-29 16:03:13 -07:00
Russ Cox
a508381e89 time: correct path to time zone zip file on Unix
Most Unix systems have their own time zone data,
so we almost never get far enough in the list to
discover that we cannot fall back to the zip file.
Adjust testing to exercise the final fallback.

Plan 9 and Windows were already correct
(and are the main users of the zip file).

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/19280043
2013-10-29 17:11:51 -04:00
Russ Cox
2e984c2180 encoding/xml: fix doc comment
The tag is ",chardata" not "chardata".

Fixes #6631.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/19300046
2013-10-29 17:11:25 -04:00
Brad Fitzpatrick
1428045469 net/http/httputil: fix DumpRequestOut with ContentLength & false body param
Fixes #6471

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/14920050
2013-10-29 14:06:11 -07:00
Russ Cox
ef805fe3a0 os: do not return Lstat errors from Readdir
This CL restores the Go 1.1.2 semantics for os.File's Readdir method.

The code in Go 1.1.2 was rewritten mainly because it looked buggy.
This new version attempts to be clearer but still provide the 1.1.2 results.

The important diff is not this CL's version against tip but this CL's version
against Go 1.1.2.

Go 1.1.2:

        names, err := f.Readdirnames(n)
        fi = make([]FileInfo, len(names))
        for i, filename := range names {
                fip, err := Lstat(dirname + filename)
                if err == nil {
                        fi[i] = fip
                } else {
                        fi[i] = &fileStat{name: filename}
                }
        }
        return fi, err

This CL:

        names, err := f.Readdirnames(n)
        fi = make([]FileInfo, len(names))
        for i, filename := range names {
                fip, lerr := lstat(dirname + filename)
                if lerr != nil {
                        fi[i] = &fileStat{name: filename}
                        continue
                }
                fi[i] = fip
        }
        return fi, err

The changes from Go 1.1.2 are stylistic, not semantic:
1. Use lstat instead of Lstat, for testing (done before this CL).
2. Make error handling in loop body look more like an error case.
3. Use separate error variable name in loop body, to be clear
   we are not trying to influence the final return result.

Fixes #6656.
Fixes #6680.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/18870043
2013-10-29 11:50:40 -04:00
Russ Cox
7dbbb53f37 debug/dwarf: add DWARF 4 form constants
Some versions of clang generate DWARF 4-format attributes
even when using -gdwarf-2. We don't care much about the
values, but we do need to be able to parse past them.

This fixes a bug in Go 1.2 rc2 reported via private mail using
a near-tip version of clang.

R=golang-dev, iant, dvyukov
CC=golang-dev
https://golang.org/cl/18460043
2013-10-29 10:36:51 -04:00
Russ Cox
00a757fb74 runtime: relax preemption assertion during stack split
The case can happen when starttheworld is calling acquirep
to get things moving again and acquirep gets preempted.
The stack trace is in golang.org/issue/6644.

It is difficult to build a short test case for this, but
the person who reported issue 6644 confirms that this
solves the problem.

Fixes #6644.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/18740044
2013-10-28 19:40:40 -04:00
Josh Bleecher Snyder
5644774ea5 net: handle single-line non-\n-terminated files correctly in readLine
Fixes #6646.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/15960047
2013-10-28 19:31:25 -04:00
Andrew Gerrand
6ea5687b46 net/url: fix Encode doc comment
Encoded query strings are always sorted by key; the example wasn't.

R=golang-dev, dsymonds, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/16430043
2013-10-25 23:00:22 +03:00
Brad Fitzpatrick
2d6a13997a strings: fix Replacer bug with prefix matches
singleStringReplacer had a bug where if a string was replaced
at the beginning and no output had yet been produced into the
temp buffer before matching ended, an invalid nil check (used
as a proxy for having matched anything) meant it always
returned its input.

Fixes #6659

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/16880043
2013-10-24 15:51:19 -07:00
Matthew Cottingham
17a03d8650 database/sql: link to wiki in package docs
Update #5886

R=golang-dev, kamil.kisiel, adg, r, rsc, dave, arnehormann, bradfitz
CC=golang-dev
https://golang.org/cl/14087043
2013-10-24 10:13:23 -07:00
Shenghou Ma
d220c9957c time: fix ParseDuration overflow when given more than 9 digits on 32-bit arch
Fixes #6617.

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/15080043
2013-10-22 18:33:05 -04:00
Russ Cox
089bc25ae2 math: remove unnecessary source file
The routines in this file are dregs from a very early copy of the math API.
There are no Go prototypes and no non-amd64 implementations.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/15750046
2013-10-22 10:37:33 -04:00
Bill Neubauer
72d40a4bd9 go/build: document the go1.2 build tag
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/14930046
2013-10-22 16:43:32 +04:00
Adam Langley
7d9acff751 crypto/x509: name constraints should be a disjunction.
The code was requiring that all constraints be met, but it should be
satisfied by meeting *any* of them.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/15570044
2013-10-21 19:01:24 -04:00
Adam Langley
efed6f99d2 crypto/tls: advertise support for RSA+SHA1 in TLS 1.2 handshake.
Despite SHA256 support being required for TLS 1.2 handshakes, some
servers are aborting handshakes that don't offer SHA1 support.

This change adds support for signing TLS 1.2 ServerKeyExchange messages
with SHA1. It does not add support for signing TLS 1.2 client
certificates with SHA1 as that would require the handshake to be
buffered.

Fixes #6618.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/15650043
2013-10-21 16:35:09 -04:00
David Symonds
fae4553a9d net/mail: fix minor doc typo.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/15510043
2013-10-21 17:32:45 +11:00
Russ Cox
66f49f78a5 net: make sure failed Dial returns nil Conn
Fixes #6614.

R=golang-dev, bradfitz, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/14950045
2013-10-18 15:35:45 -04:00
Dmitriy Vyukov
f6329700ae runtime: remove nomemprof
Nomemprof seems to be unneeded now, there is no recursion.
If the recursion will be re-introduced, it will break loudly by deadlocking.
Fixes #6566.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/14695044
2013-10-18 10:45:19 +04:00
Brad Fitzpatrick
f41b43a024 net/url: fix regression when serializing relative URLs
Only add a slash to path if it's a separator between
a host and path.

Fixes #6609

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/14815043
2013-10-17 16:06:40 -07:00
Ian Lance Taylor
88c448ba40 runtime: correct test for when to poll network
Fixes #6610.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/14793043
2013-10-17 11:57:48 -07:00
Ian Lance Taylor
667303f158 runtime: correct parameter name in MCentral_AllocList comment
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/14792043
2013-10-17 11:57:00 -07:00
Russ Cox
4dce7f8575 encoding/xml: accept chains of interfaces and pointers
Fixes #6556.

R=golang-dev, iant, adg
CC=golang-dev
https://golang.org/cl/14747043
2013-10-17 12:13:33 -04:00
Alberto García Hierro
e39eda1366 database/sql: make tests repeatable with -cpu=n,n
New test added in CL 14611045 causes a deadlock when
running the tests with -cpu=n,n because the fakedb
driver always waits when opening a new connection after
running TestConnectionLeak.  Reset its state after.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/14780043
2013-10-17 09:02:32 -07:00
Brad Fitzpatrick
e5babeff8a database/sql: fix some test fmt verbs
Found by vet.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14762044
2013-10-16 16:30:39 -07:00
Alberto García Hierro
37db880469 database/sql: Fix connection leak and potential deadlock
CL 10726044 introduced a race condition which causes connections
to be leaked under certain circumstances. If SetMaxOpenConns is
used, the application eventually deadlocks. Otherwise, the number
of open connections just keep growing indefinitely.

Fixes #6593

R=golang-dev, bradfitz, tad.glines, bketelsen
CC=golang-dev
https://golang.org/cl/14611045
2013-10-16 09:22:57 -07:00
Alberto García Hierro
478f4b6754 database/sql: fix double decrement of numOpen count; test for connection leaks
Add a check at the end of every test to make sure
there are no leaked connections after running a test.

Avoid incorrectly decrementing the number of open connections
when the driver connection ends up it a bad state (numOpen was
decremented twice).

Prevent leaking a Rows struct (which ends up leaking a
connection) in Row.Scan() when a *RawBytes destination is
improperly used.

Close the Rows struct in TestRowsColumns.

Update #6593

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/14642044
2013-10-16 09:17:25 -07:00
Alex Brainman
9aee98def8 undo CL 14231047 / 2f4c2dde2756
undone because the change slows down profile collection
significantly and unpredictable at times (see comments
at https://golang.org/cl/14231047 for details)

««« original CL description
runtime: collect profiles even while on g0 stack

Fixes #6417

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

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/14535046
2013-10-15 14:37:43 -04:00
Alex Brainman
9a420b79d7 runtime/pprof: disable flaky TestGoroutineSwitch on windows
Update #6417

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/14604043
2013-10-15 13:00:06 +11:00
Michael Piatek
21e6b90d36 net/http: skip content-type sniffing if the header is explicitly unset.
Fixes #5953

R=dsymonds, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/14434044
2013-10-15 08:22:04 +11:00
Ian Lance Taylor
c78d67fb86 debug/dwarf: report the value of an unrecognized attribute format
R=golang-dev, r, minux.ma
CC=golang-dev
https://golang.org/cl/14669045
2013-10-14 10:53:55 -07:00
Ian Lance Taylor
5b2f626159 go/build: add GOOS and GOARCH to name of gccgo pkg directory
This matches the behaviour of builder.includeArgs in
cmd/go/build.go.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/14535048
2013-10-11 16:17:45 -07:00
Ian Lance Taylor
96648e0195 go/build: fix test if built with CGO_ENABLED=0
Fixes #6567.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/14502060
2013-10-11 15:55:50 -07:00
Ian Lance Taylor
649fc255a9 net: fix TestDialFailPDLeak to work when GOMAXPROCS is large
Fixes #6553.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/14526048
2013-10-09 13:52:29 -07:00
Keith Randall
139cc96a57 runtime: markfreed's error reports should be prefixed with "markfreed", not "markallocated".
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14441055
2013-10-09 13:28:47 -07:00
Ian Lance Taylor
cb30917387 runtime/cgo: mark callback functions as NOSPLIT
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/14448044
2013-10-09 08:44:47 -07:00
Russ Cox
0965459bd9 debug/dwarf: handle surprising clang encoding
Fixes a bug in cgo on OS X using clang.
See golang.org/issue/6472 for details.

Fixes #6472.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14575043
2013-10-09 11:08:22 -04:00
Ian Lance Taylor
7bbe0163c7 net: fix typo in failure message in test
R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/14582043
2013-10-09 06:44:11 -07:00
Russ Cox
8ba6deb1ec compress/flate: fix infinite loop on malformed data
Test using compress/gzip, because that's how the
data arrived.

Fixes #6550.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14441051
2013-10-09 08:37:06 -04:00
Rob Pike
daa61d1eb3 encoding/gob: add examples
Also tweak the package document, putting in section headings and
adding a sentence about intended use.

Fixes #4925.

R=golang-dev, iant, adg, ugorji
CC=golang-dev
https://golang.org/cl/14519044
2013-10-08 13:13:40 -07:00
Carl Shapiro
254dc5fdbe cmd/go, runtime: express armv5t architecture constraint differently
Instead of adding an -march=armv5t flag to the gcc command
line, the same effect is obtained with an ".arch armv5t"
pseudo op in the assembly file that uses armv5t instructions.

R=golang-dev, iant, dave
CC=golang-dev
https://golang.org/cl/14511044
2013-10-08 10:40:51 -07:00
Rob Pike
9795882704 math: the trig functions work in radians; document that
Fixes #6543
6543 is also a fine NGC object.

R=golang-dev, dsymonds, kamil.kisiel, minux.ma
CC=golang-dev
https://golang.org/cl/14515044
2013-10-07 16:32:47 -07:00
Joel Sing
fc1bea321d os/user: fix user lookups on dragonfly
Like FreeBSD, DragonFly does not provide a sysconf value for
_SC_GETPW_R_SIZE_MAX.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14469043
2013-10-07 09:21:33 -07:00
Joel Sing
fba015ecb4 os/user: enable tests on all supported platforms
All of the currently supported platforms have a working user
implementation and do not use stubs. As a result, enable the tests
on all platforms rather than whitelisting.

R=golang-dev, dave, iant
CC=golang-dev
https://golang.org/cl/14454044
2013-10-07 09:12:17 -07:00
Joel Sing
932428a1ed os/signal: make test logs reflect reality
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14470043
2013-10-07 09:04:20 -07:00
Keith Randall
869368a528 runtime: fix bug in maps at the intersection of iterators, growing, and NaN keys
If an iterator is started while a map is in the middle of a grow,
and the map has NaN keys, then those keys might get returned by
the iterator more than once.  This fix makes the evacuation decision
deterministic and repeatable for NaN keys so each one gets returned
only once.

R=golang-dev, r, khr, iant
CC=golang-dev
https://golang.org/cl/14367043
2013-10-04 13:54:03 -07:00
Keith Randall
15baf6b4ac runtime: remove 3 unused declarations.
R=golang-dev, cshapiro, iant
CC=golang-dev
https://golang.org/cl/14405043
2013-10-04 13:22:20 -07:00
Ian Lance Taylor
ef4e12a4ba reflect: test using a MakeFunc value in a couple of different ways
The gccgo implementation mishandled calling Interface on a
value created by MakeFunc.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14401043
2013-10-04 13:12:50 -07:00
Alex Brainman
4207897dcc runtime: collect profiles even while on g0 stack
Fixes #6417

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/14231047
2013-10-04 13:53:34 +10:00
Ian Lance Taylor
e59db90bfb reflect: add a test that gccgo mishandled
Failure occurred when using reflect.Call to pass a func value
following a non-pointer value.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14186043
2013-10-03 13:23:02 -07:00
Rob Pike
c4579635cf sync/atomic: explain how to subtract an unsigned constant
Explain for those unfamiliar with twos-complement arithmetic how to
implement negation of signed positive constant.
Fixes #6408.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/14267044
2013-10-03 10:40:42 -07:00
Russ Cox
01479b6c4a go/doc: update ToHTML doc comment
Update #5429

R=golang-dev, r, dan.kortschak
CC=golang-dev
https://golang.org/cl/14293043
2013-10-03 09:49:12 -04:00
Russ Cox
408238e20b runtime: change default stack segment size to 8 kB
Changing from 4 kB to 8 kB brings significant improvement
on a variety of the Go 1 benchmarks, on both amd64
and 386 systems.

Significant runtime reductions:

          amd64  386
GoParse    -14%  -1%
GobDecode  -12% -20%
GobEncode  -64%  -1%
JSONDecode  -9%  -4%
JSONEncode -15%  -5%
Template   -17% -14%

In the longer term, khr's new stacks will avoid needing to
make this decision at all, but for Go 1.2 this is a reasonable
stopgap that makes performance significantly better.

Demand paging should mean that if the second 4 kB is not
used, it will not be brought into memory, so the change
should not adversely affect resident set size.
The same argument could justify bumping as high as 64 kB
on 64-bit machines, but there are diminishing returns
after 8 kB, and using 8 kB limits the possible unintended
memory overheads we are not aware of.

Benchmark graphs at
http://swtch.com/~rsc/gostackamd64.html
http://swtch.com/~rsc/gostack386.html

Full data at
http://swtch.com/~rsc/gostack.zip

R=golang-dev, khr, dave, bradfitz, dvyukov
CC=golang-dev
https://golang.org/cl/14317043
2013-10-03 09:19:10 -04:00
Russ Cox
94a6511b7f net: use original argument in lookup error
Fixes #6324.

R=golang-dev, iant, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/13280049
2013-10-02 22:09:54 -04:00