1
0
mirror of https://github.com/golang/go synced 2024-09-29 17:24:34 -06:00
Commit Graph

43299 Commits

Author SHA1 Message Date
Austin Clements
da8591b61c all: remove darwin/arm build-tags and files
This removes all files that are only used on darwin/arm and cleans up
build tags in files that are still used on other platforms.

Updates #37611.

Change-Id: Ic9490cf0edfc157c6276a7ca950c1768b34a998f
Reviewed-on: https://go-review.googlesource.com/c/go/+/227197
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-08 18:35:43 +00:00
Austin Clements
79b6900cc7 doc: remove darwin/386, darwin/arm from ports list
Updates #37611.

Change-Id: I7ae5a61d2e2189fd48ac3548e370e0de1dd79832
Reviewed-on: https://go-review.googlesource.com/c/go/+/227343
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-08 18:35:03 +00:00
Bryan C. Mills
94d22d12fa Revert "runtime/pprof: try to use real stack in TestTryAdd"
This reverts CL 227484.

Reason for revert: failing on linux-amd64-noopt builder.

Change-Id: Id677de8cfb18fbccb7d9b04b0f8a21d3c1d2b060
Reviewed-on: https://go-review.googlesource.com/c/go/+/227580
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-08 18:04:59 +00:00
Michael Matloob
c4f2a9788a cmd/go: allow configuring module cache directory with GOMODCACHE
Adds a GOMODCACHE environment variable that's used by cmd/go to determine the
location of the module cache. The default value of GOMODCACHE will be
GOPATH[0]/pkg/mod, the default location of the module cache before this change.

Replace the cmd/go/internal/modfetch.PkgMod variable which previously held the
location of the module cache with the new cmd/go/internal/cfg.GOMODCACHE
variable, for consistency with many of the other environment variables that
affect the behavior of cmd/go.  (Most of the changes in this CL are due to
moving/renaming the variable.)

The value of cfg.GOMODCACHE is now set using a variable initializer. It was
previously set in cmd/go/internal/modload.Init.

The location of GOPATH/pkg/sumdb is unchanged by this CL. While it was
previously determined using the value of PkgMod, it now is determined
independently dirctly from the value of GOPATH[0].

Fixes #34527

Change-Id: Id4d31d217b3507d6057c8ef7c52af1a0606603e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/219538
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-04-08 17:51:12 +00:00
Josh Bleecher Snyder
97711bfd60 runtime: skip TestPingPongHog in race mode
TestPingPongHog tests properties of the scheduler.
But the race detector intentionally does randomized scheduling,
so the test is not applicable.

Fixes #38266

Change-Id: Ib06aa317b2776cb1faa641c4e038e2599cf70b2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/227344
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-08 16:40:46 +00:00
BurtonQin
4874835232 net/textproto, sync: unlock mutexes appropriately before panics
Ensure mutexes are unlocked right before panics, where defers aren’t easily usable.

Change-Id: I67c9870e7a626f590a8de8df6c8341c5483918dc
GitHub-Last-Rev: bb8ffe538b
GitHub-Pull-Request: golang/go#37143
Reviewed-on: https://go-review.googlesource.com/c/go/+/218717
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-08 16:19:51 +00:00
Keith Randall
7a35d39b56 runtime/race: update ppc64 .syso file
Update #14881
Update #37355

Change-Id: I5edd53b7532836cfe6037fb668b1b8fe8f7a32f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/227443
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2020-04-08 15:12:49 +00:00
Michael Pratt
0dfb0513ec runtime/pprof: try to use real stack in TestTryAdd
TestTryAdd is particularly brittle because it tests some real cases by
constructing fake sample stack frames. If those frames don't correctly
represent what the runtime would generate then they may fail to catch
regressions.

Instead, call runtime.Callers at the bottom of real function calls to
generate real frames as a base for truncation, etc in tests. Several of
these tests still have to fake parts of the frames to test the right
thing, but this is a bit less fragile.

Change-Id: I62522a9ded5544b06d1bf28550af5400f3af667b
Reviewed-on: https://go-review.googlesource.com/c/go/+/227484
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2020-04-08 14:51:58 +00:00
Ian Lance Taylor
08dd4ad7e3 runtime: only check for pointers up to ptrdata, not size
Change-Id: I166cf253b7f2483d652c98d2fba36c380e2f3347
Reviewed-on: https://go-review.googlesource.com/c/go/+/227177
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2020-04-08 04:18:04 +00:00
Xiangdong Ji
8e121b1587 runtime: fix infinite callstack of cgo on arm64
This change adds CFA information to the assembly function 'crosscall1'
and reorgnizes its code to establish well-formed prologue and epilogue.
It will fix an infinite callstack issue when debugging cgo program with
GDB on arm64.

Brief root cause analysis:

GDB's aarch64 unwinder parses prologue to determine current frame's size
and previous PC&SP if CFA information is not available.

The unwinder parses the prologue of 'crosscall1' to determine a frame size
of 0x10, then turns to its next frame trying to compute its previous PC&SP
as they are not saved on current frame's stack as per its 'traditional frame
unwind' rules, which ends up getting an endless frame chain like:
    [callee]  : pc:<pc0>, sp:<sp0>
    crosscall1: pc:<pc1>, sp:<sp0>+0x10
    [caller]  : pc:<pc1>, sp:<sp0>+0x10+0x10
    [caller]  : pc:<pc1>, sp:<sp0>+0x10+0x10+0x10
    ...
GDB fails to detect the 'caller' frame is same as 'crosscall1' and terminate
unwinding since SP increases everytime.

Fixes #37238
Change-Id: Ia6bd8555828541a3a61f7dc9b94dfa00775ec52a
Reviewed-on: https://go-review.googlesource.com/c/go/+/226999
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-08 03:46:37 +00:00
Dan Scales
0a820007e7 runtime: static lock ranking for the runtime (enabled by GOEXPERIMENT)
I took some of the infrastructure from Austin's lock logging CR
https://go-review.googlesource.com/c/go/+/192704 (with deadlock
detection from the logs), and developed a setup to give static lock
ranking for runtime locks.

Static lock ranking establishes a documented total ordering among locks,
and then reports an error if the total order is violated. This can
happen if a deadlock happens (by acquiring a sequence of locks in
different orders), or if just one side of a possible deadlock happens.
Lock ordering deadlocks cannot happen as long as the lock ordering is
followed.

Along the way, I found a deadlock involving the new timer code, which Ian fixed
via https://go-review.googlesource.com/c/go/+/207348, as well as two other
potential deadlocks.

See the constants at the top of runtime/lockrank.go to show the static
lock ranking that I ended up with, along with some comments. This is
great documentation of the current intended lock ordering when acquiring
multiple locks in the runtime.

I also added an array lockPartialOrder[] which shows and enforces the
current partial ordering among locks (which is embedded within the total
ordering). This is more specific about the dependencies among locks.

I don't try to check the ranking within a lock class with multiple locks
that can be acquired at the same time (i.e. check the ranking when
multiple hchan locks are acquired).

Currently, I am doing a lockInit() call to set the lock rank of most
locks. Any lock that is not otherwise initialized is assumed to be a
leaf lock (a very high rank lock), so that eliminates the need to do
anything for a bunch of locks (including all architecture-dependent
locks). For two locks, root.lock and notifyList.lock (only in the
runtime/sema.go file), it is not as easy to do lock initialization, so
instead, I am passing the lock rank with the lock calls.

For Windows compilation, I needed to increase the StackGuard size from
896 to 928 because of the new lock-rank checking functions.

Checking of the static lock ranking is enabled by setting
GOEXPERIMENT=staticlockranking before doing a run.

To make sure that the static lock ranking code has no overhead in memory
or CPU when not enabled by GOEXPERIMENT, I changed 'go build/install' so
that it defines a build tag (with the same name) whenever any experiment
has been baked into the toolchain (by checking Expstring()). This allows
me to avoid increasing the size of the 'mutex' type when static lock
ranking is not enabled.

Fixes #38029

Change-Id: I154217ff307c47051f8dae9c2a03b53081acd83a
Reviewed-on: https://go-review.googlesource.com/c/go/+/207619
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-07 21:51:03 +00:00
Michael Munday
bfd569fcb0 cmd/compile: delete the floating point Greater and Geq ops
Extend CL 220417 (which removed the integer Greater and Geq ops) to
floating point comparisons. Greater and Geq can always be
implemented using Less and Leq.

Fixes #37316.

Change-Id: Ieaddb4877dd0ff9037a1dd11d0a9a9e45ced71e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/222397
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-04-07 19:55:05 +00:00
Josh Bleecher Snyder
7ee8467b27 cmd/compile: use MOVBQZX for OpAMD64LoweredHasCPUFeature
In the commit message of CL 212360, I wrote:

> This new intrinsic ... generates MOVB+TESTB+NE.
> (It is possible that MOVBQZX+TESTQ+NE would be better.)

I should have tested. MOVBQZX+TESTQ+NE does in fact appear to be better.

For the benchmark in #36196, on my machine:

name      old time/op  new time/op  delta
FMA-8     0.86ns ± 6%  0.70ns ± 5%  -18.79%  (p=0.000 n=98+97)
NonFMA-8  0.61ns ± 5%  0.60ns ± 4%   -0.74%  (p=0.001 n=100+97)

Interestingly, these are both considerably faster than
the measurements I took a couple of months ago (1.4ns/2ns).
It appears that CL 219131 (clearing VZEROUPPER in asyncPreempt) helped a lot.
And FMA is now once again slower than NonFMA, although this change
helps it regain some ground.

Updates #15808
Updates #36351
Updates #36196

Change-Id: I8a326289a963b1939aaa7eaa2fab2ec536467c7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/227238
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-04-07 18:19:55 +00:00
Egon Elbre
64f19d7080 cmd/compile/internal/logopt: preserve env while running command
The test was not preserving temporary directory flags leading to a
failure on windows with:

    mkdir C:\WINDOWS\go-build315158903: Access is denied.

Fixes #38251

Change-Id: I6ee31b31e84b7f6e75ea6ee0f3b8c094835bf5d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/227497
Reviewed-by: David Chase <drchase@google.com>
2020-04-07 17:18:30 +00:00
Ruixin(Peter) Bao
553a8626ba cmd/internal: add MVCIN instruction to s390x assembler
On s390x, we already have MVCIN opcode in asmz.go,
but we did not use it. This CL uses that opcode and adds MVCIN
instruction.

MVCIN instruction can be used to move data from one storage location
to another while reversing the order of bytes within the field. This
could be useful when transforming data from little-endian to big-endian.

Change-Id: Ifa1a911c0d3442f4a62f91f74ed25b196d01636b
Reviewed-on: https://go-review.googlesource.com/c/go/+/227478
Reviewed-by: Michael Munday <mike.munday@ibm.com>
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-07 15:03:09 +00:00
Jay Conrod
74d6de03fd cmd/go: report scan error position in 'go list -e'
This CL extracts some error handling code into a common method for
presenting errors encountered when loading package data.

Fixes #36087
Fixes #36762

Change-Id: I87c8d41e3cc6e6afa152d9c067bc60923bf19fbe
Reviewed-on: https://go-review.googlesource.com/c/go/+/210938
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-04-06 18:06:41 +00:00
Cherry Zhang
7dc1c62cc9 cmd/link: remove darwin/arm test
The darwin/arm port is removed in Go 1.15. Setting GOOS=darwin
GOARCH=arm will fail, therefore "go test cmd/link" on macOS will
fail (in non -short mode). Remove this test point.

Updates #37611.

Change-Id: Ia9531c4b4a6692a0c49153517af9fdddd1f3e0bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/227341
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-06 16:11:47 +00:00
Josh Bleecher Snyder
42d4df9459 cmd/compile: lay out exit post-dominated blocks at the end
Complete a long-standing TODO in the code.

Exit blocks are cold code, so we lay them out at the end of the function.
Blocks that are post-dominated by exit blocks are also ipso facto exit blocks.
Treat them as such.

Implement using a simple loop, because there are generally very few exit blocks.

In addition to improved instruction cache, this empirically yields
better register allocation.

Binary size impact:

file    before    after     Δ       %       
cgo     4812872   4808776   -4096   -0.085% 
fix     3370072   3365976   -4096   -0.122% 
vet     8252280   8248184   -4096   -0.050% 
total   115052984 115040696 -12288  -0.011% 

This also appears to improve compiler performance
(-0.15% geomean time/op, -1.20% geomean user time/op),
but that could just be alignment effects.
Compiler benchmarking hasn't been super reliably recently,
and there's no particular reason to think this should
speed up the compiler that much.

Change-Id: I3d262c4f5cb80626a67a5c17285e2fa09f423c00
Reviewed-on: https://go-review.googlesource.com/c/go/+/227217
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2020-04-06 16:08:18 +00:00
Cherry Zhang
23866aedd9 cmd/link: fix data race in testDWARF
Multiple instances of testDWARF run in parallel, with a shared
backing store of the env input slice. Do modification of the
environment locally, instead of on the shared slice.

Fixes #38265.

Change-Id: I22a7194c8cd55ba22c9d6c47ac47bf7e710a7027
Reviewed-on: https://go-review.googlesource.com/c/go/+/227342
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-06 16:08:10 +00:00
Jay Conrod
44ae94751a cmd/go: report 'go get' errors for absolute paths outside module root
'go get' will now check absolute paths without wildcards the same way
it checks relative paths. modload.DirImportPath may be used for both
without converting path separators.

Fixes #38038

Change-Id: I453299898ece58f3b5002a5e80021d6bfe815fdd
Reviewed-on: https://go-review.googlesource.com/c/go/+/226857
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2020-04-06 15:59:41 +00:00
David Chase
98534812bd cmd/compile: make logopt test skip if cannot create scratch directory
Fixes #38251.

Change-Id: Ic635843fb503484a1c9a230b0cca571393d3da5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/227339
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2020-04-06 15:22:07 +00:00
Michael Munday
a4451e1143 cmd/compile: print block auxint value in HTML output
The auxint value was being printed in LongString() but not LongHTML().

Fixes #38250.

Change-Id: I28e819feef8710f912bee424d1b900eb07f3abb8
Reviewed-on: https://go-review.googlesource.com/c/go/+/227160
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-06 14:42:24 +00:00
Lynn Boger
815509ae31 cmd/compile: improve lowered moves and zeros for ppc64le
This change includes the following:
- Generate LXV/STXV sequences instead of LXVD2X/STXVD2X on power9.
These instructions do not require an index register, which
allows more loads and stores within a loop without initializing
multiple index registers. The LoweredQuadXXX generate LXV/STXV.
- Create LoweredMoveXXXShort and LoweredZeroXXXShort for short
moves that don't generate loops, and therefore don't clobber the
address registers or flags.
- Use registers other than R3 and R4 to avoid conflicting with
registers that have already been allocated to avoid unnecessary
register moves.
- Eliminate the use of R14 as scratch register and use R31
instead.
- Add PCALIGN when the LoweredMoveXXX or LoweredZeroXXX generates a
loop with more than 3 iterations.

This performance opportunity was noticed in github.com/golang/snappy
benchmarks. Results on power9:

WordsDecode1e1    54.1ns ± 0%    53.8ns ± 0%   -0.51%  (p=0.029 n=4+4)
WordsDecode1e2     287ns ± 0%     282ns ± 1%   -1.83%  (p=0.029 n=4+4)
WordsDecode1e3    3.98µs ± 0%    3.64µs ± 0%   -8.52%  (p=0.029 n=4+4)
WordsDecode1e4    66.9µs ± 0%    67.0µs ± 0%   +0.20%  (p=0.029 n=4+4)
WordsDecode1e5     723µs ± 0%     723µs ± 0%   -0.01%  (p=0.200 n=4+4)
WordsDecode1e6    7.21ms ± 0%    7.21ms ± 0%   -0.02%  (p=1.000 n=4+4)
WordsEncode1e1    29.9ns ± 0%    29.4ns ± 0%   -1.51%  (p=0.029 n=4+4)
WordsEncode1e2    2.12µs ± 0%    1.75µs ± 0%  -17.70%  (p=0.029 n=4+4)
WordsEncode1e3    11.7µs ± 0%    11.2µs ± 0%   -4.61%  (p=0.029 n=4+4)
WordsEncode1e4     119µs ± 0%     120µs ± 0%   +0.36%  (p=0.029 n=4+4)
WordsEncode1e5    1.21ms ± 0%    1.22ms ± 0%   +0.41%  (p=0.029 n=4+4)
WordsEncode1e6    12.0ms ± 0%    12.0ms ± 0%   +0.57%  (p=0.029 n=4+4)
RandomEncode       286µs ± 0%     203µs ± 0%  -28.82%  (p=0.029 n=4+4)
ExtendMatch       47.4µs ± 0%    47.0µs ± 0%   -0.85%  (p=0.029 n=4+4)

Change-Id: Iecad3a39ae55280286e42760a5c9d5c1168f5858
Reviewed-on: https://go-review.googlesource.com/c/go/+/226539
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-06 12:09:39 +00:00
Ian Lance Taylor
5f3354d1bf time, runtime: only call resetTimer from (*Timer).Reset
Previously we stopped the timer and then reset it. With the current
timer implementation that is no longer required.

Change-Id: Ie7aba61ad53ce835f6fcd0b6bce7fe0a15b10e24
Reviewed-on: https://go-review.googlesource.com/c/go/+/227180
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2020-04-06 03:35:33 +00:00
Bradford Lamson-Scribner
763bd58b19 cmd/compile: restore missing columns in ssa.html
If the final pass(es) are identical during ssa.html generation,
they are persisted in-memory as "pendingPhases" but never get
written as a column in the html. This change flushes those
in-memory phases.

Fixes #38242

Change-Id: Id13477dcbe7b419a818bb457861b2422ba5ef4bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/227182
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-05 23:23:03 +00:00
Andy Pan
281d41cb40 A+C: add Andy Pan (individual CLA)
https://go-review.googlesource.com/q/author:panjf2000%2540gmail.com

Change-Id: I05c73d848b8f40dc864a18c733ca3f47b1eab54d
Reviewed-on: https://go-review.googlesource.com/c/go/+/227004
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-05 22:58:00 +00:00
Bradford Lamson-Scribner
6736b2fdb2 cmd/compile: refactor around HTMLWriter removing logger in favor of Func
Replace HTMLWriter's Logger field with a *Func. Implement Fatalf method
for HTMLWriter which gets the Frontend() from the Func and calls down
into it's Fatalf method, passing the msg and args along. Replace
remaining calls to the old Logger with calls to logging methods on
the Func.

Change-Id: I966342ef9997396f3416fb152fa52d60080ebecb
Reviewed-on: https://go-review.googlesource.com/c/go/+/227277
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-05 20:54:32 +00:00
Alex Brainman
656f27ebf8 cmd/compile: enable -d=checkptr even on windows
CL 201783 enable -d=checkptr when -race or -msan is specified
everywhere but windows.

But, now that all unsafe pointer conversions in the standard
library are fixed, enable -d=checkptr even on windows.

Updates #34964
Updates #34972

Change-Id: Id912fa83b0d5b46c6f1c134c742fd94d2d185835
Reviewed-on: https://go-review.googlesource.com/c/go/+/227003
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-04-05 06:04:27 +00:00
Brad Fitzpatrick
9f40f9f4d3 cmd/dist: remove darwin/386, darwin/arm as valid ports
This only removes the ability to build it, and removes it as a
src/buildall.bash target (which uses go tool dist list).

Now:

$ go tool dist list | grep ^darwin
darwin/amd64
darwin/arm64

After this, remaining is removing leftover port--specific code in the
tree.

Updates #37610
Updates #37611

Change-Id: I00f03b2355c2e152f75e57abd3063be243529d2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/226985
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2020-04-04 16:49:40 +00:00
Josh Bleecher Snyder
fff7509d47 cmd/compile: add intrinsic HasCPUFeature for checking cpu features
Before using some CPU instructions, we must check for their presence.
We use global variables in the runtime package to record features.

Prior to this CL, we issued a regular memory load for these features.
The downside to this is that, because it is a regular memory load,
it cannot be hoisted out of loops or otherwise reordered with other loads.

This CL introduces a new intrinsic just for checking cpu features.
It still ends up resulting in a memory load, but that memory load can
now be floated to the entry block and rematerialized as needed.

One downside is that the regular load could be combined with the comparison
into a CMPBconstload+NE. This new intrinsic cannot; it generates MOVB+TESTB+NE.
(It is possible that MOVBQZX+TESTQ+NE would be better.)

This CL does only amd64. It is easy to extend to other architectures.

For the benchmark in #36196, on my machine, this offers a mild speedup.

name      old time/op  new time/op  delta
FMA-8     1.39ns ± 6%  1.29ns ± 9%  -7.19%  (p=0.000 n=97+96)
NonFMA-8  2.03ns ±11%  2.04ns ±12%    ~     (p=0.618 n=99+98)

Updates #15808
Updates #36196

Change-Id: I75e2fcfcf5a6df1bdb80657a7143bed69fca6deb
Reviewed-on: https://go-review.googlesource.com/c/go/+/212360
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Giovanni Bajo <rasky@develer.com>
2020-04-04 01:01:04 +00:00
Dan Scales
ed7a8332c4 cmd/compile: allow mid-stack inlining when there is a cycle of recursion
We still disallow inlining for an immediately-recursive function, but allow
inlining if a function is in a recursion chain.

If all functions in the recursion chain are simple, then we could inline
forever down the recursion chain (eventually running out of stack on the
compiler), so we add a map to keep track of the functions we have
already inlined at a call site. We stop inlining when we reach a
function that we have already inlined in the recursive chain. Of course,
normally the inlining will have stopped earlier, because of the cost
function.

We could also limit the depth of inlining by a simple count (say, limit
max inlining of 10 at any given site). Would that limit other
opportunities too much?

Added a test in test/inline.go. runtime.BenchmarkStackCopyNoCache() is
also already a good test that triggers the check to stop inlining
when we reach the start of the recursive chain again.

For the bent benchmark suite, the performance improvement was mostly not
statistically significant, but the geomean averaged out to: -0.68%. The text size
increase was less than .1% for all bent benchmarks. The cmd/go text size increase
was 0.02% and the cmd/compile text size increase was .1%.

Fixes #29737

Change-Id: I892fa84bb07a947b3125ec8f25ed0e508bf2bdf5
Reviewed-on: https://go-review.googlesource.com/c/go/+/226818
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2020-04-03 21:43:52 +00:00
Xiangdong Ji
339e9c6400 crypto/sha512: optimize sha512 by removing function literal
The function 'block' called indirectly via function literal 'blockGeneric' prevents
'gc' performing an accurate escape analysis to its arguments, that will result in
unnecessary heap object allocation and GC cost.

Consistent performance improvement to sha512 and its dependency packages are
observed on various arm64 servers if eliminating the function literal, especially for
small-sized benchmarks.

A72:
========================================================================================================
name                                               old time/op    new time/op     delta
pkg:crypto/sha512 goos:linux goarch:arm64
Hash8Bytes-64                                        1.61µs ± 0%     1.37µs ± 0%   -14.99%  (p=0.000 n=8+9)
Hash1K-64                                            11.2µs ± 0%     10.9µs ± 0%    -2.41%  (p=0.000 n=8+10)
Hash8K-64                                            77.8µs ± 0%     77.5µs ± 0%    -0.44%  (p=0.002 n=10+10)
pkg:crypto/ecdsa goos:linux goarch:arm64
pkg:crypto/hmac goos:linux goarch:arm64
pkg:crypto/tls goos:linux goarch:arm64
HandshakeServer/RSA-64                                920µs ± 0%      919µs ± 0%    -0.10%  (p=0.035 n=10+9)
HandshakeServer/ECDHE-P256-RSA/TLSv13-64             1.32ms ± 1%     1.31ms ± 0%    -0.24%  (p=0.002 n=9+8)
HandshakeServer/ECDHE-P256-RSA/TLSv12-64             1.25ms ± 0%     1.25ms ± 0%    -0.07%  (p=0.040 n=9+9)
HandshakeServer/ECDHE-P256-ECDSA-P256/TLSv12-64       486µs ± 0%      485µs ± 0%    -0.19%  (p=0.000 n=9+10)
HandshakeServer/ECDHE-X25519-ECDSA-P256/TLSv13-64    1.01ms ± 0%     1.01ms ± 0%    -0.36%  (p=0.000 n=9+10)
HandshakeServer/ECDHE-X25519-ECDSA-P256/TLSv12-64     948µs ± 0%      947µs ± 0%    -0.11%  (p=0.001 n=10+10)
HandshakeServer/ECDHE-P521-ECDSA-P521/TLSv12-64      42.1ms ± 3%     42.5ms ± 2%    +0.77%  (p=0.010 n=8+8)
Throughput/MaxPacket/8MB/TLSv13-64                   46.9ms ± 9%     42.8ms ± 2%    -8.71%  (p=0.000 n=10+9)
Throughput/MaxPacket/64MB/TLSv13-64                   385ms ±17%      332ms ±18%   -13.64%  (p=0.002 n=10+10)
Throughput/DynamicPacket/2MB/TLSv12-64              39.1ms ±110%     17.2ms ±24%   -55.97%  (p=0.002 n=10+9)
Throughput/DynamicPacket/4MB/TLSv12-64               32.2ms ±22%     27.2ms ±40%   -15.69%  (p=0.029 n=10+10)
Throughput/DynamicPacket/4MB/TLSv13-64               27.4ms ±18%     24.9ms ±31%    -9.12%  (p=0.031 n=9+9)
Throughput/DynamicPacket/8MB/TLSv12-64               61.8ms ±32%     43.9ms ±18%   -28.93%  (p=0.000 n=10+9)
Throughput/DynamicPacket/8MB/TLSv13-64               49.4ms ±14%     45.7ms ±19%    -7.44%  (p=0.035 n=10+10)
Throughput/DynamicPacket/32MB/TLSv13-64               181ms ±13%      163ms ± 7%   -10.17%  (p=0.001 n=9+10)
Latency/MaxPacket/5000kbps/TLSv13-64                 37.2ms ±52%     30.8ms ± 0%   -17.21%  (p=0.017 n=10+9)
Latency/DynamicPacket/2000kbps/TLSv13-64             16.7ms ± 1%     16.6ms ± 0%    -0.39%  (p=0.002 n=8+10)
pkg:crypto/ed25519 goos:linux goarch:arm64
KeyGeneration-64                                      139µs ± 0%      139µs ± 0%    -0.45%  (p=0.000 n=9+10)
NewKeyFromSeed-64                                     139µs ± 0%      139µs ± 0%    -0.34%  (p=0.000 n=10+10)
Signing-64                                            144µs ± 0%      143µs ± 0%    -0.73%  (p=0.000 n=10+10)
Verification-64                                       410µs ± 0%      410µs ± 0%    -0.09%  (p=0.000 n=9+9)

[Geo mean]                                           9.81ms          9.59ms         -2.30%

name                                               old speed      new speed       delta
pkg:crypto/sha512 goos:linux goarch:arm64
Hash8Bytes-64                                      4.96MB/s ± 0%   5.84MB/s ± 0%   +17.60%  (p=0.000 n=7+9)
Hash1K-64                                          91.5MB/s ± 0%   93.7MB/s ± 0%    +2.47%  (p=0.000 n=8+10)
Hash8K-64                                           105MB/s ± 0%    106MB/s ± 0%    +0.45%  (p=0.001 n=10+10)
pkg:crypto/hmac goos:linux goarch:arm64
pkg:crypto/tls goos:linux goarch:arm64
Throughput/MaxPacket/8MB/TLSv13-64                  179MB/s ± 9%    196MB/s ± 2%    +9.31%  (p=0.000 n=10+9)
Throughput/MaxPacket/64MB/TLSv13-64                 176MB/s ±20%    203MB/s ±16%   +15.35%  (p=0.002 n=10+10)
Throughput/DynamicPacket/2MB/TLSv12-64             70.2MB/s ±82%  118.9MB/s ±45%   +69.30%  (p=0.005 n=10+10)
Throughput/DynamicPacket/4MB/TLSv12-64              132MB/s ±19%    159MB/s ±31%   +20.31%  (p=0.029 n=10+10)
Throughput/DynamicPacket/4MB/TLSv13-64              155MB/s ±16%    171MB/s ±24%   +10.26%  (p=0.031 n=9+9)
Throughput/DynamicPacket/8MB/TLSv12-64              141MB/s ±37%    192MB/s ±15%   +36.28%  (p=0.000 n=10+9)
Throughput/DynamicPacket/8MB/TLSv13-64              170MB/s ±12%    185MB/s ±17%    +8.46%  (p=0.035 n=10+10)
Throughput/DynamicPacket/32MB/TLSv13-64             186MB/s ±12%    206MB/s ± 6%   +10.96%  (p=0.001 n=9+10)

[Geo mean]                                          133MB/s         141MB/s         +6.04%

name                                               old alloc/op   new alloc/op    delta
pkg:crypto/ecdsa goos:linux goarch:arm64
SignP256-64                                          3.03kB ± 0%     2.67kB ± 1%   -11.71%  (p=0.000 n=10+9)
pkg:crypto/ed25519 goos:linux goarch:arm64
NewKeyFromSeed-64                                      352B ± 0%         0B       -100.00%  (p=0.000 n=10+10)
Signing-64                                           1.50kB ± 0%     0.45kB ± 0%   -70.21%  (p=0.000 n=10+10)

[Geo mean]                                           3.39kB          4.08kB        +20.24%

name                                               old allocs/op  new allocs/op   delta
pkg:crypto/ecdsa goos:linux goarch:arm64
SignP256-64                                            34.0 ± 0%       32.0 ± 0%    -5.88%  (p=0.000 n=10+10)
SignP384-64                                           14.5k ± 0%      14.5k ± 0%    -0.12%  (p=0.045 n=10+10)
pkg:crypto/ed25519 goos:linux goarch:arm64
NewKeyFromSeed-64                                      2.00 ± 0%       0.00       -100.00%  (p=0.000 n=10+10)
Signing-64                                             11.0 ± 0%        5.0 ± 0%   -54.55%  (p=0.000 n=10+10)

[Geo mean]                                             35.7            53.6        +50.15%

A57:
=========================================================================================================
name                                              old time/op    new time/op    delta
pkg:crypto/sha512 goos:linux goarch:arm64
Hash8Bytes-8                                        1.93µs ± 0%    1.69µs ± 0%   -12.37%  (p=0.000 n=10+10)
Hash1K-8                                            13.8µs ± 0%    13.5µs ± 0%    -2.01%  (p=0.000 n=10+10)
Hash8K-8                                            96.1µs ± 0%    95.7µs ± 0%    -0.35%  (p=0.000 n=10+8)
pkg:crypto/ecdsa goos:linux goarch:arm64
SignP256-8                                          14.9µs ± 4%    14.4µs ± 1%    -2.84%  (p=0.000 n=10+9)
pkg:crypto/hmac goos:linux goarch:arm64
HMACSHA256_1K-8                                     1.87µs ± 0%    1.86µs ± 0%    -0.55%  (p=0.000 n=9+10)
HMACSHA256_32-8                                      760ns ± 0%     756ns ± 0%    -0.54%  (p=0.001 n=10+10)
pkg:crypto/tls goos:linux goarch:arm64
HandshakeServer/RSA-8                               1.11ms ± 0%    1.12ms ± 0%    +0.35%  (p=0.001 n=9+10)
HandshakeServer/ECDHE-P256-RSA/TLSv13-8             1.63ms ± 0%    1.63ms ± 0%    -0.23%  (p=0.004 n=10+9)
HandshakeServer/ECDHE-P256-ECDSA-P256/TLSv13-8       694µs ± 0%     687µs ± 0%    -0.96%  (p=0.000 n=10+8)
HandshakeServer/ECDHE-P256-ECDSA-P256/TLSv12-8       607µs ± 0%     601µs ± 0%    -0.99%  (p=0.000 n=9+9)
HandshakeServer/ECDHE-X25519-ECDSA-P256/TLSv13-8    1.25ms ± 0%    1.25ms ± 0%    -0.24%  (p=0.015 n=10+10)
HandshakeServer/ECDHE-X25519-ECDSA-P256/TLSv12-8    1.16ms ± 0%    1.16ms ± 0%    -0.30%  (p=0.000 n=8+10)
Latency/MaxPacket/200kbps/TLSv12-8                   697ms ± 0%     697ms ± 0%    +0.01%  (p=0.029 n=10+10)
Latency/DynamicPacket/200kbps/TLSv13-8               140ms ± 0%     140ms ± 0%    +0.04%  (p=0.006 n=9+10)
pkg:crypto/ed25519 goos:linux goarch:arm64
NewKeyFromSeed-8                                     168µs ± 0%     168µs ± 0%    +0.04%  (p=0.001 n=9+10)
Signing-8                                            174µs ± 0%     173µs ± 0%    -0.26%  (p=0.000 n=10+10)
Verification-8                                       495µs ± 0%     494µs ± 0%    -0.10%  (p=0.000 n=9+9)

[Geo mean]                                          9.85ms         9.82ms         -0.36%

name                                              old speed      new speed      delta
pkg:crypto/sha512 goos:linux goarch:arm64
Hash8Bytes-8                                      4.15MB/s ± 0%  4.74MB/s ± 0%   +14.11%  (p=0.000 n=10+10)
Hash1K-8                                          74.3MB/s ± 0%  75.8MB/s ± 0%    +2.05%  (p=0.000 n=10+10)
Hash8K-8                                          85.3MB/s ± 0%  85.6MB/s ± 0%    +0.35%  (p=0.000 n=10+8)
pkg:crypto/hmac goos:linux goarch:arm64
HMACSHA256_1K-8                                    549MB/s ± 0%   552MB/s ± 0%    +0.56%  (p=0.000 n=9+10)
HMACSHA256_32-8                                   42.1MB/s ± 0%  42.3MB/s ± 1%    +0.53%  (p=0.001 n=10+10)
pkg:crypto/tls goos:linux goarch:arm64

[Geo mean]                                         138MB/s        139MB/s         +0.54%

name                                              old alloc/op   new alloc/op   delta
pkg:crypto/ecdsa goos:linux goarch:arm64
SignP256-8                                          2.99kB ± 0%    2.64kB ± 0%   -11.77%  (p=0.000 n=10+10)
pkg:crypto/ed25519 goos:linux goarch:arm64
NewKeyFromSeed-8                                      352B ± 0%        0B       -100.00%  (p=0.000 n=10+10)
Signing-8                                           1.50kB ± 0%    0.45kB ± 0%   -70.21%  (p=0.000 n=10+10)

[Geo mean]                                          3.34kB         4.01kB        +20.04%

name                                              old allocs/op  new allocs/op  delta
pkg:crypto/ecdsa goos:linux goarch:arm64
SignP256-8                                            34.0 ± 0%      32.0 ± 0%    -5.88%  (p=0.000 n=10+10)
pkg:crypto/ed25519 goos:linux goarch:arm64
NewKeyFromSeed-8                                      2.00 ± 0%      0.00       -100.00%  (p=0.000 n=10+10)
Signing-8                                             11.0 ± 0%       5.0 ± 0%   -54.55%  (p=0.000 n=10+10)

[Geo mean]                                            35.7           53.6        +50.17%

Change-Id: Ibbda2d9bdff4eea4f611d4590abceb8764c44f2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/211617
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-03 18:17:13 +00:00
David du Colombier
e31d741801 flag: fix TestExitCode on Plan 9
CL 221427 added TestExitCode. This test is failing
on Plan 9 because ExitCode is always equal to 1
on error since Plan 9 use error strings.

This change fixes TestExitCode by checking that
ExitCode is equal to 1 on error instead of the
specific value.

Fixes #38237.

Change-Id: Ie269722e731e275e5bfc51644c1fa6be76525f1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/227158
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-04-03 17:51:12 +00:00
Jay Conrod
c4f875e84e cmd/go: report original module path in error parsing replaced go.mod
MVS reports an error when a go.mod file declares a module path that
doesn't match the path it was required with. If the module is a
replacement, its declared path may be the original path (preferred) or
the replacement path.

This CL makes the reported error a little more clear: the "required as"
path should be the original required path, not the replacement path.

Fixes #38220

Change-Id: I08b50a100679a447c8803cca1d1b32bc115ec1b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/227097
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-04-03 17:42:31 +00:00
Egon Elbre
d78639519d run.bat: check go.exe instead of go
Windows requires checking with the .exe extension.

Change-Id: I8e2fe83df81b92f04967bafb28f8effde999f597
Reviewed-on: https://go-review.googlesource.com/c/go/+/227157
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-03 17:41:28 +00:00
David Chase
47ade08141 cmd/compile: add logging for large (>= 128 byte) copies
For 1.15, unless someone really wants it in 1.14.

A performance-sensitive user thought this would be useful,
though "large" was not well-defined.  If 128 is large,
there are 139 static instances of "large" copies in the compiler
itself.

Includes test.

Change-Id: I81f20c62da59d37072429f3a22c1809e6fb2946d
Reviewed-on: https://go-review.googlesource.com/c/go/+/205066
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-04-03 17:24:48 +00:00
Xiangdong Ji
3103495fa9 runtime: eliminate redundant load in Xchg and Xadd on arm64
Loading arguments of Xchg(64) and Xadd(64) functions to registers
could be done only once.

Change-Id: Iaf0a695ec9c6a221dfa755855edb68c476978a5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/227001
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-03 17:08:32 +00:00
Cherry Zhang
e18a5ba0ca cmd/link: in stack bound check, don't check a call repetitively
In stack bound check pass, check a call once, not over and over
again. Fix an accidental quadratic behavior...

In particular, switching to the new linker caused MIPS builders
noticeably slower. This CL fixes it.

Change-Id: Idd00c79e80af6278652c92a1d9d7bb2d194e9490
Reviewed-on: https://go-review.googlesource.com/c/go/+/227078
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Austin Clements <austin@google.com>
2020-04-03 14:12:25 +00:00
Cherry Zhang
5dde10c304 cmd/internal/obj/mips: don't emit spurious CALLIND relocations
Generate a CALLIND relocation only for indirect calls, not for
indirect jumps. In particular, the RET instruction is lowered to
JMP (LR), an indirect jump, and occurs frequently. The large
amount of spurious relocations causes the linker to do a lot of
extra work.

Change-Id: Ie0edc04609788f5a687fd00c22558c3f83867697
Reviewed-on: https://go-review.googlesource.com/c/go/+/227079
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
2020-04-03 13:43:12 +00:00
Cherry Zhang
6117275788 cmd/link: write to temp directory in test
In TestMMap, write to temporary directory, instead of the current
directory (which may not be writeable).

Fix linux-mips64le-mengzhuo builder.

Change-Id: I06dc3266f125523568c543634079c447d91903bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/227077
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-03 13:42:33 +00:00
Brad Fitzpatrick
a9a78b7005 doc: document testing.TB.TempDir in release notes
Updates #35998

Change-Id: I93784e9a9efdd1531e3c342aa0899bf059da0ae1
Reviewed-on: https://go-review.googlesource.com/c/go/+/226983
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-03 05:33:35 +00:00
Shang Jian Ding
dcf0929de6 flag: exit 0 when -h or -help invoked but undefined
flag treats -h or -help as a special case to print a nice help
message, but exit with a status code of 2. This update makes
that status code 0.

Fixes #37533

Change-Id: I7e0bd29944ce46607fb7cfc6740734f7444a151a
GitHub-Last-Rev: 83f64d757b
GitHub-Pull-Request: golang/go#37530
Reviewed-on: https://go-review.googlesource.com/c/go/+/221427
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-03 04:24:39 +00:00
Keith Randall
041bcb32b5 runtime/race: update some .syso files
Update race detector syso files for some platforms.

There's still 2 more to do, but they might take a while so I'm
mailing the ones I have now.

Note: some arm64 tests did not complete successfully due to out
of memory errors, but I suspect the .syso is correct.

Update #14481
Update #37485 (I think?)
Update #37355

Change-Id: I7e7e707a1fd7574855a538ba89dc11acc999c760
Reviewed-on: https://go-review.googlesource.com/c/go/+/226981
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-03 00:09:20 +00:00
Dmitri Shuralyov
886303004f net/http: release callbacks after fetch promise completes
When the request context was canceled, the Transport.RoundTrip method
could return before the fetch promise resolved. This would cause the
success and failure callback functions to get called after they've
been released, which in turn prints a "call to released function"
error to the console.

Avoid that problem by releasing the callbacks after the fetch promise
completes, by moving the release calls into the callbacks themselves.
This way we can still return from the Transport.RoundTrip method as
soon as the context is canceled, without waiting on the promise to
resolve. If the AbortController is unavailable and it's not possible to
abort the fetch operation, the promise may take a long time to resolve.

For #38003.

Change-Id: Ied1475e31dcba101b3326521b0cd653dbb345e1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/226204
Reviewed-by: Johan Brandhorst <johan.brandhorst@gmail.com>
Reviewed-by: Richard Musiol <neelance@gmail.com>
2020-04-02 23:01:56 +00:00
Brad Fitzpatrick
888a0c8ef6 testing: add TB.TempDir
Fixes #35998

Change-Id: I87c6bf4e34e832be68862ca16ecfa6ea12048d31
Reviewed-on: https://go-review.googlesource.com/c/go/+/226877
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-02 22:13:55 +00:00
Brad Fitzpatrick
2bed279721 net: update ParseIP doc to say IPv4-mapped-IPv6 is supported
Change-Id: I49a79c07081cd8f12a3ffef21fd02a9a622a7eb5
Reviewed-on: https://go-review.googlesource.com/c/go/+/226979
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-02 22:10:27 +00:00
Cherry Zhang
48a90d639d cmd: merge branch 'dev.link' into master
In the dev.link branch we continued developing the new object
file format support and the linker improvements described in
https://golang.org/s/better-linker .

The new object file is index-based and provides random access.
The linker maps the object files into read-only memory, and
accesses symbols on-demand using indices, as opposed to reading
all object files sequentially into the heap with the old format.

This work is not done yet. Currently we still convert back to the
old in-memory representation half way through the link process,
but only for symbols that are needed.

At this point, we think it is ready to enable the new object
files and new linker for early testing. Using the new object
files and the new linker, it reduces the linker's memory usage by
~10% and wall-clock run time by ~5%, and more to come.

Currently, both the old and new object file formats are supported.
The new format and new linker are used by default. For feature
gating, as a fallback, the old format and old linker can be used
by setting the compiler/assembler/linker's -go115newobj flag to
false. Note that the flag needs to be specified consistently to
all compilations, i.e.

	-gcflags=all=-go115newobj=false -asmflags=all=-go115newobj=false -ldflags=all=-go115newobj=false

In case we need to revert, we can set the flags default to false.
CL 224626 is an example.

cmd/oldlink is a full copy of the old linker. It is invoked if
the old format is requested.

This is a clean merge, as we already merged master branch to
dev.link first.

Change-Id: I8f081eef8c4621362f03ecbcb850d6262b5d3dc6
2020-04-02 15:51:19 -04:00
Cherry Zhang
6435590182 [dev.link] cmd/oldlink: update with recent changes
Update the old linker to bring in recent changes made on the
master branch: CL 225397 and CL 220917.

This brings cmd/oldlink to be in sync with commit
aa4d92b8aa.

Change-Id: Ic386736fa30944dcb71c57096915381d3e6be82c
Reviewed-on: https://go-review.googlesource.com/c/go/+/227028
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-02 19:03:11 +00:00
Cherry Zhang
6b6eb23041 [dev.link] all: merge branch 'master' into dev.link
The only conflict is a modify-deletion conflict in
cmd/link/internal/ld/link.go, where the old error reporter is
deleted in the new linker. Ported to
cmd/link/internal/ld/errors.go.

Change-Id: I5c78f398ea95bc1d7e6579c84dd8252c9f2196b7
2020-04-02 14:06:19 -04:00
Filippo Valsorda
9baafabac9 crypto/rsa: refactor RSA-PSS signing and verification
Cleaned up for readability and consistency.

There is one tiny behavioral change: when PSSSaltLengthEqualsHash is
used and both hash and opts.Hash were set, hash.Size() was used for the
salt length instead of opts.Hash.Size(). That's clearly wrong because
opts.Hash is documented to override hash.

Change-Id: I3e25dad933961eac827c6d2e3bbfe45fc5a6fb0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/226937
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2020-04-02 17:46:57 +00:00