1
0
mirror of https://github.com/golang/go synced 2024-11-05 17:16:10 -07:00
Commit Graph

41616 Commits

Author SHA1 Message Date
Matthew Dempsky
5eec0a91ea reflect: fix unsafe conversions reported by -d=checkptr
The code for generating gcdata was (technically) unsafe. It was also
rather repetitive. This CL refactors it a bit and abstracts use of
gcdata into a helper gcSlice method.

Updates #34972.

Change-Id: Ie86d7822eafe263f1d3d150eedf0ec66be1ec85d
Reviewed-on: https://go-review.googlesource.com/c/go/+/202582
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-22 18:09:15 +00:00
Matthew Dempsky
a97ccc8940 sync/atomic: suppress checkptr errors for hammerStoreLoadPointer
This test could be updated to use unsafe.Pointer arithmetic properly
(e.g., see discussion at #34972), but it doesn't seem worthwhile. The
test is just checking that LoadPointer and StorePointer are atomic.

Updates #34972.

Change-Id: I85a8d610c1766cd63136cae686aa8a240a362a18
Reviewed-on: https://go-review.googlesource.com/c/go/+/202597
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-22 18:09:03 +00:00
Bryan C. Mills
22278ca0d4 net: convert TestTCPServer to use subtests
My fix in CL 202618 inadvertently violated an invariant in the inner
loop of TestTCPServer (namely, that len(trchs) == i). That causes a
panic when one or more of the channels is omitted due to a flake.

Instead of trying to fix up the test, let's just factor out a subtest
and skip the whole thing if the transceiver's Dial flakes out.

Updates #32919

Change-Id: Ib6f274a44194311c8c5a2faf19f586cc9eccfd4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/202561
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-22 17:34:15 +00:00
Robert Griesemer
51504f0a2d go/types: don't update package-external types when checking validity
The recently added type-validity check uses a new field of Named
types for marking (to detect cycles). That field was modified even
if the type was not part of the current package or belonged to the
Universe scope (error type). This led to race conditions if the
package's type was imported by multiple, concurrently type-checked
packages.

A test would be nice but it's a bit cumbersome to set one up.
Verified manually that package-external types are left alone.

Fixes #35049.

Change-Id: I51686bef47fcca48b99b91ecb1b2e9d58e135ea6
Reviewed-on: https://go-review.googlesource.com/c/go/+/202483
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-22 16:13:55 +00:00
David du Colombier
19d2a1cc2c cmd/go: fix TestScript/list_ambiguous_path on Plan 9
CL 198459 added TestScript/list_ambiguous_path. This
test is failing on Plan 9, because the expected error
doesn't match the error message returned on Plan 9.

This change fixes the test by matching the correct
error message on Plan 9.

Fixes #35072.

Change-Id: If8cdb641e0e9544ae4ac24f8d0c54859a3b23a69
Reviewed-on: https://go-review.googlesource.com/c/go/+/202447
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-22 15:28:05 +00:00
Bryan C. Mills
95544cc2c2 net: ignore or skip known-flaky localhost Dial operations on macOS 10.12 builder
Fixes #22019
Fixes #32919

Change-Id: I60bf6c69b18c3e2d78b494e54adc958fe40134da
Reviewed-on: https://go-review.googlesource.com/c/go/+/202618
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-22 15:15:06 +00:00
Brave Cow
07ccdeb192 net/http: update sanitizeCookieValue description
Commit 8f6d68eb (CL 37328) changed the code of sanitizeCookieValue without updating its description.

Change-Id: Ib4a1a1f316548258b828458a31b09706bbd59b53
GitHub-Last-Rev: 9731494e17
GitHub-Pull-Request: golang/go#34790
Reviewed-on: https://go-review.googlesource.com/c/go/+/200041
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-22 15:03:09 +00:00
Baokun Lee
ea726d8dc6 cmd/go/internal/modcmd: error out if one module with two different paths
If a single module is imported via two different paths, go mod tidy
should have reported this error instead of deferring it until go build.

Fixes #34650.

Change-Id: I9d09df1551b3e2083ed9f0bc77f2989073057717
Reviewed-on: https://go-review.googlesource.com/c/go/+/199598
Run-TryBot: Baokun Lee <nototon@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-22 14:26:04 +00:00
Ian Lance Taylor
d29c14f3d2 runtime: factor signal stack code out of sigtrampgo
This reduces the required nosplit stack size, which permits building
on Solaris with -gcflags=all=-N -l.

Fixes #35046

Change-Id: Icb3a421bb791c73e2f670ecfadbe32daea79789f
Reviewed-on: https://go-review.googlesource.com/c/go/+/202446
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-22 13:57:02 +00:00
Ian Lance Taylor
4f364be08d runtime: correctly negate errno value for *BSD ARM
Fixes #35037

Change-Id: I0b9bcd001556cd409994d83dabcdd6e32b001d28
Reviewed-on: https://go-review.googlesource.com/c/go/+/202441
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-22 11:49:50 +00:00
Jason A. Donenfeld
16f0f9c8e1 syscall: respect permission bits on file opening on Windows
On Windows, os.Chmod and syscall.Chmod toggle the FILE_ATTRIBUTES_
READONLY flag depending on the permission bits. That's a bit odd but I
guess some compromises were made at some point and this is what was
chosen to map to a Unix concept that Windows doesn't really have in the
same way. That's fine. However, the logic used in Chmod was forgotten
from os.Open and syscall.Open, which then manifested itself in various
places, most recently, go modules' read-only behavior.

This makes syscall.Open consistent with syscall.Chmod and adds a test
for the permission _behavior_ using ioutil. By testing the behavior
instead of explicitly testing for the attribute bits we care about, we
make sure this doesn't regress in unforeseen ways in the future, as well
as ensuring the test works on platforms other than Windows.

In the process, we fix some tests that never worked and relied on broken
behavior, as well as tests that were disabled on Windows due to the
broken behavior and had TODO notes.

Fixes #35033

Change-Id: I6f7cf54517cbe5f6b1678d1c24f2ab337edcc7f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/202439
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-22 10:09:39 +00:00
Ian Lance Taylor
7f98c0eb03 os/exec: skip possible netpoll pipe in known FDs in test
Fixes #35045

Change-Id: I90ac29882c7d03936c98c4116a8bccdd2ecbf76b
Reviewed-on: https://go-review.googlesource.com/c/go/+/202445
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-10-22 08:54:50 +00:00
Ian Lance Taylor
4ec51894ee runtime: force testing calls of netpoll to run on system stack
Fixes #35053

Change-Id: I31853d434610880044c169e0c1e9732f97ff1bdb
Reviewed-on: https://go-review.googlesource.com/c/go/+/202444
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
2019-10-22 08:46:40 +00:00
ajz01
57ad6ef15d go/parser: remove superfluous case from switch statement
Change-Id: I96a9b34bf8e42c21a3e0258cbc8b1416328834be
GitHub-Last-Rev: 32709619a6
GitHub-Pull-Request: golang/go#35066
Reviewed-on: https://go-review.googlesource.com/c/go/+/202598
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-10-22 04:05:25 +00:00
Cuong Manh Le
9979366e07 cmd/compile: disable checkptr for //go:nosplit functions
Make go test -a -short -gcflags=all=-d=checkptr passes on darwin.

Update #34972

Change-Id: I71cf14ec1faccd4837713aa30c90ed665899b908
Reviewed-on: https://go-review.googlesource.com/c/go/+/202158
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-22 01:03:29 +00:00
Cuong Manh Le
2e1a6a28df runtime: fix unsafe.Pointer alignment on Linux
Caught by go test -a -short -gcflags=all=-d=checkptr runtime

TestMincoreErrorSign intentionally uses uintptr(1) to get -EINVAL,
but it violates unsafe pointer rules 2. So use another misaligned
pointer add(new(int32), 1), but do not violate unsafe pointer rules.

TestEpollctlErrorSign passes an unsafe.Pointer of &struct{}{} to
Epollctl, which is then casted to epollevent, causes mis-alignment.
Fixing it by exporting epollevent on runtime_test package, so it can be
passed to Epollctl.

Updates #34972

Change-Id: I78ebfbeaf706fd1d372272af0bbc4e2cabca4631
Reviewed-on: https://go-review.googlesource.com/c/go/+/202157
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-22 01:03:09 +00:00
Ian Lance Taylor
0050c079d5 runtime, syscall, time: prepare for adding timers to P's
Add new fields to runtime.timer, and adjust the various timer
functions in preparation for adding timers to P's. This continues to
use the old timer code.

Updates #6239
Updates #27707

Change-Id: I9adb3814f657e083ec5e22736c4b5b52b77b6a3f
Reviewed-on: https://go-review.googlesource.com/c/go/+/171829
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-21 23:41:41 +00:00
Robert Griesemer
a59808ed01 go/parser: better error (recovery) for Allman/BSD-style func decls
This matches the behavior and error of cmd/compile.

Fixes #34946.

Change-Id: I329ef358deea63d8425f76f1d54c95749b96c365
Reviewed-on: https://go-review.googlesource.com/c/go/+/202484
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-21 23:36:02 +00:00
Ian Lance Taylor
6b3bb4ba3b runtime: handle timers on P's in procresize/(*pp).destroy
Updates #6239
Updates #27707

Change-Id: I52cab8bf3dc8c552463725fc1d9e4e6b12230b03
Reviewed-on: https://go-review.googlesource.com/c/go/+/171828
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-21 23:18:36 +00:00
Matthew Dempsky
9989221ac1 reflect, internal/reflectlite: set capacity when slicing unsafe pointers
Follow the idiom for allowing -d=checkptr to recognize and verify
correctness.

Updates #22218.
Updates #34972.

Change-Id: Ib6001c6f0e6dc535a36bcfaa1ae48e29e0c737f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/202580
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-21 23:16:36 +00:00
Matthew Dempsky
7b58581a23 cmd/compile: recognize (*[Big]T)(ptr)[:n:m] pattern for -d=checkptr
A common idiom for turning an unsafe.Pointer into a slice is to write:

    s := (*[Big]T)(ptr)[:n:m]

This technically violates Go's unsafe pointer rules (rule #1 says T2
can't be bigger than T1), but it's fairly common and not too difficult
to recognize, so might as well allow it for now so we can make
progress on #34972.

This should be revisited if #19367 is accepted.

Updates #22218.
Updates #34972.

Change-Id: Id824e2461904e770910b6e728b4234041d2cc8bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/201839
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-21 23:16:27 +00:00
Keith Randall
dba19c65a7 bytes/hash: initialize all 64 bits of hash seed
Fixes #34925

Change-Id: Iadf12ca47a69b62c3f48d732b430cc85cf62a91c
Reviewed-on: https://go-review.googlesource.com/c/go/+/202577
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-21 22:01:12 +00:00
Ian Lance Taylor
10e7bc994f runtime: add wasm support for timers on P's
When we put timers on P's, the wasm code will not be able to rely on
the timer goroutine. Use the beforeIdle hook to schedule a wakeup.

Updates #6239
Updates #27707

Change-Id: Idf6309944778b8c3d7178f5d09431940843ea233
Reviewed-on: https://go-review.googlesource.com/c/go/+/171827
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-10-21 21:43:41 +00:00
Michael Munday
7c3060e923 cmd/compile/internal/ssa: regenerate rewrite rules
Slight differences existed due to a change in rulegen after the
FMA intrinsic code was generated.

Change-Id: Ieb6b3ec1b29985a18d1bbbc5a820ffea699306fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/202443
Run-TryBot: Michael Munday <mike.munday@ibm.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-21 21:14:04 +00:00
Matthew Dempsky
b282efa022 cmd/compile: recognize reflect.{Slice,String}Header for -d=checkptr
Avoids false positive pointer arithmetic panic.

Fixes #35027.

Change-Id: Idd008caaab25fcf739327ac50a021b835ef13def
Reviewed-on: https://go-review.googlesource.com/c/go/+/202560
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-21 20:51:06 +00:00
Dmitri Shuralyov
3409ce39bf net/http: remove parseURL variable
The parseURL variable was introduced in CL 49930 in order to work
around the fact that the name "url" was shadowed by a parameter of
exported functions, and couldn't be renamed without sacrificing
documentation readability. Documentation readability takes higher
priority than internal implementation details.

Back then, I considered renaming the net/url import but saw that it
would be too disruptive of a change to the large net/http package.

Now I see a better way: it's possible to import net/url both as url
and as urlpkg (the package is still imported just once, but it becomes
available via two names). This way we eliminate the need for wasting
(a little) memory on the parseURL variable, improve code readability
slightly, and delete some lines of code and comments.

Updates #21077

Change-Id: I42cd9833afdcf4a5f5874fb7ee9c8c11eae557dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/202482
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-10-21 20:43:40 +00:00
Dmitri Shuralyov
d24cf6d53e database/sql: remove forced log import from test
This var _ = log.Printf line was added 8 years ago, in CL 4973055,
which created the database/sql package and its tests. There was no
goimports back then, so this was likely added to make it easier to
use log package during development of tests.

It's no longer needed, so remove it. It can always be conveniently
re-added via goimports whenever needed.

Change-Id: I7c32ae3e593c194d970920084139dfa5a42386dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/202481
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-21 19:27:15 +00:00
Bryan C. Mills
71d127aafd crypto/tls: retry net.Dial flakes on Dragonfly
localPipe currently flakes in various crypto/tls tests. Since that
function doesn't seem to flake anywhere else, I suspect a kernel bug.

To make the test less flaky, retry the Dial if we suspect that it is
affected. (Worst case, we delay the test by a few seconds before
erroring out as usual.)

Fixes #29583

Change-Id: I357990ffa316edb471bd7d46d6404fa0884da646
Reviewed-on: https://go-review.googlesource.com/c/go/+/202557
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-21 19:06:29 +00:00
Cuong Manh Le
ba97d0d84d cmd/compile: remove overflow pointer padding for nacl
CL 200077 removed nacl bits in the toolchain, but it misses the code to
add pointer overflow padding, which is specific for nacl.

This CL removes that part.

Passes toolstash-check.

Updates #30439

Change-Id: I1e77cade9f31690e16cd13d3445a98b500671252
Reviewed-on: https://go-review.googlesource.com/c/go/+/202159
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-21 19:04:47 +00:00
harsimran1
3b2eb699a0 net/http/pprof: explicitly mention DefaultServeMux for default handlers
Change-Id: I224db88f3809001802e004077ce856f0e3347c67
Reviewed-on: https://go-review.googlesource.com/c/go/+/169017
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-21 18:43:12 +00:00
Emmanuel T Odeke
ff4e0e42d8 net/http: make TimeoutHandler log spurious WriteHeader calls
Makes TimeoutHandler consistent with other handlers, by
logging any spurious WriteHeader calls.

Fixes #30803

Change-Id: I693fbdf8378f31bca13d579eece8e8e00eb175bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/200518
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-21 18:38:15 +00:00
sandyskies
03978a97e5 io: make CopyBuffer docs state when buf is not used
Document that if either src implements the WriteTo interface
or if dst implements the ReaderFrom interface, then
buf will not be used.

Fixes #32276

Change-Id: Id0a69c90e255e694e7ec9f79ffe4d8391441e59e
GitHub-Last-Rev: 750e7e86d5
GitHub-Pull-Request: golang/go#32279
Reviewed-on: https://go-review.googlesource.com/c/go/+/179137
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-10-21 17:47:24 +00:00
smasher164
58b031949b cmd/compile: add fma intrinsic for arm
This change introduces an arm intrinsic that generates the FMULAD
instruction for the fused-multiply-add operation on systems that
support it. System support is detected via cpu.ARM.HasVFPv4. A rewrite
rule translates the generic intrinsic to FMULAD.

Updates #25819.

Change-Id: I8459e5dd1cdbdca35f88a78dbeb7d387f1e20efa
Reviewed-on: https://go-review.googlesource.com/c/go/+/142117
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-21 17:42:47 +00:00
Ian Lance Taylor
06ac26279c runtime: initial scheduler changes for timers on P's
Add support to the main scheduler loop for handling timers on P's.
This is not used yet, as timers are not yet put on P's.

Updates #6239
Updates #27707

Change-Id: I6a359df408629f333a9232142ce19e8be8496dae
Reviewed-on: https://go-review.googlesource.com/c/go/+/171826
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-21 17:23:42 +00:00
Emmanuel T Odeke
ff9f7bc9da net/http: make Transport.RoundTrip close body on any invalid request
Fixes #35015

Change-Id: I7a1ed9cfa219ad88014aad033e3a01f9dffc3eb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/202239
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-21 17:10:59 +00:00
Ian Lance Taylor
a7ce2ca52f runtime, syscall, time: add and use resettimer
As a small step toward speeding up timers, restrict modification
of the timer.when field to the timer code itself. Other code that
wants to change the when field of an existing timer must now call
resettimer rather than changing the when field and calling addtimer.
The new resettimer function also works for a new timer.

This is just a refactoring in preparation for later code.

Updates #27707

Change-Id: Iccd5dcad415ffbeac4c2a3cf015e91f82692acf8
Reviewed-on: https://go-review.googlesource.com/c/go/+/171825
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-10-21 17:06:22 +00:00
smasher164
7a6da218b1 cmd/compile: add fma intrinsic for amd64
To permit ssa-level optimization, this change introduces an amd64 intrinsic
that generates the VFMADD231SD instruction for the fused-multiply-add
operation on systems that support it. System support is detected via
cpu.X86.HasFMA. A rewrite rule can then translate the generic ssa intrinsic
("Fma") to VFMADD231SD.

The benchmark compares the software implementation (old) with the intrinsic
(new).

name   old time/op  new time/op  delta
Fma-4  27.2ns ± 1%   1.0ns ± 9%  -96.48%  (p=0.008 n=5+5)

Updates #25819.

Change-Id: I966655e5f96817a5d06dff5942418a3915b09584
Reviewed-on: https://go-review.googlesource.com/c/go/+/137156
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-21 16:42:10 +00:00
Ian Lance Taylor
50f4896b72 runtime: add netpollBreak
The new netpollBreak function can be used to interrupt a blocking netpoll.
This function is not currently used; it will be used by later CLs.

Updates #27707

Change-Id: I5cb936609ba13c3c127ea1368a49194fc58c9f4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/171824
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-21 16:37:45 +00:00
smasher164
33425ab8db cmd/compile: introduce generic ssa intrinsic for fused-multiply-add
In order to make math.FMA a compiler intrinsic for ISAs like ARM64,
PPC64[le], and S390X, a generic 3-argument opcode "Fma" is provided and
rewritten as

    ARM64: (Fma x y z) -> (FMADDD z x y)
    PPC64: (Fma x y z) -> (FMADD x y z)
    S390X: (Fma x y z) -> (FMADD z x y)

Updates #25819.

Change-Id: Ie5bc628311e6feeb28ddf9adaa6e702c8c291efa
Reviewed-on: https://go-review.googlesource.com/c/go/+/131959
Run-TryBot: Akhil Indurti <aindurti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-21 16:24:15 +00:00
Akhil Indurti
93a601dd2a math: add guaranteed-precision FMA implementation
Currently, the precision of the float64 multiply-add operation
(x * y) + z varies across architectures. While generated code for
ppc64, s390x, and arm64 can guarantee that there is no intermediate
rounding on those platforms, other architectures like x86, mips, and
arm will exhibit different behavior depending on available instruction
set. Consequently, applications cannot rely on results being identical
across GOARCH-dependent codepaths.

This CL introduces a software implementation that performs an IEEE 754
double-precision fused-multiply-add operation. The only supported
rounding mode is round-to-nearest ties-to-even. Separate CLs include
hardware implementations when available. Otherwise, this software
fallback is given as the default implementation.

Specifically,
    - arm64, ppc64, s390x: Uses the FMA instruction provided by all
      of these ISAs.
    - mips[64][le]: Falls back to this software implementation. Only
      release 6 of the ISA includes a strict FMA instruction with
      MADDF.D (not implementation defined). Because the number of R6
      processors in the wild is scarce, the assembly implementation
      is left as a future optimization.
    - x86: Guards the use of VFMADD213SD by checking cpu.X86.HasFMA.
    - arm: Guards the use of VFMA by checking cpu.ARM.HasVFPv4.
    - software fallback: Uses mostly integer arithmetic except
      for input that involves Inf, NaN, or zero.

Updates #25819.

Change-Id: Iadadff2219638bacc9fec78d3ab885393fea4a08
Reviewed-on: https://go-review.googlesource.com/c/go/+/127458
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-21 16:15:30 +00:00
Bryan C. Mills
84b0e3665d cmd/go: add a flag to avoid creating unwritable directories in the module cache
This change adds the '-modcacherw' build flag, which leaves
newly-created directories (but not the files!) in the module cache
read-write instead of making them unwritable.

Fixes #31481

Change-Id: I7c21a53dd145676627c3b51096914ce797991d99
Reviewed-on: https://go-review.googlesource.com/c/go/+/202079
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-21 15:48:39 +00:00
Ian Lance Taylor
b653c878b1 runtime: change read and write to return negative errno value
The internal read and write functions used to return -1 on error;
change them to return a negative errno value instead.
This will be used by later CLs in this series.

For most targets this is a simplification, although for ones that call
into libc it is a complication.

Updates #27707

Change-Id: Id02bf9487f03e7e88e4f2b85e899e986738697ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/171823
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-21 14:07:34 +00:00
Tobias Klauser
6917b3c839 vendor: re-vendor golang.org/x/net to fix Dragonfly build
This picks up CL 202317 which fixes golang.org/x/net for Dragonfly
master (upcoming 5.8 release). Also re-enable the interface tests
disabled in CL 201482.

Vendored using:

    $ go get golang.org/x/net@24d2ffbea1e8
    $ go mod tidy
    $ go mod vendor

Fixes #34368

Change-Id: Iac152b7ffaa607bfedbb4024b4e1ffc9b649d689
Reviewed-on: https://go-review.googlesource.com/c/go/+/202438
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-21 13:35:49 +00:00
Ian Lance Taylor
e01e917687 runtime: use correct pipe call for mips/mips64 GNU/Linux
On MIPS, pipe returns two values rather than taking a pointer.

On MIPS64, call pipe2 rather than pipe.

Also, use the correct system call number for fcntl on mips64.

Change-Id: Ie72acdefeb593f44cb98735fc40eac99cf73509e
Reviewed-on: https://go-review.googlesource.com/c/go/+/202417
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-21 11:41:11 +00:00
Joshua M. Clulow
d960de0b6f runtime: temporarily skip gdb python-related tests on illumos
Updates golang/go#20821

Change-Id: I186356a78ac385a15b4604e0ea6110c4c212ebc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/202357
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-21 05:11:52 +00:00
Ian Lance Taylor
3b0aa546d2 runtime: define nonblockingPipe
This requires defining pipe, pipe2, and setNonblock for various platforms.

The new function is currently only used on AIX. It will be used by
later CLs in this series.

Updates #27707

Change-Id: Id2f987b66b4c66a3ef40c22484ff1d14f58e9b31
Reviewed-on: https://go-review.googlesource.com/c/go/+/171822
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-20 21:15:55 +00:00
Umang Parmar
504fce98ba go/build: recognize '.sx' as equivalent of '.S'
On case insensitive filesystems, '.S' is interpreted as '.s' so,
providing option to use '.sx' extension for '.S' files as an alternative.

Fixes #32434

Change-Id: Ie2f7e5e2f3f12690ce18659e30ca94252a8f7bfc
GitHub-Last-Rev: dcca989ec4
GitHub-Pull-Request: golang/go#32557
Reviewed-on: https://go-review.googlesource.com/c/go/+/181699
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-20 21:15:11 +00:00
Umang Parmar
6a24de92a2 cmd/go: allow passing -U flag in cgo CFLAGS
Fixes #34730

Change-Id: I2a16bbbd7af386e0abf59e1cc4b7d6e4ca3047c6
GitHub-Last-Rev: 096ff5a59a
GitHub-Pull-Request: golang/go#34899
Reviewed-on: https://go-review.googlesource.com/c/go/+/201039
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-20 21:14:18 +00:00
Tobias Klauser
78c168fc60 syscall: don't use 32-bit aligned access for cmsgAlignOf on dragonfly after ABI change
Use 32-bit alignment for versions before the September 2019 ABI changes
http://lists.dragonflybsd.org/pipermail/users/2019-September/358280.html

Fixes #34958

Change-Id: Iab4b23083a7c9ca7e96a737b03e75cd36d98ee24
Reviewed-on: https://go-review.googlesource.com/c/go/+/201977
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-20 19:33:07 +00:00
Giovanni Bajo
b16463c912 cmd/compile: in prove, give a different name to each poset
Instead of using a two-slot array and having to remember which
index is the signed poset, and which is the unsigned one, just
use two different variables.

Change-Id: Ic7f7676436c51bf43a182e999a926f8b7f69434b
Reviewed-on: https://go-review.googlesource.com/c/go/+/196678
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-20 15:43:25 +00:00