1
0
mirror of https://github.com/golang/go synced 2024-09-30 08:28:34 -06:00
Commit Graph

24706 Commits

Author SHA1 Message Date
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
Håvard Haugen
c1ad904bdb cmd/compile/internal/gc: remove unnecessary stringsCompare
Remove several uses of stringsCompare.

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

Change-Id: I3f2323df2ad8c03bad77e0a91d6e2e714803705b
Reviewed-on: https://go-review.googlesource.com/14556
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-16 00:08:58 +00:00
Ian Lance Taylor
64ad58768e cmd/go: don't run TestIssue7573 if cgo not supported
Fixes #12629.

Change-Id: Iee96dc4f806a38f3cd8e065b8d0d5f682bb7e29b
Reviewed-on: https://go-review.googlesource.com/14597
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-15 21:15:59 +00:00
Rob Pike
448f84a43a internal/obj: protect against nil addr.Sym
This has been the root cause of a number of crashes caused by
fuzz throwing modem noise at the assembler, which in turn attempts
to print diagnostics but instead just gets crashes.

Fixes #12627.

Change-Id: I72c2da79d8eb240e1a37aa6140454c552b05e0f1
Reviewed-on: https://go-review.googlesource.com/14595
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-15 20:56:39 +00:00
Robert Griesemer
dace9397b1 src/cmd/compile/internal/gc: fix type assertion in overflow check
Fixes #11600.

Change-Id: I8871d4e525168fed35115855483a237bbd6e5445
Reviewed-on: https://go-review.googlesource.com/14596
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-09-15 19:50:09 +00:00
Austin Clements
2cbd7072b1 debug/dwarf: add test for split DWARF
This adds a test that debug/dwarf can read the skeleton DWARF data
from a split DWARF image (though it doesn't currently support piecing
the external DWARF data back together). This should work because
there's nothing particularly different about skeleton DWARF data, but
previously failed because of poor handling of unrecognized attributes.

Updates #12592.

Change-Id: I2fc5f4679883b05ebd7ec9f0b5c398a758181a32
Reviewed-on: https://go-review.googlesource.com/14542
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: jcd . <jcd@golang.org>
2015-09-15 17:57:56 +00:00
Austin Clements
6044dd098d debug/dwarf: return ClassUnknown if attribute class cannot be determined
Currently, if the .debug_abbrev section of an ELF file contains
attributes that aren't known to the dwarf package and that have form
formSecOffset, the dwarf package will fail to open the DWARF data with
an error like "decoding dwarf section abbrev at offset 0x17: cannot
determine class of unknown attribute with formSecOffset". For the most
part, the class is implied by the form encoded in the abbrev section,
but formSecOffset can imply many different DWARF classes. Hence,
debug/dwarf disambiguates these using a table of known attributes.
However, it will reject the entire image if it encounters an attribute
it can't determine the class of. This is particularly unfortunate
because the caller may never even uses the offending attribute.

Fix this by introducing a ClassUnknown attribute class to use as a
fallback in these cases. This allows the dwarf package to load the
DWARF data and isolates the problem to just the affected attributes.

Fixes #12592.

Change-Id: I766227b136e9757f8b89c0b3ab8e9ddea899d94f
Reviewed-on: https://go-review.googlesource.com/14541
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: jcd . <jcd@golang.org>
2015-09-15 17:57:51 +00:00
Ian Lance Taylor
b6d115a583 runtime: on unexpected netpoll error, throw instead of looping
The current code prints an error message and then tries to carry on.
This is not helpful for Go users: they see a message that means
nothing and that they can do nothing about.  In the only known case of
this message, in issue 11498, the best guess is that the netpoll code
went into an infinite loop.  Instead of doing that, crash the program.

Fixes #11498.

Change-Id: Idda3456c5b708f0df6a6b56c5bb4e796bbc39d7c
Reviewed-on: https://go-review.googlesource.com/12047
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-09-15 17:56:56 +00:00
Keith Randall
731bdc5115 runtime: fix aeshash of empty string
Aeshash currently computes the hash of the empty string as
hash("", seed) = seed.  This is bad because the hash of a compound
object with empty strings in it doesn't include information about
where those empty strings were.  For instance [2]string{"", "foo"}
and [2]string{"foo", ""} might get the same hash.

Fix this by returning a scrambled seed instead of the seed itself.
With this fix, we can remove the scrambling done by the generated
array hash routines.

The test also rejects hash("", seed) = 0, if we ever thought
it would be a good idea to try that.

The fallback hash is already OK in this regard.

Change-Id: Iaedbaa5be8d6a246dc7e9383d795000e0f562037
Reviewed-on: https://go-review.googlesource.com/14129
Reviewed-by: jcd . <jcd@golang.org>
2015-09-15 17:51:23 +00:00
Alberto Donizetti
3d5bed2726 math/big: Add small complete example of big.Rat usage
Updates #11241

Change-Id: If71f651f3b8aca432c91314358b93f195217d9ec
Reviewed-on: https://go-review.googlesource.com/14317
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-09-15 17:46:22 +00:00
Rob Pike
a1aafdbe28 doc: go1.6.txt: template.Funcs checks names
Change-Id: I7de85034d499a9f859ab37d56463073f5cb29b35
Reviewed-on: https://go-review.googlesource.com/14592
Reviewed-by: Rob Pike <r@golang.org>
2015-09-15 16:12:59 +00:00
Rob Pike
173bf3487f asm: more early returns on errors
More protection against random input bytes.

Fixes #12614.

Change-Id: Ie9f817de1376a10bb80b22ecee3bae4f1d26cc6c
Reviewed-on: https://go-review.googlesource.com/14563
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-15 16:10:05 +00:00
Rob Pike
dbfd9085d6 text/template: verify that names in FuncMap are valid identifiers
There was no verification in Funcs that the map had valid names,
which meant that the error could only be caught when parsing
the template that tried to use them. Fix this by validating the names
in Funcs and panicking before parsing if there is a bad name.

This is arguably an API change, since it didn't trigger a panic
before, but Funcs did already panic if the function itself was no
good, so I argue it's an acceptable change to add more sanity
checks.

Fixes #9685.

Change-Id: Iabf1d0602c49d830f3ed71ca1ccc7eb9a5521ff5
Reviewed-on: https://go-review.googlesource.com/14562
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-15 16:09:55 +00:00
Marvin Stenger
211cdf1e00 cmd/compile/internal/gc: cleaning lex.go
Cleaning along the way:
-convert variable types from int to bool
-remove unnecessary functions
-remove unnecessary type conversion
-remove unnecessary variable declarations
-transform struct{string,string} with lookup to map[string]string

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

Change-Id: I259728fe4afd7f23b67f08fab856ce0abee57b21
Reviewed-on: https://go-review.googlesource.com/14435
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-15 15:55:56 +00:00
Brad Fitzpatrick
19d262ffdf net: remove named parameters in Listener.Accept doc signature
They added no value.

Change-Id: I9e690379d2dfd983266de0ea5231f2b57c8b1517
Reviewed-on: https://go-review.googlesource.com/14568
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-15 04:07:24 +00:00
Dave Cheney
af261a5c85 cmd/go: skip external tests on linux/arm
CL 13166 skipped external tests on freebsd/arm with the rationale
that the cmd/go tests are not architecture dependent.

This CL does the same for linux/arm to help linux/arm users who are
building Go on platforms like the Raspberry Pi where ./all.bash
frequently times out due to a lack of resources.

Change-Id: Iae1a25b63b74200da3f1b5637da0fa5c2dceeb83
Reviewed-on: https://go-review.googlesource.com/13342
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-15 03:57:49 +00:00
Alex Brainman
d7c12042bf runtime: provide room for first 4 syscall parameters in windows usleep2
Windows amd64 requires all syscall callers to provide room for first
4 parameters on stack. We do that for all our syscalls, except inside
of usleep2. In https://codereview.appspot.com/7563043#msg3 rsc says:

"We don't need the stack alignment and first 4 parameters on amd64
because it's just a system call, not an ordinary function call."

He seems to be wrong on both counts. But alignment is already fixed.
Fix parameter space now too.

Fixes #12444

Change-Id: I66a2a18d2f2c3846e3aa556cc3acc8ec6240bea0
Reviewed-on: https://go-review.googlesource.com/14282
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-15 01:12:32 +00:00
Robert Griesemer
8fab2929dd go/parser: better error message for unexpected ',' in struct type
Fixes #12437.

Change-Id: I5463970a6259527003eb0e12903a338cc78e0683
Reviewed-on: https://go-review.googlesource.com/14564
Reviewed-by: Chris Manghane <cmang@golang.org>
2015-09-14 23:37:18 +00:00
Ian Lance Taylor
ffd7d31787 runtime: unblock special glibc signals on each thread
Glibc uses some special signals for special thread operations.  These
signals will be used in programs that use cgo and invoke certain glibc
functions, such as setgid.  In order for this to work, these signals
need to not be masked by any thread.  Before this change, they were
being masked by programs that used os/signal.Notify, because it
carefully masks all non-thread-specific signals in all threads so that a
dedicated thread will collect and report those signals (see ensureSigM
in signal1_unix.go).

This change adds the two glibc special signals to the set of signals
that are unmasked in each thread.

Fixes #12498.

Change-Id: I797d71a099a2169c186f024185d44a2e1972d4ad
Reviewed-on: https://go-review.googlesource.com/14297
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-14 21:59:54 +00:00
Austin Clements
4ac4085f8e runtime: minor clarifications of markroot
This puts the _Root* indexes in a more friendly order and tweaks
markrootSpans to use a for-range loop instead of its own indexing.

Change-Id: I2c18d55c9a673ea396b6424d51ef4997a1a74825
Reviewed-on: https://go-review.googlesource.com/14548
Reviewed-by: Rick Hudson <rlh@golang.org>
2015-09-14 19:37:44 +00:00
Austin Clements
a1cad70a2f runtime: remove unused g.readyg field
Commit 0e6a6c5 removed readyExecute a long time ago, but left behind
the g.readyg field that was used by readyExecute. Remove this now
unused field.

Change-Id: I41b87ad2b427974d256ec7a7f6d4bdc2ce8a13bb
Reviewed-on: https://go-review.googlesource.com/13111
Reviewed-by: Rick Hudson <rlh@golang.org>
2015-09-14 18:40:22 +00:00
Austin Clements
70462f90ec runtime: simplify mSpan_Sweep
This is a cleanup following cc8f544, which was a minimal change to fix
issue #11617. This consolidates the two places in mSpan_Sweep that
update sweepgen. Previously this was necessary because sweepgen must
be updated before freeing the span, but we freed large spans early.
Now we free large spans later, so there's no need to duplicate the
sweepgen update. This also means large spans can take advantage of the
sweepgen sanity checking performed for other spans.

Change-Id: I23b79dbd9ec81d08575cd307cdc0fa6b20831768
Reviewed-on: https://go-review.googlesource.com/12451
Reviewed-by: Rick Hudson <rlh@golang.org>
2015-09-14 18:29:58 +00:00
Austin Clements
572f08a064 runtime: split marking of span roots into 128 subtasks
Marking of span roots can represent a significant fraction of the time
spent in mark termination. Simply traversing the span list takes about
1ms per GB of heap and if there are a large number of finalizers (for
example, for network connections), it may take much longer.

Improve the situation by splitting the span scan into 128 subtasks
that can be executed in parallel and load balanced by the markroots
parallel for. This lets the GC balance this job across the Ps.

A better solution is to do this during concurrent mark, or to improve
it algorithmically, but this is a simple change with a lot of bang for
the buck.

This was suggested by Rhys Hiltner.

Updates #11485.

Change-Id: I8b281adf0ba827064e154a1b6cc32d4d8031c03c
Reviewed-on: https://go-review.googlesource.com/13112
Reviewed-by: Keith Randall <khr@golang.org>
2015-09-14 18:15:40 +00:00
Austin Clements
739f133837 runtime: fix hashing of trace stacks
The call to hash the trace stack reversed the "seed" and "size"
arguments to memhash and, hence, always called memhash with a 0 size,
which dutifully returned a hash value that depended only on the number
of PCs in the stack and not their values. As a result, all stacks were
put in to a very subset of the 8,192 buckets.

Fix this by passing these arguments in the correct order.

Change-Id: I67cd29312f5615c7ffa23e205008dd72c6b8af62
Reviewed-on: https://go-review.googlesource.com/13613
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-09-14 18:14:14 +00:00
Håvard Haugen
b9dbb030d5 cmd/compiler/internal/gc: make Type.Copyto a []*Node
Passes go build -a -toolexec 'toolstash -cmp' std cmd

Change-Id: Ief4613cfb341172a85e3a894f44fb2bb308c7b55
Reviewed-on: https://go-review.googlesource.com/14554
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-14 04:51:46 +00:00
Andrew Gerrand
b07a51b3d4 database/sql: fix typo
Fixes #12606

Change-Id: Ib68cb20108ad35c3dd96e606649c4c8f9c0f085c
Reviewed-on: https://go-review.googlesource.com/14571
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-14 00:20:55 +00:00
Håvard Haugen
4c96e7b79b cmd/compile/internal/gc: clean up errcmp
Change-Id: Id07811a25bf4aa3ff834e7254a3dfb04522b2926
Reviewed-on: https://go-review.googlesource.com/14174
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-13 23:50:25 +00:00
Dave Cheney
4f48507d90 runtime: reduce pthread stack size in TestCgoCallbackGC
Fixes #11959

This test runs 100 concurrent callbacks from C to Go consuming 100
operating system threads, which at 8mb a piece (the default on linux/arm)
would reserve over 800mb of address space. This would frequently
cause the test to fail on platforms with ~1gb of ram, such as the
raspberry pi.

This change reduces the thread stack allocation to 256kb, a number picked
at random, but at 1/32th the previous size, should allow the test to
pass successfully on all platforms.

Change-Id: I8b8bbab30ea7b2972b3269a6ff91e6fe5bc717af
Reviewed-on: https://go-review.googlesource.com/13731
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Martin Capitanio <capnm9@gmail.com>
Reviewed-by: Minux Ma <minux@golang.org>
2015-09-13 23:46:55 +00:00
Shenghou Ma
0b5bcf53ee runtime/cgo: explicitly link msvcrt on windows
It's because runtime links to ntdll, and ntdll exports a couple
incompatible libc functions. We must link to msvcrt first and
then try ntdll.

Fixes #12030.

Change-Id: I0105417bada108da55f5ae4482c2423ac7a92957
Reviewed-on: https://go-review.googlesource.com/14472
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-12 08:34:52 +00:00
Dave Cheney
ea4e321d4d cmd/compile/internal/gc: avoid allocation in bnum
Although bnum was being called with a Bits value, a limitation
of the escape analyser (golang/go#12588) meant that taking the
address of the Bits.b array in the range statement caused the
formal parameter to escape to the heap.

Passing the a pointer to a Bits, as with all the other Bits helper
methods avoids the allocation.

Before:
BenchmarkBnum1-4        20000000                69.6 ns/op            32 B/op          1 allocs/op

After:
BenchmarkBnum1-4        100000000               10.1 ns/op             0 B/op          0 allocs/op

Change-Id: I673bd57ddc032ee67d09474156d795fb1ba72018
Reviewed-on: https://go-review.googlesource.com/14501
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-12 02:55:38 +00:00
Robert Griesemer
3b0224282c spec: fix composite literal syntax to match prose
Fixes #12578.

Change-Id: I257d70a67609463e24936bc1739285da154be2fe
Reviewed-on: https://go-review.googlesource.com/14531
Reviewed-by: Rob Pike <r@golang.org>
2015-09-12 00:45:55 +00:00
Michal Bohuslávek
ab14797f21 go/printer: fix indentation of *ast.CallExpr parameters
The current version of go/printer formats the following code
like this:

	foo.Bar().
		Run(func() {
		do()
	}).
		Set(map[string]interface{}{
		"x": "three",
		"y": 4,
	}).
		Run(
		func() {
			do()
		},
	)

This CL changes the go/printer behaviour to make the code look
like this.

	foo.Bar().
		Run(func() {
			do()
		}).
		Set(map[string]interface{}{
			"x": "three",
			"y": 4,
		}).
		Run(
			func() {
				do()
			},
		)

Fixes #12066.

Change-Id: If0f525dae1a5d45f9ba40534dbb65715d7e8001b
Reviewed-on: https://go-review.googlesource.com/13928
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-09-11 23:36:34 +00:00