]> Cypherpunks repositories - gostls13.git/log
gostls13.git
11 years agoruntime: move stack scanning into the parallel mark phase
Carl Shapiro [Tue, 3 Dec 2013 22:12:55 +0000 (14:12 -0800)]
runtime: move stack scanning into the parallel mark phase

This change reduces the cost of the stack scanning by frames.
It moves the stack scanning from the serial root enumeration
phase to the parallel tracing phase.  The output that follows
are timings for the issue 6482 benchmark

Baseline

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

Stack scan by frames, non-parallel

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

Stack scan by frames, parallel

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

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

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

Baseline

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

Gentraceback

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

R=golang-dev, dvyukov, rsc
CC=golang-dev
https://golang.org/cl/17410043

11 years agoruntime: get rid of concatstring's vararg C argument.
Keith Randall [Tue, 3 Dec 2013 18:39:19 +0000 (10:39 -0800)]
runtime: get rid of concatstring's vararg C argument.

Pass as a slice of strings instead.  For 2-5 strings, implement
dedicated routines so no slices are needed.

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

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

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/36380043

11 years agoruntime: fix race detector when map keys/values are passed by pointer.
Keith Randall [Tue, 3 Dec 2013 02:03:25 +0000 (18:03 -0800)]
runtime: fix race detector when map keys/values are passed by pointer.

Now that the map implementation is reading the keys and values from
arbitrary memory (instead of from stack slots), it needs to tell the
race detector when it does so.

Fixes #6875.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/36360043

11 years agoreflect: test to make sure big Zero()-obtained objects are really zero.
Keith Randall [Tue, 3 Dec 2013 01:58:19 +0000 (17:58 -0800)]
reflect: test to make sure big Zero()-obtained objects are really zero.

Update #6876.

R=dave, bradfitz
CC=golang-dev
https://golang.org/cl/36370043

11 years agoreflect: fix Zero() implementation - not every type has a
Keith Randall [Tue, 3 Dec 2013 00:54:29 +0000 (16:54 -0800)]
reflect: fix Zero() implementation - not every type has a
zero object allocated, so we still need to allocate a new
zero area every time.

Fixes #6876.

R=golang-dev
CC=golang-dev
https://golang.org/cl/36320043

11 years agoreflect: prevent the callXX routines from calling makeFuncStub
Keith Randall [Mon, 2 Dec 2013 21:36:50 +0000 (13:36 -0800)]
reflect: prevent the callXX routines from calling makeFuncStub
and methodValueCall directly.  Instead, we inline their behavior
inside of reflect.call.

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

Fixes #6619.

R=golang-dev, dvyukov, rsc, iant, khr
CC=golang-dev
https://golang.org/cl/26970044

11 years agoruntime: don't use ... formal argument to deferreturn.
Keith Randall [Mon, 2 Dec 2013 21:07:15 +0000 (13:07 -0800)]
runtime: don't use ... formal argument to deferreturn.

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

11 years agoruntime: pass key/value to map accessors by reference, not by value.
Keith Randall [Mon, 2 Dec 2013 21:05:04 +0000 (13:05 -0800)]
runtime: pass key/value to map accessors by reference, not by value.

This change is part of the plan to get rid of all vararg C calls
which are a pain for getting exact stack scanning.

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

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

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

R=golang-dev, dvyukov, khr, rsc
CC=golang-dev
https://golang.org/cl/14794043

11 years agotag go1.2
Andrew Gerrand [Sun, 1 Dec 2013 22:06:41 +0000 (09:06 +1100)]
tag go1.2

R=golang-dev, dsymonds, alex.brainman
CC=golang-dev
https://golang.org/cl/35000043

11 years agomisc/vim: send Fmt errors to the quickfix list instead of the location list.
David Symonds [Wed, 27 Nov 2013 08:32:15 +0000 (19:32 +1100)]
misc/vim: send Fmt errors to the quickfix list instead of the location list.

Output from gofmt is a list of errors, so they should appear in the error list.

R=adg
CC=golang-dev
https://golang.org/cl/33760043

11 years agodoc/install.html: fix a tag.
Oling Cat [Mon, 25 Nov 2013 02:36:16 +0000 (13:36 +1100)]
doc/install.html: fix a tag.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/30900044

11 years agomisc/vim: describe how to get gofmt-on-save behaviour.
David Symonds [Mon, 25 Nov 2013 00:03:47 +0000 (11:03 +1100)]
misc/vim: describe how to get gofmt-on-save behaviour.

Fixes #6826.

R=golang-dev, bradfitz, adg
CC=golang-dev
https://golang.org/cl/31770043

11 years agoREADME: Fix installation instructions
Rob Pike [Wed, 20 Nov 2013 21:47:37 +0000 (13:47 -0800)]
README: Fix installation instructions
They were out of date and should refer to the source installation instructions.

Fixes #6783.

R=golang-dev, rsc, adg, dave
CC=golang-dev
https://golang.org/cl/28500043

11 years agodoc: update installation instructions
Andrew Gerrand [Wed, 20 Nov 2013 20:55:29 +0000 (07:55 +1100)]
doc: update installation instructions

Clarify that GOROOT should only be set when using a custom install path.
Remove NetBSD from binary install page (we don't provide binaries).
Remove "What's next" links from installation instructions.
Emphasize "How to Write Go Code" page.

Fixes #6613.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/28700043

11 years agotest: revert unintentional commits
dvyukov [Tue, 19 Nov 2013 11:36:13 +0000 (15:36 +0400)]
test: revert unintentional commits
I thought I am in a different repo...

11 years ago-
dvyukov [Tue, 19 Nov 2013 11:31:01 +0000 (15:31 +0400)]
-

11 years ago13+
dvyukov [Tue, 19 Nov 2013 08:55:12 +0000 (12:55 +0400)]
13+

11 years agomisc/dist: fix file regexp
Andrew Gerrand [Mon, 18 Nov 2013 02:30:25 +0000 (13:30 +1100)]
misc/dist: fix file regexp

This step makes it possible to upload the -osx10.x binaries
separately to their construction (after signing, for example).

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/28160043

11 years agotag go1.2rc5
Andrew Gerrand [Mon, 18 Nov 2013 01:47:37 +0000 (12:47 +1100)]
tag go1.2rc5

R=dsymonds
CC=golang-dev
https://golang.org/cl/28150043

11 years agoC: add Marko Mikulicic (Google CLA)
Brad Fitzpatrick [Fri, 15 Nov 2013 19:01:54 +0000 (11:01 -0800)]
C: add Marko Mikulicic (Google CLA)

R=golang-dev, crawshaw
CC=golang-dev
https://golang.org/cl/27000043

11 years agodoc/asm: more about SP, ARM R11
Russ Cox [Thu, 14 Nov 2013 02:29:34 +0000 (21:29 -0500)]
doc/asm: more about SP, ARM R11

Also rename URL to /doc/asm.

R=golang-dev, minux.ma, r
CC=golang-dev
https://golang.org/cl/26170043

11 years agoencoding/gob: do not use MarshalText, UnmarshalText
Russ Cox [Thu, 14 Nov 2013 02:29:19 +0000 (21:29 -0500)]
encoding/gob: do not use MarshalText, UnmarshalText

This seems to be the best of a long list of bad ways to fix this issue.

Fixes #6760.

R=r
CC=golang-dev
https://golang.org/cl/22770044

11 years agoencoding/gob: expose encode/decode example
Andrew Gerrand [Wed, 13 Nov 2013 22:20:29 +0000 (09:20 +1100)]
encoding/gob: expose encode/decode example

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/26220045

11 years agotag go1.2rc4
Andrew Gerrand [Wed, 13 Nov 2013 04:32:40 +0000 (15:32 +1100)]
tag go1.2rc4

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/25580045

11 years agosrc/cmd/?a: link to new assembler document
Rob Pike [Wed, 13 Nov 2013 04:07:08 +0000 (20:07 -0800)]
src/cmd/?a: link to new assembler document
Blocked on 20930043, the CL the new text references.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/18430044

11 years agodoc/asm.html: new document, a brief guide to the assembler
Rob Pike [Wed, 13 Nov 2013 04:04:22 +0000 (20:04 -0800)]
doc/asm.html: new document, a brief guide to the assembler

Fixes #6060

R=golang-dev, iant, bradfitz, josharian, minux.ma, aram, rsc
CC=golang-dev
https://golang.org/cl/20930043

11 years agospec: clarify rules for blank identifiers
Robert Griesemer [Wed, 13 Nov 2013 02:06:54 +0000 (21:06 -0500)]
spec: clarify rules for blank identifiers

This documents the status quo more precisely.
Not a language change.

Fixes #6006.

R=r, rsc, iant, ken
CC=golang-dev
https://golang.org/cl/14415043

11 years agodoc: use the same wording for OS X as the other OSes
Andrew Gerrand [Wed, 13 Nov 2013 00:53:01 +0000 (11:53 +1100)]
doc: use the same wording for OS X as the other OSes

I used "and above" when I should have said "or later".

Sorry for the churn.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/25670043

11 years agodoc: we support all recent versions of OS X
Andrew Gerrand [Wed, 13 Nov 2013 00:35:25 +0000 (11:35 +1100)]
doc: we support all recent versions of OS X

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/25370045

11 years agoCONTRIBUTORS: add additional e-mail address for Richard Musiol
Robert Griesemer [Tue, 12 Nov 2013 18:03:13 +0000 (10:03 -0800)]
CONTRIBUTORS: add additional e-mail address for Richard Musiol

R=adonovan
CC=golang-dev
https://golang.org/cl/25360043

11 years agoA+C: Richard Musiol (individual CLA)
Robert Griesemer [Tue, 12 Nov 2013 17:57:00 +0000 (09:57 -0800)]
A+C: Richard Musiol (individual CLA)

Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/25350043

11 years agomisc/vim: add a gofmt_command flag for :Fmt
David Crawshaw [Mon, 11 Nov 2013 22:28:07 +0000 (09:28 +1100)]
misc/vim: add a gofmt_command flag for :Fmt

R=dsymonds, dominik.honnef, n13m3y3r, rsc, kamil.kisiel
CC=golang-dev
https://golang.org/cl/22940044

11 years agocmd/godoc: document package-level examples
Olivier Duperray [Mon, 11 Nov 2013 01:09:24 +0000 (12:09 +1100)]
cmd/godoc: document package-level examples

Fixes  issue  5807 .

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/23940043

11 years agomisc/emacs: various cleanups
Dominik Honnef [Fri, 8 Nov 2013 20:23:12 +0000 (15:23 -0500)]
misc/emacs: various cleanups

- Use #' for function symbols
- Remove unused variables
- Use declare-function to shut up byte compiler

This is identical to CL 19010044 with one exception: Making sure
it doesn't break on Emacs 22.1

R=adonovan, bradfitz, shendaras
CC=golang-dev
https://golang.org/cl/20100043

11 years agoemacs: allow users to customize the gofmt command, in particular, to use goimports...
Sameer Ajmani [Fri, 8 Nov 2013 16:31:44 +0000 (11:31 -0500)]
emacs: allow users to customize the gofmt command, in particular, to use goimports instead.

R=adonovan
CC=golang-dev
https://golang.org/cl/23680043

11 years agocmd/cgo: fix handling of array of pointers when using clang
Russ Cox [Thu, 7 Nov 2013 20:24:51 +0000 (15:24 -0500)]
cmd/cgo: fix handling of array of pointers when using clang

Clang does not record the "size" field for pointer types,
so we must insert the size ourselves. We were already
doing this, but only for the case of pointer types.
For an array of pointer types, the setting of the size for
the nested pointer type was happening after the computation
of the size of the array type, meaning that the array type
was always computed as 0 bytes. Delay the size computation.

This bug happens on all Clang systems, not just FreeBSD.
Our test checked that cgo wrote something, not that it was correct.
FreeBSD's default clang rejects array[0] as a C struct field,
so it noticed the incorrect sizes. But the sizes were incorrect
everywhere.

Update testcdefs to check the output has the right semantics.

Fixes #6292.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/22840043

11 years agodoc: update note about GCC 4.8.2 in gccgo instructions
Ian Lance Taylor [Wed, 6 Nov 2013 21:58:35 +0000 (13:58 -0800)]
doc: update note about GCC 4.8.2 in gccgo instructions

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/22510043

11 years agogo/doc: add full stop of Japanese, Chinese and Korean.
Ato Araki [Tue, 5 Nov 2013 04:13:50 +0000 (15:13 +1100)]
go/doc: add full stop of Japanese, Chinese and Korean.

This fix will show a good synopsis on package listings in that languages.

R=adg, r
CC=golang-dev
https://golang.org/cl/21130043

11 years agoA+C: Ato Araki (individual CLA)
Andrew Gerrand [Tue, 5 Nov 2013 04:10:24 +0000 (15:10 +1100)]
A+C: Ato Araki (individual CLA)

Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/21790043

11 years agodoc/go1.2: link to cgo documentation
Andrew Gerrand [Tue, 5 Nov 2013 02:54:48 +0000 (13:54 +1100)]
doc/go1.2: link to cgo documentation

I know it's linked in the previous sentence, but this new link is where I want it to be while reading this sentence.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/21770043

11 years agonet/textproto: fix CanonicalMIMEHeaderKey panic
Brad Fitzpatrick [Mon, 4 Nov 2013 17:35:11 +0000 (12:35 -0500)]
net/textproto: fix CanonicalMIMEHeaderKey panic

Fixes #6712

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/21450043

11 years agoC: add Robert Snedegar (Google CLA)
Andrew Gerrand [Mon, 4 Nov 2013 06:41:08 +0000 (17:41 +1100)]
C: add Robert Snedegar (Google CLA)

R=golang-dev
CC=golang-dev
https://golang.org/cl/21390044

11 years agoC: add Brad Garcia (Google CLA)
Brad Fitzpatrick [Fri, 1 Nov 2013 16:18:35 +0000 (09:18 -0700)]
C: add Brad Garcia (Google CLA)

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

11 years agotag go1.2rc3
Andrew Gerrand [Fri, 1 Nov 2013 01:53:31 +0000 (12:53 +1100)]
tag go1.2rc3

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/20680043

11 years agocmd/5l, runtime: fix divide for profiling tracebacks on ARM
Russ Cox [Thu, 31 Oct 2013 18:15:55 +0000 (18:15 +0000)]
cmd/5l, runtime: fix divide for profiling tracebacks on ARM

Two bugs:
1. The first iteration of the traceback always uses LR when provided,
which it is (only) during a profiling signal, but in fact LR is correct
only if the stack frame has not been allocated yet. Otherwise an
intervening call may have changed LR, and the saved copy in the stack
frame should be used. Fix in traceback_arm.c.

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

        SUB $8, SP

into

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

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

Fixes #6681.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/19910044

11 years agoundo CL 19810043 / 352f3b7c9664
Russ Cox [Thu, 31 Oct 2013 17:18:57 +0000 (17:18 +0000)]
undo CL 19810043 / 352f3b7c9664

The CL causes misc/cgo/test to fail randomly.
I suspect that the problem is the use of a division instruction
in usleep, which can be called while trying to acquire an m
and therefore cannot store the denominator in m.
The solution to that would be to rewrite the code to use a
magic multiply instead of a divide, but now we're getting
pretty far off the original code.

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

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

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

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

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

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

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

Fixes #6681.

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

TBR=r
CC=golang-dev
https://golang.org/cl/20350043

11 years agocmd/5l, runtime: make ARM integer division profiler-friendly
Russ Cox [Wed, 30 Oct 2013 18:50:34 +0000 (18:50 +0000)]
cmd/5l, runtime: make ARM integer division profiler-friendly

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

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

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

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

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

Fixes #6681.

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

11 years agodoc/go1.2.html: delete repeated word
Rob Pike [Wed, 30 Oct 2013 16:39:20 +0000 (09:39 -0700)]
doc/go1.2.html: delete repeated word
TBR=rsc

R=golang-dev
CC=golang-dev
https://golang.org/cl/19840043

11 years agodoc/go1.2.html: stack sizes, thread limits
Rob Pike [Wed, 30 Oct 2013 15:54:53 +0000 (08:54 -0700)]
doc/go1.2.html: stack sizes, thread limits

R=golang-dev, minux.ma, adg, rsc
CC=golang-dev
https://golang.org/cl/19600043

11 years agocmd/cgo: accept extra leading _ on __cgodebug_data for all object formats
Russ Cox [Wed, 30 Oct 2013 14:24:42 +0000 (10:24 -0400)]
cmd/cgo: accept extra leading _ on __cgodebug_data for all object formats

The current Windows build breakage appears to be because
the Windows code should be looking for __cgodebug_data
not ___cgodebug_data. Dodge the question everywhere by
accepting both.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/19780043

11 years agoundo CL 19010044 / dbcd720e5396
Alan Donovan [Wed, 30 Oct 2013 02:17:14 +0000 (22:17 -0400)]
undo CL 19010044 / dbcd720e5396

bradfitz reports:
> It breaks go-mode on GNU Emacs 22.1.1 as ships with OS X 10.8.6.

««« original CL description
misc/emacs: various cleanups

- Use #' for function symbols
- Remove unused variables
- Use declare-function to shut up byte compiler

R=adonovan
CC=golang-dev
https://golang.org/cl/19010044

»»»

R=bradfitz
CC=golang-dev
https://golang.org/cl/19640043

11 years agodatabase/sql: document Result methods
Brad Fitzpatrick [Wed, 30 Oct 2013 00:38:43 +0000 (17:38 -0700)]
database/sql: document Result methods

Fixes #5110

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/19280046

11 years agodatabase/sql: Fix typos in doc
Julien Schmidt [Tue, 29 Oct 2013 23:03:13 +0000 (16:03 -0700)]
database/sql: Fix typos in doc

R=golang-dev
CC=bradfitz, golang-dev
https://golang.org/cl/17590043

11 years agoA+C: Jakob Borg (individual CLA).
David Symonds [Tue, 29 Oct 2013 22:27:02 +0000 (09:27 +1100)]
A+C: Jakob Borg (individual CLA).

R=golang-dev
CC=golang-dev
https://golang.org/cl/19510043

11 years agotime: correct path to time zone zip file on Unix
Russ Cox [Tue, 29 Oct 2013 21:11:51 +0000 (17:11 -0400)]
time: correct path to time zone zip file on Unix

Most Unix systems have their own time zone data,
so we almost never get far enough in the list to
discover that we cannot fall back to the zip file.
Adjust testing to exercise the final fallback.

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

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/19280043

11 years agoencoding/xml: fix doc comment
Russ Cox [Tue, 29 Oct 2013 21:11:25 +0000 (17:11 -0400)]
encoding/xml: fix doc comment

The tag is ",chardata" not "chardata".

Fixes #6631.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/19300046

11 years agonet/http/httputil: fix DumpRequestOut with ContentLength & false body param
Brad Fitzpatrick [Tue, 29 Oct 2013 21:06:11 +0000 (14:06 -0700)]
net/http/httputil: fix DumpRequestOut with ContentLength & false body param

Fixes #6471

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

11 years agomisc/emacs: various cleanups
Dominik Honnef [Tue, 29 Oct 2013 17:07:42 +0000 (13:07 -0400)]
misc/emacs: various cleanups

- Use #' for function symbols
- Remove unused variables
- Use declare-function to shut up byte compiler

R=adonovan
CC=golang-dev
https://golang.org/cl/19010044

11 years agoos: do not return Lstat errors from Readdir
Russ Cox [Tue, 29 Oct 2013 15:50:40 +0000 (11:50 -0400)]
os: do not return Lstat errors from Readdir

This CL restores the Go 1.1.2 semantics for os.File's Readdir method.

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

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

Go 1.1.2:

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

This CL:

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

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

Fixes #6656.
Fixes #6680.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/18870043

11 years agocmd/gc: silence clang warning
Russ Cox [Tue, 29 Oct 2013 15:50:18 +0000 (11:50 -0400)]
cmd/gc: silence clang warning

This code is only built when you run 'make' in cmd/gc,
not in all.bash.

R=golang-dev, jsing, iant
CC=golang-dev
https://golang.org/cl/19160043

11 years agomisc/emacs: support godef-jump on import statements
Dominik Honnef [Tue, 29 Oct 2013 15:14:56 +0000 (11:14 -0400)]
misc/emacs: support godef-jump on import statements

The newest version of godef supports jumping to a package's source
directory if point is on an import statement.

R=adonovan
CC=golang-dev
https://golang.org/cl/18230043

11 years agodebug/dwarf: add DWARF 4 form constants
Russ Cox [Tue, 29 Oct 2013 14:36:51 +0000 (10:36 -0400)]
debug/dwarf: add DWARF 4 form constants

Some versions of clang generate DWARF 4-format attributes
even when using -gdwarf-2. We don't care much about the
values, but we do need to be able to parse past them.

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

R=golang-dev, iant, dvyukov
CC=golang-dev
https://golang.org/cl/18460043

11 years agodoc: update front page summary text
Andrew Gerrand [Tue, 29 Oct 2013 06:56:38 +0000 (15:56 +0900)]
doc: update front page summary text

R=rsc
CC=golang-dev
https://golang.org/cl/18080045

11 years agocmd/cgo: stop using -fno-eliminate-unused-debug-types
Russ Cox [Tue, 29 Oct 2013 02:21:26 +0000 (22:21 -0400)]
cmd/cgo: stop using -fno-eliminate-unused-debug-types

This flag was added in January 2010, in CL 181102, to fix issue 497.
(Numbers were just shorter back then.) The fix was for OS X machines
and the llvm-gcc frontend.

In July 2011 we had to change the way we get enum values, because
there were no flags available to force Xcode's llvm-gcc to include the
enum names and values in DWARF debug output.

We now use clang, not llvm-gcc, on OS X machines.
Earlier versions of clang printed a warning about not knowing the flag.
Newer versions of clang now make that an error.

That is:
 - The flag was added for OS X machines.
 - The flag is no longer necessary on OS X machines.
 - The flag now breaks some OS X machines.

Remove it.

I have run the original program from issue 497 successfully
without the flag on both OS X and Linux machines.

Fixes #6678.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/18850043

11 years agoruntime: relax preemption assertion during stack split
Russ Cox [Mon, 28 Oct 2013 23:40:40 +0000 (19:40 -0400)]
runtime: relax preemption assertion during stack split

The case can happen when starttheworld is calling acquirep
to get things moving again and acquirep gets preempted.
The stack trace is in golang.org/issue/6644.

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

Fixes #6644.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/18740044

11 years agonet: handle single-line non-\n-terminated files correctly in readLine
Josh Bleecher Snyder [Mon, 28 Oct 2013 23:31:25 +0000 (19:31 -0400)]
net: handle single-line non-\n-terminated files correctly in readLine

Fixes #6646.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/15960047

11 years agonet/url: fix Encode doc comment
Andrew Gerrand [Fri, 25 Oct 2013 20:00:22 +0000 (23:00 +0300)]
net/url: fix Encode doc comment

Encoded query strings are always sorted by key; the example wasn't.

R=golang-dev, dsymonds, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/16430043

11 years agomisc/linkcheck: better redirect handling, use meaningful exit code
Andrew Gerrand [Fri, 25 Oct 2013 14:31:02 +0000 (17:31 +0300)]
misc/linkcheck: better redirect handling, use meaningful exit code

Prevent linkcheck from following redirects that lead beyond the outside
the root URL.

Return a non-zero exit code when there are problems.

Some minor refactoring for clarity.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/14425049

11 years agostrings: fix Replacer bug with prefix matches
Brad Fitzpatrick [Thu, 24 Oct 2013 22:51:19 +0000 (15:51 -0700)]
strings: fix Replacer bug with prefix matches

singleStringReplacer had a bug where if a string was replaced
at the beginning and no output had yet been produced into the
temp buffer before matching ended, an invalid nil check (used
as a proxy for having matched anything) meant it always
returned its input.

Fixes #6659

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/16880043

11 years agodatabase/sql: link to wiki in package docs
Matthew Cottingham [Thu, 24 Oct 2013 17:13:23 +0000 (10:13 -0700)]
database/sql: link to wiki in package docs

Update #5886

R=golang-dev, kamil.kisiel, adg, r, rsc, dave, arnehormann, bradfitz
CC=golang-dev
https://golang.org/cl/14087043

11 years agoC+A: add Matthew Cottingham (Individual CLA)
Brad Fitzpatrick [Thu, 24 Oct 2013 17:13:00 +0000 (10:13 -0700)]
C+A: add Matthew Cottingham (Individual CLA)

Done by addca, but codereview failed with a Python stacktrace,
so submitting by hand.

R=golang-dev
CC=golang-dev
https://golang.org/cl/16650043

11 years agoplan9: correct create permissions with union directory
Jeff Sickel [Wed, 23 Oct 2013 14:28:28 +0000 (10:28 -0400)]
plan9: correct create permissions with union directory

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

11 years agomisc/dist: use go.tools release branch
Andrew Gerrand [Wed, 23 Oct 2013 06:34:14 +0000 (10:34 +0400)]
misc/dist: use go.tools release branch

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/15450047

11 years agotest/mapnan: use time.Now instead of syscall.Getrusage
Russ Cox [Tue, 22 Oct 2013 22:33:37 +0000 (18:33 -0400)]
test/mapnan: use time.Now instead of syscall.Getrusage

Avoids a dependency on a somewhat nonstandard part of package syscall.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/15570046

11 years agocmd/cgo: use __typeof__, -w instead of typeof, -Wno-all
Russ Cox [Tue, 22 Oct 2013 22:33:23 +0000 (18:33 -0400)]
cmd/cgo: use __typeof__, -w instead of typeof, -Wno-all

Suggested by iant in earlier CL.

R=golang-dev, bradfitz, iant
CC=golang-dev
https://golang.org/cl/14920052

11 years agotime: fix ParseDuration overflow when given more than 9 digits on 32-bit arch
Shenghou Ma [Tue, 22 Oct 2013 22:33:05 +0000 (18:33 -0400)]
time: fix ParseDuration overflow when given more than 9 digits on 32-bit arch
Fixes #6617.

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/15080043

11 years agomisc/emacs: handle empty "import ()" in go-goto-imports
Dominik Honnef [Tue, 22 Oct 2013 16:35:04 +0000 (12:35 -0400)]
misc/emacs: handle empty "import ()" in go-goto-imports

R=adonovan
CC=golang-dev
https://golang.org/cl/14454058

11 years agomath: remove unnecessary source file
Russ Cox [Tue, 22 Oct 2013 14:37:33 +0000 (10:37 -0400)]
math: remove unnecessary source file

The routines in this file are dregs from a very early copy of the math API.
There are no Go prototypes and no non-amd64 implementations.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/15750046

11 years agogo/build: document the go1.2 build tag
Bill Neubauer [Tue, 22 Oct 2013 12:43:32 +0000 (16:43 +0400)]
go/build: document the go1.2 build tag

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/14930046

11 years agocrypto/x509: name constraints should be a disjunction.
Adam Langley [Mon, 21 Oct 2013 23:01:24 +0000 (19:01 -0400)]
crypto/x509: name constraints should be a disjunction.

The code was requiring that all constraints be met, but it should be
satisfied by meeting *any* of them.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/15570044

11 years agocrypto/tls: advertise support for RSA+SHA1 in TLS 1.2 handshake.
Adam Langley [Mon, 21 Oct 2013 20:35:09 +0000 (16:35 -0400)]
crypto/tls: advertise support for RSA+SHA1 in TLS 1.2 handshake.

Despite SHA256 support being required for TLS 1.2 handshakes, some
servers are aborting handshakes that don't offer SHA1 support.

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

Fixes #6618.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/15650043

11 years agonet/mail: fix minor doc typo.
David Symonds [Mon, 21 Oct 2013 06:32:45 +0000 (17:32 +1100)]
net/mail: fix minor doc typo.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/15510043

11 years agocmd/yacc: fix stderr on Windows.
Shenghou Ma [Sun, 20 Oct 2013 03:07:20 +0000 (23:07 -0400)]
cmd/yacc: fix stderr on Windows.
Fixes #6620.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/15330043

11 years agocmd/cgo: fix line number in an error message
Russ Cox [Fri, 18 Oct 2013 20:52:44 +0000 (16:52 -0400)]
cmd/cgo: fix line number in an error message

Fixes #6563.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14870046

11 years agocmd/cgo: stop using compiler error message text to analyze C names
Russ Cox [Fri, 18 Oct 2013 19:56:25 +0000 (15:56 -0400)]
cmd/cgo: stop using compiler error message text to analyze C names

The old approach to determining whether "name" was a type, constant,
or expression was to compile the C program

        name;

and scan the errors and warnings generated by the compiler.
This requires looking for specific substrings in the errors and warnings,
which ties the implementation to specific compiler versions.
As compilers change their errors or drop warnings, cgo breaks.
This happens slowly but it does happen.
Clang in particular (now required on OS X) has a significant churn rate.

The new approach compiles a slightly more complex program
that is either valid C or not valid C depending on what kind of
thing "name" is. It uses only the presence or absence of an error
message on a particular line, not the error text itself. The program is:

        // error if and only if name is undeclared
        void f1(void) { typeof(name) *x; }

        // error if and only if name is not a type
        void f2(void) { name *x; }

        // error if and only if name is not an integer constant
        void f3(void) { enum { x = (name)*1 }; }

I had not been planning to do this until Go 1.3, because it is a
non-trivial change, but it fixes a real Xcode 5 problem in Go 1.2,
and the new code is easier to understand than the old code.
It should be significantly more robust.

Fixes #6596.
Fixes #6612.

R=golang-dev, r, james, iant
CC=golang-dev
https://golang.org/cl/15070043

11 years agocmd/gc: shorten name used for map bucket type
Russ Cox [Fri, 18 Oct 2013 19:56:07 +0000 (15:56 -0400)]
cmd/gc: shorten name used for map bucket type

Before:
type.struct { buckets *struct { overflow *struct { overflow *struct { overflow *struct { overflow *struct { overflow *<...>; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; oldbuckets *struct { overflow *struct { overflow *struct { overflow *struct { overflow *struct { overflow *<...>; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable }; keys [8]string; values [8]*"".RangeTable } }

After:
type.map.bucket[string]*"".RangeTable

This makes debugging maps a little nicer, and it takes up less space in the binary.

R=golang-dev, r
CC=golang-dev, khr
https://golang.org/cl/15110044

11 years agonet: make sure failed Dial returns nil Conn
Russ Cox [Fri, 18 Oct 2013 19:35:45 +0000 (15:35 -0400)]
net: make sure failed Dial returns nil Conn

Fixes #6614.

R=golang-dev, bradfitz, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/14950045

11 years agoruntime: remove nomemprof
Dmitriy Vyukov [Fri, 18 Oct 2013 06:45:19 +0000 (10:45 +0400)]
runtime: remove nomemprof
Nomemprof seems to be unneeded now, there is no recursion.
If the recursion will be re-introduced, it will break loudly by deadlocking.
Fixes #6566.

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/14695044

11 years agomisc/dist: build race packages when os suffix present
Andrew Gerrand [Fri, 18 Oct 2013 06:03:41 +0000 (15:03 +0900)]
misc/dist: build race packages when os suffix present

The "darwin-amd64-osx10.8" target was not matching "darwin-amd64".

R=golang-dev
CC=golang-dev
https://golang.org/cl/14930043

11 years agotag go1.2rc2
Andrew Gerrand [Fri, 18 Oct 2013 05:01:00 +0000 (14:01 +0900)]
tag go1.2rc2

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/14910043

11 years agoapi: add go1.2.txt, use in tests
Andrew Gerrand [Fri, 18 Oct 2013 04:36:59 +0000 (13:36 +0900)]
api: add go1.2.txt, use in tests

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14860043

11 years agomisc/dist: set default go.tools tag
Andrew Gerrand [Fri, 18 Oct 2013 01:51:21 +0000 (10:51 +0900)]
misc/dist: set default go.tools tag

Fixes #6607.

R=dsymonds
CC=golang-dev
https://golang.org/cl/14830043

11 years agonet/url: fix regression when serializing relative URLs
Brad Fitzpatrick [Thu, 17 Oct 2013 23:06:40 +0000 (16:06 -0700)]
net/url: fix regression when serializing relative URLs

Only add a slash to path if it's a separator between
a host and path.

Fixes #6609

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/14815043

11 years agoruntime: correct test for when to poll network
Ian Lance Taylor [Thu, 17 Oct 2013 18:57:48 +0000 (11:57 -0700)]
runtime: correct test for when to poll network

Fixes #6610.

R=golang-dev, khr
CC=golang-dev
https://golang.org/cl/14793043

11 years agoruntime: correct parameter name in MCentral_AllocList comment
Ian Lance Taylor [Thu, 17 Oct 2013 18:57:00 +0000 (11:57 -0700)]
runtime: correct parameter name in MCentral_AllocList comment

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/14792043

11 years agoencoding/xml: accept chains of interfaces and pointers
Russ Cox [Thu, 17 Oct 2013 16:13:33 +0000 (12:13 -0400)]
encoding/xml: accept chains of interfaces and pointers

Fixes #6556.

R=golang-dev, iant, adg
CC=golang-dev
https://golang.org/cl/14747043

11 years agodatabase/sql: make tests repeatable with -cpu=n,n
Alberto García Hierro [Thu, 17 Oct 2013 16:02:32 +0000 (09:02 -0700)]
database/sql: make tests repeatable with -cpu=n,n

New test added in CL 14611045 causes a deadlock when
running the tests with -cpu=n,n because the fakedb
driver always waits when opening a new connection after
running TestConnectionLeak.  Reset its state after.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/14780043

11 years agoA+C: add Jamie Turner (Dropbox corporate CLA).
David Symonds [Thu, 17 Oct 2013 00:48:27 +0000 (11:48 +1100)]
A+C: add Jamie Turner (Dropbox corporate CLA).

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14765043

11 years agodatabase/sql: fix some test fmt verbs
Brad Fitzpatrick [Wed, 16 Oct 2013 23:30:39 +0000 (16:30 -0700)]
database/sql: fix some test fmt verbs

Found by vet.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14762044

11 years agospec: clarify re-use of underlying arrays in slice operations
Robert Griesemer [Wed, 16 Oct 2013 23:16:54 +0000 (16:16 -0700)]
spec: clarify re-use of underlying arrays in slice operations

Please note the slight rewording for append: The spec now
requires that append reuses the underlying array if it is
sufficiently large. Per majority sentiment.

This is technically a language change but the current
implementation always worked this way.

Fixes #5818.
Fixes #5180.

R=rsc, iant, r, ken, minux.ma, dan.kortschak, rogpeppe, go.peter.90
CC=golang-dev
https://golang.org/cl/14419054