1
0
mirror of https://github.com/golang/go synced 2024-11-07 03:06:18 -07:00
Commit Graph

41640 Commits

Author SHA1 Message Date
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
Alex Brainman
e4c3925925 cmd/link: use libmsvcrt.a during internal link
When using recent versions of gcc with cgo, internal link fails with

c:\>go test debug/pe
--- FAIL: TestInternalLinkerDWARF (0.94s)
    file_test.go:394: building test executable for linktype 2 failed: exit status 2 # command-line-arguments
        runtime/cgo(.text): relocation target __acrt_iob_func not defined for ABI0 (but is defined for ABI0)
        runtime/cgo(.text): relocation target __acrt_iob_func not defined for ABI0 (but is defined for ABI0)
        runtime/cgo(.text): relocation target __acrt_iob_func not defined for ABI0 (but is defined for ABI0)
FAIL
FAIL    debug/pe        4.572s
FAIL

It appears that __acrt_iob_func is defined in libmsvcrt.a. And this
change adds libmsvcrt.a to the list of libraries always used byi
internal linker.

libmsvcrt.a also implements __imp___acrt_iob_func. So this change
also prevents rewriting __imp___acrt_iob_func name into
__acrt_iob_func, otherwise we end up with duplicate __acrt_iob_func
symbol error.

Fixes #23649

Change-Id: Ie9864cd17e907501e9a8a3672bbc33e02ca20e5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/197977
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-20 06:38:39 +00:00
Luke Young
39cfb7609d net/http: make Transport.roundTrip close body on invalid method
Updates #35015

Change-Id: Ibfe8f72ed3887ca88ce9c1d8a29dacda72f3fe17
GitHub-Last-Rev: 4bfc56e716
GitHub-Pull-Request: golang/go#35014
Reviewed-on: https://go-review.googlesource.com/c/go/+/202237
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-20 06:25:35 +00:00
Caleb Spare
72275c0dea cmd/vet: re-vendor x/tools upstream for printf verb fix
This pulls in the x/tools fix from
https://go-review.googlesource.com/c/tools/+/202041
so that cmd/vet won't flag %x/%X verbs incorrectly for floating-point
and complex types.

Fixes #34993

Change-Id: I68d89a19d95fe6ad336e87d12d56f03556974086
Reviewed-on: https://go-review.googlesource.com/c/go/+/202083
Run-TryBot: Caleb Spare <cespare@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2019-10-19 19:28:35 +00:00
Cherry Zhang
5777ffd6e6 [dev.link] cmd/link: allow either of duplicated symbols being dupok
If two symbols have the same name, the old code allows either one
being dupok (preferably both, but either is ok). Currently, the
new code only works when the new symbol being dupok (or both).
Allow only old symbol being dupok as well.

One example for this is the tls_g variable on ARM64 and PPC64
when the race detector is enabled.

Should fix Linux/ARM64 build.

Change-Id: I8dd21c017e826847f13471c30dfd71bf225d8076
Reviewed-on: https://go-review.googlesource.com/c/go/+/201642
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2019-10-19 15:18:32 +00:00
Cherry Zhang
e9c994954f runtime: fix past-the-end write of wasmStack
On Wasm, at program start, we set the SP to
wasmStack+sizeof(wasmStack), and start to write on it. This write
is actually past the end of wasmStack. This may scribble to some
other variable next to it in the data segment. Or if wasmStack
happens to be the last object in the data segment, we'll scribble
to unreserved memory and cause the next sysReserve return
non-zero memory. Either way, this is bad. Fix this by subtracting
16 before writing.

Found while debugging the new page allocator (CL 190622 and the
stack) with Michael. We found that on Wasm, the first sysReserve
may return memory with the first a few words being non-zero.

Change-Id: I2d76dd3fee85bddb2ff6a902b5876dea3f2969a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/202086
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-19 04:45:10 +00:00
Matthew Dempsky
46aa8354fa cmd/compile: only escape unsafe.Pointer conversions when -d=checkptr=2
Escaping all unsafe.Pointer conversions for -d=checkptr seems like it
might be a little too aggressive to enable for -race/-msan mode, since
at least some tests are written to expect unsafe.Pointer conversions
to not affect escape analysis.

So instead only enable that functionality behind -d=checkptr=2.

Updates #22218.
Updates #34959.

Change-Id: I2f0a774ea5961dabec29bc5b8ebe387a1b90d27b
Reviewed-on: https://go-review.googlesource.com/c/go/+/201840
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-18 23:33:48 +00:00
Emmanuel T Odeke
5375c71289 net/http/httptest: add EnableHTTP2 to Server
Adds a knob EnableHTTP2, that enables an unstarted
Server and its respective client to speak HTTP/2,
but only after StartTLS has been invoked.

Fixes #34939

Change-Id: I287c568b8708a4d3c03e7d9eca7c323b8f4c65b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/201557
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-18 19:29:10 +00:00
Cuong Manh Le
dc3b7883b5 syscall: fix wrong unsafe.Pointer alignment in syscall
Caught with:

	go test -a -short -gcflags=all=-d=checkptr log/syslog

and:

	grep -rE '\*\[([^2]|.{2,})\].*\)\(unsafe.Pointer' syscall

Updates #34972

Change-Id: Iafd199b3a34beb7cc3e88484bf2fbae45183f951
Reviewed-on: https://go-review.googlesource.com/c/go/+/201877
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-10-18 19:06:39 +00:00
Cherry Zhang
c3459eaab0 [dev.link] all: merge branch 'master' into dev.link
Clean merge.

Change-Id: I94d5e621b98cd5b3e1f2007db83d52293edbd9ec
2019-10-18 14:44:05 -04:00
Brad Fitzpatrick
65a4dc9c18 doc/go1.14: announce upcoming removal of darwin/386 port
Fixes #34749

Change-Id: Id97afc189ea387fc0fdd044140e30096594e185a
Reviewed-on: https://go-review.googlesource.com/c/go/+/202018
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-18 18:12:39 +00:00
diaxu01
3876bd67ef cmd/internal/obj/arm64: add support of NOOP instruction
This patch uses symbol NOOP to support arm64 instruction NOP. In
arm64, NOP stands for that No Operation does nothing, other than
advance the value of the program counter by 4. This instruction
can be used for instruction alignment purposes. This patch uses
NOOP to support arm64 instruction NOP, because we have a generic
"NOP" instruction, which is a zero-width pseudo-instruction.

In arm64, instruction NOP is an alias of HINT #0. This patch adds
test cases for instruction HINT #0.

Change-Id: I54e6854c46516eb652b412ef9e0f73ab7f171f8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/200578
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-18 14:15:51 +00:00
Alberto Donizetti
57c63e0fb2 math/bits: add Rem, Rem32, Rem64
The Div functions in math/bits (Div, Div32, and Div64) compute both
quotients and remainders, but they panic if the quotients do not not
fit a 32/64 uint.

Since, on the other hand, the remainder will always fit the size of
the divisor, it is useful to have Div variants that only compute the
remainder, and don't panic on a quotient overflow.

This change adds to the math/bits package three new functions:

  Rem(hi, lo, y uint) uint
  Rem32(hi, lo, y uint32) uint32
  Rem64(hi, lo, y uint64) uint64

which can be used to compute (hi,lo)%y even when the quotient
overflows the uint size.

Fixes #28970

Change-Id: I119948429f737670c5e5ceb8756121e6a738dbdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/197838
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-18 13:47:36 +00:00
Cuong Manh Le
584ef455ac cmd/compile: skip empty init function in fninit
Fixes #34869

Change-Id: I21bc60b9a5d1204dade1cceed6cddccf5b537b0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/200958
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-10-18 12:04:04 +00:00
Keith Randall
bc529506d2 runtime/race: add test for midstack inlining
Add test to make sure we get the right traceback when mid-stack inlining.

Update #33309

Change-Id: I23979cbe6b12fad105dbd26698243648aa86a354
Reviewed-on: https://go-review.googlesource.com/c/go/+/195984
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2019-10-18 06:02:08 +00:00
Keith Randall
d8e8d092f7 runtime/race: update race detector shared libraries
Pulls in a new snapshot of the race detector, containing
a fix that lets it handle mid-stack inlining correctly.

Fixes #33309

Change-Id: I7551912a491f0615e77d069f198c1b8a6eead280
Reviewed-on: https://go-review.googlesource.com/c/go/+/201898
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-18 04:44:26 +00:00
Robert Griesemer
8d2ea2936b go/types: don't update the underlying type of an imported type
Updating the underlying type of an imported type (even though
is was set to the same type again) leads to a race condition
if the imported package is imported by separate, concurrently
type-checked packages.

Fixes #31749.

Change-Id: Iabb8e8593eb067eb4816c1df81e545ff52d32c6c
Reviewed-on: https://go-review.googlesource.com/c/go/+/201838
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-18 02:47:24 +00:00
Matthew Dempsky
8c6876e9a4 cmd/compile: disable checkptr for //go:cgo_unsafe_args functions
Fixes #34968.

Change-Id: I538d653fab6cf7cf9b9b7022a1c2d4ae6ee497b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/201823
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-17 22:27:31 +00:00
Keith Randall
ab81efa3dc runtime: save g register during arm64 race detector callbacks
The race detector C code expects the g register (aka R28) to be
preserved per the C calling convention. Make sure we save/restore it.

Once this is in we can revert the O3 -> O1 change to racebuild.

Change-Id: Ia785b2717c136f565d45bed283e87b744e35c62d
Reviewed-on: https://go-review.googlesource.com/c/go/+/201744
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-17 21:58:45 +00:00
Alexander Rakoczy
f95bf8b64b doc: document Go 1.13.3
Change-Id: Ia571b8aa791578a77ed5c2b8eaf45c9684eea1c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/201820
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-10-17 21:30:20 +00:00
Matthew Dempsky
f9226454b9 cmd/compile: fix -d=checkptr for named unsafe.Pointer types
We need to explicitly convert pointers to unsafe.Pointer before
passing to the runtime checkptr instrumentation in case the user
declared their own type with underlying type unsafe.Pointer.

Updates #22218.
Fixes #34966.

Change-Id: I3baa2809d77f8257167cd78f57156f819130baa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/201782
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-17 21:10:22 +00:00
Alexander Rakoczy
58e8f7897a doc: document Go 1.12.12
Change-Id: I832ba5f32d513b586bb0b02371231786b25631e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/201817
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-10-17 21:02:14 +00:00
Katie Hockman
a8cdf130d1 doc: document Go 1.13.2 and Go 1.12.11
Change-Id: I73f27924046a0a2493330ddc732d1a2fd3f730a5
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/575981
Reviewed-by: Filippo Valsorda <valsorda@google.com>
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/575983
Reviewed-on: https://go-review.googlesource.com/c/go/+/201785
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-10-17 20:40:53 +00:00
Cherry Zhang
bd229936cf [dev.link] cmd/link: restore export data hash
With the previous CL, the export data will not change whether it
is compiled with -dynlink flag or not. Restore the export data
hash, and reenable plugin version check.

TODO: it may be still better to just generate a fingerprint for
each package at compile time.

Change-Id: I1f298ac97c3ab9b8d05d1c95e8be74d10ca7cd0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/201720
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2019-10-17 20:28:28 +00:00
Cherry Zhang
286d744246 [dev.link] cmd/compile: pass index through when re-exporting
When we re-export an imported symbol that has an index, we should
pass the index through. Currently, if the symbol is not
referenced in the generated machine code, it does not get
assigned a package index, and the exporter will not export its
symbol index. Let the exporter handle this case -- if the symbol
has a symbol index but not a package index, still export its
symbol index. This is safe as referenced-by-name symbols always
have their package indices set to a special value.

This should reduce the number of referenced-by-name symbols, and
also make the export data more stable, less dependent on codegen
details.

Change-Id: Ic515a002ae84226e7fdbe68a53496c051b7badcc
Reviewed-on: https://go-review.googlesource.com/c/go/+/201719
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2019-10-17 20:28:15 +00:00
Matthew Dempsky
b6b984fcff cmd/compile: escape unsafe.Pointer conversions when -d=checkptr
This CL tweaks escape analysis to treat unsafe.Pointer(ptr) as an
escaping operation when -d=checkptr is enabled. This allows better
detection of unsafe pointer arithmetic and conversions, because the
runtime checkptr instrumentation can currently only detect object
boundaries for heap objects, not stack objects.

Updates #22218.
Fixes #34959.

Change-Id: I856812cc23582fe4d0d401592583323e95919f28
Reviewed-on: https://go-review.googlesource.com/c/go/+/201781
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-17 20:09:00 +00:00
Than McIntosh
b661547d94 [dev.link] cmd/link: new loader method for reading relocations in batch
Add a new loader.Relocs method that reads all of the relocations for a
symbol into a slice. Handy in cases where the client knows in advance
that it wants to visit all the relocations on a symbol (as opposed to
just one or two).

Change-Id: I1a420513e160c8bb4b90c9824ae8d5b5de060c15
Reviewed-on: https://go-review.googlesource.com/c/go/+/201721
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-17 20:08:33 +00:00