1
0
mirror of https://github.com/golang/go synced 2024-09-30 04:24:29 -06:00
Commit Graph

24837 Commits

Author SHA1 Message Date
Rob Pike
7454f53604 cmd/vet: copy changes from golang.org/x/tools to cmd/vet
This means bringing over the examples flag and sorting doc.go.

Subsequent changes will generalize the examples flag to a general
test naming flag, but let's start with the original code.

No more changes to golang.org/x/tools please. This should not have
happened (and letting it happen was partly my fault).

Change-Id: Ia879ea1d15d82372df14853f919263125dfb7b96
Reviewed-on: https://go-review.googlesource.com/14821
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-21 17:48:38 +00:00
Rob Pike
4e99ed6fef cmd/doc: don't drop const/var block if first entry is unexported
The code assumed that if the first entry was unexported, all the
entries were. The fix is simple: delete a bunch of code.

Fixes #12286.

Change-Id: Icb09274e99ce97df4d8bddbe59d17a5c0622e4c6
Reviewed-on: https://go-review.googlesource.com/14780
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-21 16:42:09 +00:00
Marvin Stenger
fcf8143d63 encoding/json: scanner: use byte, more consistent
The fields step and redoState of struct scanner are now defined as
`func(s *scanner, c byte) int` instead of
`func(s *scanner, c int) int`, since bytes are sufficient.
Further changes improve the consistency in the scanner.go file.

Change-Id: Ifb85f2130d728d2b936d79914d87a1f0b5c6ee7d
Reviewed-on: https://go-review.googlesource.com/14801
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-21 01:55:52 +00:00
Håvard Haugen
6d0178359f cmd/compile/internal/gc: eliminate stringsCompare for stackvar sorting
Passes go build -a -toolexec 'toolstash -cmp' std cmd.

Change-Id: I2a87d31da74affdf3d0f358d0efdb3f1c646d917
Reviewed-on: https://go-review.googlesource.com/14759
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-20 21:07:12 +00:00
Rob Pike
7b5af511a5 bufio: fix overflow calculation in Scan
I was being too clever, as usual. Write the obvious code to make sure
that when we grow the buffer we don't overflow.

Change-Id: I1641831177b0bb8a89ab6e9bcabccf6c2fcfe1d2
Reviewed-on: https://go-review.googlesource.com/14781
Reviewed-by: Minux Ma <minux@golang.org>
2015-09-20 04:46:08 +00:00
Tarmigan Casebolt
e643dc79d4 net: check 'ok' return in dnsmsg when initially packing rr.Header()
In the present code, there is no way for ok to ever return false, but
it still a good idea to check it.

Change-Id: I8f360018b33a5d85dabbbbec0f89ffc81f77ecbb
Reviewed-on: https://go-review.googlesource.com/13956
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-20 02:55:16 +00:00
Dmitry Vyukov
9172a1b573 runtime: race instrument read of convT2E/I arg
Sometimes this read is instrumented by compiler when it creates
a temp to take address, but sometimes it is not (e.g. for global vars
compiler takes address of the global directly).

Instrument convT2E/I similarly to chansend and mapaccess.

Fixes #12664

Change-Id: Ia7807f15d735483996426c5f3aed60a33b279579
Reviewed-on: https://go-review.googlesource.com/14752
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-19 10:26:36 +00:00
Brad Fitzpatrick
e31114dab0 cmd/dist: skip spectralnorm shootout test on the linux-arm-arm5 builder
Temporary fix to get the arm5 builder happy again.

Without hardware floating point, this test takes over 20 minutes to
run.

A proper solution would probably be to run all the benchmark tests,
but with a much lower iteration count, just to exercise the code.

Updates golang/go#12688

Change-Id: Ie56c93d3bf2a5a693a33217ba1b1df3c6c856442
Reviewed-on: https://go-review.googlesource.com/14775
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Minux Ma <minux@golang.org>
2015-09-19 05:50:43 +00:00
Dave Cheney
3e476827a6 cmd/compile/internal/gc: move intLiteral to gc.Node
intLiteral is used by the gins wrappers in arm64, ppc64 and
mips64. Refactor the function to a method on gc.Node and update
the callers to use the common copy.

Change-Id: I2db90d801a9cb18f8526eb921e13daa75ca1cf6f
Reviewed-on: https://go-review.googlesource.com/14744
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-19 04:38:02 +00:00
Austin Clements
c742ff6adc runtime: remove flaky TestInvalidptrCrash to fix build
This test fails on arm64 and some amd64 OSs and fails on Linux/amd64
if you remove the first runtime.GC(), which should be unnecessary, and
run it in all.bash (but not if you run it in isolation). I don't
understand any of these failures, so for now just remove this test.

TBR=rlh

Change-Id: Ibed00671126000ed7dc5b5d4af1f86fe4a1e30e1
Reviewed-on: https://go-review.googlesource.com/14767
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-19 01:43:00 +00:00
Austin Clements
97b64d88eb runtime: avoid debug prints of huge objects
Currently when the GC prints an object for debugging (e.g., for a
failed invalidptr or checkmark check), it dumps the entire object. To
avoid inundating the user with output for really large objects, limit
this to printing just the first 128 words (which are most likely to be
useful in identifying the type of an object) and the 32 words around
the problematic field.

Change-Id: Id94a5c9d8162f8bd9b2a63bf0b1bfb0adde83c68
Reviewed-on: https://go-review.googlesource.com/14764
Reviewed-by: Rick Hudson <rlh@golang.org>
2015-09-18 22:23:18 +00:00
Austin Clements
b7c55ba496 runtime: improve invalid pointer error message
By default, the runtime panics if it detects a pointer to an
unallocated span. At this point, this usually catches bad uses of
unsafe or cgo in user code (though it could also catch runtime bugs).
Unfortunately, the rather cryptic error misleads users, offers users
little help with debugging their own problem, and offers the Go
developers little help with root-causing.

Improve the error message in various ways. First, the wording is
improved to make it clearer what condition was detected and to suggest
that this may be the result of incorrect use of unsafe or cgo. Second,
we add a dump of the object containing the bad pointer so that there's
at least some hope of figuring out why a bad pointer was stored in the
Go heap.

Change-Id: I57b91b12bc3cb04476399d7706679e096ce594b9
Reviewed-on: https://go-review.googlesource.com/14763
Reviewed-by: Rick Hudson <rlh@golang.org>
2015-09-18 22:23:11 +00:00
Tarmigan Casebolt
7360638da0 crypto/x509: return err if marshalPublicKey fails to marshal an rsa public key
Change-Id: I9bd5c1b66fd90f0b54bd1a8f3e57b6830d2b7733
Reviewed-on: https://go-review.googlesource.com/13846
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-18 21:48:10 +00:00
Rob Pike
c0ca9f46d8 doc: go1.6.txt: template.IsTrue, bufio.Scanner.Buffer
Change-Id: Iaa01d34caf09c12c017dc0379d4fe1d2cffd5340
Reviewed-on: https://go-review.googlesource.com/14728
Reviewed-by: Rob Pike <r@golang.org>
2015-09-18 18:59:05 +00:00
Rob Pike
13be616e56 bufio: allow Scanner to accept a user-provided buffer
Add Scanner.Buffer, which lets the user give a buffer to
the scanner and set the maximum token size.

We call it Buffer not SetBuffer for consistency with Split, which
perhaps should have been called SetSplit; too late regardless.

Both Buffer and Split panic if they are called after Scan. The
panic in Split is new, but the comment on the method already
said it needed to be called first, so we might as well add the
verification while we're doing it for Buffer.

This method allows precise user control of storage.

Fixes #11702.

Change-Id: I80e3d0e3830562fdabd4f7b08f322e1378248c39
Reviewed-on: https://go-review.googlesource.com/14599
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: roger peppe <rogpeppe@gmail.com>
2015-09-18 18:56:49 +00:00
Brad Fitzpatrick
1536c2e0f6 cmd/dist: shard shootout test units
Instead of a 10 second test unit, make it 13 sub-second ones. This
takes advantage of multiple builders better.

Fixes #12623

Change-Id: I3fb2eb02f899f25749e34b546b9d41b742a746cd
Reviewed-on: https://go-review.googlesource.com/14738
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-18 18:32:56 +00:00
Rob Pike
49065cbfe4 asm: handle EOF better
Add some error catches to prevent looping at EOF.
Also give better diagnostics.
Also add tests for these cases.

Fixes #12656.

Change-Id: I1355fc149b71c868e740bfa53de29c25d160777d
Reviewed-on: https://go-review.googlesource.com/14710
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-18 18:09:15 +00:00
Rob Pike
49580db149 asm: give error message for unadorned symbol reference
On amd64, the program

TEXT    foo0(SB),7,$-8
    ADDQ R520, R1
    RET

used to trigger this error because R520 was being passed through to obj:

asm: doasm: notfound ft=23 tt=23 00000 (x.s:2)	ADDQ	0, 0 23 23

Now it gets this one, as it is indeed a parse error:

x.s:2: illegal addressing mode for symbol R520

This couldn't be fixed until #12632 had been fixed for arm64.

Fixes #12470.

Change-Id: I19830c4ae9337887b93f85d9a239e2b89dbb2219
Reviewed-on: https://go-review.googlesource.com/14691
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-09-18 18:08:52 +00:00
Robert Griesemer
8bd222f046 go/types: handle import "C" more like cmd/compile
Fixes #12667.

Change-Id: I68e73e26da9938606304163ae2637e3c6bacd6f6
Reviewed-on: https://go-review.googlesource.com/14722
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-09-18 17:46:42 +00:00
Robert Griesemer
3d91624fad go/types: unified handling of assignment errors
- simpler code
- closer to gc error messages
- more context information in some cases

Change-Id: Iad155a887b838a4fc1edf719eed18269670b5ede
Reviewed-on: https://go-review.googlesource.com/14720
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-09-18 17:04:21 +00:00
Robert Griesemer
3f08151ec3 go/types: cleanup handling of multi-valued expressions
- more uniform error messages
- removed unused code

Change-Id: I625d5c2e51a543450ad091f97cec538023ddb1dd
Reviewed-on: https://go-review.googlesource.com/14692
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-09-18 17:01:26 +00:00
Robert Griesemer
712bae04ee go/types: better error message when using multi-valued expressions in single-value context
Also: Added initial set of (missing and/or spread out) tests for binary operations.

Fixes #11896.

Change-Id: I037436d8318c18f9758b435eca2d45b3bdd17ef8
Reviewed-on: https://go-review.googlesource.com/14660
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-09-18 17:00:11 +00:00
Robert Griesemer
77f2763a63 go/types: enable disabled test
Change-Id: I101e9bc722f5ba4fa9941cb544d9c276fd4c0b8c
Reviewed-on: https://go-review.googlesource.com/14651
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-09-18 16:59:29 +00:00
Robert Griesemer
3a80e5baca go/types: report detailed reason in error messages for invalid assignments
Fixes #10260.

Change-Id: I52d059144608912e6f7f9516e4961a75e9463355
Reviewed-on: https://go-review.googlesource.com/14644
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-09-18 16:57:42 +00:00
Dave Cheney
d5fe165ca0 cmd/compile: convert externdecl to []*Node
This one of a set of changes to make the transition away from NodeList
easier by removing cases in which NodeList doesn't act semi-trivially like a
[]*Node.

This CL was originally prepared by Josh Bleecher Snyder <josharian@gmail.com>.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: Ifd73501e06e8ea5efd028b6d473b3e5d1b07a5ac
Reviewed-on: https://go-review.googlesource.com/14570
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-18 07:15:52 +00:00
Shenghou Ma
1fd78e1f60 cmd/go: provide full path as os.Args[0] when invoking tools
cmd/dist needs to re-exec or open itself to detect GOARM (CL 3973) and
detect host machine endianness (CL 14460).

Change-Id: If6438831ab0715ba8e236d64bb2c7c1bde1470aa
Reviewed-on: https://go-review.googlesource.com/14476
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-18 01:55:22 +00:00
Håvard Haugen
eddd7ff3cd cmd/compile/internal/gc: avoid stringsCompare for string literals
Passes go build -a -toolexec 'toolstash -cmp' std cmp.

Change-Id: I7567355d405c976c5d91a0cd4e9486ebeb348dbb
Reviewed-on: https://go-review.googlesource.com/14682
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-18 00:23:34 +00:00
Håvard Haugen
f482a0f023 cmd/compile/internal/gc: add unit test for cmpstackvar
A followup CL will rewrite listsort to use the new cmpstackvarlt and
change cmpstackvar to avoid stringsCompare.

Change-Id: Idf0857a3bd67f9e2243ba82aa0bff510612927c3
Reviewed-on: https://go-review.googlesource.com/14611
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-17 23:46:38 +00:00
Marvin Stenger
2dc63d1544 cmd/compile/internal/gc: cleaning; use range when appropriate
Made use of range statement in for loops.
Cleaning along the way:
-remove unnecessary variable declarations
-rename variables
-remove dead code

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: Ife8c2a98482a81ba91f5bbb65142d9f3dc46d6ee
Reviewed-on: https://go-review.googlesource.com/14379
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-17 23:23:01 +00:00
Rob Pike
a326c3e1ad text/template: export isTrue
The definition of 'truth' used by if etc. is not trivial to compute, so publish
the implementation to allow custom template functions to have the
same definition as the template language itself.

Fixes #12033.

Change-Id: Icdfd6039722d7d3f984ba0905105eb3253e14831
Reviewed-on: https://go-review.googlesource.com/14593
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-17 23:08:33 +00:00
Rob Pike
1216e18135 encoding/gob: document allocation/merge behavior
This is understood, obvious (to me), and well known but has not been clearly documented.

Fixes #11117.

Change-Id: Ib2b1e318924748d1eac0d735ad6286533be7fd39
Reviewed-on: https://go-review.googlesource.com/14693
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-17 22:55:04 +00:00
David Crawshaw
cf4527172c misc/ios: skip revoked certificates
Change-Id: If65e5e55b359a61740d2ef185147bb6df90e0b0c
Reviewed-on: https://go-review.googlesource.com/14654
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-09-17 16:25:20 +00:00
Aram Hăvărneanu
61a3ebed55 cmd/asm/internal/asm: add aliases for ARM64 condition codes
Add CS as an alias for HS, and CC as an alias for LO, otherwise

	CSINV	CS, R1, R2, R3

was interpreted as

	CSINV	0, R1, R2, R3

Also fix the corresponding faulty test.

Fixes #12632
Updates #12470

Change-Id: I974cfc7e5ced682d4754ba09b0b102cb08a46567
Reviewed-on: https://go-review.googlesource.com/14680
Reviewed-by: Rob Pike <r@golang.org>
2015-09-17 15:11:08 +00:00
Aaron Jacobs
e7e2739849 os: touch up the EINTR retry loop in OpenFile
In particular, don't use goto and do restrict the behavior to darwin.
This addresses comments from http://golang.org/cl/14484.

Change-Id: I5b99e1762d1c5b27fdd12b72a5c6d981f6a92f0f
Reviewed-on: https://go-review.googlesource.com/14673
Reviewed-by: Rob Pike <r@golang.org>
2015-09-17 14:49:30 +00:00
Shawn Walker-Salas
001a75a74c runtime/trace: fix tracing of blocking system calls
The placement and invocation of traceGoSysCall when using
entersyscallblock() instead of entersyscall() differs enough that the
TestTraceSymbolize test can fail on some platforms.

This change moves the invocation of traceGoSysCall for entersyscall() so
that the same number of "frames to skip" are present in the trace as when
entersyscallblock() is used ensuring system call traces remain identical
regardless of internal implementation choices.

Fixes golang/go#12056

Change-Id: I8361e91aa3708f5053f98263dfe9feb8c5d1d969
Reviewed-on: https://go-review.googlesource.com/13861
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-09-17 09:06:20 +00:00
Alex Brainman
3d1f8c2379 runtime: print errno and byte count before crashing in mem_windows.go
As per iant suggestion during issue #12587 crash investigation.

Also adjust incorrect throw message in sysUsed while we are here.

Change-Id: Ice07904fdd6e0980308cb445965a696d26a1b92e
Reviewed-on: https://go-review.googlesource.com/14633
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-17 07:06:42 +00:00
Aaron Jacobs
50d0ee0c98 os: handle EINTR from open(2).
The man page for sigaction(2) on OS X doesn't guarantee that SA_RESTART
will work for open(2) on regular files:

    The affected system calls include open(2), read(2), write(2),
    sendto(2), recvfrom(2), sendmsg(2) and recvmsg(2) on a
    communications channel or a slow device (such as a terminal, but not
    a regular file) and during a wait(2) or ioctl(2).

I've never observed EINTR from open(2) for a traditional file system
such as HFS+, but it's easy to observe with a fuse file system that is
slightly slow (cf. https://goo.gl/UxsVgB). After this change, the
problem can no longer be reproduced when calling os.OpenFile.

Fixes #11180.

Change-Id: I967247430e20a7d29a285b3d76bf3498dc4773db
Reviewed-on: https://go-review.googlesource.com/14484
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-17 01:20:45 +00:00
David Crawshaw
9337dc9b5e runtime/debug: more explicit Stack docs
Change-Id: I81a7f22be827519b5290b4acbcba357680cad3c4
Reviewed-on: https://go-review.googlesource.com/14605
Reviewed-by: Rob Pike <r@golang.org>
2015-09-16 22:25:11 +00:00
Michael Hudson-Doyle
9a6a8a0586 cmd/link: fix addition of -Wl,-z,relro
Not sure how I managed to do this, or get it past review.

Change-Id: I141b97ef8e09dcc9c910c45493a584a3dced2b28
Reviewed-on: https://go-review.googlesource.com/14634
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-16 21:16:13 +00:00
Robert Griesemer
b0507f1579 go/parser: better error message for incorrect type switch header
Fixes 11829.

Change-Id: I2e39f61e12953147b0cd6a11d29179c500c94964
Reviewed-on: https://go-review.googlesource.com/14566
Reviewed-by: Chris Manghane <cmang@golang.org>
2015-09-16 20:06:38 +00:00
Robert Griesemer
5b3f29a2e7 go/parser: comma is not permitted at the end of a struct field list
Fixes #11611.

Change-Id: I63d35cf15c3be759c899e3e561e631330dcc0bbb
Reviewed-on: https://go-review.googlesource.com/14565
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Chris Manghane <cmang@golang.org>
2015-09-16 20:06:01 +00:00
Rob Pike
5512ac2786 doc: go1.6.txt: add math/rand.Read
Change-Id: I94af55bb894409b77bd87df36be9471dcc544fda
Reviewed-on: https://go-review.googlesource.com/14627
Reviewed-by: Rob Pike <r@golang.org>
2015-09-16 17:56:14 +00:00
Spencer Nelson
f9e404c1c5 math/rand: make Rand fulfill the Reader interface
Add a Read function to Rand which reads random bytes into a buffer.

Fixes #8330

Change-Id: I85b90277b8be9287c6697def8dbefe0029b6ee06
Reviewed-on: https://go-review.googlesource.com/14522
Reviewed-by: Rob Pike <r@golang.org>
2015-09-16 17:54:01 +00:00
Ilya Tocar
2421c6e3df runtime: optimize duffzero for amd64.
Use MOVUPS to zero 16 bytes at a time.

results (haswell):

name             old time/op  new time/op  delta
ClearFat8-48     0.62ns ± 2%  0.62ns ± 1%     ~     (p=0.085 n=20+15)
ClearFat12-48    0.93ns ± 2%  0.93ns ± 2%     ~     (p=0.757 n=19+19)
ClearFat16-48    1.23ns ± 1%  1.23ns ± 1%     ~     (p=0.896 n=19+17)
ClearFat24-48    1.85ns ± 2%  1.84ns ± 0%   -0.51%  (p=0.023 n=20+15)
ClearFat32-48    2.45ns ± 0%  2.46ns ± 2%     ~     (p=0.053 n=17+18)
ClearFat40-48    1.99ns ± 0%  0.92ns ± 2%  -53.54%  (p=0.000 n=19+20)
ClearFat48-48    2.15ns ± 1%  0.92ns ± 2%  -56.93%  (p=0.000 n=19+20)
ClearFat56-48    2.46ns ± 1%  1.23ns ± 0%  -49.98%  (p=0.000 n=19+14)
ClearFat64-48    2.76ns ± 0%  2.14ns ± 1%  -22.21%  (p=0.000 n=17+17)
ClearFat128-48   5.21ns ± 0%  3.99ns ± 0%  -23.46%  (p=0.000 n=17+19)
ClearFat256-48   10.3ns ± 4%   7.7ns ± 0%  -25.37%  (p=0.000 n=20+17)
ClearFat512-48   20.2ns ± 4%  15.0ns ± 1%  -25.58%  (p=0.000 n=20+17)
ClearFat1024-48  39.7ns ± 2%  29.7ns ± 0%  -25.05%  (p=0.000 n=19+19)

Change-Id: I200401eec971b2dd2450c0651c51e378bd982405
Reviewed-on: https://go-review.googlesource.com/14408
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-16 16:07:44 +00:00
Klaus Post
2027b00e63 hash/crc32: add AMD64 optimized IEEE CRC calculation
IEEE is the most commonly used CRC-32 polynomial, used by zip, gzip and others.

Based on http://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf

benchmark                       old ns/op     new ns/op     delta
BenchmarkIEEECrc1KB-8           3193          352           -88.98%
BenchmarkIEEECrc4KB-8           5025          1307          -73.99%
BenchmarkCastagnoliCrc1KB-8     126           126           +0.00%

benchmark                       old MB/s     new MB/s     speedup
BenchmarkIEEECrc1KB-8           320.68       2901.92      9.05x
BenchmarkIEEECrc4KB-8           815.08       3131.80      3.84x
BenchmarkCastagnoliCrc1KB-8     8100.80      8109.78      1.00x

Change-Id: I99c9a48365f631827f516e44f97e86155f03cb90
Reviewed-on: https://go-review.googlesource.com/14080
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-16 15:42:42 +00:00
Tormod Erevik Lea
f0ea976ee4 cmd/go: indent first test binary flag description for go test -h
Fixes #12642

Change-Id: I0b94437055b7d444f5caf7ea310e85357c467bdf
Reviewed-on: https://go-review.googlesource.com/14612
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-16 14:21:29 +00:00
David Crawshaw
2d697b2401 runtime/debug: implement Stack using runtime.Stack
Fixes #12363

Change-Id: I1a025ab6a1cbd5a58f5c2bce5416788387495428
Reviewed-on: https://go-review.googlesource.com/14604
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-16 11:36:21 +00:00
David Crawshaw
fb30270037 runtime: preserve R11 in darwin/arm entrypoint
The _rt0_arm_darwin_lib entrypoint has to conform to the darwin ARMv7
calling convention, which requires functions to preserve the value of
R11. Go uses R11 as the liblink REGTMP register, so save it manually.

Also avoid using R4, which is also callee-save.

Fixes #12590

Change-Id: I9c3b374e330f81ff8fc9c01fa20505a33ddcf39a
Reviewed-on: https://go-review.googlesource.com/14603
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-16 11:23:32 +00:00
Michael Hudson-Doyle
955b4caa48 test: move allocation before munmap in recover4
recover4 allocates 16 pages of memory via mmap, makes a 4 page hole in it with
munmap, allocates another 16 pages of memory via normal allocation and then
tries to copy from one to the other. For some reason on arm64 (but no other
platform I have tested) the second allocation sometimes causes the runtime to
ask the kernel for 4 additional pages of memory -- which the kernel satisfies
by remapping the pages that were just unmapped!

Moving the second allocation before the munmap fixes this behaviour, I can run
recover4 tens of thousands of times without failure with this fix vs a failure
rate of ~0.5% before.

Fixes #12549

Change-Id: I490b895b606897e4f7f25b1b51f5d485a366fffb
Reviewed-on: https://go-review.googlesource.com/14632
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-16 08:51:48 +00:00
Håvard Haugen
7c61d24f97 cmd/compile/internal/gc: remove dead code
Found with https://github.com/remyoudompheng/go-misc/deadcode:

deadcode: walk.go:2228:1: applywritebarrier_bv is unused
deadcode: subr.go:355:1: gethunk is unused
deadcode: subr.go:1991:1: localexpr is unused
deadcode: dcl.go:82:1: poptodcl is unused
deadcode: swt.go:810:1: dumpcase is unused
deadcode: esc.go:251:1: satAdd8 is unused
deadcode: esc.go:387:1: outputsPerTag is unused
deadcode: obj.go:190:1: duint64 is unused
deadcode: obj.go:287:1: dstringptr is unused
deadcode: plive.go:95:1: xmalloc is unused
deadcode: plive.go:119:1: freeblock is unused

followed by

deadcode: go.go:633:1: hunk is unused
deadcode: go.go:635:1: nhunk is unused
deadcode: go.go:637:1: thunk is unused

after 'gethunk' was removed.

Some dead code in bv.go, mparith3.go, and dcl.go was left as is.

Passes go build -a -toolexec 'toolstash -cmp' std cmd.

Change-Id: Ia63519adedc8650d7095572ddd454fd923d3204d
Reviewed-on: https://go-review.googlesource.com/14610
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-16 00:25:04 +00:00