]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agoimage/draw: optimize out some bounds checks.
Nigel Tao [Mon, 31 Aug 2015 03:38:13 +0000 (13:38 +1000)]
image/draw: optimize out some bounds checks.

We could undoubtedly squeeze even more out of these loops, and in the
long term, a better compiler would be smarter with bounds checks, but in
the short term, this small change is an easy win.

benchmark                      old ns/op     new ns/op     delta
BenchmarkFillOver-8            1619470       1323192       -18.29%
BenchmarkCopyOver-8            1129369       1062787       -5.90%
BenchmarkGlyphOver-8           420070        378608        -9.87%

On github.com/golang/freetype/truetype's BenchmarkDrawString:
benchmark                 old ns/op     new ns/op     delta
BenchmarkDrawString-8     9561435       8807019       -7.89%

Change-Id: Ib1c6271ac18bced85e0fb5ebf250dd57d7747e75
Reviewed-on: https://go-review.googlesource.com/14093
Reviewed-by: Rob Pike <r@golang.org>
9 years agonet: Increase the acceptable delay in TestDialerDualstack
Paul Marks [Mon, 31 Aug 2015 20:30:22 +0000 (13:30 -0700)]
net: Increase the acceptable delay in TestDialerDualstack

This may fix the flakiness on Windows/x64, assuming that it's actually
due to a variance in the connection time which slightly exceeds 100ms.

150ms + 95ms = 245ms, which is still low enough to avoid triggering
Happy Eyeballs (300ms) on non-Windows platforms.

Updates #12309

Change-Id: I816a36fbc0a3e5c90e3cf1b75a134faf0d91557c
Reviewed-on: https://go-review.googlesource.com/14120
Run-TryBot: Paul Marks <pmarks@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/internal/obj/arm: remove CASE and BCASE
Dave Cheney [Mon, 31 Aug 2015 00:14:00 +0000 (10:14 +1000)]
cmd/internal/obj/arm: remove CASE and BCASE

Update #10994

CASE and BCASE were used by 5c in switch statements, cmd/compile
does not use them.

Change-Id: I7a578c461b52b94690e35460926849b28971b770
Reviewed-on: https://go-review.googlesource.com/14009
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime: soften up hash checks a bit
Keith Randall [Tue, 25 Aug 2015 04:10:36 +0000 (21:10 -0700)]
runtime: soften up hash checks a bit

The hash tests generate occasional failures, quiet them some more.

In particular we can get 1 collision when the expected number is
.001 or so. That shouldn't be a dealbreaker.

Fixes #12311

Change-Id: I784e91b5d21f4f1f166dc51bde2d1cd3a7a3bfea
Reviewed-on: https://go-review.googlesource.com/13902
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agofmt: fix scientific notation in docs
Shenghou Ma [Wed, 26 Aug 2015 21:52:13 +0000 (17:52 -0400)]
fmt: fix scientific notation in docs

Fixes #12340.

Change-Id: I17a8b3711a8593ec60882a0dcadb38f0cc138f4b
Reviewed-on: https://go-review.googlesource.com/13949
Reviewed-by: Rob Pike <r@golang.org>
9 years agoruntime: implement cmpstring and bytes.Compare in assembly for ppc64
Shenghou Ma [Sat, 29 Aug 2015 03:59:04 +0000 (23:59 -0400)]
runtime: implement cmpstring and bytes.Compare in assembly for ppc64

Change-Id: I15bf55aa5ac3588c05f0a253f583c52bab209892
Reviewed-on: https://go-review.googlesource.com/14041
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agosyscall: remove unused kernelVersion function from tests
Alexander Morozov [Mon, 31 Aug 2015 16:40:25 +0000 (09:40 -0700)]
syscall: remove unused kernelVersion function from tests

Change-Id: If0d00999c58f7421e4da06e1822ba5abccf72cac
Reviewed-on: https://go-review.googlesource.com/14111
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agosyscall: move check of unprivileged_userns_clone to whoamiCmd
Alexander Morozov [Mon, 31 Aug 2015 15:41:43 +0000 (08:41 -0700)]
syscall: move check of unprivileged_userns_clone to whoamiCmd

This is basic validation and should be performed early

Fixes #12412

Change-Id: I903f7eeafdc22376704985a53d649698cf9d8ef4
Reviewed-on: https://go-review.googlesource.com/14110
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agointernal/obj/arm64: remove CASE and BCASE
Dave Cheney [Mon, 31 Aug 2015 11:15:29 +0000 (21:15 +1000)]
internal/obj/arm64: remove CASE and BCASE

Fixes #10994

CASE and BCASE were used by 7c in switch statements, cmd/compile
does not use them, cmd/assemble couldn't assemble them, and the arm64
peephole optimiser didn't know about them.

Change-Id: Id04835fcb37e207f76d211ce54a4db9c057d6112
Reviewed-on: https://go-review.googlesource.com/14100
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Run-TryBot: Aram Hăvărneanu <aram@mgk.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoos: remove a redundant branch in File.Read.
Aaron Jacobs [Fri, 24 Jul 2015 04:21:11 +0000 (14:21 +1000)]
os: remove a redundant branch in File.Read.

All implementations of File.read ensure that n >= 0. This is usually via
fixCount, except for Windows console reads, which only ever add to n.

Change-Id: Ic019d6a2da5ef1ac68d2690c908deca4fcc6b4a4
Reviewed-on: https://go-review.googlesource.com/12624
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile/internal/gc: rename Fatal to Fatalf
Håvard Haugen [Sun, 30 Aug 2015 21:10:03 +0000 (23:10 +0200)]
cmd/compile/internal/gc: rename Fatal to Fatalf

This helps vet see a real issue:

    cmd/internal/gc$ go vet
    gen.go:1223: unreachable code

Fixes #12106.

Change-Id: I720868b07ae6b6d5a4dc6b238baa8c9c889da6d8
Reviewed-on: https://go-review.googlesource.com/14083
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/link: pass value being relocated to archreloc
Michael Hudson-Doyle [Mon, 3 Aug 2015 02:08:17 +0000 (14:08 +1200)]
cmd/link: pass value being relocated to archreloc

And clean up the mess on arm64 (the mess on arm is too confusing).

See issue #10050

Change-Id: I2ce813fe8646d4e818eb660612a7e4b2bb04de4c
Reviewed-on: https://go-review.googlesource.com/13884
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: add -lsendfile to cgo LDFLAGS for solaris
Shenghou Ma [Sun, 30 Aug 2015 21:22:40 +0000 (17:22 -0400)]
net: add -lsendfile to cgo LDFLAGS for solaris

Fixes external linking of net/http tests (or anything that uses
sendfile).

Fixes #12390.

Change-Id: Iee08998cf66e7b0ce851db138a00ebae6dc2395e
Reviewed-on: https://go-review.googlesource.com/14072
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
9 years agoruntime: check that stack barrier unwind is in sync
Austin Clements [Wed, 26 Aug 2015 19:06:43 +0000 (15:06 -0400)]
runtime: check that stack barrier unwind is in sync

Currently the stack barrier stub blindly unwinds the next stack
barrier from the G's stack barrier array without checking that it's
the right stack barrier. If through some bug the stack barrier array
position gets out of sync with where we actually are on the stack,
this could return to the wrong PC, which would lead to difficult to
debug crashes. To address this, this commit adds a check to the amd64
stack barrier stub that it's unwinding the correct stack barrier.

Updates #12238.

Change-Id: If824d95191d07e2512dc5dba0d9978cfd9f54e02
Reviewed-on: https://go-review.googlesource.com/13948
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: add GODEBUG for stack barriers at every frame
Austin Clements [Wed, 26 Aug 2015 17:54:26 +0000 (13:54 -0400)]
runtime: add GODEBUG for stack barriers at every frame

Currently enabling the debugging mode where stack barriers are
installed at every frame requires recompiling the runtime. However,
this is potentially useful for field debugging and for runtime tests,
so make this mode a GODEBUG.

Updates #12238.

Change-Id: I6fb128f598b19568ae723a612e099c0ed96917f5
Reviewed-on: https://go-review.googlesource.com/13947
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: don't install a stack barrier in cgocallback_gofunc's frame
Austin Clements [Wed, 26 Aug 2015 16:16:51 +0000 (12:16 -0400)]
runtime: don't install a stack barrier in cgocallback_gofunc's frame

Currently the runtime can install stack barriers in any frame.
However, the frame of cgocallback_gofunc is special: it's the one
function that switches from a regular G stack to the system stack on
return. Hence, the return PC slot in its frame on the G stack is
actually used to save getg().sched.pc (so tracebacks appear to unwind
to the last Go function running on that G), and not as an actual
return PC for cgocallback_gofunc.

Because of this, if we install a stack barrier in cgocallback_gofunc's
return PC slot, when cgocallback_gofunc does return, it will move the
stack barrier stub PC in to getg().sched.pc and switch back to the
system stack. The rest of the runtime doesn't know how to deal with a
stack barrier stub in sched.pc: nothing knows how to match it up with
the G's stack barrier array and, when the runtime removes stack
barriers, it doesn't know to undo the one in sched.pc. Hence, if the C
code later returns back in to Go code, it will attempt to return
through the stack barrier saved in sched.pc, which may no longer have
correct unwinding information.

Fix this by blacklisting cgocallback_gofunc's frame so the runtime
won't install a stack barrier in it's return PC slot.

Fixes #12238.

Change-Id: I46aa2155df2fd050dd50de3434b62987dc4947b8
Reviewed-on: https://go-review.googlesource.com/13944
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocrypto/x509: emit PKIX names in a more standard order.
Adam Langley [Sun, 2 Aug 2015 15:55:17 +0000 (08:55 -0700)]
crypto/x509: emit PKIX names in a more standard order.

(See referenced bug for details.)

Fixes #11966.

Change-Id: I91f9c95594cf4fd6d25d9a81f155a643c7a1f8e0
Reviewed-on: https://go-review.googlesource.com/13038
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocrypto/tls: reject ServerHellos with empty ALPN protocols.
Adam Langley [Thu, 9 Jul 2015 22:42:02 +0000 (15:42 -0700)]
crypto/tls: reject ServerHellos with empty ALPN protocols.

https://tools.ietf.org/html/rfc7301#section-3.1 specifies that a
ProtocolName may not be empty. This change enforces this for ServerHello
messages—it's already enforced for ClientHello messages.

Change-Id: Ic5a5be6bebf07fba90a3cabd10b07ab7b4337f53
Reviewed-on: https://go-review.googlesource.com/12003
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocrypto/tls: note in comments that setting GetCertificate is now sufficient.
aubble [Thu, 20 Aug 2015 18:26:56 +0000 (14:26 -0400)]
crypto/tls: note in comments that setting GetCertificate is now sufficient.

In Go 1.5, Config.Certificates is no longer required if
Config.GetCertificate has been set. This change updated four comments to
reflect that.

Change-Id: Id72cc22fc79e931b2d645a7c3960c3241042762c
Reviewed-on: https://go-review.googlesource.com/13800
Reviewed-by: Adam Langley <agl@golang.org>
9 years agocrypto/aes: dedicated asm version of AES-GCM
Vlad Krasnov [Thu, 28 May 2015 20:50:23 +0000 (13:50 -0700)]
crypto/aes: dedicated asm version of AES-GCM

The existing implementation didn't use the CLMUL instructions for fast
and constant time binary-field multiplication. With this change, amd64
CPUs that support both AES and CLMUL instructions will use an optimised
asm implementation.

benchmark                 old ns/op     new ns/op     delta
BenchmarkAESGCMSeal8K     91723         3200          -96.51%
BenchmarkAESGCMOpen8K     91487         3324          -96.37%
BenchmarkAESGCMSeal1K     11873         546           -95.40%
BenchmarkAESGCMOpen1K     11833         594           -94.98%

benchmark                 old MB/s     new MB/s     speedup
BenchmarkAESGCMSeal8K     89.31        2559.62      28.66x
BenchmarkAESGCMOpen8K     89.54        2463.78      27.52x
BenchmarkAESGCMSeal1K     86.24        1872.49      21.71x
BenchmarkAESGCMOpen1K     86.53        1721.78      19.90x

Change-Id: Idd63233098356d8b353d16624747b74d0c3f193e
Reviewed-on: https://go-review.googlesource.com/10484
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
9 years agocrypto/tls: allow tls.Listen when only GetCertificate is provided.
aubble [Thu, 20 Aug 2015 18:31:15 +0000 (14:31 -0400)]
crypto/tls: allow tls.Listen when only GetCertificate is provided.

Go 1.5 allowed TLS connections where Config.Certificates was nil as long
as the GetCertificate callback was given. However, tls.Listen wasn't
updated accordingly until this change.

Change-Id: I5f67f323f63c988ff79642f3daf8a6b2a153e6b2
Reviewed-on: https://go-review.googlesource.com/13801
Reviewed-by: Adam Langley <agl@golang.org>
9 years agotesting/quick: terminate for arbitrary recursive types
Håvard Haugen [Tue, 9 Jun 2015 22:30:32 +0000 (00:30 +0200)]
testing/quick: terminate for arbitrary recursive types

Recursive types R containing slices of R's did not terminate despite the
effort in CL 10821.

For recursive types there was a competition between slice expansion by a
factor 'complexSize', and termination with probability '1/complexSize'
which lead to stack overflow as soon as a recursive struct had slices
pointing to its own type.

Fix this by shrinking the size hint as a function of recursion depth.
This has the dual effect of reducing the number of elements generated
per slice and also increasing the probability for termination.

Fixes #11148.

Change-Id: Ib61155b4f2e2de3873d508d63a1f4be759426d67
Reviewed-on: https://go-review.googlesource.com/13830
Reviewed-by: Adam Langley <agl@golang.org>
9 years agomath/big: use optimized formula in ModSqrt for 3 mod 4 primes
David Leon Gil [Fri, 26 Jun 2015 17:29:45 +0000 (10:29 -0700)]
math/big: use optimized formula in ModSqrt for 3 mod 4 primes

For primes which are 3 mod 4, using Tonelli-Shanks is slower
and more complicated than using the identity

     a**((p+1)/4) mod p == sqrt(a)

For 2^450-2^225-1 and 2^10860-2^5430-1, which are 3 mod 4:

BenchmarkModSqrt225_TonelliTri      1000     1135375 ns/op
BenchmarkModSqrt225_3Mod4          10000      156009 ns/op
BenchmarkModSqrt5430_Tonelli           1  3448851386 ns/op
BenchmarkModSqrt5430_3Mod4             2   914616710 ns/op

~2.6x to 7x faster.

Fixes #11437 (which is a prime choice of issues to fix)

Change-Id: I813fb29454160483ec29825469e0370d517850c2
Reviewed-on: https://go-review.googlesource.com/11522
Reviewed-by: Adam Langley <agl@golang.org>
9 years agoencoding/asn1: fix panic when Marshaling nil.
Michal Bohuslávek [Wed, 26 Aug 2015 11:49:22 +0000 (13:49 +0200)]
encoding/asn1: fix panic when Marshaling nil.

Fixes #11127.

Change-Id: Ibcfc3a05e91fa4260d70b04bee2bbba2376bd313
Reviewed-on: https://go-review.googlesource.com/13923
Reviewed-by: Adam Langley <agl@golang.org>
9 years agoruntime: short-circuit bytes.Compare if src and dst are the same slice
Keith Randall [Tue, 25 Aug 2015 03:58:19 +0000 (20:58 -0700)]
runtime: short-circuit bytes.Compare if src and dst are the same slice

Should only matter on ppc64 and ppc64le.

Fixes #11336

Change-Id: Id4b0ac28b573648e1aa98e87bf010f00d006b146
Reviewed-on: https://go-review.googlesource.com/13901
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agotime: fix 400 year offset in comment
Ian Lance Taylor [Sat, 29 Aug 2015 00:30:59 +0000 (17:30 -0700)]
time: fix 400 year offset in comment

Change-Id: I33c2c222ea884d9ff57800ea5185644b5d8e591a
Reviewed-on: https://go-review.googlesource.com/14034
Reviewed-by: Minux Ma <minux@golang.org>
9 years agomisc/nacl: fix nacl build
Dave Cheney [Sat, 29 Aug 2015 00:06:43 +0000 (10:06 +1000)]
misc/nacl: fix nacl build

Update testzip.proto to reflect vendoring of golang.org/x/arch.

Change-Id: I532da1100f74d1e9887eb3cf26974660ae818d92
Reviewed-on: https://go-review.googlesource.com/14007
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile/internal/gc: use slice instead of linked list for nodes to export
Robert Griesemer [Wed, 12 Aug 2015 21:29:50 +0000 (14:29 -0700)]
cmd/compile/internal/gc: use slice instead of linked list for nodes to export

Change-Id: Ib79ab787fdc90a5a29b25474d91afa9bfaf51276
Reviewed-on: https://go-review.googlesource.com/13589
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/compiler/internal/gc: fix argument for Sprintf
Robert Griesemer [Fri, 28 Aug 2015 22:38:20 +0000 (15:38 -0700)]
cmd/compiler/internal/gc: fix argument for Sprintf

Val.Ctype used to be struct field, it's now a method.

Change-Id: I08f0b32b66dba15b2a392e84a557efb905b530cb
Reviewed-on: https://go-review.googlesource.com/14031
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocompress/gzip: clarify Latin-1 restrictions on gzip.Header
Matthew Dempsky [Thu, 27 Aug 2015 16:56:26 +0000 (09:56 -0700)]
compress/gzip: clarify Latin-1 restrictions on gzip.Header

Fixes #12361.

Change-Id: Ifd62e8d93b2d733e67e0186c7185cd6291d3bbc1
Reviewed-on: https://go-review.googlesource.com/13939
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/internal/rsc.io: delete
Russ Cox [Fri, 28 Aug 2015 16:04:44 +0000 (12:04 -0400)]
cmd/internal/rsc.io: delete

The code is now in cmd/vendor/golang.org/x/arch.

Change-Id: I518d48c21b0d7fed914552b89ee41411f088456b
Reviewed-on: https://go-review.googlesource.com/14021
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/internal/objfile: use golang.org/x/arch instead of rsc.io
Russ Cox [Fri, 28 Aug 2015 16:04:16 +0000 (12:04 -0400)]
cmd/internal/objfile: use golang.org/x/arch instead of rsc.io

Change-Id: I5348774ff01a5f0f706a1dba4aa9500661841f47
Reviewed-on: https://go-review.googlesource.com/14020
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/vendor/golang.org/x/arch: import arm/armasm and x86/x86asm
Russ Cox [Fri, 28 Aug 2015 16:03:34 +0000 (12:03 -0400)]
cmd/vendor/golang.org/x/arch: import arm/armasm and x86/x86asm

For use by cmd/objdump in place of the current cmd/internal/rsc.io/... tree.

Change-Id: I7d765ddf43ab4118a3221fd755ff0a2a02daa5de
Reviewed-on: https://go-review.googlesource.com/13979
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: check explicitly for short unwinding of stacks
Russ Cox [Wed, 26 Aug 2015 15:39:10 +0000 (11:39 -0400)]
runtime: check explicitly for short unwinding of stacks

Right now we find out implicitly if stack barriers are in place,
or defers. This change makes sure we find out about short
unwinds always.

Change-Id: Ibdde1ba9c79eb792660dcb7aa6f186e4e4d559b3
Reviewed-on: https://go-review.googlesource.com/13966
Reviewed-by: Austin Clements <austin@google.com>
9 years agodoc: mention vendoring in go1.6.txt (forgot git add before)
Russ Cox [Fri, 28 Aug 2015 15:43:25 +0000 (11:43 -0400)]
doc: mention vendoring in go1.6.txt (forgot git add before)

Change-Id: I34eff138c61e5ad456a4918c402ca0e8333601a0
Reviewed-on: https://go-review.googlesource.com/13978
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc/go1.6.txt: start go1.6.txt with a note about nacl
Dave Cheney [Fri, 28 Aug 2015 04:51:13 +0000 (14:51 +1000)]
doc/go1.6.txt: start go1.6.txt with a note about nacl

Start go1.6.txt with a note that nacl ports are no longer
restricted to pepper_41 and a record of the text/template change.

Change-Id: I21dda64aec113c35caf1d565f29e3aac8171480a
Reviewed-on: https://go-review.googlesource.com/14004
Reviewed-by: Rob Pike <r@golang.org>
9 years agoregistry: Explain how GetMUIStringValue works and where it falls short
Daniel Johansson [Thu, 27 Aug 2015 20:16:09 +0000 (22:16 +0200)]
registry: Explain how GetMUIStringValue works and where it falls short

GetMUIStringValue tries as a convenience to resolve string values even for pathless
resource DLLs by searching the system directory (one of several paths used
by the system's standard DLL search order algorithm). This would not be
needed if regLoadMUIString searched for pathless DLLs itself, but it
doesn't, instead it needs an absolute path, otherwise it will fail.

This approach works fine for solving issue #12015 (handle localized time
zone names; for which GetMUIStringValue was created) since tzres.dll that
is used to resolve localized time zone names has no path in the registry
but is located under the system directory.

However, this approach will fail if a pathless DLL is located somewhere
else than the system directory.

Because of this limitation GetMUIStringValue may have to be revised in the
future to allow for custom paths, possibly through another version of the
function.

See also:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724890%28v=vs.85%29.aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586%28v=vs.85%29.aspx

Change-Id: Ida66a0ef1928e0461ce248c795827902d785e6cd
Reviewed-on: https://go-review.googlesource.com/13929
Reviewed-by: Rob Pike <r@golang.org>
9 years agosyscall: remove nacl srpc helper
Dave Cheney [Thu, 27 Aug 2015 06:15:00 +0000 (16:15 +1000)]
syscall: remove nacl srpc helper

Fixes #11961

Minux removed the use of SRPC in 003dccfa, but the SRPC name service
code was left in the tree. SRPC was removed in pepper_42 making the
code, which ran on startup, fail, even though it was not used.

Removing srpc_nacl.go for a total diff of -822 lines has got to count
as one of the easiest nacl fixes we've had to date.

Change-Id: Ic4e348146bfe47450bbb9cabb91699ba153e6bf0
Reviewed-on: https://go-review.googlesource.com/13958
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocompress/bzip2: make decoding faster
Alberto Donizetti [Sun, 23 Aug 2015 15:15:07 +0000 (17:15 +0200)]
compress/bzip2: make decoding faster

Issue 6754 reports that Go bzip2 Decode function is much slower
(about 2.5x in go1.5) than the Python equivalent (which is
actually just a wrapper around the usual C library) on random data.

Profiling the code shows that half a dozen of CMP instructions in a
tight loop are responsibile for most of the execution time.

This patch reduces the number of branches of the loop, greatly
improving performance on random data and speeding up decoding of
real data.

name            old time/op    new time/op    delta
DecodeDigits-4    9.28ms ± 1%    8.05ms ± 1%  -13.18%  (p=0.000 n=15+14)
DecodeTwain-4     28.9ms ± 2%    26.4ms ± 1%   -8.57%  (p=0.000 n=15+14)
DecodeRand-4      3.94ms ± 1%    3.06ms ± 1%  -22.45%  (p=0.000 n=15+14)

name            old speed      new speed      delta
DecodeDigits-4  4.65MB/s ± 1%  5.36MB/s ± 1%  +15.21%  (p=0.000 n=13+14)
DecodeTwain-4   4.32MB/s ± 2%  4.72MB/s ± 1%   +9.36%  (p=0.000 n=15+14)
DecodeRand-4    4.27MB/s ± 1%  5.51MB/s ± 1%  +28.86%  (p=0.000 n=15+14)

I've run some benchmark comparing Go bzip2 implementation with the
usual Linux bzip2 command (which is written in C). On my machine
this patch brings go1.5
  from ~2.26x to ~1.50x of bzip2 time (on 64MB  random data)
  from ~1.70x to ~1.50x of bzip2 time (on 100MB english text)
  from ~2.00x to ~1.88x of bzip2 time (on 64MB  /dev/zero data)

Fixes #6754

Change-Id: I3cb12d2c0c2243c1617edef1edc88f05f91d26d1
Reviewed-on: https://go-review.googlesource.com/13853
Reviewed-by: Nigel Tao <nigeltao@golang.org>
9 years agocmd/go: -a does apply to the standard library
Ian Lance Taylor [Fri, 21 Aug 2015 04:20:25 +0000 (21:20 -0700)]
cmd/go: -a does apply to the standard library

This changed in https://golang.org/cl/10761.

Update #12203.

Change-Id: Ia37ebb7ecba689ad3cb2559213d675f21cf03a95
Reviewed-on: https://go-review.googlesource.com/13799
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: enable vendoring experiment by default
Russ Cox [Thu, 27 Aug 2015 16:16:09 +0000 (12:16 -0400)]
cmd/go: enable vendoring experiment by default

If we're going to do this for Go 1.6 we might as well do it now
and find out what breaks.

Change-Id: I8306b7829d8d13b564a1466c902ec6ba1a5a58c1
Reviewed-on: https://go-review.googlesource.com/13967
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet: restore LookupPort for integer strings
Russ Cox [Tue, 25 Aug 2015 15:25:46 +0000 (11:25 -0400)]
net: restore LookupPort for integer strings

This worked in Go 1.4 but was lost in the "pure Go" lookup
routines substituted late in the Go 1.5 cycle.

Fixes #12263.

Change-Id: I77ec9d97cd8e67ace99d6ac965e5bc16c151ba83
Reviewed-on: https://go-review.googlesource.com/13915
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agosyscall: don't call Setgroups if Credential.Groups is empty
Alexander Morozov [Thu, 27 Aug 2015 03:45:28 +0000 (20:45 -0700)]
syscall: don't call Setgroups if Credential.Groups is empty

Setgroups with zero-length groups is no-op for changing groups and
supposed to be used only for determining curent groups length. Also
because we deny setgroups by default if use GidMappings we have
unnecessary error from that no-op syscall.

Change-Id: I8f74fbca9190a3dcbbef1d886c518e01fa05eb62
Reviewed-on: https://go-review.googlesource.com/13938
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/go: properly ignore import comments for vendored packages rooted at GOPATH
Vincent Vanackere [Wed, 26 Aug 2015 13:55:27 +0000 (15:55 +0200)]
cmd/go: properly ignore import comments for vendored packages rooted at GOPATH

Fixes #12232.

Change-Id: Ide3fb7f5fc5ae377ae8683fbb94fd0dc01480549
Reviewed-on: https://go-review.googlesource.com/13924
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agosrc/runtime: Add missing defs for android/386.
Tim Cooijmans [Thu, 20 Aug 2015 07:50:10 +0000 (09:50 +0200)]
src/runtime: Add missing defs for android/386.

Change-Id: I63bf6d2fdf41b49ff8783052d5d6c53b20e2f050
Reviewed-on: https://go-review.googlesource.com/13760
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
9 years agocmd/asm: fix potential infinite loop in parser
Didier Spezia [Tue, 25 Aug 2015 16:25:11 +0000 (16:25 +0000)]
cmd/asm: fix potential infinite loop in parser

For ARM machines, the assembler supports list of registers
operands such as [R1,R2].

A list missing a ']' results in the parser issuing many errors
and consuming all the tokens. At EOF (i.e. end of the line),
it still loops.

Normally, a counter is maintained to make sure the parser
stops after 10 errors. However, multiple errors occuring on the
same line are simply ignored. Only the first one is reported.
At most one error per line is accounted.

Missing ']' in a register list therefore results in an
infinite loop.

Fixed the parser by explicitly checking for ']' to interrupt
this loops

In the operand tests, also fixed a wrong entry which I think was
not set on purpose (but still led to a successful result).

Fixes #11764

Change-Id: Ie87773388ee0d21b3a2a4cb941d4d911d0230ba4
Reviewed-on: https://go-review.googlesource.com/13920
Reviewed-by: Rob Pike <r@golang.org>
9 years agotext/template: add ExecError type and return it from Execute on error
Rob Pike [Thu, 27 Aug 2015 06:28:52 +0000 (16:28 +1000)]
text/template: add ExecError type and return it from Execute on error

Useful to discriminate evaluation errors from write errors.

Fixes #11898.

Change-Id: I907d339a3820e887872d78e0e2d8fd011451fd19
Reviewed-on: https://go-review.googlesource.com/13957
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoruntime: remove unused xchgp/xchgp1
Michael Hudson-Doyle [Wed, 26 Aug 2015 22:59:43 +0000 (10:59 +1200)]
runtime: remove unused xchgp/xchgp1

I noticed that they were unimplemented on arm64 but then that they were
in fact not used at all.

Change-Id: Iee579feda2a5e374fa571bcc8c89e4ef607d50f6
Reviewed-on: https://go-review.googlesource.com/13951
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agogo/types: fix real(a) and imag(a) for untyped arguments
Robert Griesemer [Thu, 30 Jul 2015 23:06:36 +0000 (16:06 -0700)]
go/types: fix real(a) and imag(a) for untyped arguments

Fixes #11947.

Change-Id: I6225f96b8dea0cecb097f9c7452a1aa80ae4476d
Reviewed-on: https://go-review.googlesource.com/12939
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agonet/http/httputil: permit nil request body in ReverseProxy
Brad Fitzpatrick [Wed, 26 Aug 2015 17:53:59 +0000 (10:53 -0700)]
net/http/httputil: permit nil request body in ReverseProxy

Accepting a request with a nil body was never explicitly supported but
happened to work in the past.

This doesn't happen in most cases because usually people pass
a Server's incoming Request to the ReverseProxy's ServeHTTP method,
and incoming server requests are guaranteed to have non-nil bodies.

Still, it's a regression, so fix.

Fixes #12344

Change-Id: Id9a5a47aea3f2875d195b66c9a5f8581c4ca2aed
Reviewed-on: https://go-review.googlesource.com/13935
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agogo/types: check for duplicate values in expression switches
Robert Griesemer [Thu, 6 Aug 2015 20:55:19 +0000 (13:55 -0700)]
go/types: check for duplicate values in expression switches

Fixes #11578.

Change-Id: I29a542be247127f470ba6c39aac0d0f6a18de553
Reviewed-on: https://go-review.googlesource.com/13285
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agogo/types, go/constant: remove backward-compatibility files (cleanup)
Robert Griesemer [Mon, 24 Aug 2015 21:05:52 +0000 (14:05 -0700)]
go/types, go/constant: remove backward-compatibility files (cleanup)

Not needed anymore since go/types is always built against the current
standard library.

Fixes #11538.

Change-Id: I2f07d73703f4e5661c4b5df5d487939dcf530b43
Reviewed-on: https://go-review.googlesource.com/13897
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agonet/http: remove always true comparison
Todd Neal [Tue, 25 Aug 2015 23:44:30 +0000 (18:44 -0500)]
net/http: remove always true comparison

byte is unsigned so the comparison against zero is always true.

Change-Id: I8fa60245972be362ae920507a291f92c0f9831ad
Reviewed-on: https://go-review.googlesource.com/13941
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agotime: handle localized time zone names
Daniel Johansson [Sun, 23 Aug 2015 20:08:27 +0000 (22:08 +0200)]
time: handle localized time zone names

The existing implementation fails to determine the correct time zone
abbreviations when the display language is non-English. This change adds
support for localized time zone names (standard- and daylightname)
by using the function RegLoadMUIString.

Fixes #12015

Change-Id: Ic0dc89c50993af8f292b199c20bc5932903e7e87
Reviewed-on: https://go-review.googlesource.com/13854
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agobytes: improve Compare function on amd64 for large byte arrays
Uttam C Pawar [Thu, 2 Jul 2015 18:43:46 +0000 (11:43 -0700)]
bytes: improve Compare function on amd64 for large byte arrays

This patch contains only loop unrolling change for size > 63B

Following are the performance numbers for various sizes on
On Haswell based system: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz.

benchcmp go.head.8.25.15.txt go.head.8.25.15.opt.txt
benchmark                       old ns/op     new ns/op     delta
BenchmarkBytesCompare1-4        5.37          5.37          +0.00%
BenchmarkBytesCompare2-4        5.37          5.38          +0.19%
BenchmarkBytesCompare4-4        5.37          5.37          +0.00%
BenchmarkBytesCompare8-4        4.42          4.38          -0.90%
BenchmarkBytesCompare16-4       4.27          4.45          +4.22%
BenchmarkBytesCompare32-4       5.30          5.36          +1.13%
BenchmarkBytesCompare64-4       6.93          6.78          -2.16%
BenchmarkBytesCompare128-4      10.3          9.50          -7.77%
BenchmarkBytesCompare256-4      17.1          13.8          -19.30%
BenchmarkBytesCompare512-4      31.3          22.1          -29.39%
BenchmarkBytesCompare1024-4     62.5          39.0          -37.60%
BenchmarkBytesCompare2048-4     112           73.2          -34.64%

Change-Id: I4eeb1c22732fd62cbac97ba757b0d29f648d4ef1
Reviewed-on: https://go-review.googlesource.com/11871
Reviewed-by: Keith Randall <khr@golang.org>
9 years agomisc/cgo/testshared: do not run gccgo tests when gccgo is too old
Michael Hudson-Doyle [Sun, 23 Aug 2015 22:44:36 +0000 (10:44 +1200)]
misc/cgo/testshared: do not run gccgo tests when gccgo is too old

Fixes #12083

Change-Id: I8256739b33cf08d84dec23120d527667de2e6eea
Reviewed-on: https://go-review.googlesource.com/13822
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoruntime: remove always false comparison in sigsend
Todd Neal [Tue, 25 Aug 2015 23:25:42 +0000 (18:25 -0500)]
runtime: remove always false comparison in sigsend

s is a uint32 and can never be zero. It's max value is already tested
against sig.wanted, whose size is derived from _NSIG.  This also
matches the test in signal_enable.

Fixes #11282

Change-Id: I8eec9c7df8eb8682433616462fe51b264c092475
Reviewed-on: https://go-review.googlesource.com/13940
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile, cmd/link, reflect, runtime: remove type.zero field
Michael Hudson-Doyle [Fri, 21 Aug 2015 03:23:57 +0000 (15:23 +1200)]
cmd/compile, cmd/link, reflect, runtime: remove type.zero field

No longer used after previous hashmap change.

Change-Id: I558470f872281e84a78406132df4e391d077b833
Reviewed-on: https://go-review.googlesource.com/13785
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/cgo: annotate named return struct members in comments
Andy Maloney [Mon, 3 Aug 2015 13:25:33 +0000 (09:25 -0400)]
cmd/cgo: annotate named return struct members in comments

If an exported function has named return variables, then show the names
as comments in the return struct we create in the header file.

Example here:

 https://groups.google.com/forum/#!topic/golang-nuts/r393ne4zIfY

Change-Id: I21fb4ca2673f6977bec35ccab0cef7d42b311f96
Reviewed-on: https://go-review.googlesource.com/13061
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile, runtime: stop returning t.zero on hashmap miss
Michael Hudson-Doyle [Fri, 21 Aug 2015 02:54:55 +0000 (14:54 +1200)]
cmd/compile, runtime: stop returning t.zero on hashmap miss

Previously t.zero always pointed to runtime.zerovalue. Change the hashmap code
to always return a runtime pointer directly, and change that pointer to point
to a larger buffer if one is needed.

(It might be better to only copy from the pointer returned by the mapaccess
functions when the value type is small enough and have the compiler insert
explicit zeroing for larger value types, but I tried and failed to do this).

This removes all uses of the zero field of the type data; the field itself can
be removed in a separate change.

Fixes #11491

Change-Id: I5b81752ff4067d74a5a281c41e88f151bae0171e
Reviewed-on: https://go-review.googlesource.com/13784
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/cgo: change comments in generated C code to be C-style
Andy Maloney [Thu, 6 Aug 2015 15:45:53 +0000 (11:45 -0400)]
cmd/cgo: change comments in generated C code to be C-style

Change-Id: I3889eda72ae0f57117f1d4299e3574f8bf68be67
Reviewed-on: https://go-review.googlesource.com/13310
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/link: call moduledata symbols "local.moduledata" if they are created by the linker
Michael Hudson-Doyle [Wed, 19 Aug 2015 01:34:33 +0000 (13:34 +1200)]
cmd/link: call moduledata symbols "local.moduledata" if they are created by the linker

This was always a bit confusing, but it also fixes a problem: runtime.firstmoduledata
was always overridden in the linker to be a local symbol but cmd/internal/obj had
already rewritten code accessing it to access it via the GOT. This works on amd64, but
causes link failures on other platforms (e.g. arm64).

Change-Id: I9b8153af74b4d0f092211d63a000d15818f39773
Reviewed-on: https://go-review.googlesource.com/13786
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: fix register allocation for == operator
Ulrich Kunitz [Thu, 20 Aug 2015 16:56:18 +0000 (18:56 +0200)]
cmd/compile: fix register allocation for == operator

The issue 12226 has been caused by the allocation of the same register
for the equality check of two byte values. The code in cgen.go freed the
register for the second operand before the allocation of the register
for the first operand.

Fixes #12226

Change-Id: Ie4dc33a488bd48a17f8ae9b497fd63c1ae390555
Reviewed-on: https://go-review.googlesource.com/13771
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/compile: fix uninitialized memory in compare of interface value
Austin Clements [Mon, 24 Aug 2015 17:35:49 +0000 (13:35 -0400)]
cmd/compile: fix uninitialized memory in compare of interface value

A comparison of the form l == r where l is an interface and r is
concrete performs a type assertion on l to convert it to r's type.
However, the compiler fails to zero the temporary where the result of
the type assertion is written, so if the type is a pointer type and a
stack scan occurs while in the type assertion, it may see an invalid
pointer on the stack.

Fix this by zeroing the temporary. This is equivalent to the fix for
type switches from c4092ac.

Fixes #12253.

Change-Id: Iaf205d456b856c056b317b4e888ce892f0c555b9
Reviewed-on: https://go-review.googlesource.com/13872
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: check pointer equality in arm64 cmpbody
Dave Cheney [Tue, 25 Aug 2015 03:12:32 +0000 (13:12 +1000)]
runtime: check pointer equality in arm64 cmpbody

Updates #11336

Follow the lead of amd64 by doing a pointer equality check
before comparing string/byte contents on arm64.

BenchmarkCompareBytesEqual-8               25.8           26.3           +1.94%
BenchmarkCompareBytesToNil-8               9.59           9.59           +0.00%
BenchmarkCompareBytesEmpty-8               9.59           9.17           -4.38%
BenchmarkCompareBytesIdentical-8           26.3           9.17           -65.13%
BenchmarkCompareBytesSameLength-8          16.3           16.3           +0.00%
BenchmarkCompareBytesDifferentLength-8     16.3           16.3           +0.00%
BenchmarkCompareBytesBigUnaligned-8        1132038        1131409        -0.06%
BenchmarkCompareBytesBig-8                 1126758        1128470        +0.15%
BenchmarkCompareBytesBigIdentical-8        1084366        9.17           -100.00%

Change-Id: Id7125c31957eff1ddb78897d4511bd50e79af3f7
Reviewed-on: https://go-review.googlesource.com/13885
Reviewed-by: Keith Randall <khr@golang.org>
9 years agoruntime: fix nmspinning comparison
Todd Neal [Tue, 25 Aug 2015 00:11:35 +0000 (19:11 -0500)]
runtime: fix nmspinning comparison

nmspinning has a value range of [0, 2^31-1].  Update the comment to
indicate this and fix the comparison so it's not always false.

Fixes #11280

Change-Id: Iedaf0654dcba5e2c800645f26b26a1a781ea1991
Reviewed-on: https://go-review.googlesource.com/13877
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: add a missing hex conversion
Shenghou Ma [Tue, 25 Aug 2015 01:24:23 +0000 (21:24 -0400)]
runtime: add a missing hex conversion

gobuf.g is a guintptr, so without hex(), it will be printed as
a decimal, which is not very helpful and inconsistent with how
other pointers are printed.

Change-Id: I7c0432e9709e90a5c3b3e22ce799551a6242d017
Reviewed-on: https://go-review.googlesource.com/13879
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agodebug/elf: map/slice literals janitoring
Didier Spezia [Sun, 23 Aug 2015 13:59:00 +0000 (13:59 +0000)]
debug/elf: map/slice literals janitoring

Simplify slice/map literal expressions.
Caught with gofmt -d -s, fixed with gofmt -w -s
Reformatted some expressions to improve readability.

Change-Id: Iaf123e6bd49162ec45c59297ad3b002ca59443bc
Reviewed-on: https://go-review.googlesource.com/13850
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/go: skip test using external linking on linux/ppc64 too
Shenghou Ma [Tue, 25 Aug 2015 01:17:04 +0000 (21:17 -0400)]
cmd/go: skip test using external linking on linux/ppc64 too

While we're at it, also fix a typo.

Change-Id: Id436f33cffa5683e2a8450cce5b545960cf2877e
Reviewed-on: https://go-review.googlesource.com/13878
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoencoding/gob: remove always false comparison
Todd Neal [Mon, 24 Aug 2015 23:30:53 +0000 (18:30 -0500)]
encoding/gob: remove always false comparison

This is not a functional change. nr is a uint64 and can never be less
than zero, remove the no-op comparison.

Fixes #11279

Change-Id: Iebb36cc8fe97428b503e65d01b5e67d2b2bc7369
Reviewed-on: https://go-review.googlesource.com/13876
Run-TryBot: Todd Neal <todd@tneal.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoos/signal: skip the nohup test on darwin when running in tmux.
Aaron Jacobs [Mon, 24 Aug 2015 22:53:42 +0000 (08:53 +1000)]
os/signal: skip the nohup test on darwin when running in tmux.

The nohup command doesn't work in tmux on darwin.

Fixes #5135.

Change-Id: I1c21073d8bd54b49dd6b0bad86ef088d6d8e7a5f
Reviewed-on: https://go-review.googlesource.com/13883
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agohash/fnv: fix wiki url
Joe Tsai [Thu, 6 Aug 2015 08:49:00 +0000 (01:49 -0700)]
hash/fnv: fix wiki url

The URL is shown on go docs and is an eye-sore.

For go1.6.

Change-Id: I8b8ea3751200d06ed36acfe22f47ebb38107f8db
Reviewed-on: https://go-review.googlesource.com/13282
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: check pointer equality in arm cmpbody
Dave Cheney [Mon, 24 Aug 2015 05:07:58 +0000 (15:07 +1000)]
runtime: check pointer equality in arm cmpbody

Updates #11336

Follow the lead of amd64 do a pointer equality check
before comparing string/byte contents on arm.

BenchmarkCompareBytesEqual-4               208             211             +1.44%
BenchmarkCompareBytesToNil-4               83.6            81.8            -2.15%
BenchmarkCompareBytesEmpty-4               80.2            75.2            -6.23%
BenchmarkCompareBytesIdentical-4           208             75.2            -63.85%
BenchmarkCompareBytesSameLength-4          126             128             +1.59%
BenchmarkCompareBytesDifferentLength-4     128             130             +1.56%
BenchmarkCompareBytesBigUnaligned-4        14192804        14060971        -0.93%
BenchmarkCompareBytesBig-4                 12277313        12128193        -1.21%
BenchmarkCompareBytesBigIdentical-4        9385046         78.5            -100.00%

Change-Id: I5b24620018688c5fe04b6ff6743a24c4ce225788
Reviewed-on: https://go-review.googlesource.com/13881
Reviewed-by: Keith Randall <khr@golang.org>
9 years agofmt: in Scanf, %c can scan a space, so don't skip spaces at %c
Rob Pike [Sun, 23 Aug 2015 07:45:58 +0000 (17:45 +1000)]
fmt: in Scanf, %c can scan a space, so don't skip spaces at %c

In short, %c should just give you the next rune, period.
Apparently this is the design. I use the term loosely.

Fixes #12275

Change-Id: I6f30bed442c0e88eac2244d465c7d151b29cf393
Reviewed-on: https://go-review.googlesource.com/13821
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agodoc: remove mention of defunct golang-bugs mailing list
Andrew Gerrand [Mon, 24 Aug 2015 19:43:54 +0000 (05:43 +1000)]
doc: remove mention of defunct golang-bugs mailing list

Fixes #12299

Change-Id: Id7b73d2935c9f7c0952f833613973ef455d02b0d
Reviewed-on: https://go-review.googlesource.com/13858
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoencoding/asn1: fix unused assignments
Tarmigan Casebolt [Mon, 24 Aug 2015 02:51:22 +0000 (19:51 -0700)]
encoding/asn1: fix unused assignments

Unused assignment for `err` encoding/asn1/marshal.go:622:3
Unused assignment for `err` encoding/asn1/marshal.go:650:5

Change-Id: I4226238645ce3640f25124cb405444e61439fd3f
Reviewed-on: https://go-review.googlesource.com/13847
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agonet: allow ParseMAC to parse 20-octet IPoIB link-layer address
Matt Layher [Fri, 17 Jul 2015 21:28:42 +0000 (17:28 -0400)]
net: allow ParseMAC to parse 20-octet IPoIB link-layer address

Fixes #11763

Change-Id: Ie291b36a8c29694e80940836d7e6fd96d2d76494
Reviewed-on: https://go-review.googlesource.com/12382
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agoimage/gif: avoid unused assignment
Tarmigan Casebolt [Mon, 24 Aug 2015 02:51:28 +0000 (19:51 -0700)]
image/gif: avoid unused assignment

Change-Id: Iaaecd8be9268c923f40cf0e5153cbf79f7015b8d
Reviewed-on: https://go-review.googlesource.com/13892
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agounicode: include rune 0 in RangeTables.
Marcel van Lohuizen [Wed, 19 Aug 2015 18:28:18 +0000 (20:28 +0200)]
unicode: include rune 0 in RangeTables.

All of Go passes. No changes for the text repo.

Fixes #10153

Change-Id: I313369bf471c8974390a6d42075e5c54f6a81750
Reviewed-on: https://go-review.googlesource.com/13667
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agogo/internal/gcimporter: remove unused assignment
Tarmigan Casebolt [Mon, 24 Aug 2015 02:51:24 +0000 (19:51 -0700)]
go/internal/gcimporter: remove unused assignment

Change-Id: I0b19731a46e4e67a7dd503dd133cafc7678760a7
Reviewed-on: https://go-review.googlesource.com/13890
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agomath: avoid unused assignment in jn.go
Tarmigan Casebolt [Mon, 24 Aug 2015 02:51:33 +0000 (19:51 -0700)]
math: avoid unused assignment in jn.go

Change-Id: Ie4f21bcd5849e994c63ec5bbda2dee6f3ec4da12
Reviewed-on: https://go-review.googlesource.com/13891
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agointernal/syscall/windows/registry: remove debugging dreg
Alex Brainman [Mon, 24 Aug 2015 03:49:30 +0000 (13:49 +1000)]
internal/syscall/windows/registry: remove debugging dreg

Change-Id: I1b9f6ad322a7f68fa160c4f09d7fb56815e505a7
Reviewed-on: https://go-review.googlesource.com/13828
Reviewed-by: Rob Pike <r@golang.org>
9 years agomake.bash: abort if $GOROOT_BOOTSTRAP == $GOROOT
Dave Cheney [Thu, 20 Aug 2015 02:28:51 +0000 (12:28 +1000)]
make.bash: abort if $GOROOT_BOOTSTRAP == $GOROOT

Fixes #12214

Change-Id: I82586b54ac7b9c0c71055bb66b921e3efbf4977c
Reviewed-on: https://go-review.googlesource.com/13719
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/internal/obj: delete Debugzerostack dead code
Josh Bleecher Snyder [Sun, 23 Aug 2015 03:31:55 +0000 (20:31 -0700)]
cmd/internal/obj: delete Debugzerostack dead code

Fixes #11060

Change-Id: I4c6647fc2f103015b67e30dc2cdb6f771526c139
Reviewed-on: https://go-review.googlesource.com/13840
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet: drop redundant domain name length check
Mikio Hara [Sat, 22 Aug 2015 02:03:11 +0000 (11:03 +0900)]
net: drop redundant domain name length check

It is already validated by isDoaminName.

Change-Id: I7a955b632a5143e16b012641cf12bad452900753
Reviewed-on: https://go-review.googlesource.com/13789
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agomime: move examples to external test file
Andrew Gerrand [Sat, 22 Aug 2015 09:40:01 +0000 (10:40 +0100)]
mime: move examples to external test file

Fixes #11257

Change-Id: I3f75db47b0f8e877d81e3c2dcea01ff747b47685
Reviewed-on: https://go-review.googlesource.com/13779
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: in usage messages, name the binary "compile" instead of "Xg"
Brad Fitzpatrick [Sat, 22 Aug 2015 11:29:33 +0000 (20:29 +0900)]
cmd/compile: in usage messages, name the binary "compile" instead of "Xg"

Fixes #12227

Change-Id: I7c1b93e50736185a641fb637000aae2f15bc04ed
Reviewed-on: https://go-review.googlesource.com/13820
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agohtml: speed up UnescapeString
Ingo Oeser [Sat, 9 May 2015 15:55:05 +0000 (17:55 +0200)]
html: speed up UnescapeString

Add benchmarks for for sparsely escaped and densely escaped strings.
Then speed up the sparse unescaping part heavily by using IndexByte and
copy to skip the parts containing no escaping very fast.

Unescaping densely escaped strings slower because of
the new function call overhead. But sparsely encoded strings are seen
more often in the utf8 enabled web.

We win part of the speed back by looking up entityName differently.

benchmark                  old ns/op    new ns/op    delta
BenchmarkEscape                31680        31396   -0.90%
BenchmarkEscapeNone             6507         6872   +5.61%
BenchmarkUnescape              36481        48298  +32.39%
BenchmarkUnescapeNone            332          325   -2.11%
BenchmarkUnescapeSparse         8836         3221  -63.55%
BenchmarkUnescapeDense         30639        32224   +5.17%

Change-Id: If606cb01897a40eefe35ba98f2ff23bb25251606
Reviewed-on: https://go-review.googlesource.com/10172
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agotime: Use AppendFormat in Marshal[Text|JSON]
Justin Nuß [Sun, 31 May 2015 11:17:59 +0000 (13:17 +0200)]
time: Use AppendFormat in Marshal[Text|JSON]

The current implementations of MarshalJSON and MarshalText use
time.Format which returns a string (converted from a byte slice),
only to convert it back to a byte slice.

Avoid the conversion (and thus an allocation) by directly appending
the formatted time to a preallocated byte slice, using the new
AppendFormat function, introduced in golang.org/cl/1760.

This reduces the allocations done in Marshal[Text|JSON] by 50%.

benchmark                old ns/op     new ns/op     delta
BenchmarkMarshalJSON     626           507           -19.01%
BenchmarkMarshalText     598           511           -14.55%

benchmark                old allocs     new allocs     delta
BenchmarkMarshalJSON     2              1              -50.00%
BenchmarkMarshalText     2              1              -50.00%

benchmark                old bytes     new bytes     delta
BenchmarkMarshalJSON     96            48            -50.00%
BenchmarkMarshalText     96            48            -50.00%

Fixes #11025

Change-Id: I468f78d075a6ecc1cdc839df7fb407fbc6ff2e70
Reviewed-on: https://go-review.googlesource.com/10555
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile/internal, cmd/internal/obj: used keyed ProgInfo literals
Brad Fitzpatrick [Sat, 30 May 2015 22:08:46 +0000 (15:08 -0700)]
cmd/compile/internal, cmd/internal/obj: used keyed ProgInfo literals

Safer, more readable, shorter.

Change-Id: I5cf1f438e20a3df45fc43cc5c870a533f7c524bf
Reviewed-on: https://go-review.googlesource.com/10517
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/compile: allow huge rsh in constants arithmetic
Alberto Donizetti [Thu, 20 Aug 2015 15:53:41 +0000 (17:53 +0200)]
cmd/compile: allow huge rsh in constants arithmetic

Currently an expression like

var v = 0 >> 1000

is rejected by gc with a "stupid shift" error, while gotype
compiles it successfully.

As suggested by gri on the issue tracker, allow an rsh right
operand to be any valid uint value.

Fixes #11328

Change-Id: I6ccb3b7f842338d91fd26ae37dd4fa279d7fc440
Reviewed-on: https://go-review.googlesource.com/13777
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agocmd/compile/internal/big: update vendored math/big
Robert Griesemer [Fri, 21 Aug 2015 18:33:25 +0000 (11:33 -0700)]
cmd/compile/internal/big: update vendored math/big

This updates the big package used by the compiler to match the
public big package which contains some updates and bug fixes.
Obtained by running vendor.bash in the internal/big directory.
No manual changes.

Change-Id: I299aecc6599d4a745a721ce48def32449640dbb2
Reviewed-on: https://go-review.googlesource.com/13815
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agomath/big: fix TestBytes test
Robert Griesemer [Fri, 21 Aug 2015 18:30:19 +0000 (11:30 -0700)]
math/big: fix TestBytes test

Fixes #12231.

Change-Id: I1f07c444623cd864667e21b2fee534eacdc193bb
Reviewed-on: https://go-review.googlesource.com/13814
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/trace: don't fail when no browser is available
David du Colombier [Fri, 21 Aug 2015 18:31:50 +0000 (20:31 +0200)]
cmd/trace: don't fail when no browser is available

When there is no browser available on the system,
we should print the URL instead of failing.

Change-Id: I4a2b099e17609394273eff150062c285d76bbac1
Reviewed-on: https://go-review.googlesource.com/13774
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years agomath/big: correctly handle large exponent in SetString
Alberto Donizetti [Fri, 21 Aug 2015 17:17:18 +0000 (19:17 +0200)]
math/big: correctly handle large exponent in SetString

Even though the umul/uquo functions expect two valid, finite big.Floats
arguments, SetString was calling them with possibly Inf values, which
resulted in bogus return values.

Replace umul and udiv calls with Mul and Quo calls to fix this. Also,
fix two wrong tests.

See relevant issue on issue tracker for a detailed explanation.

Fixes #11341

Change-Id: Ie35222763a57a2d712a5f5f7baec75cab8189a53
Reviewed-on: https://go-review.googlesource.com/13778
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agomath/big: remove superfluous comparison
Robert Griesemer [Fri, 19 Jun 2015 17:49:42 +0000 (10:49 -0700)]
math/big: remove superfluous comparison

This is not a functional change.

Also:
- minor cleanups, better comments
- uniform spelling of noun "zeros" (per OED)

Fixes #11277.

Change-Id: I1726f358ce15907bd2410f646b02cf8b11b919cd
Reviewed-on: https://go-review.googlesource.com/11267
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agoruntime/cgo: remove __stack_chk_fail_local
Hyang-Ah (Hana) Kim [Thu, 13 Aug 2015 13:05:22 +0000 (09:05 -0400)]
runtime/cgo: remove __stack_chk_fail_local

I cannot find where it's being used.

This addresses a duplicate symbol issue encountered in golang/go#9327.

Change-Id: I8efda45a006ad3e19423748210c78bd5831215e0
Reviewed-on: https://go-review.googlesource.com/13615
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime, syscall: remove unused bits from Solaris implementation
Shawn Walker-Salas [Thu, 30 Jul 2015 20:32:55 +0000 (13:32 -0700)]
runtime, syscall: remove unused bits from Solaris implementation

CL 9184 changed the runtime and syscall packages to link Solaris binaries
directly instead of using dlopen/dlsym but did not remove the unused (and
now broken) references to dlopen, dlclose, and dlsym.

Fixes #11923

Change-Id: I36345ce5e7b371bd601b7d48af000f4ccacd62c0
Reviewed-on: https://go-review.googlesource.com/13410
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
9 years agodoc: fix typo in release notes
Rob Pike [Thu, 20 Aug 2015 01:46:05 +0000 (11:46 +1000)]
doc: fix typo in release notes

Change-Id: I5310cef72e714b22bcf2ae9e6fd85dbb7e8a15a2
Reviewed-on: https://go-review.googlesource.com/13787
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoall: fix some vet-caught formatting errors, mostly but not only in tests
Rob Pike [Tue, 11 Aug 2015 05:29:40 +0000 (15:29 +1000)]
all: fix some vet-caught formatting errors, mostly but not only in tests

Could go in 1.5, although not critical.
See also #12107

Change-Id: I7f1608b58581d21df4db58f0db654fef79e33a90
Reviewed-on: https://go-review.googlesource.com/13481
Reviewed-by: Dave Cheney <dave@cheney.net>