Commit graph

27698 commits

Author SHA1 Message Date
Dmitry Vyukov
0435e88a11 runtime: revert "do not call timeBeginPeriod on windows"
This reverts commit ab4c9298b8.

Sysmon critically depends on system timer resolution for retaking
of Ps blocked in system calls. See #14790 for an example
of a program where execution time goes from 2ms to 30ms if
timeBeginPeriod(1) is not used.

We can remove timeBeginPeriod(1) when we support UMS (#7876).

Update #14790

Change-Id: I362b56154359b2c52d47f9f2468fe012b481cf6d
Reviewed-on: https://go-review.googlesource.com/20834
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-04-09 16:11:41 +00:00
Dave Cheney
9d4efdfd12 cmd/internal/bio: move Bgetc to link/internal/ld
Also, remove bio.Brdline.

Change-Id: I3e0caed27a373fd71737cf6892de5e8fc208b776
Reviewed-on: https://go-review.googlesource.com/21783
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
2016-04-09 07:15:22 +00:00
Dave Cheney
bce9747ed0 cmd: remove unused code
Generated with honnef.co/go/unused

There is a large amount of unused code in cmd/internal/obj/s390x but
that can wait til the s390x port is merged.

There is some unused code in
cmd/internal/unvendor/golang.org/x/arch/arm/armasm but that should be
addressed upstream and a new revision imported.

Change-Id: I252c0f9ea8c5bb1a0b530a374ef13a0a20ea56aa
Reviewed-on: https://go-review.googlesource.com/21782
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
2016-04-09 06:55:21 +00:00
Dave Cheney
93368be61e cmd/internal/bio: embed bufio.{Reader,Writer} in bio.{Reader,Writer}
Change-Id: Ie95b0b0d4f724f4769cf2d4f8063cb5019fa9bc9
Reviewed-on: https://go-review.googlesource.com/21781
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-09 06:12:13 +00:00
Dave Cheney
ca397bb68e cmd: remove bio.BufReader and bio.BufWriter
bio.BufReader was never used.

bio.BufWriter was used to wrap an existing io.Writer, but the
bio.Writer returned would not be seekable, so replace all occurences
with bufio.Reader instead.

Change-Id: I9c6779e35c63178aa4e104c17bb5bb8b52de0359
Reviewed-on: https://go-review.googlesource.com/21722
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-09 03:53:38 +00:00
Dave Cheney
6fee4aa5c7 cmd/link/internal: make ld.Bso a *bio.Writer
This is a pre requesite of CL 21722 and removes a lot of unidiomatic
boilerplate in the linker.

Change-Id: If7491b88212b2be7b0c8c588e9c196839131f8ad
Reviewed-on: https://go-review.googlesource.com/21780
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-09 03:22:13 +00:00
Michael Hudson-Doyle
092ef8a2ca cmd/cgo: fix cgo with gccgo
Change-Id: I1780899255e22c16d7f8e9947609a1c284d7c42e
Reviewed-on: https://go-review.googlesource.com/21690
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-08 23:27:33 +00:00
David Chase
c3b3e7b4ef cmd/compile: insert instrumentation more carefully in racewalk
Be more careful about inserting instrumentation in racewalk.
If the node being instrumented is an OAS, and it has a non-
empty Ninit, then append instrumentation to the Ninit list
rather than letting it be inserted before the OAS (and the
compilation of its init list).  This deals with the case that
the Ninit list defines a variable used in the RHS of the OAS.

Fixes #15091.

Change-Id: Iac91696d9104d07f0bf1bd3499bbf56b2e1ef073
Reviewed-on: https://go-review.googlesource.com/21771
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: David Chase <drchase@google.com>
2016-04-08 21:06:39 +00:00
Dmitry Vyukov
0fb7b4cccd runtime: emit file:line info into traces
This makes traces self-contained and simplifies trace workflow
in modern cloud environments where it is simpler to reach
a service via HTTP than to obtain the binary.

Change-Id: I6ff3ca694dc698270f1e29da37d5efaf4e843a0d
Reviewed-on: https://go-review.googlesource.com/21732
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-04-08 20:52:30 +00:00
Michael Munday
9ada88aec2 cmd/cgo: increase s390x int type size to 8 bytes
The size of the int type in Go on s390x is 8 bytes, not 4.

Change-Id: I1a71ce8c9925f3499abb61c1aa4f6fa2d2ec0d7e
Reviewed-on: https://go-review.googlesource.com/21760
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-08 20:31:58 +00:00
Emmanuel Odeke
59af53d681 bytes: add ContainsRune
Make package bytes consistent with strings
by adding missing function ContainsRune.

Fixes #15189

Change-Id: Ie09080b389e55bbe070c57aa3bd134053a805423
Reviewed-on: https://go-review.googlesource.com/21710
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-04-08 20:24:57 +00:00
Michael Munday
6c5352f181 syscall: add assembly for Linux on s390x
Change-Id: I42ade65a91f3effc03dd663ee449410baa9f8ca8
Reviewed-on: https://go-review.googlesource.com/21740
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-08 18:40:11 +00:00
Brad Fitzpatrick
59d186832b context: disable more flaky tests on openbsd
Updates #15158

Change-Id: Icb3788152a7a5a9b0d56ea38da46d770ffdce413
Reviewed-on: https://go-review.googlesource.com/21763
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-04-08 18:39:11 +00:00
Michael Munday
dae98d5c3b test: skip nilptr3 test on s390x
Fails for the same reason as ppc64 and mips64 (incomplete
optimization).

Change-Id: Ieb4d997fc27d4f2b756e63dd7f588abe10c0213a
Reviewed-on: https://go-review.googlesource.com/20963
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-08 17:51:46 +00:00
Michael Munday
78715cebcf cmd/link: add s390x to link tool main function
Change-Id: I83bc2b4a00216b069f133113e4ae9ad76c98a708
Reviewed-on: https://go-review.googlesource.com/21741
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-08 16:00:41 +00:00
Rob Pike
01360a64c5 io: change the name of ReadAtSizer to SizedReaderAt
This is a proposal. The old name is pretty poor. The new one describes
it better and may be easier to remember. It does not start with Read,
though I think that inconsistency is worthwhile.

Reworded the comment a bit for clarity.

Change-Id: Icb4f9c663cc68958e0363d7ff78a0b29cc521f98
Reviewed-on: https://go-review.googlesource.com/21629
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-08 14:46:19 +00:00
Dave Cheney
8f2edf1199 cmd: replace bio.Buf with bio.Reader and bio.Writer
Replace the bidirectional bio.Buf type with a pair of unidirectional
buffered seekable Reader and Writers.

Change-Id: I86664a06f93c94595dc67c2cbd21356feb6680ef
Reviewed-on: https://go-review.googlesource.com/21720
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-08 14:37:37 +00:00
Michael Munday
d22357ce9d cmd/compile: cleanup -dynlink/-shared support check
Moves the list of architectures that support shared libraries into
a function. Also adds s390x to that list.

Change-Id: I99c8a9f6cd4816ce3d53abaabaf8d002e25e6b28
Reviewed-on: https://go-review.googlesource.com/21661
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Run-TryBot: Michael Munday <munday@ca.ibm.com>
2016-04-08 14:34:31 +00:00
Dave Cheney
49e07f2b7e cmd/compile/internal/gc: unexport Export
Export does not need to be exported.

Change-Id: I252f0c024732f1d056817cab13e8e3c589b54d13
Reviewed-on: https://go-review.googlesource.com/21721
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-08 14:01:21 +00:00
Andrew Gerrand
4dae828f77 cmd/go: fix failing tests since vet was moved from x/tools
Change-Id: I3276a118ced78f3efd8f1bc5fb8b8fa2fde52496
Reviewed-on: https://go-review.googlesource.com/21704
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-08 05:40:53 +00:00
Emmanuel Odeke
853f1a1a63 net/http: fixed trivial go vet warnings
Updates #15177

Change-Id: I748f025461f313b5b426821ead695f90d3011a6b
Reviewed-on: https://go-review.googlesource.com/21677
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-08 04:53:16 +00:00
Keith Randall
68ac1f7746 cmd/compile: Fix constant-folding of unsigned shifts
Make sure the results of unsigned constant-folded
shifts are sign-extended into the AuxInt field.

Fixes #15175

Change-Id: I3490d1bc3d9b2e1578ed30964645508577894f58
Reviewed-on: https://go-review.googlesource.com/21586
Reviewed-by: Alexandru Moșoi <alexandru@mosoi.ro>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-07 21:39:32 +00:00
Cheng-Lung Sung
dfded57819 cmd/go: revise importPath when ImportPath is 'command-line-arguments'
Fixes #14613

Change-Id: I40d9696db3879549e78373ef17f6c92bd4b3470b
Reviewed-on: https://go-review.googlesource.com/21596
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-07 21:34:12 +00:00
Joe Tsai
e88f89028a bytes, string: add Reset method to Reader
Currently, there is no easy allocation-free way to turn a
[]byte or string into an io.Reader. Thus, we add a Reset method
to bytes.Reader and strings.Reader to allow the reuse of these
Readers with another []byte or string.

This is consistent with the fact that many standard library io.Readers
already support a Reset method of some type:
	bufio.Reader
	flate.Reader
	gzip.Reader
	zlib.Reader
	debug/dwarf.LineReader
	bytes.Buffer
	crypto/rc4.Cipher

Fixes #15033

Change-Id: I456fd1af77af6ef0b4ac6228b058ac1458ff3d19
Reviewed-on: https://go-review.googlesource.com/21386
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-07 18:58:01 +00:00
Michael Munday
e6f36f0cd5 runtime: add s390x support (new files and lfstack_64bit.go modifications)
Change-Id: I51c0a332e3cbdab348564e5dcd27583e75e4b881
Reviewed-on: https://go-review.googlesource.com/20946
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-07 18:56:54 +00:00
David Crawshaw
9658b7ef83 cmd/link: hide go.dwarf symbols
Fixes #15179

Change-Id: I0f70b7ae1682eafaece7f22d8e76f0aa806f3ec9
Reviewed-on: https://go-review.googlesource.com/21589
Run-TryBot: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-07 18:54:45 +00:00
David Crawshaw
e6181eb9e1 cmd/link: disable DWARF when not generating symtab
Fixes #15166

Change-Id: I30284e3c0fb2c80b26a2572e2fb249b8018e85f9
Reviewed-on: https://go-review.googlesource.com/21587
Run-TryBot: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-07 18:27:47 +00:00
Burcu Dogan
39f1ecd157 C: fix jbd's identity
Change-Id: Ib4353710a742b1067723c7c6186e8639559668a3
Reviewed-on: https://go-review.googlesource.com/21655
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-07 18:25:13 +00:00
Brad Fitzpatrick
e2c09749af context: mark more tests as flaky on OpenBSD
Updates #15158

Change-Id: I53e9e68d36efbf52736822e6caa047cfff501283
Reviewed-on: https://go-review.googlesource.com/21653
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-07 17:49:26 +00:00
Aliaksandr Valialkin
187afdebef math/big: re-use memory in Int.GCD
This improves TLS handshake performance.

benchmark                                 old ns/op     new ns/op     delta
BenchmarkGCD10x10/WithoutXY-4             965           968           +0.31%
BenchmarkGCD10x10/WithXY-4                1813          1391          -23.28%
BenchmarkGCD10x100/WithoutXY-4            1093          1075          -1.65%
BenchmarkGCD10x100/WithXY-4               2348          1676          -28.62%
BenchmarkGCD10x1000/WithoutXY-4           1569          1565          -0.25%
BenchmarkGCD10x1000/WithXY-4              4262          3242          -23.93%
BenchmarkGCD10x10000/WithoutXY-4          6069          6066          -0.05%
BenchmarkGCD10x10000/WithXY-4             12123         11331         -6.53%
BenchmarkGCD10x100000/WithoutXY-4         52664         52610         -0.10%
BenchmarkGCD10x100000/WithXY-4            97494         95649         -1.89%
BenchmarkGCD100x100/WithoutXY-4           5244          5228          -0.31%
BenchmarkGCD100x100/WithXY-4              22572         18630         -17.46%
BenchmarkGCD100x1000/WithoutXY-4          6143          6233          +1.47%
BenchmarkGCD100x1000/WithXY-4             24652         19357         -21.48%
BenchmarkGCD100x10000/WithoutXY-4         15725         15804         +0.50%
BenchmarkGCD100x10000/WithXY-4            60552         55973         -7.56%
BenchmarkGCD100x100000/WithoutXY-4        107008        107853        +0.79%
BenchmarkGCD100x100000/WithXY-4           349597        340994        -2.46%
BenchmarkGCD1000x1000/WithoutXY-4         63785         64434         +1.02%
BenchmarkGCD1000x1000/WithXY-4            373186        334035        -10.49%
BenchmarkGCD1000x10000/WithoutXY-4        78038         78241         +0.26%
BenchmarkGCD1000x10000/WithXY-4           543692        507034        -6.74%
BenchmarkGCD1000x100000/WithoutXY-4       205607        207727        +1.03%
BenchmarkGCD1000x100000/WithXY-4          2488113       2415323       -2.93%
BenchmarkGCD10000x10000/WithoutXY-4       1731340       1714992       -0.94%
BenchmarkGCD10000x10000/WithXY-4          10601046      7111329       -32.92%
BenchmarkGCD10000x100000/WithoutXY-4      2239155       2212173       -1.21%
BenchmarkGCD10000x100000/WithXY-4         30097040      26538887      -11.82%
BenchmarkGCD100000x100000/WithoutXY-4     119845326     119863916     +0.02%
BenchmarkGCD100000x100000/WithXY-4        768006543     426795966     -44.43%

benchmark                                 old allocs     new allocs     delta
BenchmarkGCD10x10/WithoutXY-4             5              5              +0.00%
BenchmarkGCD10x10/WithXY-4                17             9              -47.06%
BenchmarkGCD10x100/WithoutXY-4            6              6              +0.00%
BenchmarkGCD10x100/WithXY-4               21             9              -57.14%
BenchmarkGCD10x1000/WithoutXY-4           6              6              +0.00%
BenchmarkGCD10x1000/WithXY-4              30             12             -60.00%
BenchmarkGCD10x10000/WithoutXY-4          6              6              +0.00%
BenchmarkGCD10x10000/WithXY-4             26             12             -53.85%
BenchmarkGCD10x100000/WithoutXY-4         6              6              +0.00%
BenchmarkGCD10x100000/WithXY-4            28             12             -57.14%
BenchmarkGCD100x100/WithoutXY-4           5              5              +0.00%
BenchmarkGCD100x100/WithXY-4              183            61             -66.67%
BenchmarkGCD100x1000/WithoutXY-4          8              8              +0.00%
BenchmarkGCD100x1000/WithXY-4             170            47             -72.35%
BenchmarkGCD100x10000/WithoutXY-4         8              8              +0.00%
BenchmarkGCD100x10000/WithXY-4            200            67             -66.50%
BenchmarkGCD100x100000/WithoutXY-4        8              8              +0.00%
BenchmarkGCD100x100000/WithXY-4           188            65             -65.43%
BenchmarkGCD1000x1000/WithoutXY-4         5              5              +0.00%
BenchmarkGCD1000x1000/WithXY-4            2435           1193           -51.01%
BenchmarkGCD1000x10000/WithoutXY-4        8              8              +0.00%
BenchmarkGCD1000x10000/WithXY-4           2211           1076           -51.33%
BenchmarkGCD1000x100000/WithoutXY-4       8              8              +0.00%
BenchmarkGCD1000x100000/WithXY-4          2271           1108           -51.21%
BenchmarkGCD10000x10000/WithoutXY-4       5              5              +0.00%
BenchmarkGCD10000x10000/WithXY-4          23183          11605          -49.94%
BenchmarkGCD10000x100000/WithoutXY-4      8              8              +0.00%
BenchmarkGCD10000x100000/WithXY-4         23421          11717          -49.97%
BenchmarkGCD100000x100000/WithoutXY-4     5              5              +0.00%
BenchmarkGCD100000x100000/WithXY-4        232976         116815         -49.86%

benchmark                                 old bytes      new bytes     delta
BenchmarkGCD10x10/WithoutXY-4             208            208           +0.00%
BenchmarkGCD10x10/WithXY-4                736            432           -41.30%
BenchmarkGCD10x100/WithoutXY-4            256            256           +0.00%
BenchmarkGCD10x100/WithXY-4               896            432           -51.79%
BenchmarkGCD10x1000/WithoutXY-4           368            368           +0.00%
BenchmarkGCD10x1000/WithXY-4              1856           1152          -37.93%
BenchmarkGCD10x10000/WithoutXY-4          1616           1616          +0.00%
BenchmarkGCD10x10000/WithXY-4             7920           7376          -6.87%
BenchmarkGCD10x100000/WithoutXY-4         13776          13776         +0.00%
BenchmarkGCD10x100000/WithXY-4            68800          68176         -0.91%
BenchmarkGCD100x100/WithoutXY-4           208            208           +0.00%
BenchmarkGCD100x100/WithXY-4              6960           2112          -69.66%
BenchmarkGCD100x1000/WithoutXY-4          544            560           +2.94%
BenchmarkGCD100x1000/WithXY-4             7280           2400          -67.03%
BenchmarkGCD100x10000/WithoutXY-4         2896           2912          +0.55%
BenchmarkGCD100x10000/WithXY-4            15280          10002         -34.54%
BenchmarkGCD100x100000/WithoutXY-4        27344          27365         +0.08%
BenchmarkGCD100x100000/WithXY-4           88288          83427         -5.51%
BenchmarkGCD1000x1000/WithoutXY-4         544            544           +0.00%
BenchmarkGCD1000x1000/WithXY-4            178288         40043         -77.54%
BenchmarkGCD1000x10000/WithoutXY-4        3344           3136          -6.22%
BenchmarkGCD1000x10000/WithXY-4           188720         54432         -71.16%
BenchmarkGCD1000x100000/WithoutXY-4       27792          27592         -0.72%
BenchmarkGCD1000x100000/WithXY-4          373872         239447        -35.95%
BenchmarkGCD10000x10000/WithoutXY-4       4288           4288          +0.00%
BenchmarkGCD10000x10000/WithXY-4          11935584       481875        -95.96%
BenchmarkGCD10000x100000/WithoutXY-4      31296          28834         -7.87%
BenchmarkGCD10000x100000/WithXY-4         13237088       1662620       -87.44%
BenchmarkGCD100000x100000/WithoutXY-4     40768          40768         +0.00%
BenchmarkGCD100000x100000/WithXY-4        1165518864     14256010      -98.78%

Change-Id: I652b3244bd074a03f3bc9a87c282330f9e5f1507
Reviewed-on: https://go-review.googlesource.com/21506
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-07 17:19:37 +00:00
Michael Munday
1e7c61d8c3 math/big: add s390x function implementations
Change-Id: I2aadc885d6330460e494c687757f07c5e006f3b0
Reviewed-on: https://go-review.googlesource.com/20937
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-07 16:15:27 +00:00
Michael Munday
7da42d7597 sync/atomic: add s390x implementations of atomic functions
Load and store instructions are atomic on s390x.

Change-Id: I33c641a75954f4fbd301b11a467cb57872038880
Reviewed-on: https://go-review.googlesource.com/20947
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-07 15:30:14 +00:00
Alan Donovan
95a895df0c go/types: make Identical(nil, T) == Identical(T, nil)
Fixes #15173

Change-Id: I353756f7bc36db0d2b24d40c80771481b7b18f6b
Reviewed-on: https://go-review.googlesource.com/21585
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-07 14:21:18 +00:00
Dave Cheney
9cc9e95b28 Revert "runtime: merge lfstack{Pack,Unpack} into one file"
This broke solaris, which apparently does use the upper 17 bits of the address space.

This reverts commit 3b02c5b1b6.

Change-Id: Iedfe54abd0384960845468205f20191a97751c0b
Reviewed-on: https://go-review.googlesource.com/21652
Reviewed-by: Dave Cheney <dave@cheney.net>
2016-04-07 14:05:24 +00:00
Alexandru Moșoi
8448d3aace cmd/compile: fold CMPconst and SHR
Fold the comparison when the SHR result is small.

Useful for:
- murmur mix like hashing where higher bits are desirable, i.e. hash = uint32(i * C) >> 18
- integer log2 via DeBruijn sequence: http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn

Change-Id: If70ae18cb86f4cc83ab6213f88ced03cc4986156
Reviewed-on: https://go-review.googlesource.com/21514
Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-04-07 13:28:13 +00:00
Richard Miller
121c434f7a runtime/pprof: make TestBlockProfile less timing dependent
The test for profiling of channel blocking is timing dependent,
and in particular the blockSelectRecvAsync case can fail on a
slow builder (plan9_arm) when many tests are run in parallel.
The child goroutine sleeps for a fixed period so the parent
can be observed to block in a select call reading from the
child; but if the OS process running the parent goroutine is
delayed long enough, the child may wake again before the
parent has reached the blocking point.  By repeating the test
three times, the likelihood of a blocking event is increased.

Fixes #15096

Change-Id: I2ddb9576a83408d06b51ded682bf8e71e53ce59e
Reviewed-on: https://go-review.googlesource.com/21604
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-07 09:57:06 +00:00
Dave Cheney
3b02c5b1b6 runtime: merge lfstack{Pack,Unpack} into one file
Merge the remaining lfstack{Pack,Unpack} implemetations into one file.

unsafe.Sizeof(uintptr(0)) == 4 is a constant comparison so this branch
folds away at compile time.

Dmitry confirmed that the upper 17 bits of an address will be zero for a
user mode pointer, so there is no need to sign extend on amd64 during
unpack, so we can reuse the same implementation as all othe 64 bit
archs.

Change-Id: I99f589416d8b181ccde5364c9c2e78e4a5efc7f1
Reviewed-on: https://go-review.googlesource.com/21597
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2016-04-07 09:17:22 +00:00
Matthew Dempsky
438ce713a1 cmd/link/internal/amd64: remove empty source file
Change-Id: I2da012ed996c669db513a462f014c6f3ffa396ee
Reviewed-on: https://go-review.googlesource.com/21646
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2016-04-07 06:45:47 +00:00
Matthew Dempsky
4b7e36cdfe cmd: extract obj's Biobuf code into new bio package
API could still be made more Go-ey.

Updates #15165.

Change-Id: I514ffceffa43c293ae5d7e5f1e9193fda0098865
Reviewed-on: https://go-review.googlesource.com/21644
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-07 06:09:54 +00:00
Matthew Dempsky
b17b95301a cmd/internal/sys: change ArchFamily constants to iotas
RIP architecture characters.

Change-Id: I36f53afdc311b14b9459ff3821bd6df54a057ded
Reviewed-on: https://go-review.googlesource.com/21628
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2016-04-07 04:17:26 +00:00
Matthew Dempsky
22ef687da8 cmd/link: remove dependency on sys.ArchFamily values
Change-Id: I858054b72847f4f27a1ebbdaff82820a28c03743
Reviewed-on: https://go-review.googlesource.com/21627
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-07 04:17:10 +00:00
Matthew Dempsky
d481ffc1af cmd/compile, cmd/link: eliminate uses of ArchFamily in error messages
Two of these error messages are already dead code: cmd/compile.main
and cmd/link.main already switch on $GOARCH, ensuring it must be a
prefix of the sys.Arch.Family.

The error message about uncompiled Go source files can be just be
simplified: anyone who's manually constructing Go object file archives
probably knows what tool to use to compile Go source files.

Change-Id: Ia4a67c0a1d1158379c127c91e909226d3367f3c2
Reviewed-on: https://go-review.googlesource.com/21626
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-07 02:46:53 +00:00
Matthew Dempsky
c6e11fe037 cmd: add new common architecture representation
Information about CPU architectures (e.g., name, family, byte
ordering, pointer and register size) is currently redundantly
scattered around the source tree. Instead consolidate the basic
information into a single new package cmd/internal/sys.

Also, introduce new sys.I386, sys.AMD64, etc. names for the constants
'8', '6', etc. and replace most uses of the latter. The notable
exceptions are a couple of error messages that still refer to the old
char-based toolchain names and function reltype in cmd/link.

Passes toolstash/buildall.

Change-Id: I8a6f0cbd49577ec1672a98addebc45f767e36461
Reviewed-on: https://go-review.googlesource.com/21623
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-07 01:23:25 +00:00
Michael Hudson-Doyle
31cf1c1779 runtime: clamp OS-reported number of processors to _MaxGomaxprocs
So that all Go processes do not die on startup on a system with >256 CPUs.

I tested this by hacking osinit to set ncpu to 1000.

Updates #15131

Change-Id: I52e061a0de97be41d684dd8b748fa9087d6f1aef
Reviewed-on: https://go-review.googlesource.com/21599
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-07 00:11:25 +00:00
Ryan Brown
a037c73ccf cmd/link: generate DWARF info using symbols
This updates dwarf.go to generate debug information as symbols
instead of directly writing to the output file. This should make
it easier to move generation of some of the debug info into the compiler.

Change-Id: Id2358988bfb689865ab4d68f82716f0676336df4
Reviewed-on: https://go-review.googlesource.com/20679
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-06 23:50:14 +00:00
Michael Munday
0382a30dd6 math: add functions and stubs for s390x
Includes assembly implementations of Sqrt and Dim.

Change-Id: I57472e8d31e2ee74bcebf9f8e818f765eb9b8abf
Reviewed-on: https://go-review.googlesource.com/20936
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-06 23:35:56 +00:00
Robert Griesemer
81aacb80d5 cmd/compile, go/importer: minor cleanups
Change-Id: I4ffb79d8cb08b0b44f59757fb7f0ec3ed1e4479f
Reviewed-on: https://go-review.googlesource.com/21624
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-04-06 22:37:47 +00:00
Josh Bleecher Snyder
007b12977a cmd/compile: move Type.Maplineno to separate data structure
Relatively few types are ever used as map keys,
so tracking this separately is a net win.

Passes toolstash -cmp.

name       old alloc/op     new alloc/op     delta
Template       55.9MB ± 0%      55.5MB ± 0%  -0.71%        (p=0.000 n=10+10)
Unicode        37.8MB ± 0%      37.7MB ± 0%  -0.27%        (p=0.000 n=10+10)
GoTypes         180MB ± 0%       179MB ± 0%  -0.52%         (p=0.000 n=7+10)
Compiler        806MB ± 0%       803MB ± 0%  -0.41%        (p=0.000 n=10+10)

CPU and number of allocs are unchanged.

Change-Id: I6d60d74a4866995a231dfed3dd5792d75d904292
Reviewed-on: https://go-review.googlesource.com/21622
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-04-06 22:03:47 +00:00
Rob Pike
d636d7907c bytes: add ContainsAny
This function is present in the strings package but missing from bytes,
and we would like to keep the two packages consistent.

Add it to bytes, and copy the test over as well.

Fixes #15140

Change-Id: I5dbd28da83a9fe741885794ed15f2af2f826cb3c
Reviewed-on: https://go-review.googlesource.com/21562
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-06 21:17:08 +00:00
Dave Cheney
0c81248bf4 runtime: remove unused return value from lfstackUnpack
None of the two places that call lfstackUnpack use the second argument.
This simplifies a followup CL that merges the lfstack{Pack,Unpack}
implementations.

Change-Id: I3c93f6259da99e113d94f8c8027584da79c1ac2c
Reviewed-on: https://go-review.googlesource.com/21595
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-06 21:04:43 +00:00