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

13745 Commits

Author SHA1 Message Date
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
ChaiShushan
3d2c4df983 cmd/yacc: gofmt y.go
R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/36950043
2013-12-18 15:17:08 -05:00
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
David du Colombier
9607255760 cmd/6g, cmd/gc, cmd/ld: fix Plan 9 amd64 warnings
warning: src/cmd/6g/reg.c:671 format mismatch d VLONG, arg 4
warning: src/cmd/gc/pgen.c:230 set and not used: oldstksize
warning: src/cmd/gc/plive.c:877 format mismatch lx UVLONG, arg 2
warning: src/cmd/gc/walk.c:2878 set and not used: cbv
warning: src/cmd/gc/walk.c:2885 set and not used: hbv
warning: src/cmd/ld/data.c:198 format mismatch s IND FUNC(IND CHAR) INT, arg 2
warning: src/cmd/ld/data.c:230 format mismatch s IND FUNC(IND CHAR) INT, arg 2
warning: src/cmd/ld/dwarf.c:1517 set and not used: pc
warning: src/cmd/ld/elf.c:1507 format mismatch d VLONG, arg 2
warning: src/cmd/ld/ldmacho.c:509 set and not used: dsymtab

R=golang-dev, gobot, rsc
CC=golang-dev
https://golang.org/cl/36740045
2013-12-18 20:20:46 +01:00
David du Colombier
ef0100c7d7 libmach, cmd/8l: fix Plan 9 warnings
warning: src/libmach/sym.c:1861 non-interruptable temporary
warning: src/cmd/8l/../ld/pcln.c:29 set and not used: p

R=golang-dev, gobot, rsc
CC=golang-dev
https://golang.org/cl/40500043
2013-12-18 20:19:59 +01:00
David du Colombier
6e97513012 liblink: fix Plan 9 warnings
warning: src/liblink/asm5.c:485 non-interruptable temporary
warning: src/liblink/asm5.c:565 set and not used: c
warning: src/liblink/asm5.c:622 format mismatch ux VLONG, arg 2
warning: src/liblink/asm5.c:1218 overspecified class: asmout GLOBL STATIC
warning: src/liblink/asm5.c:2088 overspecified class: oprrr GLOBL STATIC
warning: src/liblink/asm5.c:2202 overspecified class: opbra GLOBL STATIC
warning: src/liblink/asm5.c:2237 overspecified class: olr GLOBL STATIC
warning: src/liblink/asm5.c:2266 overspecified class: olhr GLOBL STATIC
warning: src/liblink/asm5.c:2291 overspecified class: osr GLOBL STATIC
warning: src/liblink/asm5.c:2302 overspecified class: oshr GLOBL STATIC
warning: src/liblink/asm5.c:2312 overspecified class: osrr GLOBL STATIC
warning: src/liblink/asm5.c:2319 overspecified class: oshrr GLOBL STATIC
warning: src/liblink/asm5.c:2325 overspecified class: olrr GLOBL STATIC
warning: src/liblink/asm5.c:2332 overspecified class: olhrr GLOBL STATIC
warning: src/liblink/asm5.c:2338 overspecified class: ofsr GLOBL STATIC
warning: src/liblink/asm5.c:2375 overspecified class: omvl GLOBL STATIC
warning: src/liblink/asm8.c:1261 format mismatch d VLONG, arg 3
warning: src/liblink/asm8.c:1274 format mismatch +d VLONG, arg 5
warning: src/liblink/list5.c:153 format mismatch d VLONG, arg 3
warning: src/liblink/list5.c:310 format mismatch d VLONG, arg 3
warning: src/liblink/obj6.c:665 set and not used: q
warning: src/liblink/pcln.c:32 set and not used: p

R=golang-dev, jas, gobot, rsc
CC=golang-dev
https://golang.org/cl/40370043
2013-12-18 20:19:29 +01: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
Ian Lance Taylor
0830f64bf0 liblink: don't search for an import file with an absolute path
This restores the old behaviour, and makes it possible to
continue to use 6g and 6l directly, rather than the go tool,
with dot imports.

R=rsc
CC=golang-dev
https://golang.org/cl/43710043
2013-12-18 10:33:47 -08:00
Russ Cox
f48120ef51 cmd/nm: minor cleanup from previous CL
I forgot to apply Ian's suggestions before submitting CL 40600043.

R=iant
CC=golang-dev
https://golang.org/cl/43560045
2013-12-18 13:29:40 -05: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
Shenghou Ma
8ce584c2aa liblink: rewrite '\\' in paths to '/' on windows
At least three Go tests rely on that (log, runtime/{pprof,debug}).

Fixes #6972.
Fixes #6974.
Fixes #6975.

R=alex.brainman, mattn.jp, rsc
CC=golang-dev
https://golang.org/cl/43150043
2013-12-17 22:40:13 -05: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
Russ Cox
c86fc68ac6 cmd/go: avoid use of 'go tool pack'
All packages now use the -pack option to the compiler.
For a pure Go package, that's enough.
For a package with additional C and assembly files, the extra
archive entries can be added directly (by concatenation)
instead of by invoking go tool pack.

These changes make it possible to rewrite cmd/pack in Go.

R=iant, r
CC=golang-dev
https://golang.org/cl/42910043
2013-12-17 21:44:36 -05:00
Russ Cox
b2d43caa7a cmd/dist: avoid use of 'go tool pack'
All packages now use the -pack option to the compiler.
For a pure Go package, that's enough.
For a package with additional C and assembly files, the extra
archive entries can be added directly (by concatenation)
instead of by invoking go tool pack.

These changes make it possible to rewrite cmd/pack in Go.

R=iant, r
CC=golang-dev
https://golang.org/cl/42890043
2013-12-17 21:44:18 -05:00
Russ Cox
b022334029 cmd/gc: implement -pack flag
The -pack flag causes 5g, 6g, 8g to write a Go archive directly,
instead of requiring the use of 'go tool pack' to convert the .5/.6/.8
to .a format.

Writing directly avoids the copy and also avoids having the
export data stored twice in the archive (once in __.PKGDEF,
once in .5/.6/.8).

A separate CL will enable the use of this flag by cmd/go.

Other build systems that do not know about -pack will be unaffected.

The changes to cmd/ld handle a minor simplification to the format:
an unused section is removed.

R=iant, r
CC=golang-dev
https://golang.org/cl/42880043
2013-12-17 21:43:33 -05: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