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

13745 Commits

Author SHA1 Message Date
Shenghou Ma
aa0ae7554c os: clarify docs for Rename.
Three changes:
1. mention "move" to clarify things up.
2. use {old,new}path instead of {old,new}name, which makes it clear what
   relative path would do here.
3. mention "OS-specific restrictions might apply".

Fixes #6887.

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

R=golang-dev, r, cshapiro, iant, rsc
CC=golang-dev
https://golang.org/cl/38120043
2013-12-09 17:51:30 -08:00
Russ Cox
4c01a23cf1 cmd/pack: stop parsing object files to generate __.SYMDEF
Nothing looks at __.SYMDEF, and the object file format is changing.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/39580044
2013-12-09 19:35:17 -05:00
Russ Cox
4230044bb8 runtime: remove non-extern decls of runtime.goarm
The linker is in charge of providing the one true declaration.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/39560043
2013-12-09 19:35:07 -05:00
Alex Brainman
6795687427 cmd/cgo: use __gcc_struct__ for go exported functions
Fixes #6833

R=minux.ma, iant
CC=golang-dev
https://golang.org/cl/35790045
2013-12-10 11:30:12 +11:00
Anthony Martin
52ee63f544 liblink: fix extern register accesses on Plan 9 (386)
R=golang-dev, 0intro, rsc
CC=golang-dev
https://golang.org/cl/39680044
2013-12-09 18:48:44 -05:00
David du Colombier
58005207d2 cmd/8c, cmd/8g, cmd/8l: fix Plan 9 warnings
warning: src/cmd/8c/list.c:124 format mismatch d VLONG, arg 3
warning: src/cmd/8c/list.c:134 format mismatch d VLONG, arg 3
warning: src/cmd/8c/list.c:142 format mismatch d VLONG, arg 3
warning: src/cmd/8c/list.c:152 format mismatch d VLONG, arg 3
warning: src/cmd/8c/list.c:156 format mismatch d VLONG, arg 4
warning: src/cmd/8c/list.c:160 format mismatch d VLONG, arg 4
warning: src/cmd/8c/list.c:165 format mismatch d VLONG, arg 4
warning: src/cmd/8c/list.c:167 format mismatch d VLONG, arg 3
warning: src/cmd/8c/list.c:172 format mismatch d VLONG, arg 4
warning: src/cmd/8c/list.c:174 format mismatch d VLONG, arg 3
warning: src/cmd/8c/list.c:178 format mismatch d VLONG, arg 3
warning: src/cmd/8c/list.c:184 format mismatch d VLONG, arg 3

warning: src/cmd/8g/list.c:91 format mismatch d VLONG, arg 4
warning: src/cmd/8g/list.c:100 format mismatch d VLONG, arg 4
warning: src/cmd/8g/list.c:114 format mismatch d VLONG, arg 5
warning: src/cmd/8g/list.c:118 format mismatch d VLONG, arg 5
warning: src/cmd/8g/list.c:122 format mismatch d VLONG, arg 5
warning: src/cmd/8g/list.c:126 format mismatch d VLONG, arg 5
warning: src/cmd/8g/list.c:136 format mismatch d VLONG, arg 4

warning: src/cmd/8l/list.c:107 format mismatch d VLONG, arg 4
warning: src/cmd/8l/list.c:125 format mismatch ux VLONG, arg 4
warning: src/cmd/8l/list.c:128 format mismatch ux VLONG, arg 4
warning: src/cmd/8l/list.c:130 format mismatch d VLONG, arg 4
warning: src/cmd/8l/list.c:134 format mismatch d VLONG, arg 5
warning: src/cmd/8l/list.c:138 format mismatch d VLONG, arg 6
warning: src/cmd/8l/list.c:143 format mismatch d VLONG, arg 5
warning: src/cmd/8l/list.c:148 format mismatch d VLONG, arg 5
warning: src/cmd/8l/list.c:150 format mismatch d VLONG, arg 4
warning: src/cmd/8l/list.c:154 format mismatch d VLONG, arg 4
warning: src/cmd/8l/list.c:158 format mismatch d VLONG, arg 4
warning: src/cmd/8l/obj.c:132 format mismatch ux VLONG, arg 2

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/39710043
2013-12-09 18:47:22 -05:00
Anthony Martin
274a8e3f56 runtime: do not use memmove in the Plan 9 signal handler
Fixes a regression introduced in revision 4cb93e2900d0.

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

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

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

R=rsc
CC=golang-dev
https://golang.org/cl/34640045
2013-12-09 18:41:48 -05:00
Anthony Martin
66c32384dd build: do not use the host's libbio on Plan 9
R=jas, lucio.dere, rsc
CC=golang-dev
https://golang.org/cl/14604047
2013-12-09 18:39:58 -05:00
Carl Shapiro
bc9691c465 cmd/gc, runtime: correct a misnomer regarding dead value maps
The funcdata symbol incorrectly named the dead value map the
dead pointer map.  The dead value map identifies all dead
values, including pointers and non-pointers, in a stack frame.
The purpose of this map is to allow the runtime to poison
locations of dead data to catch lost invariants.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/38670043
2013-12-09 14:45:10 -08:00
Russ Cox
9a53fb571d cmd/gc: fix windows build, probably
TBR=iant
CC=golang-dev
https://golang.org/cl/39540043
2013-12-09 13:02:56 -05:00
Russ Cox
1eac128d64 cmd/6l: fix linux/amd64
TBR=iant
CC=golang-dev
https://golang.org/cl/39530043
2013-12-09 09:58:35 -08:00
Russ Cox
65a643ba47 cmd/dist, cmd/go: pass -fmessage-length always
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/36300044
2013-12-09 12:56:23 -05:00
Russ Cox
295e73e13f cmd/gc: print more information for windows failure
TBR=iant
CC=golang-dev
https://golang.org/cl/39510043
2013-12-09 12:55:25 -05:00
Russ Cox
0c0589ec42 cmd/ld: fix linux/386 build
TBR=iant
CC=golang-dev
https://golang.org/cl/39400044
2013-12-09 07:42:55 -08:00
Russ Cox
79479ac486 cmd/dist, cmd/go: pass -fmessage-length=0 when using clang
That option turns off word wrapping of individual
error messages generated by clang. The wrapping
makes the errors harder to read and conflicts with the
idea of a terminal window that can be resized.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/35810043
2013-12-09 10:33:27 -05:00
David du Colombier
b9bed39714 liblink: fix Plan 9 build
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/39280043
2013-12-09 07:55:53 -05:00
Russ Cox
7c17982f72 runtime: remove cross-function jump in vlop_arm.s
The new linker will disallow this on arm
(it is already disallowed on amd64 and 386)
in order to be able to lay out each function
separately.

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

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

R=iant, r, minux.ma
CC=golang-dev
https://golang.org/cl/35800043
2013-12-08 22:52:08 -05:00
Russ Cox
f606c1be80 cmd/5g, cmd/6g, cmd/8g: use liblink
Preparation for golang.org/s/go13linker work.

This CL does not build by itself. It depends on 35740044
and 35790044 and will be submitted at the same time.

R=iant
CC=golang-dev
https://golang.org/cl/34590045
2013-12-08 22:51:55 -05:00
Russ Cox
76a8c873cf cmd/5c, cmd/6c, cmd/8c: use liblink
Preparation for golang.org/s/go13linker work.

This CL does not build by itself. It depends on 35740044
and 35790044 and will be submitted at the same time.

R=iant
CC=golang-dev
https://golang.org/cl/34580044
2013-12-08 22:51:31 -05:00
Russ Cox
f7aaa553da cmd/5a, cmd/6a, cmd/8a: use liblink
Preparation for golang.org/s/go13linker work.

This CL does not build by itself. It depends on 35740044
and 35790044 and will be submitted at the same time.

R=iant
CC=golang-dev
https://golang.org/cl/35830043
2013-12-08 22:49:56 -05:00
Russ Cox
7d507dc6e6 liblink: create new library based on linker code
There is an enormous amount of code moving around in this CL,
but the code is the same, and it is invoked in the same ways.
This CL is preparation for the new linker structure, not the new
structure itself.

The new library's definition is in include/link.h.

The main change is the use of a Link structure to hold all the
linker-relevant state, replacing the smattering of global variables.
The Link structure should both make it clearer which state must
be carried around and make it possible to parallelize more easily
later.

The main body of the linker has moved into the architecture-independent
cmd/ld directory. That includes the list of known header types, so the
distinction between Hplan9x32 and Hplan9x64 is removed (no other
header type distinguished 32- and 64-bit formats), and code for unused
formats such as ipaq kernels has been deleted.

The code being deleted from 5l, 6l, and 8l reappears in liblink or in ld.
Because multiple files are being merged in the liblink directory,
it is not possible to show the diffs nicely in hg.

The Prog and Addr structures have been unified into an
architecture-independent form and moved to link.h, where they will
be shared by all tools: the assemblers, the compilers, and the linkers.
The unification makes it possible to write architecture-independent
traversal of Prog lists, among other benefits.

The Sym structures cannot be unified: they are too fundamentally
different between the linker and the compilers. Instead, liblink defines
an LSym - a linker Sym - to be used in the Prog and Addr structures,
and the linker now refers exclusively to LSyms. The compilers will
keep using their own syms but will fill out the corresponding LSyms in
the Prog and Addr structures.

Although code from 5l, 6l, and 8l is now in a single library, the
code has been arranged so that only one architecture needs to
be linked into a particular program: 5l will not contain the code
needed for x86 instruction layout, for example.

The object file writing code in liblink/obj.c is from cmd/gc/obj.c.

Preparation for golang.org/s/go13linker work.

This CL does not build by itself. It depends on 35740044
and will be submitted at the same time.

R=iant
CC=golang-dev
https://golang.org/cl/35790044
2013-12-08 22:49:37 -05:00
Russ Cox
8642cbd660 cmd/dist: add liblink build information
In addition to adding the library, change the way the anames array is created.
Previously, it was written to src/cmd/6l/enam.c (and similarly for 5l and 8l)
and each of the other tools (6g, 6c, 6a) compiled the 6l/enam.c file in addition
to their own sources.

Now that there is a library shared by all these programs, move the anames
array into that library. To eliminate name conflicts, name the array after
the architecture letter: anames5, anames6, anames8.

First step to linker cleanup (golang.org/s/go13linker).

This CL does not build by itself. It depends on the CLs introducing
liblink and changing commands to use it.

R=iant
CC=golang-dev
https://golang.org/cl/35740044
2013-12-08 22:48:11 -05:00
Carl Shapiro
6965a752a7 cmd/gc: do not generate dead value maps yet
We are not clearing dead values in the garbage collector so it
is not worth the RSS cost to materialize the data and write it
out to the binary.

R=golang-dev, iant, cshapiro
CC=golang-dev
https://golang.org/cl/38650043
2013-12-06 15:49:47 -08:00
Carl Shapiro
d4f68f2892 cmd/gc: clarify a TODO regarding variables used in liveness analysis
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/38640043
2013-12-06 15:36:54 -08:00
Carl Shapiro
76c54c1193 runtime: add GODEBUG option for an electric fence like heap mode
When enabled this new debugging mode will allocate objects on
their own page and never recycle memory addresses.  This is an
essential tool to root cause a broad class of heap corruption.

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

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

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

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

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

R=golang-dev, dvyukov, rsc, cshapiro
CC=golang-dev
https://golang.org/cl/21990045
2013-12-03 14:42:38 -08:00
Keith Randall
f238049a00 cmd/gc: fix special-casing of the printed names of map internal structures.
Shaves 1% off of binary size.

update #6853

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

Baseline

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

Stack scan by frames, non-parallel

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

Stack scan by frames, parallel

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

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

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

Baseline

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

Gentraceback

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

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

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

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

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

Fixes #6875.

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

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

Fixes #6876.

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

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

Fixes #6619.

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

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

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

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

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

Fixes #6760.

R=r
CC=golang-dev
https://golang.org/cl/22770044
2013-11-13 21:29:19 -05:00
Andrew Gerrand
b6c7cc3241 encoding/gob: expose encode/decode example
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/26220045
2013-11-14 09:20:29 +11:00
Rob Pike
0bdd90bc0a 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
2013-11-12 20:07:08 -08:00
Olivier Duperray
8f10c76471 cmd/godoc: document package-level examples
Fixes  issue  5807 .

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/23940043
2013-11-11 12:09:24 +11:00
Russ Cox
6be1cb8c7a 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
2013-11-07 15:24:51 -05:00
Ato Araki
df03aeb67c go/doc: add full stop of Japanese, Chinese and Korean.
This fix will show a good synopsis on package listings in that languages.

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

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

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

        SUB $8, SP

into

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

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

Fixes #6681.

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

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

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

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

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

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

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

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

Fixes #6681.

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

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

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

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

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

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

Fixes #6681.

R=golang-dev, r, josharian
CC=golang-dev
https://golang.org/cl/19810043
2013-10-30 18:50:34 +00:00
Russ Cox
797d1bac0d 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
2013-10-30 10:24:42 -04:00
Brad Fitzpatrick
7307ffa7cd database/sql: document Result methods
Fixes #5110

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

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

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

Fixes #6631.

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

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

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

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

Go 1.1.2:

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

This CL:

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

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

Fixes #6656.
Fixes #6680.

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

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

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

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

Fixes #6644.

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

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

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

Fixes #6659

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

R=golang-dev, kamil.kisiel, adg, r, rsc, dave, arnehormann, bradfitz
CC=golang-dev
https://golang.org/cl/14087043
2013-10-24 10:13:23 -07:00
Russ Cox
c8ddfd9ad1 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
2013-10-22 18:33:23 -04:00
Shenghou Ma
d220c9957c time: fix ParseDuration overflow when given more than 9 digits on 32-bit arch
Fixes #6617.

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

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

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

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

Fixes #6618.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/15650043
2013-10-21 16:35:09 -04:00
David Symonds
fae4553a9d net/mail: fix minor doc typo.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/15510043
2013-10-21 17:32:45 +11:00
Shenghou Ma
be1a94b401 cmd/yacc: fix stderr on Windows.
Fixes #6620.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/15330043
2013-10-19 23:07:20 -04:00
Russ Cox
dbe2eacf04 cmd/cgo: fix line number in an error message
Fixes #6563.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14870046
2013-10-18 16:52:44 -04:00
Russ Cox
06ad3b2de1 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
2013-10-18 15:56:25 -04:00
Russ Cox
20f99ffa3e 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
2013-10-18 15:56:07 -04:00
Russ Cox
66f49f78a5 net: make sure failed Dial returns nil Conn
Fixes #6614.

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

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/14695044
2013-10-18 10:45:19 +04:00
Andrew Gerrand
04e95a1a56 api: add go1.2.txt, use in tests
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14860043
2013-10-18 13:36:59 +09:00
Brad Fitzpatrick
f41b43a024 net/url: fix regression when serializing relative URLs
Only add a slash to path if it's a separator between
a host and path.

Fixes #6609

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

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

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

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

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

Fixes #6593

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

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

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

Close the Rows struct in TestRowsColumns.

Update #6593

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/14642044
2013-10-16 09:17:25 -07:00
Shenghou Ma
4d38d1260e cmd/cgo: simpler fix for issue 6506.
Replaces CL 14682044.
Fixes #6506.

R=rsc, iant, dave
CC=golang-dev
https://golang.org/cl/14717043
2013-10-15 21:35:52 -04:00
Russ Cox
5feb15508e cmd/cgo: print the builtin prolog after the per-file preamble
The preamble may want to #define some special symbols
and then #include <sys/types.h> itself. The builtin prolog
also #includes <sys/types.h>, which would break such a
preamble (because the second #include will be a no-op).

The use of sys/types.h in the builtin prolog is new since Go 1.1,
so this should preserve the semantics of more existing cgo
code than we would otherwise.

It also fixes src/pkg/syscall/mkall.sh's use of go tool cgo -godefs
on some Linux systems.

Thanks to fullung@ for identifying the problem.

Fixes #6558.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14684044
2013-10-15 15:00:48 -04:00
Alex Brainman
9aee98def8 undo CL 14231047 / 2f4c2dde2756
undone because the change slows down profile collection
significantly and unpredictable at times (see comments
at https://golang.org/cl/14231047 for details)

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

Fixes #6417

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

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/14535046
2013-10-15 14:37:43 -04:00
Russ Cox
043ace1213 cmd/cgo: fix Xcode 5 incompatibility for #defined expressions
Ensure that clang always exits with a non-zero status by
giving it something that it always warns about (the statement "1;").

Fixes #6128.

R=golang-dev, iant, minux.ma
CC=golang-dev
https://golang.org/cl/14702043
2013-10-15 14:34:46 -04:00
Russ Cox
56aeec31c6 cmd/cgo: work around bug in clang debug info for builtins like memset
Fixes #6506.

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

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/14604043
2013-10-15 13:00:06 +11:00
Keith Randall
2acb80b5e5 cmd/gc: fix comment about performing indexing at compile time.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14441070
2013-10-14 14:26:52 -07:00
Michael Piatek
21e6b90d36 net/http: skip content-type sniffing if the header is explicitly unset.
Fixes #5953

R=dsymonds, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/14434044
2013-10-15 08:22:04 +11:00
Ian Lance Taylor
c78d67fb86 debug/dwarf: report the value of an unrecognized attribute format
R=golang-dev, r, minux.ma
CC=golang-dev
https://golang.org/cl/14669045
2013-10-14 10:53:55 -07:00
Shenghou Ma
89ebc28b58 cmd/api: make it work even when cgo is disabled
make use of $USER or %USERNAME% to determine the current user.
Fixes #6578.

R=golang-dev, bradfitz, alex.brainman
CC=golang-dev
https://golang.org/cl/14649043
2013-10-14 00:18:46 -04:00
Ian Lance Taylor
5b2f626159 go/build: add GOOS and GOARCH to name of gccgo pkg directory
This matches the behaviour of builder.includeArgs in
cmd/go/build.go.

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

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/14502060
2013-10-11 15:55:50 -07:00
Shenghou Ma
7dba510c7b cmd/gc: re-word some error messages
Fixes #6557.

R=golang-dev, rsc, tracey.brendan
CC=golang-dev
https://golang.org/cl/14432053
2013-10-10 22:43:34 -04:00
Ian Lance Taylor
649fc255a9 net: fix TestDialFailPDLeak to work when GOMAXPROCS is large
Fixes #6553.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/14526048
2013-10-09 13:52:29 -07:00
Keith Randall
139cc96a57 runtime: markfreed's error reports should be prefixed with "markfreed", not "markallocated".
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14441055
2013-10-09 13:28:47 -07:00
Ian Lance Taylor
c774e90208 cmd/go: add any .c/.cc files to the SWIG shared library
Also add the action's object directory to the list of
directories we use to find SWIG shared libraries.

Fixes #6521.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/14369043
2013-10-09 10:35:46 -07:00
Ian Lance Taylor
cb30917387 runtime/cgo: mark callback functions as NOSPLIT
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/14448044
2013-10-09 08:44:47 -07:00
Russ Cox
0965459bd9 debug/dwarf: handle surprising clang encoding
Fixes a bug in cgo on OS X using clang.
See golang.org/issue/6472 for details.

Fixes #6472.

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

Fixes #6550.

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

Fixes #4925.

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

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

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

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

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

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

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

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

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14186043
2013-10-03 13:23:02 -07:00
Robert Hencke
a51b8cf870 gofmt: explain why lower bounds aren't automatically simplified
Full credit goes to gri and rsc for their explanations.

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

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

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

Significant runtime reductions:

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

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

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

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

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

R=golang-dev, khr, dave, bradfitz, dvyukov
CC=golang-dev
https://golang.org/cl/14317043
2013-10-03 09:19:10 -04:00
Dave Day
0a033a18ad cmd/gc: support -installsuffix in the compiler and builder
Add the -installsuffix flag to gc and {5,6,8}l, which overrides -race
for the suffix if both are supplied.
Pass this flag from the go tool for build and install.

R=rsc
CC=golang-dev
https://golang.org/cl/14246044
2013-10-03 13:48:47 +10:00
Russ Cox
94a6511b7f net: use original argument in lookup error
Fixes #6324.

R=golang-dev, iant, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/13280049
2013-10-02 22:09:54 -04:00
Russ Cox
e0867738fc cmd/go: document relative imports
Fixes #3524.

R=golang-dev, iant, r
CC=golang-dev
https://golang.org/cl/14296043
2013-10-02 21:42:23 -04:00
Russ Cox
95d85d90d8 crypto/tls: document ConnectionState fields
Fixes #6456.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14289043
2013-10-02 21:40:01 -04:00
Russ Cox
4216203bcf runtime: remove syscall.NewCallbackCDecl on Windows
It is not possible to use (there is no declaration in package syscall),
and no one seems to care.

Alex Brainman may bring this back properly for Go 1.3.

Fixes #6338.

R=golang-dev, r, alex.brainman
CC=golang-dev
https://golang.org/cl/14287043
2013-10-02 21:39:45 -04:00
Josh Bleecher Snyder
0857045818 encoding/json: add an example for RawMessage
RawMessage is useful and mildly non-obvious.
Given the frequency with which RawMessage questions
show up on golang-nuts, and get answered with an example,
I suspect adding an example to the docs might help.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/14190044
2013-10-03 08:52:18 +10:00
Russ Cox
1b0bffa973 net/http: be clear that HTTPS is supported
Fixes #6443.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/14231045
2013-10-02 13:21:15 -04:00
Russ Cox
5f853d7d94 runtime: fix finalizer test on amd64
Not scanning the stack by frames means we are reintroducing
a few false positives into the collection. Run the finalizer registration
in its own goroutine so that stack is guaranteed to be out of
consideration in a later collection.

This is working around a regression from yesterday's tip, but
it's not a regression from Go 1.1.

R=golang-dev
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/14290043
2013-10-02 12:30:49 -04:00
Rémy Oudompheng
8d6bc666fb cmd/gc: qualified embedded fields with owner package.
R=rsc
CC=golang-dev
https://golang.org/cl/14188044
2013-10-02 12:27:33 -04:00
Frithjof Schulze
4d7c63558c crypto/tls: Update reference to the TLS 1.2 RFC.
Ticket 13740047 updated the documented TLS version to 1.2.
This also updates the RFC refered to.

R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/14029043
2013-10-02 12:09:13 -04:00
Russ Cox
c3dadca977 runtime: do not scan stack by frames during garbage collection
Walking the stack by frames is ~3x more expensive
than not, and since it didn't end up being precise,
there is not enough benefit to outweigh the cost.

This is the conservative choice: this CL makes the
stack scanning behavior the same as it was in Go 1.1.

Add benchmarks to package runtime so that we have
them when we re-enable this feature during the
Go 1.3 development.

benchmark                     old ns/op    new ns/op    delta
BenchmarkGoroutineSelect        3194909      1272092  -60.18%
BenchmarkGoroutineBlocking      3120282       866366  -72.23%
BenchmarkGoroutineForRange      3256179       939902  -71.13%
BenchmarkGoroutineIdle          2005571       482982  -75.92%

The Go 1 benchmarks, just to add more data.
As far as I can tell the changes are mainly noise.

benchmark                         old ns/op    new ns/op    delta
BenchmarkBinaryTree17            4409403046   4414734932   +0.12%
BenchmarkFannkuch11              3407708965   3378306120   -0.86%
BenchmarkFmtFprintfEmpty                100           99   -0.60%
BenchmarkFmtFprintfString               242          239   -1.24%
BenchmarkFmtFprintfInt                  204          206   +0.98%
BenchmarkFmtFprintfIntInt               320          316   -1.25%
BenchmarkFmtFprintfPrefixedInt          295          299   +1.36%
BenchmarkFmtFprintfFloat                442          435   -1.58%
BenchmarkFmtManyArgs                   1246         1216   -2.41%
BenchmarkGobDecode                 10186951     10051210   -1.33%
BenchmarkGobEncode                 16504381     16445650   -0.36%
BenchmarkGzip                     447030885    447056865   +0.01%
BenchmarkGunzip                   111056154    111696305   +0.58%
BenchmarkHTTPClientServer             89973        93040   +3.41%
BenchmarkJSONEncode                28174182     27933893   -0.85%
BenchmarkJSONDecode               106353777    110443817   +3.85%
BenchmarkMandelbrot200              4822289      4806083   -0.34%
BenchmarkGoParse                    6102436      6142734   +0.66%
BenchmarkRegexpMatchEasy0_32            133          132   -0.75%
BenchmarkRegexpMatchEasy0_1K            372          373   +0.27%
BenchmarkRegexpMatchEasy1_32            113          111   -1.77%
BenchmarkRegexpMatchEasy1_1K            964          940   -2.49%
BenchmarkRegexpMatchMedium_32           202          205   +1.49%
BenchmarkRegexpMatchMedium_1K         68862        68858   -0.01%
BenchmarkRegexpMatchHard_32            3480         3407   -2.10%
BenchmarkRegexpMatchHard_1K          108255       112614   +4.03%
BenchmarkRevcomp                  751393035    743929976   -0.99%
BenchmarkTemplate                 139637041    135402220   -3.03%
BenchmarkTimeParse                      479          475   -0.84%
BenchmarkTimeFormat                     460          466   +1.30%

benchmark                          old MB/s     new MB/s  speedup
BenchmarkGobDecode                    75.34        76.36    1.01x
BenchmarkGobEncode                    46.50        46.67    1.00x
BenchmarkGzip                         43.41        43.41    1.00x
BenchmarkGunzip                      174.73       173.73    0.99x
BenchmarkJSONEncode                   68.87        69.47    1.01x
BenchmarkJSONDecode                   18.25        17.57    0.96x
BenchmarkGoParse                       9.49         9.43    0.99x
BenchmarkRegexpMatchEasy0_32         239.58       241.74    1.01x
BenchmarkRegexpMatchEasy0_1K        2749.74      2738.00    1.00x
BenchmarkRegexpMatchEasy1_32         282.49       286.32    1.01x
BenchmarkRegexpMatchEasy1_1K        1062.00      1088.96    1.03x
BenchmarkRegexpMatchMedium_32          4.93         4.86    0.99x
BenchmarkRegexpMatchMedium_1K         14.87        14.87    1.00x
BenchmarkRegexpMatchHard_32            9.19         9.39    1.02x
BenchmarkRegexpMatchHard_1K            9.46         9.09    0.96x
BenchmarkRevcomp                     338.26       341.65    1.01x
BenchmarkTemplate                     13.90        14.33    1.03x

Fixes #6482.

R=golang-dev, dave, r
CC=golang-dev
https://golang.org/cl/14257043
2013-10-02 11:59:53 -04:00
Shenghou Ma
6b188ef57a cmd/dist, build: support building statically linked toolchain
Added a new $GO_DISTFLAGS to make.bash, and while we're here,
added mention $CXX in make.bash (CL 13704044).

Fixes #6448.
Update #3564
We can pass GO_DISTFLAGS=-s from misc/dist to make.bash so that
it will build a statically linked toolchain.
(Note: OS X doesn't have the concept of static linking, so don't
pass GO_DISTFLAGS=-s for OS X builds)

R=adg, rsc, iant
CC=golang-dev
https://golang.org/cl/13887043
2013-10-01 23:44:20 -04:00
Dave Day
57f69710d5 cmd/go: use -installsuffix to determine the includes directory list
Currently, the directories generaed by includeArgs can have the "_race"
suffix added if invoked with -race flag, but ignores -installsuffix if
set.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/14174043
2013-10-01 20:44:57 -04:00
Carl Shapiro
7a480a8c9b undo CL 14154043 / 3e485428767e
««« original CL description
encoding/gob: do not hide pointer argument for the garbage collector

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

R=golang-dev
CC=golang-dev
https://golang.org/cl/14165043
2013-09-30 16:02:12 -07:00
Carl Shapiro
6ffd70e7f0 encoding/gob: do not hide pointer argument for the garbage collector
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14154043
2013-09-30 15:54:21 -07:00
Dave Cheney
cdb33231b2 race.bash, race.bat: build a race enabled cmd/cgo before trying to use it
Fixes #5537.

To avoid `go install -v race std` replacing cmd/cgo with a race enabled version and another package trying to build a cgo enabled package, always build cmd/cgo race enabled before doing the rest of the build.

R=remyoudompheng, rsc, dvyukov, minux.ma
CC=golang-dev
https://golang.org/cl/14071044
2013-09-29 10:34:41 +10:00
Robin Eklind
9bd1f49e37 syscall: Fix one issue detected by vet.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/14038044
2013-09-28 11:06:50 +10:00
Kamil Kisiel
48da6754e2 encoding/json: Tweak documentation for Encoder.Encode.
The documentation for the Encoder type calls it a stream,
not a connection.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/14015044
2013-09-27 15:38:39 +10:00
Carl Shapiro
0ab8f2d287 reflect: expose reflect.call argument slice to the garbage collector
The argument slice was kept hidden from the garbage collector
by destroying its referent in an unsafe.Pointer to uintptr
conversion.  This change preserves the unsafe.Pointer referent
and only performs an unsafe.Pointer to uintptr conversions
within expressions that construct new unsafe.Pointer values.

R=golang-dev, khr, rsc
CC=golang-dev
https://golang.org/cl/14008043
2013-09-26 21:59:13 -07:00
Rob Pike
fa7791e922 all: fix some mistakes found by go tool vet .
R=golang-dev, iant, adg
CC=golang-dev
https://golang.org/cl/14000043
2013-09-27 10:09:15 +10:00
Adam Langley
f752484c74 crypto/tls: don't select TLS 1.2 cipher suites in prior versions.
AES-GCM cipher suites are only defined for TLS 1.2, although there's
nothing really version specific about them. However, development
versions of NSS (meaning Firefox and Chrome) have an issue where
they'll advertise TLS 1.2-only cipher suites in a TLS 1.1 ClientHello
but then balk when the server selects one.

This change causes Go clients not to advertise TLS 1.2 cipher suites
unless TLS 1.2 is being used, and prevents servers from selecting them
unless TLS 1.2 has been negotiated.

https://code.google.com/p/chromium/issues/detail?id=297151
https://bugzilla.mozilla.org/show_bug.cgi?id=919677

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13573047
2013-09-26 17:09:56 -04:00
Dave Cheney
649a2a9be5 runtime, syscall: update freebsd/arm calling convention to match EABI
Fixes #6451.

There is still some breakages unrelated to the syscall change.

[root@beaglebone ~/go/src]# /root/go/pkg/tool/freebsd_arm/go_bootstrap version
go version devel freebsd/arm
a std@beaglebone ~/go/src]# /root/go/pkg/tool/freebsd_arm/go_bootstrap install -
fatal error: mark - finalizer inconsistency

runtime stack:
runtime.throw(0x3e80ac)
        /root/go/src/pkg/runtime/panic.c:464 +0x5c
addfinroots(0x2)
        /root/go/src/pkg/runtime/mgc0.c:1501 +0x74
runtime.walkfintab(0x6c200)
        /root/go/src/pkg/runtime/mfinal.c:216 +0xa0
addroots()
        /root/go/src/pkg/runtime/mgc0.c:1561 +0x188
gc(0x50632f78)
        /root/go/src/pkg/runtime/mgc0.c:2098 +0x19c
mgc(0x306170a0)
        /root/go/src/pkg/runtime/mgc0.c:2049 +0x30
runtime.mcall(0x3e97b0)
        /root/go/src/pkg/runtime/asm_arm.s:165 +0x3c

goroutine 1 [garbage collection]:
runtime.gc(0x0)
        /root/go/src/pkg/runtime/mgc0.c:2020 +0x1a0 fp=0x50632f80
runtime.mallocgc(0x680, 0x1b1971, 0x1)
        /root/go/src/pkg/runtime/malloc.goc:143 +0x210 fp=0x50632fbc
----- stack segment boundary -----
cnew(0x1b1970, 0x640, 0x1)
        /root/go/src/pkg/runtime/malloc.goc:718 +0xc4 fp=0x50626110
runtime.cnewarray(0x1b1970, 0x640)
        /root/go/src/pkg/runtime/malloc.goc:731 +0x3c fp=0x50626120
makeslice1(0x1ac6d0, 0x500, 0x640, 0x50626190)
        /root/go/src/pkg/runtime/slice.c:57 +0x50 fp=0x5062612c
growslice1(0x1ac6d0, 0x30714a00, 0x500, 0x500, 0x501, ...)
        /root/go/src/pkg/runtime/slice.c:113 +0x8c fp=0x50626144
runtime.growslice(0x1ac6d0, 0x30714a00, 0x500, 0x500, 0x1, ...)
        /root/go/src/pkg/runtime/slice.c:80 +0x19c fp=0x50626174
go/build.(*importReader).readByte(0x3070d1b0, 0xb384e)
        /root/go/src/pkg/go/build/read.go:43 +0xbc fp=0x506261b4
go/build.(*importReader).peekByte(0x3070d1b0, 0x3070d101, 0x3070d180)
        /root/go/src/pkg/go/build/read.go:89 +0x210 fp=0x506261d0
go/build.readComments(0x203e2560, 0x306f79a8, 0x306f79a8, 0x203e2560, 0x306f79a8, ...)
        /root/go/src/pkg/go/build/read.go:194 +0x84 fp=0x506261f4
go/build.(*Context).matchFile(0x3e9730, 0x306209c0, 0x13, 0x306c42b4, 0x5, ...)
        /root/go/src/pkg/go/build/build.go:812 +0x74c fp=0x5062629c
go/build.(*Context).Import(0x3e9730, 0x1f95c8, 0x1, 0x30620960, 0x13, ...)
        /root/go/src/pkg/go/build/build.go:580 +0xd64 fp=0x506268dc
go/build.(*Context).ImportDir(0x3e9730, 0x30620960, 0x13, 0x0, 0x24d901, ...)
        /root/go/src/pkg/go/build/build.go:397 +0x5c fp=0x50626904
main.func·021(0x30620960, 0x13, 0x203e2200, 0x30680330, 0x0, ...)
        /root/go/src/cmd/go/main.go:521 +0x2cc fp=0x5062696c
path/filepath.walk(0x30620960, 0x13, 0x203e2200, 0x30680330, 0x50626ae8, ...)
        /root/go/src/pkg/path/filepath/path.go:341 +0x5c fp=0x506269d8
path/filepath.walk(0x3067e720, 0x11, 0x203e2200, 0x30680210, 0x50626ae8, ...)
        /root/go/src/pkg/path/filepath/path.go:359 +0x308 fp=0x50626a44
path/filepath.Walk(0x3067e720, 0x11, 0x50626ae8, 0x1f9728, 0x1)
        /root/go/src/pkg/path/filepath/path.go:380 +0xb4 fp=0x50626a68
main.matchPackages(0xbfffedea, 0x3, 0x1b1190, 0x3067e600, 0x10)
        /root/go/src/cmd/go/main.go:530 +0x2c0 fp=0x50626b1c
main.allPackages(0xbfffedea, 0x3, 0x1fadc8, 0x3, 0x1)
        /root/go/src/cmd/go/main.go:474 +0x34 fp=0x50626b70
main.importPathsNoDotExpansion(0x30620018, 0x1, 0x1, 0x0, 0xffffffff, ...)
        /root/go/src/cmd/go/main.go:305 +0x2f8 fp=0x50626c04
main.importPaths(0x30620018, 0x1, 0x1, 0x3, 0x0, ...)
        /root/go/src/cmd/go/main.go:315 +0x44 fp=0x50626c88
main.packagesAndErrors(0x30620018, 0x1, 0x1, 0x50626d60, 0x90f44, ...)
        /root/go/src/cmd/go/pkg.go:798 +0x1bc fp=0x50626d1c
main.packagesForBuild(0x30620018, 0x1, 0x1, 0x53490, 0x0, ...)
        /root/go/src/cmd/go/pkg.go:818 +0x44 fp=0x50626dac
main.runInstall(0x3e46e0, 0x30620018, 0x1, 0x1)
        /root/go/src/cmd/go/build.go:311 +0x48 fp=0x50626e60
main.main()
        /root/go/src/cmd/go/main.go:161 +0x518 fp=0x50626f8c
runtime.main()
        /root/go/src/pkg/runtime/proc.c:222 +0x100 fp=0x50626fc0
runtime.goexit()
        /root/go/src/pkg/runtime/proc.c:1396 fp=0x50626fc0

goroutine 3 [syscall]:
os/signal.loop()
        /root/go/src/pkg/os/signal/signal_unix.go:21 +0x24
created by os/signal.init·1
        /root/go/src/pkg/os/signal/signal_unix.go:27 +0x48

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/13824044
2013-09-26 21:35:49 +10:00
Shenghou Ma
752960aa5c cmd/go: "go test -c -test.bench=XX fmt" shouldn't hang
Fixes #6480.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13925043
2013-09-25 16:18:33 -04:00
Ian Lance Taylor
935a826a2f cmd/cgo: fix so that tests pass again when using gccgo
Use the symbol prefixes with the prologue functions when using
gccgo.

Use an & when referring to a function declared as a variable.

Fix the malloc prologue function.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13878043
2013-09-24 18:11:13 -07:00
Rob Pike
e2e9d1d684 html/template: update the Tree field after parsing new templates
After text/template.Parse, all the templates may have changed, so
we need to set them all back to their unescaped state. The code
did this but (mea culpa) forgot to set the Tree field of the html/template
struct.

Since the Tree is reset during escaping, this only matters if an error
arises during escaping and we want to print a message.

Fixes #6459.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/13877043
2013-09-25 10:00:09 +10:00
Robert Griesemer
20db0f428a go/ast: add Slice3 field to SliceExpr
If Slice3 is set, the expression is
a 3-index slice expression (2 colons).
Required for type-checking.

Backward-compatible API extension.

R=r, rsc
CC=golang-dev
https://golang.org/cl/13826050
2013-09-24 16:35:35 -07:00
Kamil Kisiel
b0ef6aeff9 math/big: Fix variable name in documentation for *Int.Bytes and BitLen.
R=golang-dev, iant, gri
CC=golang-dev
https://golang.org/cl/13869043
2013-09-24 16:32:23 -07:00