1
0
mirror of https://github.com/golang/go synced 2024-10-02 16:28:34 -06:00
Commit Graph

35058 Commits

Author SHA1 Message Date
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
Ross Chater
50181df8ff time: fix typo in doc
Change-Id: I44bd5fa14ac6c4367927ae312e03ede06fcc7bb9
Reviewed-on: https://go-review.googlesource.com/78675
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-19 03:17:25 +00:00
Davor Kapsa
83634e9cf2 runtime/pprof: fix doc typo
Change-Id: I6e814182d89c3e7ff184141af097af0afb844d00
Reviewed-on: https://go-review.googlesource.com/78620
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-18 20:40:15 +00:00
Daniel Martí
962834dd14 bytes: make all readOp constants actually typed
This is a regression introduced in golang.org/cl/28817. That change got
rid of the iota, which meant that the type was no longer applied to all
the constant names.

Re-add the iota starting at -1, simplifying the code and adding the
types once more.

Change-Id: I38bd0e04f8d298196bccd33651e29f5011401a8d
Reviewed-on: https://go-review.googlesource.com/78617
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-18 17:07:05 +00:00
Elias Naur
aad9289571 cmd/dist: skip SWIG tests on Android
They were added in CL 78175 but doesn't run on Android (yet). Skip
them for now.

For the Android builders.

Change-Id: I3b4bfe1f0d820ab98cf50aaab1ee2fad1a44a851
Reviewed-on: https://go-review.googlesource.com/78615
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-18 16:15:19 +00:00
Ian Lance Taylor
da360f30e9 cmd/go: always copy files on Windows
Copying ensures that we respect the NTFS permissions of the parent folder.
I don't know if there is a way to tell when it is safe to simply rename.

Fixes #22343

Change-Id: I424bfe655b53b0e0fe425ce92bbc15450d52d851
Reviewed-on: https://go-review.googlesource.com/72910
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-11-18 06:31:57 +00:00
Daniel Theophanes
262141a12a database/sql: check for arg counts after eliminating arguments
Check for the expected number of arguments in a SQL statement
after arguments are eliminated in the argument converter.

This situation was already tested for in TestNamedValueChecker.
However the test used Exec which didn't have any check for
NumInput on it at all, thus this issue was never caught.

In addition to moving the NumInput check on the Query
methods after the converter, add the NumInput check
to the Exec methods as well.

Fixes #22630

Change-Id: If45920c6e1cf70dca63822a0cedec2cdc5cc611c
Reviewed-on: https://go-review.googlesource.com/76732
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-18 01:52:49 +00:00
Ian Lance Taylor
ce68e1b81c builtin: improve docs for make slice
Fixes #22764

Change-Id: I339d3bbb08983e0d69d69a1d00c4d15d0661762a
Reviewed-on: https://go-review.googlesource.com/78335
Reviewed-by: Rob Pike <r@golang.org>
2017-11-18 01:48:52 +00:00
Ian Lance Taylor
d48336b798 cmd/go: tweak support options test for old compilers
Fixes #22787

Change-Id: Ie0f3995e4bb611ee5927345b17b0d5b381a5ed74
Reviewed-on: https://go-review.googlesource.com/78543
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-18 01:35:39 +00:00
Lynn Boger
12e2933bbe cmd/dist: return dropped tests from misc/cgo/test
In a previous change to cmd/dist/test.go to fix some pie
testcases, a few other tests were incorrectly dropped.
This returns the testcases that shouldn't have been removed.

Fixes #22708

Change-Id: I2f735f4fd3a378f0f45d12a99768638aeb4787c7
Reviewed-on: https://go-review.googlesource.com/77650
Run-TryBot: Russ Cox <rsc@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-18 00:33:04 +00:00
Keith Randall
b868616b63 cmd/cgo: special case C ptr types to use uintptr
Some C types are declared as pointers, but C code
stores non-pointers in them.  When the Go garbage
collector sees such a pointer, it gets unhappy.

Instead, for these types represent them on the Go
side with uintptr.

We need this change to handle Apple's CoreFoundation
CF*Ref types. Users of these types might need to
update their code like we do in root_cgo_darwin.go.
The only change that is required under normal
circumstances is converting some nils to 0.
A go fix module is provided to help.

Fixes #21897

RELNOTE=yes

Change-Id: I9716cfb255dc918792625f42952aa171cd31ec1b
Reviewed-on: https://go-review.googlesource.com/66332
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-17 22:11:03 +00:00
Michael Munday
644787c337 cmd/compile: delete temporary files when test finishes
I noticed some files prefixed with ssa_fg_tmp in the /tmp folder of
the s390x builder. runGenTest (a helper for TestGenFlowGraph) wasn't
deleting its temporary files. The distinct prefix made this easy to
figure out.

Change-Id: If0d608aaad04a414e74e29f027ec9443c626e4eb
Reviewed-on: https://go-review.googlesource.com/78475
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-17 21:35:43 +00:00
isharipo
4e19cfcdf2 cmd/internal/obj/x86: add AVX2 gather and VSIB
Enables AVX2 gather instructions and VSIB support,
which makes vm32{x,y} vm64{x,y} operands encodable.

AXXX constants placed with respect to sorting order.
New VEX optabs inserted near non-VEX entries to simplify
potential transition to auto-generated VSIB optabs.

Tests go into new AMD64 encoder test file (amd64enc_extra.s)
to avoid unnecessary interactions with auto-generated "amd64enc.s".

Side note: x86avxgen did not produced these instructions
because x86.v0.2.csv misses them.
This also explains why x86 test suite have no AVX2 gather
instructions tests.

List of new instructions:
  VGATHERPDP
  VGATHERDPS
  VGATHERQPD
  VGATHERQPS
  VPGATHERDD
  VPGATHERDQ
  VPGATHERQD
  VPGATHERQQ

Change-Id: Iac852f3c5016523670bd99de6bec6a48f66fb4f6
Reviewed-on: https://go-review.googlesource.com/77970
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-17 21:17:58 +00:00
Adam Langley
3a395e2283 crypto/x509: always emit a critical SAN extension if the Subject is empty.
The RFC is a little ambiguous here: “the subject field contains an empty
sequence” could mean that it's a non-empty sequence where one of the
sets contains an empty sequence. But, in context, I think it means “the
subject field is an empty sequence”.

Fixes #22249

Change-Id: Idfe1592411573f6e871b5fb997e7d545597a0937
Reviewed-on: https://go-review.googlesource.com/70852
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-17 19:00:41 +00:00
Adam Langley
2f1de1593e crypto/x509: relax EKU checking in some cases.
CL 71030 enforced EKU nesting at verification time, to go along with the
change in name constraints behaviour. From scanning the Certificate
Transparency logs, it's clear that some CAs are not getting EKU nesting
correct.

This change relaxes the EKU rules in a few ways:
  ∙ EKUs in roots are no longer checked.
  ∙ Any CA certificate may issue OCSP responder certificates.
  ∙ The ServerAuth and SGC EKUs are treated as a single EKU when
    checking nesting.
  ∙ ServerAuth in a CA can now authorise ClientAuth.
  ∙ The generic CodeSigning EKU can now authorise two, Microsoft-specific
    code-signing EKUs.

Change-Id: I7b7ac787709af0dcd177fe419ec2e485b8d85540
Reviewed-on: https://go-review.googlesource.com/77330
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-17 18:52:45 +00:00
Adam Langley
5a22637cf7 crypto/x509: don't fail to parse addition elements in GeneralSubtree.
The GeneralSubtree structure can have additional elements after the name
(minimum and maximum, which are unused). Previously these fields, if
present, would cause a parse error. This change allows trailing data in
the GeneralSubtrees structure.

Change-Id: I6bfb11ec355fa6812810a090c092a5ee0fdeddc3
Reviewed-on: https://go-review.googlesource.com/77333
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-17 18:52:31 +00:00
Brad Fitzpatrick
ac8a70d209 Revert "net: Forget lookups for canceled contexts"
This reverts commit 6a3d4be3b8.

Reason for revert: breaks various builds. See comments on CL 77670

Change-Id: Iaf3260319b560f49ace06af705a2114630f32063
Reviewed-on: https://go-review.googlesource.com/78515
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-17 17:14:02 +00:00
David Chase
d2414cefba cmd/compile: leave Pos unset for racewalk enter/exit
The locations chosen for racewalking inserted code can
be wrong and thus cause unwanted next/step behavior in
debuggers.  Forcing the positions to be unset results in
better behavior.

Test added, and test harness corrected to deal with
changes to gdb's output caused by -racewalk.

Incidental changes in Delve (not part of the usual testing,
but provided because we care about Delve) also reflected
in this CL.

Fixes #22600.

Change-Id: Idd0218afed52ab8c68efd9eabbdff3c92ea2b996
Reviewed-on: https://go-review.googlesource.com/78336
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2017-11-17 16:56:42 +00:00
Bill O'Farrell
c2efb2fde5 cmd/link: enable c-shared and c-archive mode on s390x
Adding s390x to the list of architectures that support c-shared and c-archive.
Required adding load-time initialization (via _rt0_s390x_linux_lib) and adding s390x
to the c-shared and c-archive tests.

Change-Id: I75883b2891c310fe8ce7f08c27b06895c074e123
Reviewed-on: https://go-review.googlesource.com/74910
Reviewed-by: Michael Munday <mike.munday@ibm.com>
2017-11-17 15:54:54 +00:00
Austin Clements
bf9ad7080d runtime: remove another TODO
I experimented with having the compiler spill the two registers that
are clobbered by the write barrier fast path, but it slightly slows
down compilebench, which is a good write barrier benchmark:

name       old time/op     new time/op     delta
Template       175ms ± 0%      176ms ± 1%    ~           (p=0.393 n=10+10)
Unicode       83.6ms ± 1%     85.1ms ± 2%  +1.79%         (p=0.000 n=9+10)
GoTypes        585ms ± 0%      588ms ± 1%    ~            (p=0.173 n=8+10)
Compiler       2.78s ± 1%      2.81s ± 2%  +0.81%        (p=0.023 n=10+10)
SSA            7.11s ± 1%      7.15s ± 1%  +0.59%        (p=0.029 n=10+10)
Flate          115ms ± 1%      116ms ± 2%    ~           (p=0.853 n=10+10)
GoParser       144ms ± 2%      145ms ± 2%    ~           (p=1.000 n=10+10)
Reflect        389ms ± 1%      390ms ± 1%    ~           (p=0.481 n=10+10)
Tar            185ms ± 2%      185ms ± 2%    ~           (p=0.529 n=10+10)
XML            205ms ± 0%      207ms ± 2%    ~            (p=0.065 n=9+10)

Since this didn't pan out, remove the TODO.

Change-Id: I2186942c6d1ba10585a5da03cd7c1d26ce906273
Reviewed-on: https://go-review.googlesource.com/78034
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2017-11-17 01:00:05 +00:00
Austin Clements
366f46fe00 runtime: remove TODO
I experimented with changing the write barrier to take the value in SI
rather than AX to improve register allocation. It had no effect on
performance and only made the "hello world" text 0.07% smaller, so
let's just remove the comment.

Change-Id: I6a261d14139b7a02a8467b31e74951dfb927ffb4
Reviewed-on: https://go-review.googlesource.com/78033
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2017-11-17 00:59:52 +00:00
Daniel Theophanes
b44b2feb91 database/sql: allow OpenConnector in a driver.Driver interface
While driver.Connector was previously added to allow non-string
connection arguments and access to the context, most users of
the sql package will continue to rely on a string DSN.

Allow drivers to implement a string DSN to Connector interface
that both allows a single parsing of the string DSN and uses
the Connector interface which passes available context to
the driver dialer.

Fixes #22713

Change-Id: Ia0b862262f4c4670effe2538d0d6d43733fea18d
Reviewed-on: https://go-review.googlesource.com/77550
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2017-11-16 22:36:07 +00:00
Russ Cox
096b195df5 cmd/go: add import config debugging flag
Change-Id: I11d83c8841f3de4ed4d9d014dec65d6f20464b11
Reviewed-on: https://go-review.googlesource.com/78396
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-11-16 21:10:47 +00:00
Russ Cox
71b0264a38 cmd/go: simplify compiler import config preparation
I realized this simplification was possible when writing the vet loop
(just above the code being modified here) but never circled back
to make the compiler loop match.

Change-Id: Ic2277d2a4b6d94ea4897cc3615fc1a29f2fb243c
Reviewed-on: https://go-review.googlesource.com/78395
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-11-16 21:10:25 +00:00
Brad Fitzpatrick
7edb721fbc os/user: handle large 32-bit uid/gid values when stringifying User.Uid/Gid
Fixes #22739

Change-Id: I374c29d237c498c9e5ac848b01f6d49d7c41b31f
Reviewed-on: https://go-review.googlesource.com/77930
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-16 18:42:02 +00:00
Russ Cox
92c3582471 cmd/go/internal/work: do not write trivial.c when testing gcc flags
CL 61111 disabled the writing of trivial.c in -n mode, which
made -n mode at least inconsistent with regular mode in
how it was testing for flags. We think that both were getting
the same answer, so avoid creating the file in both modes
to make sure.

If this CL turns out to be wrong, then when we revert it we
should make sure that the empty file is written even in -n mode,
because this check affects the command-line flags printed
by other commands in that mode.

Change-Id: I0a050bfc148fe5a9d430a153d7816b2821277f0d
Reviewed-on: https://go-review.googlesource.com/78115
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-16 17:34:32 +00:00
Russ Cox
62dc3c3f0d cmd/go: fix swig support and run swig tests during run.bash
(The tests only run when swig is already installed on the local system.)

Change-Id: I172d106a68cfc746a1058f5a4bcf6761bab88912
Reviewed-on: https://go-review.googlesource.com/78175
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-16 17:19:19 +00:00
Russ Cox
7cddd39f96 cmd/go: drop flaky part of TestGoTestJSON
Still failing on builders. I give up.
(For example https://build.golang.org/log/4fa5ba031c2fab5df397ac894f8b81392a93728e.)

Change-Id: Ifa87813e27e1adfe9920c7e657b0ff129eb5bf2f
Reviewed-on: https://go-review.googlesource.com/78315
Reviewed-by: Russ Cox <rsc@golang.org>
2017-11-16 16:59:15 +00:00
Russ Cox
8e28a8d2a0 cmd/go: fix cgo-disabled test failure from CL 77151
Change-Id: I8ed4c6dd32a74d94565d77771bb773f006ff90ac
Reviewed-on: https://go-review.googlesource.com/78317
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-11-16 16:58:13 +00:00
Joe Tsai
ba2835db6c archive/tar: partially revert sparse file support
This CL removes the following APIs:
	type SparseEntry struct{ ... }
	type Header struct{ SparseHoles []SparseEntry; ... }
	func (*Header) DetectSparseHoles(f *os.File) error
	func (*Header) PunchSparseHoles(f *os.File) error
	func (*Reader) WriteTo(io.Writer) (int, error)
	func (*Writer) ReadFrom(io.Reader) (int, error)

This API was added during the Go1.10 dev cycle, and are safe to remove.

The rationale for reverting is because Header.DetectSparseHoles and
Header.PunchSparseHoles are functionality that probably better belongs in
the os package itself.

The other API like Header.SparseHoles, Reader.WriteTo, and Writer.ReadFrom
perform no OS specific logic and only perform the actual business logic of
reading and writing sparse archives. Since we do know know what the API added to
package os may look like, we preemptively revert these non-OS specific changes
as well by simply commenting them out.

Updates #13548
Updates #22735

Change-Id: I77842acd39a43de63e5c754bfa1c26cc24687b70
Reviewed-on: https://go-review.googlesource.com/78030
Reviewed-by: Russ Cox <rsc@golang.org>
2017-11-16 16:54:08 +00:00
Russ Cox
ca886e0673 cmd/go/internal/cache: fix build failure introduced in CL 78176
Maybe a bad git merge - not sure.
In any event, I do miss the trybots.

Noticed while fixing: change print-to-stderr+panic
to pure panic, just so that the test (which catches the panic)
does not print any errors before passing.

Change-Id: If25153ea64e81066455401110ae7a79c36f2f712
Reviewed-on: https://go-review.googlesource.com/78316
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-11-16 16:54:03 +00:00