1
0
mirror of https://github.com/golang/go synced 2024-11-12 08:10:21 -07:00
Commit Graph

34788 Commits

Author SHA1 Message Date
Tobias Klauser
ac0f890c57 cmd/dist: omit dragonfly/386 GOOS/GOARCH pair
dragonfly/386 isn't a valid GOOS/GOARCH pair.

Change-Id: I44374a932b20f0d49b2e509484143970eb5464c2
Reviewed-on: https://go-review.googlesource.com/79656
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-23 18:28:51 +00:00
David du Colombier
b72678f37f net: skip TestLookupLongTXT on Plan 9
CL 79555 added TestLookupLongTXT. However, this test is
failing on Plan 9, because the DNS resolver (ndb/dns)
only returns a single TXT record.

Updates #22857.

Change-Id: I33cdc63a3d3de4d1c7f2684934316c44992fb9e2
Reviewed-on: https://go-review.googlesource.com/79695
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-23 16:45:24 +00:00
Tom Levy
8a092b74fc doc: fix typo in Effective Go: s/ReaderWriter/ReadWriter/
Change-Id: I3bfe1b11265f0def4701faf2cfc1ad10a666a473
Reviewed-on: https://go-review.googlesource.com/79596
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-23 04:07:39 +00:00
Austin Clements
294963fb7f runtime: document sigtrampgo better
Add an explanation of why sigtrampgo is nosplit.

Updates #21314.

Change-Id: I3f5909d2b2c180f9fa74d53df13e501826fd4316
Reviewed-on: https://go-review.googlesource.com/79615
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-23 03:05:56 +00:00
Russ Cox
b6cf58d5b8 net: fix LookupTXT of long records on Windows
The response to a TXT lookup is a sequence of RRs,
each of which contains a sequence of string fragments.

The correct handling of the response is to do:

    for each rr {
        list = append(list, strings.Join(rr.fragments, ""))
    }

(like in at dnsRR_TXT.Walk, used on most platforms).

The Windows code incorrectly does:

    for each rr {
        list = append(list, rr.fragments...)
    }

This CL fixes it to concatenate fragments, as it must.

Fixes #21472.

Change-Id: I78cce96f172e5e90da9a212b0343457f6d5f92e8
Reviewed-on: https://go-review.googlesource.com/79555
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-23 01:17:18 +00:00
Ian Lance Taylor
571ee0436f os/signal: don't run TestTerminalSignal on Android
At least some versions of the Android libc do not define posix_openpt.

Updates #22845

Change-Id: Id21705f47ef0f9694313a7dc7351a952d48d407b
Reviewed-on: https://go-review.googlesource.com/79399
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-23 00:34:48 +00:00
Alex Brainman
4a41da5bac cmd/go: add TestACL
Add test that verifies that go command produces executable
that have security attributes of the target directory.

Update #22343

Change-Id: Ieab02381927a2b09bee21c49c043b3298bd088e6
Reviewed-on: https://go-review.googlesource.com/78215
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-22 23:42:48 +00:00
Tom Lanyon
5051671c7e os/exec: update docs for cmd.Std{out,err} and cmd.Wait to clarify how copying is done
Fixes #22610.

Change-Id: I172fe1d1941a8a2750af7ee75f7af7e81a702c40
Reviewed-on: https://go-review.googlesource.com/76320
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-22 23:18:02 +00:00
Robert Griesemer
ecc8650398 go/types: fix type in Interface.Complete method
This doesn't appear to have caused problems (because we don't depend
on the sort order, it seems) but it's clearly incorrect.

Change-Id: Ib6eb0128a3c17997c7907a618f9ce102b32aaa98
Reviewed-on: https://go-review.googlesource.com/79497
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-22 22:37:15 +00:00
Austin Clements
4671da0414 runtime: print runtime frames in throwsplit trace
newstack manually prints the stack trace if we try to grow the stack
when throwsplit is set. However, the default behavior is to omit
runtime frames. Since runtime frames can be critical to understanding
this crash, this change fixes this traceback to include them.

Updates #21431.

Change-Id: I5aa43f43aa2f10a8de7d67bcec743427be3a3b5d
Reviewed-on: https://go-review.googlesource.com/79518
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-22 21:44:38 +00:00
Austin Clements
09739d2850 runtime: call throw on systemstack in exitsyscall
If exitsyscall tries to grow the stack it will panic, but throw calls
print, which can grow the stack. Move the two bare throws in
exitsyscall to the system stack.

Updates #21431.

Change-Id: I5b29da5d34ade908af648a12075ed327a864476c
Reviewed-on: https://go-review.googlesource.com/79517
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-22 21:44:35 +00:00
Ian Lance Taylor
c6c0f47e92 os/signal: fix t.Fatal that should be t.Fatalf
Change-Id: I2a24b2bde9a7c641b3bc802ff8b2ddebf4990109
Reviewed-on: https://go-review.googlesource.com/79496
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-22 21:16:29 +00:00
Ian Lance Taylor
9adfe0f475 os/signal: don't run TestTerminalSignal on Solaris
Fixes #22849

Change-Id: Icf7f07d0d1d0669f5db4943030588646c819c62a
Reviewed-on: https://go-review.googlesource.com/79495
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-22 20:58:08 +00:00
Daniel Martí
88599f184d cmd/vet: add missing %v to the verb regex
In golang.org/cl/74352, the print rules were overhauled to give better
error messages. This also meant adding a regex to find and extract the
used formatting verbs.

However, %v was missed. Add it to the expression, and add a test too.

Fixes #22847.

Change-Id: If117cc364db0cb91373742239b8a626c137642b0
Reviewed-on: https://go-review.googlesource.com/79455
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-22 20:27:00 +00:00
Emmanuel Odeke
1490cf67ed net/http: implement sniffing for some fonts
Implement sniffing for fonts:
* MS Font object  --> "application/vnd.ms-fontobject"
* ttf		  --> "application/font-ttf"

* off		  --> "application/font-off"
* otf		  --> "application/font-off"

* cff		  --> "application/font-cff"
* woff		  --> "application/font-woff"

Fixes #20808

Change-Id: Ibe02a87d3c9d610c6a30e1b6c03f4e520404e70f
Reviewed-on: https://go-review.googlesource.com/47553
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-22 19:25:48 +00:00
Ian Lance Taylor
6ecd843e7c os/signal: make TestTerminalSignal more reliable
Look for program output and shell prompt to see when to continue.

Updates #22845

Change-Id: I44ed1908861f3b0dc098aee9a401324b77268921
Reviewed-on: https://go-review.googlesource.com/79395
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Munday <mike.munday@ibm.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-22 19:19:02 +00:00
Matthew Dempsky
3c375f1b7e cmd/compile, go/types: error if main.main is not a function
Fixes #21256.

Change-Id: I3af4c76e734c09d07f15525b793a544a7279b906
Reviewed-on: https://go-review.googlesource.com/79435
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-11-22 19:14:31 +00:00
Matthew Dempsky
5e423ed855 cmd/link: fix export data truncation bug
Similar fix as in CL 60773 for fixing cmd/pack.

Fixes #21703.

Change-Id: I457ed8a3be828fd458abc5c8c1cc766a9f7aab13
Reviewed-on: https://go-review.googlesource.com/79135
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-22 18:12:36 +00:00
Kevin Burke
f100e0c228 os/user: fix darwin GetGroupIds for n > 256
If a Mac user has more than 256 groups, getGroupList returns -1 but
does not correctly set n. We need to retry the syscall with an
ever-increasing group size until we get all of the user's groups.

The easiest way to test this change is to set n to a value lower than
the current user's number of groups, test on a Mac and observe
a failure, then apply the patch and test that it passes.

Fixes #21067.

Change-Id: I0f5c4eac1c465226a460bc0803eff791dcfd4200
Reviewed-on: https://go-review.googlesource.com/51892
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-22 17:14:47 +00:00
Austin Clements
64b68bedc5 runtime/debug: make SetGCPercent(-1) wait for concurrent GC
Currently, SetGCPercent(-1) disables GC, but doesn't wait for any
currently running concurrent GC to finish, so GC can still be running
when it returns. This is a change in behavior from Go 1.8, probably
defies user expectations, and can break various runtime tests that
depend on SetGCPercent(-1) to disable garbage collection in order to
prevent preemption deadlocks.

Fix this by making SetGCPercent(-1) block until any concurrently
running GC cycle finishes.

Fixes #22443.

Change-Id: I904133a34acf97a7942ef4531ace0647b13930ef
Reviewed-on: https://go-review.googlesource.com/79195
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-22 14:47:12 +00:00
Keith Randall
48e207d518 cmd/compile: fix mapassign_fast* routines for pointer keys
The signature of the mapassign_fast* routines need to distinguish
the pointerness of their key argument.  If the affected routines
suspend part way through, the object pointed to by the key might
get garbage collected because the key is typed as a uint{32,64}.

This is not a problem for mapaccess or mapdelete because the key
in those situations do not live beyond the call involved.  If the
object referenced by the key is garbage collected prematurely, the
code still works fine.  Even if that object is subsequently reallocated,
it can't be written to the map in time to affect the lookup/delete.

Fixes #22781

Change-Id: I0bbbc5e9883d5ce702faf4e655348be1191ee439
Reviewed-on: https://go-review.googlesource.com/79018
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
2017-11-22 04:30:27 +00:00
Tim Wright
a2a1c173d7 syscall: add missing fs locking in Link, Rename on nacl
Per the comments at the head of fs_nacl.go, unexported methods expect
the fs mutex to have been taken by the caller.
This change brings Link and Rename into line with the other exported
functions wrt fs locking.

Fixes #22690

Change-Id: I46d08f7d227f23ff49bb0099d218214364a45e1a
Reviewed-on: https://go-review.googlesource.com/79295
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-22 03:47:23 +00:00
Michael Schurter
7eb7f8f5a7 encoding/json: reduce allocations by Decoder for \uXXXX
Manually convert hex escape sequence to rune instead of calling
strconv.ParseUint.

This inlines the unhex func from docs (and many other packages).

name              old time/op    new time/op    delta
UnicodeDecoder-4     468ns ± 1%     402ns ± 1%  -14.26%  (p=0.000
n=10+10)

name              old speed      new speed      delta
UnicodeDecoder-4  29.9MB/s ± 1%  34.8MB/s ± 1%  +16.59%  (p=0.000
n=10+10)

name              old alloc/op   new alloc/op   delta
UnicodeDecoder-4     44.0B ± 0%     36.0B ± 0%  -18.18%  (p=0.000
n=10+10)

name              old allocs/op  new allocs/op  delta
UnicodeDecoder-4      4.00 ± 0%      2.00 ± 0%  -50.00%  (p=0.000
n=10+10)

Fixes #20567

Change-Id: If350978d5bb98ff517485752184d02249f5d1f3a
Reviewed-on: https://go-review.googlesource.com/44738
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-22 03:36:29 +00:00
Brad Fitzpatrick
71aee2a190 doc: update the URL of the latest go1.4 source snapshot
Updates golang/go#20672

Change-Id: I3c62b1606aec93e188255f1701c0af569d540016
Reviewed-on: https://go-review.googlesource.com/79276
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-22 02:36:34 +00:00
Ian Lance Taylor
3fec6da0ab internal/poll: loop on EINTR in Read on Darwin
Test is in os/signal package because the problem is signal related.

Fixes #22838.

Change-Id: I223eeebb5fbc972910737eddef8ab9784cb984a6
Reviewed-on: https://go-review.googlesource.com/79215
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-22 02:27:19 +00:00
Florin Patan
1e679ae2aa doc: rename Gogland to GoLand
This updates the name of the IDE and the capability it has.

Fixes #22784

Change-Id: Ief261324c86bc77a03071629f496f4d4d9df1b44
Reviewed-on: https://go-review.googlesource.com/79255
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-22 01:18:45 +00:00
Austin Clements
e862f98d1e test: make inline_callers.go test not inline the runtime
CL 76551 modified inline_callers.go to build everything, including the
runtime, with -l=4. While that works in most places (and ideally
should work everywhere), it blows out the nosplit stack on
solaris/amd64.

Fix this by only building the test itself with -l=4.

This undoes some of the changes to this test from CL 73212, which
originally changed the go tool to rebuild all packages with the given
flags. This change modified the expected output of this test, so now
that we can go back to building only the test itself with inlining, we
revert these changes to the expected output. (That CL also changed
log.Fatalf to log.Printf, but didn't add "\n" to the end of the lines,
so this CL fixes that, too.)

Fixes #22797.

Change-Id: I6a91963a59ebe98edbe0921d8717af6b2c2191b0
Reviewed-on: https://go-review.googlesource.com/79197
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-22 00:52:54 +00:00
Brad Fitzpatrick
1e3f563b14 runtime: fix build on non-Linux platforms
CL 78538 was updated after running TryBots to depend on
syscall.NanoSleep which isn't available on all non-Linux platforms.

Change-Id: I1fa615232b3920453431861310c108b208628441
Reviewed-on: https://go-review.googlesource.com/79175
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2017-11-21 21:52:58 +00:00
Dmitri Shuralyov
597213c87c time: rename TestLoadLocationFromTzinfo to TestLoadLocationFromTZData
Tzinfo was replaced with TZData during the review of CL 68890, but this
instance was forgotten. Update it for consistency.

Follows CL 68890.
Updates #20629.

Change-Id: Id6d3c4f5f7572b01065f2db556db605452d1b570
Reviewed-on: https://go-review.googlesource.com/79176
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-21 21:13:15 +00:00
isharipo
49322ca9ed cmd/internal/obj/x86: fix /is4 encoding for VBLEND
Fixes VBLENDVP{D/S}, VPBLENDVB encoding for /is4 imm8[7:4]
encoded register operand.

Explanation:
`reg[r]+regrex[r]+1` will yield correct values for 8..15 reg indexes,
but for 0..7 it gives `index+1` results.
There was no test that used lower 8 register with /is4 encoding,
so the bug passed the tests.
The proper solution is to get 4th bit from regrex with a proper shift:
`reg[r]|(regrex[r]<<1)`.

Instead of inlining `reg[r]|(regrex[r]<<1)` expr,
using new `regIndex(r)` function.

Test that reproduces this issue is added to
amd64enc_extra.s test suite.

Bug came from https://golang.org/cl/70650.

Change-Id: I846a25e88d5e6df88df9d9c3f5fe94ec55416a33
Reviewed-on: https://go-review.googlesource.com/78815
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
2017-11-21 20:29:59 +00:00
Reilly Watson
78615844f5 doc: fix some typos in diagnostics.html
The section about custom pprof paths referenced the wrong path.

This also fixes a couple minor grammatical issues elsewhere in the doc.

Fixes #22832

Change-Id: I890cceb53a13c1958d9cf958c658ccfcbb6863d5
Reviewed-on: https://go-review.googlesource.com/79035
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
2017-11-21 20:29:01 +00:00
Brad Fitzpatrick
40d8b4b2e2 time: fix build on Android
Some type renames were missing in the android file from CL 79017

Change-Id: I419215575ca7975241afb8d2069560c8b1d142c6
Reviewed-on: https://go-review.googlesource.com/79136
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-21 19:44:00 +00:00
Michael Pratt
b75b4d0ee6 runtime: skip netpoll check if there are no waiters
If there are no netpoll waiters then calling netpoll will never find any
goroutines. The later blocking netpoll in findrunnable already has this
optimization.

With golang.org/cl/78538 also applied, this change has a small impact on
latency:

name                             old time/op  new time/op  delta
WakeupParallelSpinning/0s-12     13.6µs ± 1%  13.7µs ± 1%    ~     (p=0.873 n=19+20)
WakeupParallelSpinning/1µs-12    17.7µs ± 0%  17.6µs ± 0%  -0.31%  (p=0.000 n=20+20)
WakeupParallelSpinning/2µs-12    20.2µs ± 2%  19.9µs ± 1%  -1.59%  (p=0.000 n=20+19)
WakeupParallelSpinning/5µs-12    32.0µs ± 1%  32.1µs ± 1%    ~     (p=0.201 n=20+19)
WakeupParallelSpinning/10µs-12   51.7µs ± 0%  51.4µs ± 1%  -0.60%  (p=0.000 n=20+18)
WakeupParallelSpinning/20µs-12   92.2µs ± 0%  92.2µs ± 0%    ~     (p=0.474 n=19+19)
WakeupParallelSpinning/50µs-12    215µs ± 0%   215µs ± 0%    ~     (p=0.319 n=20+19)
WakeupParallelSpinning/100µs-12   330µs ± 2%   331µs ± 2%    ~     (p=0.296 n=20+19)
WakeupParallelSyscall/0s-12       127µs ± 0%   126µs ± 0%  -0.57%  (p=0.000 n=18+18)
WakeupParallelSyscall/1µs-12      129µs ± 0%   128µs ± 1%  -0.43%  (p=0.000 n=18+19)
WakeupParallelSyscall/2µs-12      131µs ± 1%   130µs ± 1%  -0.78%  (p=0.000 n=20+19)
WakeupParallelSyscall/5µs-12      137µs ± 1%   136µs ± 0%  -0.54%  (p=0.000 n=18+19)
WakeupParallelSyscall/10µs-12     147µs ± 1%   146µs ± 0%  -0.58%  (p=0.000 n=18+19)
WakeupParallelSyscall/20µs-12     168µs ± 0%   167µs ± 0%  -0.52%  (p=0.000 n=19+19)
WakeupParallelSyscall/50µs-12     228µs ± 0%   227µs ± 0%  -0.37%  (p=0.000 n=19+18)
WakeupParallelSyscall/100µs-12    329µs ± 0%   328µs ± 0%  -0.28%  (p=0.000 n=20+18)

There is a bigger improvement in CPU utilization. Before this CL, these
benchmarks spent 12% of cycles in netpoll, which are gone after this CL.

This also fixes the sched.lastpoll load, which should be atomic.

Change-Id: I600961460608bd5ba3eeddc599493d2be62064c6
Reviewed-on: https://go-review.googlesource.com/78915
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Austin Clements <austin@google.com>
2017-11-21 19:36:56 +00:00
Jamie Liu
868c8b374d runtime: only sleep before stealing work from a running P
The sleep in question does not make sense if the stolen-from P cannot
run the stolen G. The usleep(3) has been observed delaying execution of
woken G's by ~60us; skipping it reduces the wakeup-to-execution latency
to ~7us in these cases, improving CPU utilization.

Benchmarks added by this change:

name                             old time/op  new time/op  delta
WakeupParallelSpinning/0s-12     14.4µs ± 1%  14.3µs ± 1%     ~     (p=0.227 n=19+20)
WakeupParallelSpinning/1µs-12    18.3µs ± 0%  18.3µs ± 1%     ~     (p=0.950 n=20+19)
WakeupParallelSpinning/2µs-12    22.3µs ± 1%  22.3µs ± 1%     ~     (p=0.670 n=20+18)
WakeupParallelSpinning/5µs-12    31.7µs ± 0%  31.7µs ± 0%     ~     (p=0.460 n=20+17)
WakeupParallelSpinning/10µs-12   51.8µs ± 0%  51.8µs ± 0%     ~     (p=0.883 n=20+20)
WakeupParallelSpinning/20µs-12   91.9µs ± 0%  91.9µs ± 0%     ~     (p=0.245 n=20+20)
WakeupParallelSpinning/50µs-12    214µs ± 0%   214µs ± 0%     ~     (p=0.509 n=19+20)
WakeupParallelSpinning/100µs-12   335µs ± 0%   335µs ± 0%   -0.05%  (p=0.006 n=17+15)
WakeupParallelSyscall/0s-12       228µs ± 2%   129µs ± 1%  -43.32%  (p=0.000 n=20+19)
WakeupParallelSyscall/1µs-12      232µs ± 1%   131µs ± 1%  -43.60%  (p=0.000 n=19+20)
WakeupParallelSyscall/2µs-12      236µs ± 1%   133µs ± 1%  -43.44%  (p=0.000 n=18+19)
WakeupParallelSyscall/5µs-12      248µs ± 2%   139µs ± 1%  -43.68%  (p=0.000 n=18+19)
WakeupParallelSyscall/10µs-12     263µs ± 3%   150µs ± 2%  -42.97%  (p=0.000 n=18+20)
WakeupParallelSyscall/20µs-12     281µs ± 2%   170µs ± 1%  -39.43%  (p=0.000 n=19+19)
WakeupParallelSyscall/50µs-12     345µs ± 4%   246µs ± 7%  -28.85%  (p=0.000 n=20+20)
WakeupParallelSyscall/100µs-12    460µs ± 5%   350µs ± 4%  -23.85%  (p=0.000 n=20+20)

Benchmarks associated with the change that originally added this sleep
(see https://golang.org/s/go15gomaxprocs):

name        old time/op  new time/op  delta
Chain       19.4µs ± 2%  19.3µs ± 1%    ~     (p=0.101 n=19+20)
ChainBuf    19.5µs ± 2%  19.4µs ± 2%    ~     (p=0.840 n=19+19)
Chain-2     19.9µs ± 1%  19.9µs ± 2%    ~     (p=0.734 n=19+19)
ChainBuf-2  20.0µs ± 2%  20.0µs ± 2%    ~     (p=0.175 n=19+17)
Chain-4     20.3µs ± 1%  20.1µs ± 1%  -0.62%  (p=0.010 n=19+18)
ChainBuf-4  20.3µs ± 1%  20.2µs ± 1%  -0.52%  (p=0.023 n=19+19)
Powser       2.09s ± 1%   2.10s ± 3%    ~     (p=0.908 n=19+19)
Powser-2     2.21s ± 1%   2.20s ± 1%  -0.35%  (p=0.010 n=19+18)
Powser-4     2.31s ± 2%   2.31s ± 2%    ~     (p=0.578 n=18+19)
Sieve        13.6s ± 1%   13.6s ± 1%    ~     (p=0.909 n=17+18)
Sieve-2      8.02s ±52%   7.28s ±15%    ~     (p=0.336 n=20+16)
Sieve-4      4.00s ±35%   3.98s ±26%    ~     (p=0.654 n=20+18)

Change-Id: I58edd8ce01075859d871e2348fc0833e9c01f70f
Reviewed-on: https://go-review.googlesource.com/78538
Reviewed-by: Austin Clements <austin@google.com>
2017-11-21 19:31:06 +00:00
Florian Uekermann
2951f909ea time: enable Location loading from user provided timezone data
The return values of the LoadLocation are inherently dependent
on the runtime environment. Add LoadLocationFromTZData, whose
results depend only on the timezone data provided as arguments.

Fixes #20629

Change-Id: I43b181f4c05c219be3ec57327540263b7cb3b2aa
Reviewed-on: https://go-review.googlesource.com/68890
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-21 19:13:52 +00:00
Wei Xiao
9a14cd9e75 bytes: add optimized countByte for arm64
Use SIMD instructions when counting a single byte.
Inspired from runtime IndexByte implementation.

Benchmark results of bytes, where 1 byte in every 8 is the one we are looking:

name               old time/op   new time/op    delta
CountSingle/10-8    96.1ns ± 1%    38.8ns ± 0%    -59.64%  (p=0.000 n=9+7)
CountSingle/32-8     172ns ± 2%      36ns ± 1%    -79.27%  (p=0.000 n=10+10)
CountSingle/4K-8    18.2µs ± 1%     0.9µs ± 0%    -95.17%  (p=0.000 n=9+10)
CountSingle/4M-8    18.4ms ± 0%     0.9ms ± 0%    -95.00%  (p=0.000 n=10+9)
CountSingle/64M-8    284ms ± 4%      19ms ± 0%    -93.40%  (p=0.000 n=10+10)

name               old speed     new speed      delta
CountSingle/10-8   104MB/s ± 1%   258MB/s ± 0%   +147.99%  (p=0.000 n=9+10)
CountSingle/32-8   185MB/s ± 1%   897MB/s ± 1%   +385.33%  (p=0.000 n=9+10)
CountSingle/4K-8   225MB/s ± 1%  4658MB/s ± 0%  +1967.40%  (p=0.000 n=9+10)
CountSingle/4M-8   228MB/s ± 0%  4555MB/s ± 0%  +1901.71%  (p=0.000 n=10+9)
CountSingle/64M-8  236MB/s ± 4%  3575MB/s ± 0%  +1414.69%  (p=0.000 n=10+10)

Change-Id: Ifccb51b3c8658c49773fe05147c3cf3aead361e5
Reviewed-on: https://go-review.googlesource.com/71111
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-21 19:07:38 +00:00
Than McIntosh
63ef3cde33 cmd/compile: ignore RegKill ops for non-phi after phi check
Relax the 'phi after non-phi' SSA sanity check to allow
RegKill ops interspersed with phi ops in a block. This fixes
a sanity check failure when -dwarflocationlists is enabled.

Updates #22694.

Change-Id: Iaae604ab6f1a8b150664dd120003727a6fb2f698
Reviewed-on: https://go-review.googlesource.com/77610
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2017-11-21 18:14:52 +00:00
Cherry Zhang
4fbf54fa0a cmd/compile: fix comment that -N does not disable escape analysis
-N does not disable escape analysis. Remove the outdated comment.

Change-Id: I96978b3afd51324b7b4f8035cf4417fb2eac4ebc
Reviewed-on: https://go-review.googlesource.com/79015
Reviewed-by: David Chase <drchase@google.com>
2017-11-21 18:09:37 +00:00
Russ Cox
225a2e12fe time: rename internal type data to dataIO
This allows LoadTimezoneFromTZData to have a parameter named data.

Change-Id: I11c115745c7f697244f806bcd654f697dab73de1
Reviewed-on: https://go-review.googlesource.com/79017
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-21 17:34:53 +00:00
Tobias Klauser
1a7ce9dd59 net: fix typo in parsePort documentation
Change-Id: Ia302d9018690cd26890f874c70bd0c429a4b51f0
Reviewed-on: https://go-review.googlesource.com/78975
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-21 17:31:56 +00:00
David Chase
bd41c6783b cmd/compile: improve debugging output for GOSSAFUNC
This changes the assembly language output to use the
innermost (instead of outermost) position for line
number and file.

The file is printed separately, only when it changes,
to remove redundant and space-consuming noise from the
output.

Unknown positions have line number "?"

The output format was changed slightly to make it
easier to read.

One source of gratuitous variation in debugging output was
removed.

Change-Id: I1fd9c8b0ddd82766488582fb684dce4b04f35723
Reviewed-on: https://go-review.googlesource.com/78895
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-11-21 16:29:33 +00:00
Heschi Kreinick
4a3d408d18 cmd/link: use . as DW_AT_comp_dir
Go's DWARF usually has absolute paths, in which case DW_AT_comp_dir
doesn't matter. But the -trimpath flag produces relative paths, and
then the spec says that they are relative to _comp_dir.

There's no way to know what the "right" value of _comp_dir is without
more user input, but we can at least leave the paths alone rather than
making them absolute.

After this change, Delve can find sources to a program built with
-gcflags=-trimpath=$(pwd) as long as it's run in the right directory.

Change-Id: I8bc7bed098e352d2c06800bfbbe14e8392e1bbed
Reviewed-on: https://go-review.googlesource.com/78415
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-11-21 15:22:20 +00:00
fanzha02
556fb16bbd cmd/internal/obj/arm64: fix assemble msr/mrs bug
The arguments <pstatefield> is a struct that includes two elements,
element reg is special register, elememt enc is pstate field values.
The current code compares two different type values and get a incorrect
result.

The fix follows pstate field to create a systemreg struct,
each system register has a vaule to use in instruction.

Uncomment the msr/mrs cases.

Fixes #21464

Change-Id: I1bb1587ec8548f3e4bd8d5be4d7127bd10d53186
Reviewed-on: https://go-review.googlesource.com/56030
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-21 14:00:35 +00:00
Emmanuel Odeke
5f29a7a705 cmd/compile: hint on wrong case-field names in composite literals
Improve the error message for wrong
case-field names in composite literals,
by mentioning the correct field name.

Given the program:
package main

type it struct {
        ID string
}

func main() {
        i1 := &it{id: "Bar"}
}

just like we do for usage of fields, we now
report wrongly cased fields as hints to give:

ts.go:8:14: unknown field 'id' in struct literal of type it (but does have ID)

instead of before:

ts.go:8:14: unknown field 'id' in struct literal of type it

Fixes #22794

Change-Id: I18cd70e75817025cb1df083503cae306e8d659fd
Reviewed-on: https://go-review.googlesource.com/78545
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-11-20 20:29:43 +00:00
fanzha02
436f2d8d97 cmd/internal/obj/arm64: fix assemble hlt/hvc/smc/brk/clrex bug
When instruction has only one argument, Go parser saves the
argument value into prog.From without any special handling.
But assembler gets the argument value from prog.To.

The fix adds special handling for CLREX and puts other instructions
arguments value into prog.From.

Uncomment hlt/hvc/smc/brk/dcps1/dcps2/dcps3/clrex test cases.

Fixes #20765

Change-Id: I1fc0d2faafb19b537cab5a665bd4af56c3a2c925
Reviewed-on: https://go-review.googlesource.com/78275
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-11-20 14:39:51 +00:00
Rob Pike
337f04bd6c cmd/doc: don't print a declaration twice
That can occur if we have -u set and there is an upper- and lower-case
name of the same spelling in a single declaration.

A rare corner case but easy to fix.

Fix by remembering what we've printed.

Fixes #21797.

Change-Id: Ie0b681ae8c277fa16e9635ba594c1dff272b8aeb
Reviewed-on: https://go-review.googlesource.com/78715
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-20 05:08:37 +00:00
Laurent Voisin
363a5da3b8 cmd/go: fix typo in error message
Change-Id: I9b618de68a5f2c89caae06d35a153cda2f466b6a
Reviewed-on: https://go-review.googlesource.com/78678
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-19 22:41:07 +00:00
Daniel Martí
207c53e038 cmd/doc: print a symbol error on "bytes Foo"
In golang.org/cl/59413, the two-argument behavior of cmd/doc was changed
to use findPackage instead of build.Import, meaning that the tool was
more consistent and useful.

However, it introduced a regression:

	$ go doc bytes Foo
	doc: no such package: bytes

This is because the directory list search would not find Foo in bytes,
and reach the end of the directory list - thus resulting in a "no such
package" error, since no directory matched our first argument.

Move the "no such package" error out of parseArgs, so that the "loop
until something is printed" loop can have control over it. In
particular, it is useful to know when we have reached the end of the
list without any exact match, yet we did find one package matching
"bytes":

	$ go doc bytes Foo
	doc: no symbol Foo in package bytes

While at it, make the "no such package" error not be fatal so that we
may test for it. It is important to have the test, as parseArgs may now
return a nil package instead of exiting the entire program, potentially
meaning a nil pointer dereference panic.

Fixes #22810.

Change-Id: I90cc6fd755e2d1675bea6d49a1c13cc18ac9bfb9
Reviewed-on: https://go-review.googlesource.com/78677
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2017-11-19 20:39:12 +00:00
Daniel Martí
f91ab6c025 bytes: don't use an iota for the readOp constants
As per the comments in golang.org/cl/78617. Also leaving a comment here,
to make sure noone else thinks to re-introduce the iota like I did.

Change-Id: I2a2275998b81896eaa0e9d5ee0197661ebe84acf
Reviewed-on: https://go-review.googlesource.com/78676
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-19 16:37:43 +00:00
Kunpei Sakai
e4a3043d1d testing: fix invalid error message about argument of TestMain
Also, this commit adds a test for ensuring that TestMain(t *testing.T) is a normal test.

Fixes #22388

Change-Id: Iffcb1db5cdcf34b9c822fcdb58f8926535415177
Reviewed-on: https://go-review.googlesource.com/72591
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-19 05:06:59 +00:00