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

18561 Commits

Author SHA1 Message Date
Han-Wen Nienhuys
5744be9fe4 crypto/cipher: speed up xor operations in CBC, CFB, OBF, CTR
and GCM on 386 and amd64

Intel(R) Core(TM) i5-2540M CPU @ 2.60GHz:

benchmark                    old MB/s     new MB/s  speedup
BenchmarkAESGCMSeal1K           82.39        92.05    1.12x
BenchmarkAESGCMOpen1K           82.28        91.88    1.12x
BenchmarkAESCFBEncrypt1K       141.54       277.59    1.96x
BenchmarkAESCFBDecrypt1K       133.06       278.07    2.09x
BenchmarkAESOFB1K              160.51       380.24    2.37x
BenchmarkAESCTR1K              164.07       429.25    2.62x
BenchmarkAESCBCEncrypt1K       170.99       263.74    1.54x
BenchmarkAESCBCDecrypt1K       124.96       249.14    1.99x

Fixes #6741.

R=agl, dave, agl
CC=golang-dev
https://golang.org/cl/24250044
2013-12-11 16:05:02 -05:00
Russ Cox
426b48a775 cmd/5a, cmd/6a, cmd/8a: fix .y files to match y.tab.[ch]
When I renamed LAddr back to Addr (before sending the
original linker CLs), I missed the .y files in my global substitute.
Since the .y files are only processed when running make in
one of those directories (not during all.bash), they were
behind the generated files.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/40770044
2013-12-11 12:11:37 -05:00
Joel Sing
75800a9a28 crypto/sha256: block implementation in amd64 assembly
Benchmark on Intel(R) Xeon(R) CPU X5650  @ 2.67GHz

benchmark              old ns/op    new ns/op    delta
BenchmarkHash8Bytes         1259          677  -46.23%
BenchmarkHash1K            14387         6749  -53.09%
BenchmarkHash8K           106006        50107  -52.73%

benchmark               old MB/s     new MB/s  speedup
BenchmarkHash8Bytes         6.35        11.81    1.86x
BenchmarkHash1K            71.17       151.72    2.13x
BenchmarkHash8K            77.28       163.49    2.12x

R=agl
CC=golang-dev
https://golang.org/cl/28460043
2013-12-11 11:41:30 -05:00
Shenghou Ma
77fe6befb7 net/http: document that body is closed after (*Request).Write.
Fixes #6911.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/38690043
2013-12-10 23:35:50 -05:00
Andrew Gerrand
dba08e0615 misc/dist: rename to makerelease
The ambiguity has gone on too long.

R=golang-dev, minux.ma, r, dsymonds
CC=golang-dev
https://golang.org/cl/39920043
2013-12-11 14:47:18 +11:00
Oling Cat
b349477eab doc/effective_go.html: close some tags.
R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/37700043
2013-12-11 09:49:28 +11:00
Ian Lance Taylor
6ae3780503 test: don't rely on order of unrelated imports in bug191
There is no necessary relationship between the imports of the
packages a and b, and gccgo happens to import them in a
different order, leading to different output.  This ordering
is not the purpose of the test in any case.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/40400043
2013-12-10 12:05:37 -08:00
Carl Shapiro
c69402d82b runtime: remove outdated comment and related indentation
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/39810043
2013-12-10 11:17:43 -08:00
Adam Langley
ddbad5ef20 crypto/x509: fix behaviour of KeyUsageAny.
(Reporter wasn't able to provide a certificate chain that uses this
feature for testing.)

Fixes #6831

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/40340043
2013-12-10 14:06:26 -05:00
Russ Cox
de8549dfd3 test/run: make -v output look like go test output
Among other things, it makes it easier to scan to
see what is slow.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/40040044
2013-12-10 14:02:42 -05:00
Ian Lance Taylor
9bea6f3b2c test: add some test cases that were miscompiled by gccgo
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/40310043
2013-12-10 10:47:30 -08:00
David du Colombier
4321beba85 liblink, cmd/gc: fix incompatible type signatures on Plan 9
R=ality, golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/39640043
2013-12-10 08:42:41 -05:00
Joel Sing
517e49eb29 syscall: skip routing messages with mismatched version
Skip routing messages with a mismatched version, rather than failing
and returning EINVAL. Only return EINVAL if we were unable to parse
any of the routing messages (presumably due to a version mismatch).

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/30340043
2013-12-11 00:03:46 +11:00
Alberto García Hierro
c8869e9caf database/sql: Remove redundant condition in if
The final condition (db.maxIdleConnsLocked() > db.freeConn.Len()) can
only be true iff db.maxIdleConnsLocked() is greater than 0, so previously
checking if it's greater than 0 is a waste, specially when that involves
a method call which (ATM) can't be inlined and includes a switch.

Dissasembly follows (test for err == nil has been omitted for clarity):

Before:
43c357: cmp    $0x0,%bl
43c35a: jne    43c3ce <database/sql.(*DB).putConnDBLocked+0x1ce>
43c35c: mov    %rax,(%rsp)
43c360: callq  43aec0 <database/sql.(*DB).maxIdleConnsLocked>
43c365: mov    0x8(%rsp),%rbx
43c36a: cmp    $0x0,%rbx
43c36e: jle    43c3ce <database/sql.(*DB).putConnDBLocked+0x1ce>
43c370: mov    0x30(%rsp),%rbx
43c375: mov    %rbx,(%rsp)
43c379: callq  43aec0 <database/sql.(*DB).maxIdleConnsLocked>
43c37e: mov    0x30(%rsp),%rdx
43c383: mov    0x8(%rsp),%rcx
43c388: mov    0x28(%rdx),%rbp
43c38c: mov    0x28(%rbp),%rbx
43c390: cmp    %rcx,%rbx
43c393: jge    43c3ce <database/sql.(*DB).putConnDBLocked+0x1ce>
43c395: mov    0x28(%rdx),%rbp
43c399: mov    %rbp,(%rsp)
43c39d: mov    0x38(%rsp),%rcx
43c3a2: mov    $0x556c60,%eax
43c3a7: mov    %rax,0x8(%rsp)
43c3ac: mov    %rcx,0x10(%rsp)
43c3b1: callq  4db5b0 <container/list.(*List).PushFront>

After:
43c357: cmp    $0x0,%bl
43c35a: jne    43c3b5 <database/sql.(*DB).putConnDBLocked+0x1b5>
43c35c: mov    %rax,(%rsp)
43c360: callq  43aec0 <database/sql.(*DB).maxIdleConnsLocked>
43c365: mov    0x30(%rsp),%rdx
43c36a: mov    0x8(%rsp),%rcx
43c36f: mov    0x28(%rdx),%rbp
43c373: mov    0x28(%rbp),%rbx
43c377: cmp    %rcx,%rbx
43c37a: jge    43c3b5 <database/sql.(*DB).putConnDBLocked+0x1b5>
43c37c: mov    0x28(%rdx),%rbp
43c380: mov    %rbp,(%rsp)
43c384: mov    0x38(%rsp),%rcx
43c389: mov    $0x556c60,%eax
43c38e: mov    %rax,0x8(%rsp)
43c393: mov    %rcx,0x10(%rsp)
43c398: callq  4db590 <container/list.(*List).PushFront>

R=golang-dev, bradfitz, iant
CC=golang-dev
https://golang.org/cl/14656044
2013-12-10 16:10:09 +04:00
Mikio Hara
e5a7ab8550 net: fix nits found by go tool vet
R=golang-dev, dave, adg
CC=golang-dev
https://golang.org/cl/27430043
2013-12-10 14:30:52 +09:00
Shenghou Ma
a4b66b7703 os: fix build.
CL 36800043 and CL 36930044 have a merge conflict that I overlooked.

R=golang-dev
CC=golang-dev
https://golang.org/cl/39850043
2013-12-09 23:46:21 -05:00
Shenghou Ma
4f2cfdc7f4 crypto/rand: support generation of 2-5 bit primes, also document the error return for Prime
Fixes #6849.
Fixes #6867.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/35870043
2013-12-09 23:25:49 -05:00
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
Alex Brainman
6ede93498c misc/cgo/testcdefs: rm correct file in test.bash
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/39780043
2013-12-10 12:06:24 +11: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
Russ Cox
dba4d11e08 .hgignore: ignore liblink/anames?.c
R=golang-dev, minux.ma, iant
CC=golang-dev
https://golang.org/cl/36300045
2013-12-09 18:40:54 -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
Peter Collingbourne
a5cc5bab5a doc: update list of gccgo import search paths
R=iant
CC=golang-dev
https://golang.org/cl/38560043
2013-12-06 13:33:10 -08:00
Ian Lance Taylor
b113965ad3 CONTRIBUTORS: add Peter Collingbourne (Google CLA)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/38590043
2013-12-06 13:32:47 -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