]> Cypherpunks repositories - gostls13.git/log
gostls13.git
10 years agocrypto/tls: fix renegotiation extension.
Adam Langley [Fri, 19 Dec 2014 23:14:03 +0000 (15:14 -0800)]
crypto/tls: fix renegotiation extension.

There are two methods by which TLS clients signal the renegotiation
extension: either a special cipher suite value or a TLS extension.

It appears that I left debugging code in when I landed support for the
extension because there's a "+ 1" in the switch statement that shouldn't
be there.

The effect of this is very small, but it will break Firefox if
security.ssl.require_safe_negotiation is enabled in about:config.
(Although almost nobody does this.)

This change fixes the original bug and adds a test. Sadly the test is a
little complex because there's no OpenSSL s_client option that mirrors
that behaviour of require_safe_negotiation.

Change-Id: Ia6925c7d9bbc0713e7104228a57d2d61d537c07a
Reviewed-on: https://go-review.googlesource.com/1900
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocrypto/rsa: rsa.SignPSS with opts=nil shouldn't crash.
Adam Langley [Mon, 5 Jan 2015 22:29:42 +0000 (14:29 -0800)]
crypto/rsa: rsa.SignPSS with opts=nil shouldn't crash.

SignPSS is documented as allowing opts to be nil, but actually
crashes in that case. This change fixes that.

Change-Id: Ic48ff5f698c010a336e2bf720e0f44be1aecafa0
Reviewed-on: https://go-review.googlesource.com/2330
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime: fix two garbage collector bugs
Russ Cox [Mon, 5 Jan 2015 20:02:09 +0000 (15:02 -0500)]
runtime: fix two garbage collector bugs

First, call clearcheckmarks immediately after changing checkmark,
so that there is less time when the checkmark flag and the bitmap
are inconsistent. The tiny gap between the two lines is fine, because
the world is stopped. Before, the gap was much larger and included
such code as "go bgsweep()", which allocated.

Second, modify gcphase only when the world is stopped.
As written, gcscan_m was changing gcphase from 0 to GCscan
and back to 0 while other goroutines were running.
Another goroutine running at the same time might decide to
sleep, see GCscan, call gcphasework, and start "helping" by
scanning its stack. That's fine, except that if gcphase flips back
to 0 as the goroutine calls scanblock, it will start draining the
work buffers prematurely.

Both of these were found wbshadow=2 (and a lot of hard work).
Eventually that will run automatically, but right now it still
doesn't quite work for all.bash, due to mmap conflicts with
pthread-created threads.

Change-Id: I99aa8210cff9c6e7d0a1b62c75be32a23321897b
Reviewed-on: https://go-review.googlesource.com/2340
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agocmd/gc: add write barrier for append(slice, slice...)
Russ Cox [Mon, 29 Dec 2014 21:26:25 +0000 (16:26 -0500)]
cmd/gc: add write barrier for append(slice, slice...)

Found with GODEBUG=wbshadow=2 mode.
Eventually that will run automatically, but right now
it still detects other missing write barriers.

Change-Id: I5624b509a36650bce6834cf394b9da163abbf8c0
Reviewed-on: https://go-review.googlesource.com/2310
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: do not display Windows Error Reporting dialogue
Alex Brainman [Wed, 31 Dec 2014 02:46:58 +0000 (13:46 +1100)]
runtime: do not display Windows Error Reporting dialogue

Fixes #9121

Change-Id: Id6ca9f259260310c4c6cbdabbc8f2fead8414e6a
Reviewed-on: https://go-review.googlesource.com/2202
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime: fix build for ARM
Shenghou Ma [Tue, 6 Jan 2015 01:16:10 +0000 (20:16 -0500)]
runtime: fix build for ARM

Change-Id: Ia18b8411bebc47ea71ac1acd9ff9dc570ec15dea
Reviewed-on: https://go-review.googlesource.com/2341
Reviewed-by: Dave Cheney <dave@cheney.net>
10 years agoreflect: add write barriers
Russ Cox [Tue, 30 Dec 2014 18:59:55 +0000 (13:59 -0500)]
reflect: add write barriers

Use typedmemmove, typedslicecopy, and adjust reflect.call
to execute the necessary write barriers.

Found with GODEBUG=wbshadow=2 mode.
Eventually that will run automatically, but right now
it still detects other missing write barriers.

Change-Id: Iec5b5b0c1be5589295e28e5228e37f1a92e07742
Reviewed-on: https://go-review.googlesource.com/2312
Reviewed-by: Keith Randall <khr@golang.org>
10 years agosync/atomic: remove atomic pointer hammer tests
Russ Cox [Tue, 30 Dec 2014 18:06:52 +0000 (13:06 -0500)]
sync/atomic: remove atomic pointer hammer tests

These depend on storing arbitrary integer values using
pointer atomics, and we can't support that anymore.

Change-Id: I8cadd6d462c3eebdbe7078f43fe7c779fa8f52b3
Reviewed-on: https://go-review.googlesource.com/2311
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agocmd/gc, runtime: make assertI2T and variants not variadic
Russ Cox [Mon, 29 Dec 2014 21:15:05 +0000 (16:15 -0500)]
cmd/gc, runtime: make assertI2T and variants not variadic

A side effect of this change is that when assertI2T writes to the
memory for the T being extracted, it can use typedmemmove
for write barriers.

There are other ways we could have done this, but this one
finishes a TODO in package runtime.

Found with GODEBUG=wbshadow=2 mode.
Eventually that will run automatically, but right now
it still detects other missing write barriers.

Change-Id: Icbc8aabfd8a9b1f00be2e421af0e3b29fa54d01e
Reviewed-on: https://go-review.googlesource.com/2279
Reviewed-by: Keith Randall <khr@golang.org>
10 years agocmd/gc: add write barrier in copy of function parameters to heap
Russ Cox [Mon, 29 Dec 2014 16:47:04 +0000 (11:47 -0500)]
cmd/gc: add write barrier in copy of function parameters to heap

Found with GODEBUG=wbshadow=2 mode.
Eventually that will run automatically, but right now
it still detects other missing write barriers.

Change-Id: I1320d5340a9e421c779f24f3b170e33974e56e4f
Reviewed-on: https://go-review.googlesource.com/2278
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime: use typed memmove (write barriers) for chan, map, interface content
Russ Cox [Mon, 29 Dec 2014 15:07:47 +0000 (10:07 -0500)]
runtime: use typed memmove (write barriers) for chan, map, interface content

Found with GODEBUG=wbshadow=2 mode.
Eventually that will run automatically, but right now
it still detects other missing write barriers.

Change-Id: Iea83d693480c2f3008b4e80d55821acff65970a6
Reviewed-on: https://go-review.googlesource.com/2277
Reviewed-by: Keith Randall <khr@golang.org>
10 years agocmd/gc, runtime: rename writebarrierfat to typedmemmove
Russ Cox [Mon, 29 Dec 2014 15:05:57 +0000 (10:05 -0500)]
cmd/gc, runtime: rename writebarrierfat to typedmemmove

Preparation for replacing many memmove calls in runtime
with typedmemmove, which is a clearer description of what
the routine is doing.

For the same reason, rename writebarriercopy to typedslicecopy.

Change-Id: I6f23bef2c2215509fefba175b16908f76dc7538c
Reviewed-on: https://go-review.googlesource.com/2276
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoruntime, sync/atomic: add write barrier for atomic write of pointer
Russ Cox [Tue, 23 Dec 2014 03:50:42 +0000 (22:50 -0500)]
runtime, sync/atomic: add write barrier for atomic write of pointer

Add write barrier to atomic operations manipulating pointers.

In general an atomic write of a pointer word may indicate racy accesses,
so there is no strictly safe way to attempt to keep the shadow copy
in sync with the real one. Instead, mark the shadow copy as not used.

Redirect sync/atomic pointer routines back to the runtime ones,
so that there is only one copy of the write barrier and shadow logic.
In time we might consider doing this for most of the sync/atomic
functions, but for now only the pointer routines need that treatment.

Found with GODEBUG=wbshadow=1 mode.
Eventually that will run automatically, but right now
it still detects other missing write barriers.

Change-Id: I852936b9a111a6cb9079cfaf6bd78b43016c0242
Reviewed-on: https://go-review.googlesource.com/2066
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
10 years agoruntime: change Gobuf.g to uintptr, not pointer
Russ Cox [Tue, 23 Dec 2014 03:43:49 +0000 (22:43 -0500)]
runtime: change Gobuf.g to uintptr, not pointer

The Gobuf.g goroutine pointer is almost always updated by assembly code.
In one of the few places it is updated by Go code - func save - it must be
treated as a uintptr to avoid a write barrier being emitted at a bad time.
Instead of figuring out how to emit the write barriers missing in the
assembly manipulation, change the type of the field to uintptr, so that
it does not require write barriers at all.

Goroutine structs are published in the allg list and never freed.
That will keep the goroutine structs from being collected.
There is never a time that Gobuf.g's contain the only references
to a goroutine: the publishing of the goroutine in allg comes first.

Goroutine pointers are also kept in non-GC-visible places like TLS,
so I can't see them ever moving. If we did want to start moving data
in the GC, we'd need to allocate the goroutine structs from an
alternate arena. This CL doesn't make that problem any worse.

Found with GODEBUG=wbshadow=1 mode.
Eventually that will run automatically, but right now
it still detects other missing write barriers.

Change-Id: I85f91312ec3e0ef69ead0fff1a560b0cfb095e1a
Reviewed-on: https://go-review.googlesource.com/2065
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
10 years agoruntime: add missing write barriers in append's copy of slice data
Russ Cox [Tue, 23 Dec 2014 03:42:05 +0000 (22:42 -0500)]
runtime: add missing write barriers in append's copy of slice data

Found with GODEBUG=wbshadow=1 mode.
Eventually that will run automatically, but right now
it still detects other missing write barriers.

Change-Id: Ic8624401d7c8225a935f719f96f2675c6f5c0d7c
Reviewed-on: https://go-review.googlesource.com/2064
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
10 years agoruntime: add GODEBUG wbshadow for finding missing write barriers
Russ Cox [Mon, 22 Dec 2014 15:53:51 +0000 (10:53 -0500)]
runtime: add GODEBUG wbshadow for finding missing write barriers

This is the detection code. It works well enough that I know of
a handful of missing write barriers. However, those are subtle
enough that I'll address them in separate followup CLs.

GODEBUG=wbshadow=1 checks for a write that bypassed the
write barrier at the next write barrier of the same word.
If a bug can be detected in this mode it is typically easy to
understand, since the crash says quite clearly what kind of
word has missed a write barrier.

GODEBUG=wbshadow=2 adds a check of the write barrier
shadow copy during garbage collection. Bugs detected at
garbage collection can be difficult to understand, because
there is no context for what the found word means.
Typically you have to reproduce the problem with allocfreetrace=1
in order to understand the type of the badly updated word.

Change-Id: If863837308e7c50d96b5bdc7d65af4969bf53a6e
Reviewed-on: https://go-review.googlesource.com/2061
Reviewed-by: Austin Clements <austin@google.com>
10 years agogo/doc: propagate types from unexported constants
Josh Bleecher Snyder [Tue, 23 Dec 2014 20:10:36 +0000 (12:10 -0800)]
go/doc: propagate types from unexported constants

When constants were declared using unexported constants,
the type information was lost when those constants were filtered out.
This CL propagates the type information of unexported constants
so that it is available for display.

This is a follow-up to CL 144110044, which fixed this problem
specifically for _ constants.

Updates #5397.

Change-Id: I3f0c767a4007d88169a5634ab2870deea4e6a740
Reviewed-on: https://go-review.googlesource.com/2091
Reviewed-by: Robert Griesemer <gri@golang.org>
10 years agomath/big: panic if n <= 0 for ProbablyPrime
Shenghou Ma [Mon, 5 Jan 2015 21:39:34 +0000 (16:39 -0500)]
math/big: panic if n <= 0 for ProbablyPrime

Fixes #9509

Change-Id: I3b86745d38e09093fe2f4b918d774bd6608727d7
Reviewed-on: https://go-review.googlesource.com/2313
Reviewed-by: Robert Griesemer <gri@golang.org>
10 years agoruntime: only check whether the runtime is stale once during tests
Brad Fitzpatrick [Mon, 5 Jan 2015 21:14:08 +0000 (13:14 -0800)]
runtime: only check whether the runtime is stale once during tests

Noticed while investigating the speed of the runtime tests, as part
of debugging while Plan 9's runtime tests are timing out on GCE.

Change-Id: I95f5a3d967a0b45ec1ebf10067e193f51db84e26
Reviewed-on: https://go-review.googlesource.com/2283
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agodoc: Added link to 'go help gopath'
Christopher Guiney [Sat, 3 Jan 2015 18:46:45 +0000 (10:46 -0800)]
doc: Added link to 'go help gopath'

The existing go code document did not link to the GOPATH documentation.
This will link to it, in hopes of making it more discoverable.

Change-Id: Ie4ded2fdce08f412e4acbcc93acdd76f5791b84a
Reviewed-on: https://go-review.googlesource.com/2265
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agomath: be consistent in how we document special cases
Fazlul Shahriar [Fri, 2 Jan 2015 03:16:38 +0000 (22:16 -0500)]
math: be consistent in how we document special cases

Change-Id: Ic6bc4af7bcc89b2881b2b9e7290aeb6fd54804e2
Reviewed-on: https://go-review.googlesource.com/2239
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoRevert "liblink, cmd/ld, runtime: remove stackguard1"
Russ Cox [Mon, 5 Jan 2015 16:29:21 +0000 (16:29 +0000)]
Revert "liblink, cmd/ld, runtime: remove stackguard1"

This reverts commit ab0535ae3fb45ba734d47542cc4845f27f708d1b.

I think it will remain useful to distinguish code that must
run on a system stack from code that can run on either stack,
even if that distinction is no
longer based on the implementation language.

That is, I expect to add a //go:systemstack comment that,
in terms of the old implementation, tells the compiler,
to pretend this function was written in C.

Change-Id: I33d2ebb2f99ae12496484c6ec8ed07233d693275
Reviewed-on: https://go-review.googlesource.com/2275
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agoreflect: document that Values can't be compared directly
Shenghou Ma [Mon, 5 Jan 2015 05:20:45 +0000 (00:20 -0500)]
reflect: document that Values can't be compared directly

Fixes #9504.

Change-Id: I148f407ace3d1b4db3f19fbb8561d1ee6c4c13b3
Reviewed-on: https://go-review.googlesource.com/2273
Reviewed-by: Rob Pike <r@golang.org>
10 years agocrypto/x509: add missing copyright
Mikio Hara [Mon, 5 Jan 2015 06:29:10 +0000 (15:29 +0900)]
crypto/x509: add missing copyright

Change-Id: Ida3b431a06527f6cd604ab4af5ce517959c8619b
Reviewed-on: https://go-review.googlesource.com/2306
Reviewed-by: Dave Cheney <dave@cheney.net>
10 years agocrypto/x509: fix nacl build
Mikio Hara [Mon, 5 Jan 2015 06:27:20 +0000 (15:27 +0900)]
crypto/x509: fix nacl build

Change-Id: Ie47c6460c1749aef3cf6d7c6ba44d43305d7ca7b
Reviewed-on: https://go-review.googlesource.com/2305
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocrypto/x509: split certFiles definition by GOOS
Dave Cheney [Mon, 5 Jan 2015 02:14:04 +0000 (13:14 +1100)]
crypto/x509: split certFiles definition by GOOS

This CL splits the (ever growing) list of ca cert locations by major unix
platforms (darwin, windows and plan9 are already handled seperately).
Although it is clear the unix variants cannot manage to agree on some standard
locations, we can avoid to some extent an artificial ranking of priority
amongst the supported GOOSs.

* Split certFiles definition by GOOS
* Include NetBSD ca cert location

Fixes #9285

Change-Id: I6df2a3fddf3866e71033e01fce43c31e51b48a9e
Reviewed-on: https://go-review.googlesource.com/2208
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agoimage: use three-index slice for NewYCbCr.
Nigel Tao [Mon, 5 Jan 2015 02:50:09 +0000 (13:50 +1100)]
image: use three-index slice for NewYCbCr.

This ensures that changing an image.YCbCr's Y values can't change its
chroma values, even after re-slicing up to capacity.

Change-Id: Icb626561522e336a3220e10f456c95330ae7db9e
Reviewed-on: https://go-review.googlesource.com/2209
Reviewed-by: Rob Pike <r@golang.org>
10 years agolog: update doc comment
Andrew Gerrand [Tue, 30 Dec 2014 01:37:54 +0000 (12:37 +1100)]
log: update doc comment

Fixes #9448.

Change-Id: I8e1d676688d9e9b2fa3519ebc530905f574a1b3e
Reviewed-on: https://go-review.googlesource.com/2088
Reviewed-by: Rob Pike <r@golang.org>
10 years agofmt: fix two typos
Shenghou Ma [Sun, 4 Jan 2015 22:58:13 +0000 (17:58 -0500)]
fmt: fix two typos

Change-Id: I7b65cf3b67bef8950115066d6d12b25cd0a5edfc
Reviewed-on: https://go-review.googlesource.com/2272
Reviewed-by: Rob Pike <r@golang.org>
10 years agocmd/go: be more careful when linking a test exe with gccgo
Michael Hudson-Doyle [Thu, 18 Dec 2014 09:27:26 +0000 (22:27 +1300)]
cmd/go: be more careful when linking a test exe with gccgo

Previously, we ended up passing two compiled objects for the package
being tested when linking the test executable.  Somewhat by luck, this
worked most of the time but occasionally it did not.  This changes the
linking code to not pass two objects for the same ImportPath and to
always pass the object for the test version of the package and removes
some unecessary nil checks.

Change-Id: I7bbd3fc708f14672ee2cc6aed3397421fceb8a38
Reviewed-on: https://go-review.googlesource.com/1840
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoliblink: fix encoding of SETcc for amd64
Shenghou Ma [Fri, 2 Jan 2015 21:30:08 +0000 (16:30 -0500)]
liblink: fix encoding of SETcc for amd64

liblink used to encode both SETEQ BP and SETEQ CH as 0f 94 c5,
however, SETEQ BP should have used a REX prefix.

Fixes #8545.

Change-Id: Ie59c990cdd0ec506cffe4318e9ad1b48db5e57dd
Reviewed-on: https://go-review.googlesource.com/2270
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
10 years agoreflect: set dir when creating a channel via ChanOf
Michael Fraenkel [Fri, 2 Jan 2015 02:38:12 +0000 (21:38 -0500)]
reflect: set dir when creating a channel via ChanOf

Fixes #9135

Change-Id: I4d0e4eb52a3d64262f107eb7eae4096a6e47ac08
Reviewed-on: https://go-review.googlesource.com/2238
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: remove unnecessary GOOS switch
Ian Lance Taylor [Sun, 4 Jan 2015 19:36:54 +0000 (11:36 -0800)]
runtime: remove unnecessary GOOS switch

Change-Id: I8f518e273c02110042b08f7c50c3d38a648c8b6e
Reviewed-on: https://go-review.googlesource.com/2281
Reviewed-by: Minux Ma <minux@golang.org>
10 years agonet: add test cases for parsing ipv4-mapped ipv6 address
Mikio Hara [Wed, 31 Dec 2014 07:46:19 +0000 (16:46 +0900)]
net: add test cases for parsing ipv4-mapped ipv6 address

This CL adds missing ipv4-mapped ipv6 address test cases to TestParseIP.

Change-Id: I3144d2a88d409bd515cf52f8711d407bfa81ed68
Reviewed-on: https://go-review.googlesource.com/2205
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: fix slicecopy return value for zero-width elements
Matthew Dempsky [Tue, 30 Dec 2014 20:31:17 +0000 (12:31 -0800)]
runtime: fix slicecopy return value for zero-width elements

Fixes #8620

Change-Id: Idb49e586919d21d07e94a39ed9ebb0562f403460
Reviewed-on: https://go-review.googlesource.com/2221
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: fix TestCgoExternalThreadSIGPROF again
Shenghou Ma [Sat, 3 Jan 2015 05:12:34 +0000 (00:12 -0500)]
runtime: fix TestCgoExternalThreadSIGPROF again

Shell out to `uname -r` this time, so that the test will compile
even if the platform doesn't have syscall.Sysctl.

Change-Id: I3a19ab5d820bdb94586a97f4507b3837d7040525
Reviewed-on: https://go-review.googlesource.com/2271
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoruntime: skip TestCgoExternalThreadSIGPROF on OS X 10.6
Shenghou Ma [Thu, 1 Jan 2015 06:10:39 +0000 (01:10 -0500)]
runtime: skip TestCgoExternalThreadSIGPROF on OS X 10.6

The test program requires static constructor, which in turn needs
external linking to work, but external linking never works on 10.6.

This should fix the darwin-{386,amd64} builders.

Change-Id: I714fdd3e35f9a7e5f5659cf26367feec9412444f
Reviewed-on: https://go-review.googlesource.com/2235
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agodoc: add a section for performance improvements in go1.5.txt
Brad Fitzpatrick [Fri, 2 Jan 2015 22:35:55 +0000 (14:35 -0800)]
doc: add a section for performance improvements in go1.5.txt

Mostly I need to tickle the builders, since I'm working on the
dashboard builders right now.

Change-Id: I833fc22bc942758a58791ed038634cdd812f5411
Reviewed-on: https://go-review.googlesource.com/2261
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoruntime: use SETEQ instead of JZ for cas
Josh Bleecher Snyder [Thu, 1 Jan 2015 01:31:32 +0000 (17:31 -0800)]
runtime: use SETEQ instead of JZ for cas

Change-Id: Ibabbca3988d39bdce584924173a912d45f50f0dd
Reviewed-on: https://go-review.googlesource.com/2243
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/go: put user ldflags at the end of the linker invocation
Josh Bleecher Snyder [Wed, 31 Dec 2014 21:25:52 +0000 (13:25 -0800)]
cmd/go: put user ldflags at the end of the linker invocation

If the user provided a key but no value via -ldflag -X,
another linker flag was used as the value.

Placing the user's flags at the end avoids this problem.
It also provides the user the opportunity to
override existing linker flags.

Fixes #8810.

Change-Id: I96f4190713dc9a9c29142e56658446fba7fb6bc8
Reviewed-on: https://go-review.googlesource.com/2242
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoos: replace itod on posix with general itoa and fix possible infinite recursion
Martin Möhrmann [Wed, 31 Dec 2014 20:18:59 +0000 (21:18 +0100)]
os: replace itod on posix with general itoa and fix possible infinite recursion

Remove use of itod on posix systems and replace with call to itoa.
Build and use same itoa function on all systems.
Fix infinite recursion in iota function for the case -1<<63.

Change-Id: I89d7e742383c5c4aeef8780501c78a3e1af87a6f
Reviewed-on: https://go-review.googlesource.com/2213
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocmd/gc: update issue tracker link
Alberto Donizetti [Thu, 1 Jan 2015 21:40:11 +0000 (22:40 +0100)]
cmd/gc: update issue tracker link

Updated the issue tracker link the compiler prints out
when asking for a bug report after an internal error.

Change-Id: I092b118130f131c6344d9d058bea4ad6379032b8
Reviewed-on: https://go-review.googlesource.com/2218
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoinclude: remove unnecessary stuff on windows
Shenghou Ma [Thu, 1 Jan 2015 07:23:55 +0000 (02:23 -0500)]
include: remove unnecessary stuff on windows

Our definition of struct timespec used to cause problems with
certain versions of mingw-rt. However, as it turns out, we don't
actually need those definitions and prototypes, so remove them.

Fixes #9472.

Change-Id: Ie0880f0d58be112625140f73d0bed71f98b7cf05
Reviewed-on: https://go-review.googlesource.com/2236
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
10 years agocmd/gc: give an error if only one argument is given to complex()
Shenghou Ma [Mon, 29 Dec 2014 00:18:54 +0000 (19:18 -0500)]
cmd/gc: give an error if only one argument is given to complex()

Fixes #8501

Change-Id: I0dbbdded7f7924351c3d1841d60cb5c934b295b7
Reviewed-on: https://go-review.googlesource.com/2143
Reviewed-by: Chris Manghane <cmang@golang.org>
10 years agoruntime: remove unused export_test declarations
David Crawshaw [Wed, 31 Dec 2014 19:08:54 +0000 (11:08 -0800)]
runtime: remove unused export_test declarations

Change-Id: Iac28c4bbe949af5628cef8ecafdd59ab5d71e6cc
Reviewed-on: https://go-review.googlesource.com/2240
Reviewed-by: Keith Randall <khr@golang.org>
10 years agonet: don't return io.EOF on reading data from datagram, raw sockets on windows
Mikio Hara [Wed, 31 Dec 2014 01:08:51 +0000 (10:08 +0900)]
net: don't return io.EOF on reading data from datagram, raw sockets on windows

Preventing returning io.EOF on non-connection oriented sockets is
already applied to Unix variants. This CL applies it to Windows.

Update #4856.

Change-Id: I82071d40f617e2962d0540b9d1d6a10ea4cdb2ec
Reviewed-on: https://go-review.googlesource.com/2203
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
10 years agonet: remove redundant test case for lookupIP with threadLimit
Mikio Hara [Wed, 31 Dec 2014 06:45:46 +0000 (15:45 +0900)]
net: remove redundant test case for lookupIP with threadLimit

There is no reason to have the redundant test case TestDNSThreadLimt
because TestLookupIPDeadline does cover what we need to test with
-dnsflood flag and more.

Also this CL moves TestLookupIPDeadline into lookup_test.go to avoid
abusing to control the order of test case execution by using file name.

Change-Id: Ib417d7d3411c59d9352c03c996704d584368dc62
Reviewed-on: https://go-review.googlesource.com/2204
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: provide a dummy value of _SIGPROF on plan9 and windows
Shenghou Ma [Thu, 1 Jan 2015 01:55:47 +0000 (20:55 -0500)]
runtime: provide a dummy value of _SIGPROF on plan9 and windows

Fixes build on plan9 and windows.

Change-Id: Ic9b02c641ab84e4f6d8149de71b9eb495e3343b2
Reviewed-on: https://go-review.googlesource.com/2233
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
10 years agoruntime/cgo: remove unused variable
Shenghou Ma [Thu, 1 Jan 2015 02:58:02 +0000 (21:58 -0500)]
runtime/cgo: remove unused variable

I missed this one in golang.org/cl/2232 and only tested the patch
on openbsd/amd64.

Change-Id: I4ff437ae0bfc61c989896c01904b6d33f9bdf0ec
Reviewed-on: https://go-review.googlesource.com/2234
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime/cgo: initialize our pthread_create wrapper earlier on openbsd
Shenghou Ma [Thu, 1 Jan 2015 01:30:57 +0000 (20:30 -0500)]
runtime/cgo: initialize our pthread_create wrapper earlier on openbsd

This is a genuine bug exposed by our test for issue 9456: our wrapper
for pthread_create is not initialized until we initialize cgo itself,
but it is possible that a static constructor could call pthread_create,
and in that case, it will be calling a nil function pointer.

Fix that by also initializing the sys_pthread_create function pointer
inside our pthread_create wrapper function, and use a pthread_once to
make sure it is only initialized once.

Fix build for openbsd.

Change-Id: Ica4da2c21fcaec186fdd3379128ef46f0e767ed7
Reviewed-on: https://go-review.googlesource.com/2232
Reviewed-by: David Crawshaw <crawshaw@golang.org>
10 years agocmd/gc: fix filename output format verb for -s
Shenghou Ma [Wed, 31 Dec 2014 00:48:26 +0000 (19:48 -0500)]
cmd/gc: fix filename output format verb for -s

%lL will prepend the current directory to the filename, which is not
what we want here (as the file name is already absolute).

Fixes #9150.

Change-Id: I4c9386be6baf421393b92d9401a264b4692986d0
Reviewed-on: https://go-review.googlesource.com/2231
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: ignore SIGPROF to foreign threads before cgocallback is fully initialized
Shenghou Ma [Sun, 28 Dec 2014 00:15:38 +0000 (19:15 -0500)]
runtime: ignore SIGPROF to foreign threads before cgocallback is fully initialized

Some libraries, for example, OpenBLAS, create work threads in a global constructor.
If we're doing cpu profiling, it's possible that SIGPROF might come to some of the
worker threads before we make our first cgo call. Cgocallback used to terminate the
process when that happens, but it's better to miss a couple profiling signals than
to abort in this case.

Fixes #9456.

Change-Id: I112b8e1a6e10e6cc8ac695a4b518c0f577309b6b
Reviewed-on: https://go-review.googlesource.com/2141
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agodoc: 2015 will be the Year of the Gopher.
David Symonds [Wed, 31 Dec 2014 13:00:00 +0000 (00:00 +1100)]
doc: 2015 will be the Year of the Gopher.

Change-Id: Ic2e34f84596b56715d5f41c9a5250f7c9f8e671b
Reviewed-on: https://go-review.googlesource.com/2087
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
10 years agostrconv: optimize decimal to string conversion
Martin Möhrmann [Thu, 25 Dec 2014 18:30:53 +0000 (19:30 +0100)]
strconv: optimize decimal to string conversion

Avoid the decimal lookup in digits array and compute the decimal character value directly.
Reduce calls to 64bit division on 32bit plattforms by splitting conversion into smaller blocks.
Convert value to uintptr type when it can be represented by uintptr.

on darwin/386

benchmark               old ns/op     new ns/op     delta
BenchmarkFormatInt      8352          7466          -10.61%
BenchmarkAppendInt      4281          3401          -20.56%
BenchmarkFormatUint     2785          2251          -19.17%
BenchmarkAppendUint     1770          1223          -30.90%

on darwin/amd64

benchmark               old ns/op     new ns/op     delta
BenchmarkFormatInt      5531          5492          -0.71%
BenchmarkAppendInt      2435          2295          -5.75%
BenchmarkFormatUint     1628          1569          -3.62%
BenchmarkAppendUint     726           750           +3.31%

Change-Id: Ifca281cbdd62ab7d7bd4b077a96da99eb12cf209
Reviewed-on: https://go-review.googlesource.com/2105
Reviewed-by: Robert Griesemer <gri@golang.org>
10 years agogo/parser: add {map,chan,interface} to expression lookahead tokens
Alan Donovan [Tue, 30 Dec 2014 19:44:41 +0000 (14:44 -0500)]
go/parser: add {map,chan,interface} to expression lookahead tokens

+ tests that these parse:
  map[int]int{}[0]++
  interface{f()}(x).f()
  chan int(x) <- 0

Fixes #9474

Change-Id: If9fa57b3ab415ae7e93aa9935ec63edda8fe9d4f
Reviewed-on: https://go-review.googlesource.com/2178
Reviewed-by: Robert Griesemer <gri@golang.org>
10 years agoarchive/tar: document Reader.Next's behavior at the end
Brad Fitzpatrick [Tue, 30 Dec 2014 06:28:02 +0000 (22:28 -0800)]
archive/tar: document Reader.Next's behavior at the end

Change-Id: I72f6d0fc66dbee3f832d2d960b99a166a5bb10c3
Reviewed-on: https://go-review.googlesource.com/2191
Reviewed-by: David Symonds <dsymonds@golang.org>
10 years agodoc: add http server trailers support to go1.5.txt
Brad Fitzpatrick [Tue, 30 Dec 2014 18:01:49 +0000 (10:01 -0800)]
doc: add http server trailers support to go1.5.txt

Change-Id: Ic15e40bb1ae0bf3a4e8c43a44daf7cc35a18da87
Reviewed-on: https://go-review.googlesource.com/2192
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoruntime: consolidate arch-specific signal handlers on Plan 9
Anthony Martin [Thu, 18 Dec 2014 13:05:44 +0000 (05:05 -0800)]
runtime: consolidate arch-specific signal handlers on Plan 9

Change-Id: I4379418853c523fc9aaeb5d6f37bc96117841418
Reviewed-on: https://go-review.googlesource.com/1786
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
10 years agodoc: update links in FAQ
Emil Hessman [Tue, 30 Dec 2014 05:45:24 +0000 (06:45 +0100)]
doc: update links in FAQ

Vitess and protobuf has moved to GitHub; update the links.

Change-Id: I2d90bde1a7f2b590c8b7b08ce73d6faa13b51da0
Reviewed-on: https://go-review.googlesource.com/2166
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agonet/http: support for setting trailers from a server Handler
Brad Fitzpatrick [Tue, 30 Dec 2014 03:32:07 +0000 (19:32 -0800)]
net/http: support for setting trailers from a server Handler

We already had client support for trailers, but no way for a server to
set them short of hijacking the connection.

Fixes #7759

Change-Id: Ic83976437739ec6c1acad5f209ed45e501dbb93a
Reviewed-on: https://go-review.googlesource.com/2157
Reviewed-by: Andrew Gerrand <adg@golang.org>
10 years agocmd/gc: logical operators should produce untyped bool for untyped
Chris Manghane [Tue, 9 Dec 2014 15:16:38 +0000 (07:16 -0800)]
cmd/gc: logical operators should produce untyped bool for untyped
operands

Fixes #6671 for cmd/gc.

Change-Id: I4907655b6e243960f2ceb544c63ea16513c7bd68
Reviewed-on: https://go-review.googlesource.com/1251
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
10 years agotest: add fixed GoSmith bugs reported on the gcc Bugzilla
Chris Manghane [Thu, 18 Dec 2014 17:54:32 +0000 (09:54 -0800)]
test: add fixed GoSmith bugs reported on the gcc Bugzilla

Change-Id: I36b57f3e299a4f96b8b5aa55c9c224d888229684
Reviewed-on: https://go-review.googlesource.com/1790
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agotesting/iotest: fix copy/paste error in comment
Robert Griesemer [Mon, 29 Dec 2014 18:54:42 +0000 (10:54 -0800)]
testing/iotest: fix copy/paste error in comment

Reported via unsupported GitHub pull request:
https://github.com/golang/go/pull/9436/

Change-Id: I12b00e8ccac700bb36b200196e2867fcc863fdf1
Reviewed-on: https://go-review.googlesource.com/2139
Reviewed-by: Alan Donovan <adonovan@google.com>
10 years agoruntime: rename atoi to _atoi on Plan 9
David du Colombier [Mon, 29 Dec 2014 16:35:42 +0000 (17:35 +0100)]
runtime: rename atoi to _atoi on Plan 9

Following change 2154, the goatoi function
was renamed atoi.

However, this definition conflicts with the
atoi function defined in the Plan 9 runtime,
which takes a []byte instead of a string.

This change fixes the build on Plan 9.

Change-Id: Ia0f7ca2f965bd5e3cce3177bba9c806f64db05eb
Reviewed-on: https://go-review.googlesource.com/2165
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoruntime: remove go prefix from a few routines
Keith Randall [Mon, 29 Dec 2014 07:16:32 +0000 (23:16 -0800)]
runtime: remove go prefix from a few routines

They are no longer needed now that C is gone.

goatoi -> atoi
gofuncname/funcname -> funcname/cfuncname
goroundupsize -> already existing roundupsize

Change-Id: I278bc33d279e1fdc5e8a2a04e961c4c1573b28c7
Reviewed-on: https://go-review.googlesource.com/2154
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoliblink, cmd/ld, runtime: remove stackguard1
Shenghou Ma [Mon, 29 Dec 2014 06:08:40 +0000 (01:08 -0500)]
liblink, cmd/ld, runtime: remove stackguard1

Now that we've removed all the C code in runtime and the C compilers,
there is no need to have a separate stackguard field to check for C
code on Go stack.

Remove field g.stackguard1 and rename g.stackguard0 to g.stackguard.
Adjust liblink and cmd/ld as necessary.

Change-Id: I54e75db5a93d783e86af5ff1a6cd497d669d8d33
Reviewed-on: https://go-review.googlesource.com/2144
Reviewed-by: Keith Randall <khr@golang.org>
10 years agodoc: add net/smtp TLSConnectionState note in go1.5.txt
Brad Fitzpatrick [Sun, 28 Dec 2014 21:37:44 +0000 (13:37 -0800)]
doc: add net/smtp TLSConnectionState note in go1.5.txt

Change-Id: Ia18f6ed0fa38dac297fc5fe1ca56e38ec37518ef
Reviewed-on: https://go-review.googlesource.com/2152
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agonet/smtp: add TLSConnectionState accessor
Brad Fitzpatrick [Sun, 28 Dec 2014 19:18:59 +0000 (11:18 -0800)]
net/smtp: add TLSConnectionState accessor

Fixes #9451

Change-Id: I0540e398b30c10779ac9d5a67a01d44bb6054a92
Reviewed-on: https://go-review.googlesource.com/2151
Reviewed-by: David Symonds <dsymonds@golang.org>
10 years agoencoding/gob: address go vet report
Emil Hessman [Sun, 28 Dec 2014 07:21:58 +0000 (08:21 +0100)]
encoding/gob: address go vet report

Use Fatalf for formatting directive rather than plain Fatal.

Change-Id: Iebd30cd6326890e9501746113a6d97480949e3d2
Reviewed-on: https://go-review.googlesource.com/2161
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoruntime: get rid of goalg, no longer needed
Keith Randall [Sun, 28 Dec 2014 04:32:11 +0000 (20:32 -0800)]
runtime: get rid of goalg, no longer needed

The goalg function was a holdover from when we had algorithm
tables in both C and Go.  It is no longer needed.

Change-Id: Ia0c1af35bef3497a899f22084a1a7b42daae72a0
Reviewed-on: https://go-review.googlesource.com/2099
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoencoding/json: address go vet reports
Emil Hessman [Sat, 27 Dec 2014 19:52:17 +0000 (20:52 +0100)]
encoding/json: address go vet reports

The error message for decoding a unquoted value into a struct field with
the ,string option specified has two arguments when one is needed.
Make the error message take one argument and add a test in order to cover
the case when a unquoted value is specified.

Also add error value as the missing argument for Fatalf call in test.

Fixes the following go vet reports:

decode.go:602: wrong number of args for format in Errorf call: 1 needed but 2 args
decode_test.go:1088: missing argument for Fatalf("%v"): format reads arg 1, have only 0 args

Change-Id: Id036e10c54c4a7c1ee9952f6910858ecc2b84134
Reviewed-on: https://go-review.googlesource.com/2109
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
10 years agocmd/pack: address go vet reports
Emil Hessman [Sun, 28 Dec 2014 05:12:19 +0000 (06:12 +0100)]
cmd/pack: address go vet reports

Use log.Fatalf for formatting directives instead of log.Fatal

Change-Id: Ia207b320f5795c63cdfa71f92c19ca6d05cc833f
Reviewed-on: https://go-review.googlesource.com/2160
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime: rename gothrow to throw
Keith Randall [Sun, 28 Dec 2014 04:58:00 +0000 (20:58 -0800)]
runtime: rename gothrow to throw

Rename "gothrow" to "throw" now that the C version of "throw"
is no longer needed.

This change is purely mechanical except in panic.go where the
old version of "throw" has been deleted.

sed -i "" 's/[[:<:]]gothrow[[:>:]]/throw/g' runtime/*.go

Change-Id: Icf0752299c35958b92870a97111c67bcd9159dc3
Reviewed-on: https://go-review.googlesource.com/2150
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
10 years agonet/http: use t.Fatalf rather than t.Fatal in cookie_test.go
Guobiao Mei [Sat, 27 Dec 2014 23:28:07 +0000 (18:28 -0500)]
net/http: use t.Fatalf rather than t.Fatal in cookie_test.go

Change-Id: I60bbb7deb7462d1ca884677b4f86bd54b20b3f35
Reviewed-on: https://go-review.googlesource.com/2140
Reviewed-by: Minux Ma <minux@golang.org>
10 years agostrconv/itoa: add test to generate the longest output string possible by formatBits
Martin Möhrmann [Sat, 27 Dec 2014 10:53:09 +0000 (11:53 +0100)]
strconv/itoa: add test to generate the longest output string possible by formatBits

The new test case produces the longest string representation possible and thereby uses
all of the 65 bytes in the buffer array used by the formatBits function.

Change-Id: I11320c4de56ced5ff098b7e37f1be08e456573e2
Reviewed-on: https://go-review.googlesource.com/2108
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agodoc: mention the crypto/cipher.Stream clarification in go1.5.txt
Shenghou Ma [Fri, 26 Dec 2014 21:00:49 +0000 (16:00 -0500)]
doc: mention the crypto/cipher.Stream clarification in go1.5.txt

Change-Id: Ie95c86d222b230a2e69f4141e3372bf94dee3e91
Reviewed-on: https://go-review.googlesource.com/2129
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocrypto/cipher: update docs for the Stream interface
Shenghou Ma [Thu, 18 Dec 2014 08:18:23 +0000 (03:18 -0500)]
crypto/cipher: update docs for the Stream interface

Specify what will happen if len(dst) != len(src).

Change-Id: I66afa3730f637753b825189687418f14ddec3629
Reviewed-on: https://go-review.googlesource.com/1754
Reviewed-by: Adam Langley <agl@golang.org>
10 years agodoc/go_spec: fix typo
Shenghou Ma [Fri, 26 Dec 2014 07:50:33 +0000 (02:50 -0500)]
doc/go_spec: fix typo

Fixes #9445

Change-Id: If7abd4d4d41cdfd5cf677f03533c930c8b965a01
Reviewed-on: https://go-review.googlesource.com/2128
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoreflect, runtime: gofmt
mattn [Fri, 26 Dec 2014 02:44:55 +0000 (11:44 +0900)]
reflect, runtime: gofmt

Change-Id: I5437b3a36181373d8ff33225d7520ab321459de9
Reviewed-on: https://go-review.googlesource.com/2084
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocmd/ld: put .bss from external objects into real .bss section
Shenghou Ma [Sun, 21 Dec 2014 07:48:01 +0000 (02:48 -0500)]
cmd/ld: put .bss from external objects into real .bss section

Fixes #9359.

Change-Id: Iba62935b5a14de23d914f433a09a40417d7e88ed
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/1889
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: simplify procresize
Dmitry Vyukov [Mon, 22 Dec 2014 15:14:00 +0000 (18:14 +0300)]
runtime: simplify procresize

Currently we do very a complex rebalancing of runnable goroutines
between queues, which tries to preserve scheduling fairness.
Besides being complex and error-prone, it also destroys all locality
of scheduling.

This change uses simpler scheme: leave runnable goroutines where
they are, during starttheworld start all Ps with local work,
plus start one additional P in case we have excessive runnable
goroutines in local queues or in the global queue.

The schedler must be able to operate efficiently w/o the rebalancing,
because garbage collections do not have to happen frequently.

The immediate need is execution tracing support: handling of
garabage collection which does stoptheworld/starttheworld several
times becomes exceedingly complex if the current execution can
jump between Ps during starttheworld.

Change-Id: I4fdb7a6d80ca4bd08900d0c6a0a252a95b1a2c90
Reviewed-on: https://go-review.googlesource.com/1951
Reviewed-by: Rick Hudson <rlh@golang.org>
10 years agoregexp: fix typo in comment: s/onpass/onepass/
Michael Matloob [Wed, 24 Dec 2014 07:19:08 +0000 (23:19 -0800)]
regexp: fix typo in comment: s/onpass/onepass/

Change-Id: Idff57050a34d09e7fa9b77e9b53d61bb5ea2a71c
Reviewed-on: https://go-review.googlesource.com/2095
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoreflect: fix func layout test for nacl build
Keith Randall [Tue, 23 Dec 2014 21:45:58 +0000 (13:45 -0800)]
reflect: fix func layout test for nacl build

This test code is ugly.  There must be a better way.
But for now, fix the build.

Change-Id: I33064145ea37f11abf040ec97caa87669be1a9fa
Reviewed-on: https://go-review.googlesource.com/2114
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agodatabase/sql: Remove unnecessary call to maybeOpenNewConnections
Marko Tiikkaja [Sun, 14 Dec 2014 02:57:14 +0000 (03:57 +0100)]
database/sql: Remove unnecessary call to maybeOpenNewConnections

numCanOpen will never be larger than 0 in maybeOpenNewConnections() when this
code path is taken, so no new connections can ever be opened.

Change-Id: Id1302e8d9afb3a67be61b5e738fe07ef81d20fe0
Reviewed-on: https://go-review.googlesource.com/1550
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agomisc/cgo/test: get rid of the backdoor package
Shenghou Ma [Sat, 20 Dec 2014 19:13:44 +0000 (14:13 -0500)]
misc/cgo/test: get rid of the backdoor package

For Go 1.5, we can use go:linkname rather than assembly thunk for gc.
Gccgo already has support for //extern.

Change-Id: I5505aa247dd5b555112f7261ed2f192c81cf0bdf
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/1888
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agotest/fixedbugs/issue9355: fix build on arm and power64
Shenghou Ma [Fri, 19 Dec 2014 05:36:26 +0000 (00:36 -0500)]
test/fixedbugs/issue9355: fix build on arm and power64

Change-Id: I1ef770184ad1d42bcb58714d559f2cc866a919ab
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/1880
Reviewed-by: Keith Randall <khr@golang.org>
10 years agosort: simplify rotate and reduce calls to it
Martin Möhrmann [Tue, 23 Dec 2014 19:44:10 +0000 (20:44 +0100)]
sort: simplify rotate and reduce calls to it

Move the checks for empty rotate changes
from the beginning of rotate to the callers.

Remove additional variable p used instead of existing m with same value.

Remove special casing of equal ranges (i==j) to exit early as no
work is saved vs checking (i!=j) and  making a single
swapRange call if this is false.

benchmark                   old ns/op      new ns/op      delta
BenchmarkStableString1K     417195         425218         +1.92%
BenchmarkStableInt1K        126661         124498         -1.71%
BenchmarkStableInt64K       10365014       10417438       +0.51%
BenchmarkStable1e2          132151         130648         -1.14%
BenchmarkStable1e4          42027428       40812649       -2.89%
BenchmarkStable1e6          8524772364     8430192391     -1.11%

Change-Id: Ia7642e9d31408496970c700f5843d53cc3ebe817
Reviewed-on: https://go-review.googlesource.com/2100
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agogo/build: add variable expansion to cgo lines
Carlos Castillo [Mon, 8 Dec 2014 15:28:40 +0000 (07:28 -0800)]
go/build: add variable expansion to cgo lines

When go parses #cgo lines, expand ${SRCDIR} into the path to the
source directory. This allows options to be passed to the
compiler and linker that involve file paths relative to the
source code directory. Without the expansion the paths would be
invalid when the current working directory changes.

Fixes #7891
Fixes #5428

Change-Id: I343a145a9771a5ccbaa958e4a1ecd1716fcae52d
Reviewed-on: https://go-review.googlesource.com/1756
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoreflect: more function layout tests
Keith Randall [Tue, 23 Dec 2014 18:57:37 +0000 (10:57 -0800)]
reflect: more function layout tests

Test more stuff:
1) flagNoPointers, an incorrect value was the cause of #9425
2) Total function layout size
3) gc program

Change-Id: I73f65fe740215938fa930d2f096febd9db0a0021
Reviewed-on: https://go-review.googlesource.com/2090
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agomime/multipart: moved some code to mime/internal/quotedprintable
Alexandre Cesaro [Thu, 18 Dec 2014 20:33:34 +0000 (21:33 +0100)]
mime/multipart: moved some code to mime/internal/quotedprintable

The code concerning quoted-printable encoding (RFC 2045) and its
variant for MIME headers (RFC 2047) is currently spread in
mime/multipart and net/mail. It is also not exported.

This commit is the first step to fix that issue. It moves the
quoted-printable decoding code from mime/multipart to
mime/internal/quotedprintable. The exposed API is unchanged.

Concerns #4943.

Change-Id: I11352afbb2edb4d6ef62870b9bc5c87c639eff12
Reviewed-on: https://go-review.googlesource.com/1810
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoruntime: fix exit on Plan 9
David du Colombier [Tue, 23 Dec 2014 10:09:15 +0000 (11:09 +0100)]
runtime: fix exit on Plan 9

Add a nil byte at the end of the itoa buffer,
before calling gostringnocopy. This prevents
gostringnocopy to read past the buffer size.

Change-Id: I87494a8dd6ea45263882536bf6c0f294eda6866d
Reviewed-on: https://go-review.googlesource.com/2033
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
10 years agomath/rand: fix example_test to show with the correct method
Guobiao Mei [Tue, 23 Dec 2014 15:47:12 +0000 (10:47 -0500)]
math/rand: fix example_test to show with the correct method

Originally it used r.Int63() to show "Uint32", and now we use the correct r.Uint32() method.

Fixes #9429

Change-Id: I8a1228f1ca1af93b0e3104676fc99000257c456f
Reviewed-on: https://go-review.googlesource.com/2069
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agotest: disable bug248 and bug345 tests on Plan 9
David du Colombier [Tue, 23 Dec 2014 08:05:28 +0000 (09:05 +0100)]
test: disable bug248 and bug345 tests on Plan 9

These tests were enabled as part of change 1774.
They depend on the errchk tool, which is a Perl
script. However, Perl is not available on Plan 9.

Change-Id: I82707aae16013acc9a3800d39b0084588b852b53
Reviewed-on: https://go-review.googlesource.com/2031
Reviewed-by: Minux Ma <minux@golang.org>
10 years agocmd/dist: fatal shouldn't print errstr on Plan 9
David du Colombier [Mon, 22 Dec 2014 21:33:39 +0000 (22:33 +0100)]
cmd/dist: fatal shouldn't print errstr on Plan 9

During change 1864 discussion, Russ Cox pointed out
the fatal function shouldn't print errstr.

Change-Id: Icd71ec04be9c944bc235b8b198158465172e4fde
Reviewed-on: https://go-review.googlesource.com/2030
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agoruntime: remove thunk_windows.s
Alex Brainman [Tue, 23 Dec 2014 04:33:51 +0000 (15:33 +1100)]
runtime: remove thunk_windows.s

Change-Id: I171298e7942093e9cc82e3a0c4fcbb5b10298816
Reviewed-on: https://go-review.googlesource.com/1998
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime: add comments for blank import of "unsafe"
Shenghou Ma [Tue, 23 Dec 2014 05:03:40 +0000 (00:03 -0500)]
runtime: add comments for blank import of "unsafe"

Change-Id: Iaad548ea90d3b70341a723450d5e4d4c2b88856f
Reviewed-on: https://go-review.googlesource.com/2063
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
10 years agocmd/api: work around Windows rename issue on the builders
Brad Fitzpatrick [Tue, 23 Dec 2014 02:28:16 +0000 (18:28 -0800)]
cmd/api: work around Windows rename issue on the builders

More cmd/api/run.go hell.

Fixes #9407

Change-Id: If8fb446a2471d6372beb0534c9ab6824029b404c
Reviewed-on: https://go-review.googlesource.com/2054
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Minux Ma <minux@golang.org>
10 years agoruntime: fix build for arm and ppc64/ppc64le
Shenghou Ma [Tue, 23 Dec 2014 04:44:41 +0000 (23:44 -0500)]
runtime: fix build for arm and ppc64/ppc64le

Change-Id: I17ddcb541dfac8b1e48e01ee005563031b6ade2a
Reviewed-on: https://go-review.googlesource.com/2062
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agobuild: give freebsd longer to run tests
Andrew Gerrand [Tue, 23 Dec 2014 01:09:38 +0000 (12:09 +1100)]
build: give freebsd longer to run tests

The freebsd-386 and freebsd-amd64 builders are timing out sometimes.
This will give them some more breathing room.

Change-Id: Ib65bd172cca046a52861759a4232d7b4b6514fa8
Reviewed-on: https://go-review.googlesource.com/1994
Reviewed-by: Ian Lance Taylor <iant@golang.org>
10 years agoruntime: import unsafe in os_windows.go (fixes windows build)
Alex Brainman [Tue, 23 Dec 2014 04:00:04 +0000 (15:00 +1100)]
runtime: import unsafe in os_windows.go (fixes windows build)

Change-Id: I55419cb580e6d18cf1c17c3e7bb8777ed6d794e7
Reviewed-on: https://go-review.googlesource.com/1995
Reviewed-by: Ian Lance Taylor <iant@golang.org>