]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
4 years ago[dev.boringcrypto] all: merge master into dev.boringcrypto
Filippo Valsorda [Wed, 8 Apr 2020 21:39:57 +0000 (17:39 -0400)]
[dev.boringcrypto] all: merge master into dev.boringcrypto

Change-Id: I2dcec316fd08d91db4183fb9d3b9afde65cc248f

4 years agocrypto/rsa: refactor RSA-PSS signing and verification
Filippo Valsorda [Wed, 1 Apr 2020 21:25:40 +0000 (17:25 -0400)]
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>
4 years agocmd/link: skip symbol references when looking for missing symbols
Joel Sing [Tue, 25 Feb 2020 15:48:24 +0000 (02:48 +1100)]
cmd/link: skip symbol references when looking for missing symbols

ErrorUnresolved attempts to find the missing symbol in another ABI,
in order to provide more friendly error messages. However, in doing so
it checks the same ABI and can find the symbol reference for the symbol
that it is currently reporting the unresolved error for. Avoid this by
ignoring SXREF symbols, which is the same behaviour used when linking
is performed.

Fixes #33979

Change-Id: I9bfc40146dec2666d25e93d3bcd1984da5c71215
Reviewed-on: https://go-review.googlesource.com/c/go/+/220917
Run-TryBot: Than McIntosh <thanm@google.com>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agocmd/asm: align an instruction or a function's address
fanzha02 [Thu, 19 Dec 2019 08:15:06 +0000 (08:15 +0000)]
cmd/asm: align an instruction or a function's address

Recently, the gVisor project needs an instruction's address
with 128 bytes alignment to fit the architecture requirement
for interrupt table.

This patch allows aligning an instruction's address to be
aligned to a specific value (2^n and in the range [8, 2048])

The main changes include:

1. Adds a new element in the FuncInfo structure defined in
cmd/internal/obj/link.go file to record the alignment
information.

2. Adds a new element in the Func structure defined in
cmd/internal/goobj/read.go file to read the alignment
information.

3. Adds the assembler support to align an intruction's offset
with a specific value (2^n and in the range [8, 2048]).
e.g. "PCALIGN $256" indicates that the next instruction should
be aligned to 256 bytes.

4. An instruction's alignment is relative to the start of the
function where this instruction is located, so the function's
address must be aligned to the same or coarser boundary.

This CL also adds a test.

Change-Id: I9b365c111b3a12f767728f1b45aa0c00f073c37d
Reviewed-on: https://go-review.googlesource.com/c/go/+/226997
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agocmd/compile: mark 'store multiple' as clobbering flags on s390x
Michael Munday [Wed, 1 Apr 2020 10:21:03 +0000 (03:21 -0700)]
cmd/compile: mark 'store multiple' as clobbering flags on s390x

Store multiple instructions can clobber flags on s390x when the
offset passed into the assembler is outside the range representable
with a signed 20 bit integer. This is because the assembler uses
the agfi instruction to implement the large offset. The assembler
could use a different sequence of instructions, but for now just
mark the instruction as 'clobberFlags' since this is risk free.

Noticed while investigating #38195.

No test yet since I'm not sure how to get this bug to trigger and
I haven't seen it affect real code.

Change-Id: I4a6ab96455a3ef8ffacb76ef0166b97eb40ff925
Reviewed-on: https://go-review.googlesource.com/c/go/+/226759
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agointernal/syscall/windows: change WSAMsg.Name type
Alex Brainman [Sat, 7 Mar 2020 00:08:06 +0000 (11:08 +1100)]
internal/syscall/windows: change WSAMsg.Name type

The problem was discovered while running

go test -a -short -gcflags=all=-d=checkptr -run=TestUDPConnSpecificMethods net

WSAMsg is type defined by Windows. And WSAMsg.Name could point to two
different structures for IPv4 and IPV6 sockets.

Currently WSAMsg.Name is declared as *syscall.RawSockaddrAny. But that
violates

(1) Conversion of a *T1 to Pointer to *T2.

rule of

https://golang.org/pkg/unsafe/#Pointer

When we convert *syscall.RawSockaddrInet4 into *syscall.RawSockaddrAny,
syscall.RawSockaddrInet4 and syscall.RawSockaddrAny do not share an
equivalent memory layout.

Same for *syscall.SockaddrInet6 into *syscall.RawSockaddrAny.

This CL changes WSAMsg.Name type to *syscall.Pointer. syscall.Pointer
length is 0, and that at least makes type checker happy.

After this change I was able to run

go test -a -short -gcflags=all=-d=checkptr std cmd

without type checker complaining.

Updates #34972

Change-Id: Ic5c2321c20abd805c687ee16ef6f643a2f8cd93f
Reviewed-on: https://go-review.googlesource.com/c/go/+/222457
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agosyscall: fix windows WSASendto -d=checkptr violation
Alex Brainman [Tue, 25 Feb 2020 07:44:55 +0000 (18:44 +1100)]
syscall: fix windows WSASendto -d=checkptr violation

WSASendto converts unsafe.Pointer to *syscall.RawSockaddrAny. But that
violates every rule of

https://golang.org/pkg/unsafe/#Pointer

Implement WSASendto by calling Windows WSASendTo API by calling
syscall.Syscall9 directly. This allows us to comply with

(4) Conversion of a Pointer to a uintptr when calling syscall.Syscall

rule.

After this change, this commands succeeds:

go test -a -short -gcflags=all=-d=checkptr -run=TestPacketConn net

Updates #34972

Change-Id: Ib9a810bedf9e05251b7d3c7f69e15bfbd177ac62
Reviewed-on: https://go-review.googlesource.com/c/go/+/220544
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agosync/atomic: fix TestSwapPointer test
Keith Randall [Wed, 1 Apr 2020 23:34:50 +0000 (16:34 -0700)]
sync/atomic: fix TestSwapPointer test

It plays way too loose with unsafe.Pointer rules.
It runs afoul of the checkptr rules, so some race detector builds
were failing.

Fixes #38210

Change-Id: I5e1c78201d06295524fdedb3fe5b49d61446f443
Reviewed-on: https://go-review.googlesource.com/c/go/+/226880
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
4 years agoos/signal, runtime: remove runtime sigqueue initialization
Ian Lance Taylor [Tue, 31 Mar 2020 17:49:31 +0000 (10:49 -0700)]
os/signal, runtime: remove runtime sigqueue initialization

We can initialize the runtime sigqueue packages on first use.
We don't require an explicit initialization step. So, remove it.

Change-Id: I484e02dc2c67395fd5584f35ecda2e28b37168df
Reviewed-on: https://go-review.googlesource.com/c/go/+/226540
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
4 years agocrypto/tls: add missing alert values
Katie Hockman [Wed, 1 Apr 2020 17:49:57 +0000 (13:49 -0400)]
crypto/tls: add missing alert values

Fixes #35911

Change-Id: I093d25aa169963769b51c37d2481bce71bd0fd2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/226858
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
4 years agodoc: update the minimum supported macOS version to 10.11
Carlos Amedee [Wed, 8 Jan 2020 19:49:43 +0000 (14:49 -0500)]
doc: update the minimum supported macOS version to 10.11

Update minimum macOS supported version from 10.10 to 10.11.

Updates #23011

Change-Id: Ie10c40e882c9d309ff56041d9768afc288d0204f
Reviewed-on: https://go-review.googlesource.com/c/go/+/213878
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agocmd/compile: add indexed-load CMP instructions
Keith Randall [Fri, 20 Mar 2020 00:48:42 +0000 (17:48 -0700)]
cmd/compile: add indexed-load CMP instructions

Things like CMPQ 4(AX)(BX*8), CX

Fixes #37955

Change-Id: Icbed430f65c91a0e3f38a633d8321d79433ad8b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/224219
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
4 years agoreflect: when Converting between float32s, don't lose signal NaNs
Keith Randall [Tue, 3 Mar 2020 18:07:32 +0000 (18:07 +0000)]
reflect: when Converting between float32s, don't lose signal NaNs

Trying this CL again, with a test that skips 387.

When converting from float32->float64->float32, any signal NaNs
get converted to quiet NaNs. Avoid that so using reflect.Value.Convert
between two float32 types keeps the signal bit of NaNs.

Skip the test on 387. I don't see any sane way of ensuring that a
float load + float store is faithful on that platform.

Fixes #36400

Change-Id: Ic316c74ddc155632e40424e207375b5d50dcd853
Reviewed-on: https://go-review.googlesource.com/c/go/+/221792
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
4 years agoruntime: fix typo in loadFactor comment
maronghe [Wed, 1 Apr 2020 07:15:49 +0000 (07:15 +0000)]
runtime: fix typo in loadFactor comment

Fixes #38174

Change-Id: Iacdbbcd0b4586302daf082e59d833b7aa58b1a6a
GitHub-Last-Rev: f0c96819ebb9928879a03957244f2de655708cbb
GitHub-Pull-Request: golang/go#38191
Reviewed-on: https://go-review.googlesource.com/c/go/+/226758
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
4 years agocmd/compile: don't inline reflect.Value.UnsafeAddr/Pointer if enable checkptr
Cuong Manh Le [Wed, 11 Mar 2020 05:51:44 +0000 (12:51 +0700)]
cmd/compile: don't inline reflect.Value.UnsafeAddr/Pointer if enable checkptr

Fixes #35073

Change-Id: I4b555bbc33d39a97544e6dd9c61d95ae212f472b
Reviewed-on: https://go-review.googlesource.com/c/go/+/222878
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years agocmd/compile: combine ssa.html columns with identical contents
Bradford Lamson-Scribner [Sun, 29 Mar 2020 19:17:46 +0000 (13:17 -0600)]
cmd/compile: combine ssa.html columns with identical contents

Combine columns in ssa.html output if they are identical. There
can now be multiple titles per column which are all clickable to
expand and collapse their column. Give collapsed columns some
padding for better readability. Some of the work in this CL was
started by Josh Bleecher Snyder and mailed to me in order to
continue to completion.

Updates #37766

Change-Id: I313b0917dc1bafe1eb99d91798ea915e5bcfaae9
Reviewed-on: https://go-review.googlesource.com/c/go/+/226209
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
4 years agoruntime: generate dummy duffcopy
Cherry Zhang [Tue, 31 Mar 2020 23:13:39 +0000 (19:13 -0400)]
runtime: generate dummy duffcopy

Although duffcopy is not used on PPC64, duff_ppc64x.s and
mkduff.go don't match. Make it so.

Fixes #38188.

Change-Id: Ic6c08e335795ea407880efd449f4229696af7744
Reviewed-on: https://go-review.googlesource.com/c/go/+/226719
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agocmd/compile: optimize len check when make slice
Cuong Manh Le [Tue, 31 Mar 2020 22:27:49 +0000 (05:27 +0700)]
cmd/compile: optimize len check when make slice

In CL 226278, we did:

if len < 0 { panicmakeslicelen }
if len > cap { panicmakeslicecap }

But due to the fact that cap is constrained to [0,2^31), so it is safe
to do:

if uint64(len) > cap {
    if len < 0 { panicmakeslicelen() }
    panicmakeslicecap()
}

save us a comparison in common case when len is within range.

Passes toolstash-check.

Change-Id: I0ebd52914ccde4cbb45f16c9e020b0c8f42e0663
Reviewed-on: https://go-review.googlesource.com/c/go/+/226737
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 years agocmd/compile: constant fold CtzNN
Josh Bleecher Snyder [Fri, 28 Feb 2020 20:36:03 +0000 (12:36 -0800)]
cmd/compile: constant fold CtzNN

Change-Id: I3ecd2c7ed3c8ae35c2bb9562aed09f7ade5c8cdd
Reviewed-on: https://go-review.googlesource.com/c/go/+/221609
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
4 years agocmd/compile: make isSmallMakeSlice checks slice cap only
Cuong Manh Le [Sat, 28 Mar 2020 18:19:50 +0000 (01:19 +0700)]
cmd/compile: make isSmallMakeSlice checks slice cap only

If slice cap is not set, it will be equal to slice len. So
isSmallMakeSlice only needs to check whether slice cap is constant.

While at it, also add test to make sure panicmakeslicecap is called
when make slice contains invalid non-constant len.

For this benchmark:

func BenchmarkMakeSliceNonConstantLen(b *testing.B) {
len := 1
for i := 0; i < b.N; i++ {
s := make([]int, len, 2)
_ = s

}
}

Result compare with parent:

name                        old time/op  new time/op  delta
MakeSliceNonConstantLen-12  18.4ns ± 1%   0.2ns ± 2%  -98.66%  (p=0.008 n=5+5)

Fixes #37975

Change-Id: I4bc926361bc2ffeab4cfaa888ef0a30cbc3b80e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/226278
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
4 years agocmd/compile, runtime: use more registers for amd64 write barrier calls
Josh Bleecher Snyder [Wed, 25 Mar 2020 05:14:02 +0000 (22:14 -0700)]
cmd/compile, runtime: use more registers for amd64 write barrier calls

The compiler-inserted write barrier calls use a special ABI
for speed and to minimize the binary size impact.

runtime.gcWriteBarrier takes its args in DI and AX.
This change adds gcWriteBarrier wrapper functions,
varying only in the register used for the second argument.
(Allowing variation in the first argument doesn't offer improvements,
which is convenient, as it avoids quadratic API growth.)
This reduces the number of register copies.

The goals are reduced binary size via reduced register pressure/copies.

One downside to this change is that when the write barrier is on,
we may bounce through several different write barrier wrappers,
which is bad for the instruction cache.

Package runtime write barrier benchmarks for this change:

name                old time/op  new time/op  delta
WriteBarrier-8      16.6ns ± 6%  15.6ns ± 6%  -5.73%  (p=0.000 n=97+99)
BulkWriteBarrier-8  4.37ns ± 7%  4.22ns ± 8%  -3.45%  (p=0.000 n=96+99)

However, I don't particularly trust these numbers.
I ran runtime.BenchmarkWriteBarrier multiple times as I rebased
this change, and noticed that the results have high variance
depending on the parent change, perhaps due to aligment.

This change was stress tested with GOGC=1 GODEBUG=gccheckmark=1 go test std.

This change reduces binary sizes:

file      before    after     Δ       %
addr2line 4308720   4296688   -12032  -0.279%
api       5965592   5945368   -20224  -0.339%
asm       5148088   5025464   -122624 -2.382%
buildid   2848760   2844904   -3856   -0.135%
cgo       4828968   4812840   -16128  -0.334%
compile   19754720  19529744  -224976 -1.139%
cover     5256840   5236600   -20240  -0.385%
dist      3670312   3658264   -12048  -0.328%
doc       4669608   4657576   -12032  -0.258%
fix       3377976   3365944   -12032  -0.356%
link      6614888   6586472   -28416  -0.430%
nm        4258368   4254528   -3840   -0.090%
objdump   4656336   4644304   -12032  -0.258%
pack      2295176   2295432   +256    +0.011%
pprof     14762356  14709364  -52992  -0.359%
test2json 2824456   2820600   -3856   -0.137%
trace     11684404  11643700  -40704  -0.348%
vet       8284760   8252248   -32512  -0.392%
total     115210328 114580040 -630288 -0.547%

This change improves compiler performance:

name        old time/op       new time/op       delta
Template          208ms ± 3%        207ms ± 3%  -0.40%  (p=0.030 n=43+44)
Unicode          80.2ms ± 3%       81.3ms ± 3%  +1.25%  (p=0.000 n=41+44)
GoTypes           699ms ± 3%        694ms ± 2%  -0.71%  (p=0.016 n=42+37)
Compiler          3.26s ± 2%        3.23s ± 2%  -0.86%  (p=0.000 n=43+45)
SSA               6.97s ± 1%        6.93s ± 1%  -0.63%  (p=0.000 n=43+45)
Flate             134ms ± 3%        133ms ± 2%    ~     (p=0.139 n=45+42)
GoParser          165ms ± 2%        164ms ± 1%  -0.79%  (p=0.000 n=45+40)
Reflect           434ms ± 4%        435ms ± 4%    ~     (p=0.937 n=44+44)
Tar               181ms ± 2%        181ms ± 2%    ~     (p=0.702 n=43+45)
XML               244ms ± 2%        244ms ± 2%    ~     (p=0.237 n=45+44)
[Geo mean]        403ms             402ms       -0.29%

name        old user-time/op  new user-time/op  delta
Template          271ms ± 2%        268ms ± 1%  -1.40%  (p=0.000 n=42+42)
Unicode           117ms ± 3%        116ms ± 5%    ~     (p=0.066 n=45+45)
GoTypes           948ms ± 2%        936ms ± 2%  -1.30%  (p=0.000 n=41+40)
Compiler          4.26s ± 1%        4.21s ± 2%  -1.25%  (p=0.000 n=37+45)
SSA               9.52s ± 2%        9.41s ± 1%  -1.18%  (p=0.000 n=44+45)
Flate             167ms ± 2%        165ms ± 2%  -1.15%  (p=0.000 n=44+41)
GoParser          201ms ± 2%        198ms ± 1%  -1.40%  (p=0.000 n=43+43)
Reflect           563ms ± 8%        560ms ± 7%    ~     (p=0.206 n=45+44)
Tar               224ms ± 2%        222ms ± 2%  -0.81%  (p=0.000 n=45+45)
XML               308ms ± 2%        304ms ± 1%  -1.17%  (p=0.000 n=42+43)
[Geo mean]        525ms             519ms       -1.08%

name        old alloc/op      new alloc/op      delta
Template         36.3MB ± 0%       36.3MB ± 0%    ~     (p=0.421 n=5+5)
Unicode          28.4MB ± 0%       28.3MB ± 0%    ~     (p=0.056 n=5+5)
GoTypes           121MB ± 0%        121MB ± 0%  -0.14%  (p=0.008 n=5+5)
Compiler          567MB ± 0%        567MB ± 0%  -0.06%  (p=0.016 n=4+5)
SSA              1.26GB ± 0%       1.26GB ± 0%  -0.07%  (p=0.008 n=5+5)
Flate            22.9MB ± 0%       22.8MB ± 0%    ~     (p=0.310 n=5+5)
GoParser         28.0MB ± 0%       27.9MB ± 0%  -0.09%  (p=0.008 n=5+5)
Reflect          78.4MB ± 0%       78.4MB ± 0%  -0.03%  (p=0.008 n=5+5)
Tar              34.2MB ± 0%       34.2MB ± 0%  -0.05%  (p=0.008 n=5+5)
XML              44.4MB ± 0%       44.4MB ± 0%  -0.04%  (p=0.016 n=5+5)
[Geo mean]       76.4MB            76.3MB       -0.05%

name        old allocs/op     new allocs/op     delta
Template           356k ± 0%         356k ± 0%  -0.13%  (p=0.008 n=5+5)
Unicode            326k ± 0%         326k ± 0%  -0.07%  (p=0.008 n=5+5)
GoTypes           1.24M ± 0%        1.24M ± 0%  -0.24%  (p=0.008 n=5+5)
Compiler          5.30M ± 0%        5.28M ± 0%  -0.34%  (p=0.008 n=5+5)
SSA               11.9M ± 0%        11.9M ± 0%  -0.16%  (p=0.008 n=5+5)
Flate              226k ± 0%         225k ± 0%  -0.12%  (p=0.008 n=5+5)
GoParser           287k ± 0%         286k ± 0%  -0.29%  (p=0.008 n=5+5)
Reflect            930k ± 0%         929k ± 0%  -0.05%  (p=0.008 n=5+5)
Tar                332k ± 0%         331k ± 0%  -0.12%  (p=0.008 n=5+5)
XML                411k ± 0%         411k ± 0%  -0.12%  (p=0.008 n=5+5)
[Geo mean]         771k              770k       -0.16%

For some packages, this change significantly reduces the size of executable text.
Examples:

file                                   before   after    Δ       %
cmd/internal/obj/arm.s                 68658    66855    -1803   -2.626%
cmd/internal/obj/mips.s                57486    56272    -1214   -2.112%
cmd/internal/obj/arm64.s               152107   147163   -4944   -3.250%
cmd/internal/obj/ppc64.s               125544   120456   -5088   -4.053%
cmd/vendor/golang.org/x/tools/go/cfg.s 31699    30742    -957    -3.019%

Full listing:

file                                                                     before   after    Δ       %
container/ring.s                                                         1890     1870     -20     -1.058%
container/list.s                                                         5366     5390     +24     +0.447%
internal/cpu.s                                                           3298     3295     -3      -0.091%
internal/testlog.s                                                       1507     1501     -6      -0.398%
image/color.s                                                            8281     8248     -33     -0.399%
runtime.s                                                                480970   480075   -895    -0.186%
sync.s                                                                   16497    16408    -89     -0.539%
internal/singleflight.s                                                  2591     2577     -14     -0.540%
math/rand.s                                                              10456    10438    -18     -0.172%
cmd/go/internal/par.s                                                    2801     2790     -11     -0.393%
internal/reflectlite.s                                                   28477    28417    -60     -0.211%
errors.s                                                                 2750     2736     -14     -0.509%
internal/oserror.s                                                       446      434      -12     -2.691%
sort.s                                                                   17061    17046    -15     -0.088%
io.s                                                                     17063    16999    -64     -0.375%
vendor/golang.org/x/crypto/hkdf.s                                        1962     1936     -26     -1.325%
text/tabwriter.s                                                         9617     9574     -43     -0.447%
hash/crc64.s                                                             3414     3408     -6      -0.176%
hash/crc32.s                                                             6657     6651     -6      -0.090%
bytes.s                                                                  31932    31863    -69     -0.216%
strconv.s                                                                53158    52799    -359    -0.675%
strings.s                                                                42829    42665    -164    -0.383%
encoding/ascii85.s                                                       4833     4791     -42     -0.869%
vendor/golang.org/x/text/transform.s                                     16810    16724    -86     -0.512%
path.s                                                                   6848     6845     -3      -0.044%
encoding/base32.s                                                        9658     9592     -66     -0.683%
bufio.s                                                                  23051    22908    -143    -0.620%
compress/bzip2.s                                                         11773    11764    -9      -0.076%
image.s                                                                  37565    37502    -63     -0.168%
syscall.s                                                                82359    82279    -80     -0.097%
regexp/syntax.s                                                          83573    82930    -643    -0.769%
image/jpeg.s                                                             36535    36490    -45     -0.123%
regexp.s                                                                 64396    64214    -182    -0.283%
time.s                                                                   82724    82622    -102    -0.123%
plugin.s                                                                 6539     6536     -3      -0.046%
context.s                                                                10959    10865    -94     -0.858%
internal/poll.s                                                          24286    24270    -16     -0.066%
reflect.s                                                                168304   167927   -377    -0.224%
internal/fmtsort.s                                                       7416     7376     -40     -0.539%
os.s                                                                     52465    51787    -678    -1.292%
cmd/go/internal/lockedfile/internal/filelock.s                           2326     2317     -9      -0.387%
os/signal.s                                                              4657     4648     -9      -0.193%
runtime/debug.s                                                          6040     5998     -42     -0.695%
encoding/binary.s                                                        30838    30801    -37     -0.120%
vendor/golang.org/x/net/route.s                                          23694    23491    -203    -0.857%
path/filepath.s                                                          17895    17889    -6      -0.034%
cmd/vendor/golang.org/x/sys/unix.s                                       78125    78109    -16     -0.020%
io/ioutil.s                                                              6999     6996     -3      -0.043%
encoding/base64.s                                                        12094    12007    -87     -0.719%
crypto/cipher.s                                                          20466    20372    -94     -0.459%
cmd/go/internal/robustio.s                                               2672     2669     -3      -0.112%
encoding/pem.s                                                           9302     9286     -16     -0.172%
internal/obscuretestdata.s                                               1719     1695     -24     -1.396%
crypto/aes.s                                                             11014    11002    -12     -0.109%
os/exec.s                                                                29388    29231    -157    -0.534%
cmd/internal/browser.s                                                   2266     2260     -6      -0.265%
internal/goroot.s                                                        4601     4592     -9      -0.196%
vendor/golang.org/x/crypto/chacha20poly1305.s                            8945     8942     -3      -0.034%
cmd/vendor/golang.org/x/crypto/ssh/terminal.s                            27226    27195    -31     -0.114%
index/suffixarray.s                                                      36431    36411    -20     -0.055%
fmt.s                                                                    77017    76709    -308    -0.400%
encoding/hex.s                                                           6241     6154     -87     -1.394%
compress/lzw.s                                                           7133     7069     -64     -0.897%
database/sql/driver.s                                                    18888    18877    -11     -0.058%
net/url.s                                                                29838    29739    -99     -0.332%
debug/plan9obj.s                                                         8329     8279     -50     -0.600%
encoding/csv.s                                                           12986    12902    -84     -0.647%
debug/gosym.s                                                            25403    25330    -73     -0.287%
compress/flate.s                                                         51192    50970    -222    -0.434%
vendor/golang.org/x/net/dns/dnsmessage.s                                 86769    86208    -561    -0.647%
compress/gzip.s                                                          9791     9758     -33     -0.337%
compress/zlib.s                                                          7310     7277     -33     -0.451%
archive/zip.s                                                            42356    42166    -190    -0.449%
debug/dwarf.s                                                            108259   107730   -529    -0.489%
encoding/json.s                                                          106378   105910   -468    -0.440%
os/user.s                                                                14751    14724    -27     -0.183%
database/sql.s                                                           99011    98404    -607    -0.613%
log.s                                                                    9466     9423     -43     -0.454%
debug/pe.s                                                               31272    31182    -90     -0.288%
debug/macho.s                                                            32764    32608    -156    -0.476%
encoding/gob.s                                                           136976   136517   -459    -0.335%
vendor/golang.org/x/text/unicode/bidi.s                                  27318    27276    -42     -0.154%
archive/tar.s                                                            71416    70975    -441    -0.618%
vendor/golang.org/x/net/http2/hpack.s                                    23892    23848    -44     -0.184%
vendor/golang.org/x/text/secure/bidirule.s                               3354     3351     -3      -0.089%
mime/quotedprintable.s                                                   5960     5925     -35     -0.587%
net/http/internal.s                                                      5874     5853     -21     -0.358%
math/big.s                                                               184147   183692   -455    -0.247%
debug/elf.s                                                              63775    63567    -208    -0.326%
mime.s                                                                   39802    39709    -93     -0.234%
encoding/xml.s                                                           111038   110713   -325    -0.293%
crypto/dsa.s                                                             6044     6029     -15     -0.248%
go/token.s                                                               12139    12077    -62     -0.511%
crypto/rand.s                                                            6889     6866     -23     -0.334%
go/scanner.s                                                             19030    19008    -22     -0.116%
flag.s                                                                   22320    22236    -84     -0.376%
vendor/golang.org/x/text/unicode/norm.s                                  66652    66391    -261    -0.392%
crypto/rsa.s                                                             31671    31650    -21     -0.066%
crypto/elliptic.s                                                        51553    51403    -150    -0.291%
internal/xcoff.s                                                         22950    22822    -128    -0.558%
go/constant.s                                                            43750    43689    -61     -0.139%
encoding/asn1.s                                                          57086    57035    -51     -0.089%
runtime/trace.s                                                          2609     2603     -6      -0.230%
crypto/x509/pkix.s                                                       10458    10471    +13     +0.124%
image/gif.s                                                              27544    27385    -159    -0.577%
vendor/golang.org/x/net/idna.s                                           24558    24502    -56     -0.228%
image/png.s                                                              42775    42685    -90     -0.210%
vendor/golang.org/x/crypto/cryptobyte.s                                  33616    33493    -123    -0.366%
go/ast.s                                                                 80684    80449    -235    -0.291%
net/internal/socktest.s                                                  16571    16535    -36     -0.217%
crypto/ecdsa.s                                                           11948    11936    -12     -0.100%
text/template/parse.s                                                    95138    94002    -1136   -1.194%
runtime/pprof.s                                                          59702    59639    -63     -0.106%
testing.s                                                                68427    68088    -339    -0.495%
internal/testenv.s                                                       5620     5596     -24     -0.427%
testing/internal/testdeps.s                                              3312     3294     -18     -0.543%
internal/trace.s                                                         78473    78239    -234    -0.298%
testing/iotest.s                                                         4968     4908     -60     -1.208%
os/signal/internal/pty.s                                                 3011     2990     -21     -0.697%
testing/quick.s                                                          12179    12125    -54     -0.443%
cmd/internal/bio.s                                                       9286     9274     -12     -0.129%
cmd/internal/src.s                                                       17684    17663    -21     -0.119%
cmd/internal/goobj2.s                                                    12588    12558    -30     -0.238%
cmd/internal/objabi.s                                                    16408    16390    -18     -0.110%
go/printer.s                                                             77417    77308    -109    -0.141%
go/parser.s                                                              80045    79113    -932    -1.164%
go/format.s                                                              5434     5419     -15     -0.276%
cmd/internal/goobj.s                                                     26146    25954    -192    -0.734%
runtime/pprof/internal/profile.s                                         102518   102178   -340    -0.332%
text/template.s                                                          95343    94935    -408    -0.428%
cmd/internal/dwarf.s                                                     31718    31572    -146    -0.460%
cmd/vendor/golang.org/x/arch/arm/armasm.s                                45240    45151    -89     -0.197%
internal/lazytemplate.s                                                  1470     1457     -13     -0.884%
cmd/vendor/golang.org/x/arch/ppc64/ppc64asm.s                            37253    37220    -33     -0.089%
cmd/asm/internal/flags.s                                                 2593     2590     -3      -0.116%
cmd/asm/internal/lex.s                                                   25068    24921    -147    -0.586%
cmd/internal/buildid.s                                                   18536    18263    -273    -1.473%
cmd/vendor/golang.org/x/arch/x86/x86asm.s                                80209    80105    -104    -0.130%
go/doc.s                                                                 75140    74585    -555    -0.739%
cmd/internal/edit.s                                                      3893     3899     +6      +0.154%
html/template.s                                                          89377    88809    -568    -0.636%
cmd/vendor/golang.org/x/arch/arm64/arm64asm.s                            117998   117824   -174    -0.147%
cmd/internal/obj.s                                                       115015   114290   -725    -0.630%
go/build.s                                                               69379    68862    -517    -0.745%
cmd/internal/objfile.s                                                   48106    47982    -124    -0.258%
cmd/cover.s                                                              46239    46113    -126    -0.272%
cmd/addr2line.s                                                          2845     2833     -12     -0.422%
cmd/internal/obj/arm.s                                                   68658    66855    -1803   -2.626%
cmd/internal/obj/mips.s                                                  57486    56272    -1214   -2.112%
cmd/internal/obj/riscv.s                                                 63834    63006    -828    -1.297%
cmd/compile/internal/syntax.s                                            146582   145456   -1126   -0.768%
cmd/internal/obj/wasm.s                                                  44117    44066    -51     -0.116%
cmd/cgo.s                                                                242645   241653   -992    -0.409%
cmd/internal/obj/arm64.s                                                 152107   147163   -4944   -3.250%
net.s                                                                    295972   292010   -3962   -1.339%
go/types.s                                                               321371   319432   -1939   -0.603%
vendor/golang.org/x/net/http/httpproxy.s                                 9450     9423     -27     -0.286%
net/textproto.s                                                          19455    19406    -49     -0.252%
cmd/internal/obj/ppc64.s                                                 125544   120456   -5088   -4.053%
go/internal/srcimporter.s                                                6475     6409     -66     -1.019%
log/syslog.s                                                             8017     7929     -88     -1.098%
cmd/compile/internal/logopt.s                                            10183    10162    -21     -0.206%
net/mail.s                                                               24085    23948    -137    -0.569%
mime/multipart.s                                                         21527    21420    -107    -0.497%
cmd/internal/obj/s390x.s                                                 127610   127757   +147    +0.115%
go/internal/gcimporter.s                                                 34913    34548    -365    -1.045%
vendor/golang.org/x/net/nettest.s                                        28103    28016    -87     -0.310%
cmd/go/internal/cfg.s                                                    9967     9916     -51     -0.512%
cmd/api.s                                                                39703    39603    -100    -0.252%
go/internal/gccgoimporter.s                                              56470    56120    -350    -0.620%
go/importer.s                                                            2077     2056     -21     -1.011%
cmd/compile/internal/types.s                                             48202    47282    -920    -1.909%
cmd/go/internal/str.s                                                    4341     4320     -21     -0.484%
cmd/internal/obj/x86.s                                                   89440    88625    -815    -0.911%
cmd/go/internal/base.s                                                   12667    12580    -87     -0.687%
cmd/go/internal/cache.s                                                  30754    30571    -183    -0.595%
cmd/doc.s                                                                62976    62755    -221    -0.351%
cmd/go/internal/search.s                                                 20114    19993    -121    -0.602%
cmd/vendor/golang.org/x/xerrors.s                                        17923    17855    -68     -0.379%
cmd/go/internal/lockedfile.s                                             16451    16415    -36     -0.219%
cmd/vendor/golang.org/x/mod/sumdb/note.s                                 18200    18150    -50     -0.275%
cmd/vendor/golang.org/x/mod/module.s                                     17869    17851    -18     -0.101%
cmd/asm/internal/arch.s                                                  37533    37482    -51     -0.136%
cmd/fix.s                                                                87728    87492    -236    -0.269%
cmd/vendor/golang.org/x/mod/sumdb/tlog.s                                 36394    36367    -27     -0.074%
cmd/vendor/golang.org/x/mod/sumdb/dirhash.s                              4990     4963     -27     -0.541%
cmd/go/internal/imports.s                                                16499    16469    -30     -0.182%
cmd/vendor/golang.org/x/mod/zip.s                                        18816    18745    -71     -0.377%
cmd/go/internal/cmdflag.s                                                5126     5123     -3      -0.059%
cmd/internal/test2json.s                                                 9540     9452     -88     -0.922%
cmd/go/internal/tool.s                                                   3629     3623     -6      -0.165%
cmd/go/internal/version.s                                                11232    11220    -12     -0.107%
cmd/go/internal/mvs.s                                                    25383    25179    -204    -0.804%
cmd/nm.s                                                                 5815     5803     -12     -0.206%
cmd/dist.s                                                               210146   209140   -1006   -0.479%
cmd/asm/internal/asm.s                                                   68655    68549    -106    -0.154%
cmd/vendor/golang.org/x/mod/modfile.s                                    72974    72510    -464    -0.636%
cmd/go/internal/load.s                                                   107548   106861   -687    -0.639%
cmd/link/internal/sym.s                                                  18708    18581    -127    -0.679%
cmd/asm.s                                                                3367     3343     -24     -0.713%
cmd/gofmt.s                                                              30795    30698    -97     -0.315%
cmd/link/internal/objfile.s                                              21828    21630    -198    -0.907%
cmd/pack.s                                                               14878    14869    -9      -0.060%
cmd/vendor/github.com/google/pprof/internal/elfexec.s                    6788     6782     -6      -0.088%
cmd/test2json.s                                                          1647     1641     -6      -0.364%
cmd/link/internal/loader.s                                               48677    48483    -194    -0.399%
cmd/vendor/golang.org/x/tools/go/analysis/internal/analysisflags.s       16783    16773    -10     -0.060%
cmd/link/internal/loadelf.s                                              35464    35126    -338    -0.953%
cmd/link/internal/loadmacho.s                                            29438    29180    -258    -0.876%
cmd/link/internal/loadpe.s                                               16440    16371    -69     -0.420%
cmd/vendor/golang.org/x/tools/go/analysis/passes/internal/analysisutil.s 2106     2100     -6      -0.285%
cmd/link/internal/loadxcoff.s                                            11711    11615    -96     -0.820%
cmd/vendor/golang.org/x/tools/go/analysis/internal/facts.s               14954    14883    -71     -0.475%
cmd/vendor/golang.org/x/tools/go/ast/inspector.s                         5394     5374     -20     -0.371%
cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl.s               37029    36822    -207    -0.559%
cmd/vendor/golang.org/x/tools/go/analysis/passes/inspect.s               340      337      -3      -0.882%
cmd/vendor/golang.org/x/tools/go/analysis/passes/cgocall.s               9919     9858     -61     -0.615%
cmd/vendor/golang.org/x/tools/go/analysis/passes/bools.s                 6705     6690     -15     -0.224%
cmd/vendor/golang.org/x/tools/go/analysis/passes/copylock.s              9783     9741     -42     -0.429%
cmd/vendor/golang.org/x/tools/go/cfg.s                                   31699    30742    -957    -3.019%
cmd/vendor/golang.org/x/tools/go/analysis/passes/ifaceassert.s           2768     2762     -6      -0.217%
cmd/vendor/golang.org/x/tools/go/analysis/passes/loopclosure.s           3031     2998     -33     -1.089%
cmd/vendor/golang.org/x/tools/go/analysis/passes/shift.s                 4382     4376     -6      -0.137%
cmd/vendor/golang.org/x/tools/go/analysis/passes/stdmethods.s            8654     8642     -12     -0.139%
cmd/vendor/golang.org/x/tools/go/analysis/passes/stringintconv.s         3458     3446     -12     -0.347%
cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag.s             8011     7995     -16     -0.200%
cmd/vendor/golang.org/x/tools/go/analysis/passes/tests.s                 6205     6193     -12     -0.193%
cmd/vendor/golang.org/x/tools/go/ast/astutil.s                           66183    65861    -322    -0.487%
cmd/vendor/github.com/google/pprof/profile.s                             150844   150261   -583    -0.386%
cmd/vendor/golang.org/x/tools/go/analysis/passes/unreachable.s           8057     8054     -3      -0.037%
cmd/vendor/golang.org/x/tools/go/analysis/passes/unusedresult.s          3670     3667     -3      -0.082%
cmd/vendor/github.com/google/pprof/internal/measurement.s                10464    10440    -24     -0.229%
cmd/vendor/golang.org/x/tools/go/types/typeutil.s                        12319    12274    -45     -0.365%
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.s                  13503    13342    -161    -1.192%
cmd/vendor/golang.org/x/tools/go/analysis/passes/ctrlflow.s              5261     5218     -43     -0.817%
cmd/vendor/golang.org/x/tools/go/analysis/passes/errorsas.s              1462     1459     -3      -0.205%
cmd/vendor/golang.org/x/tools/go/analysis/passes/lostcancel.s            9594     9582     -12     -0.125%
cmd/vendor/golang.org/x/tools/go/analysis/passes/printf.s                34397    34338    -59     -0.172%
cmd/vendor/github.com/google/pprof/internal/graph.s                      53225    52936    -289    -0.543%
cmd/vendor/github.com/ianlancetaylor/demangle.s                          177450   175329   -2121   -1.195%
crypto/x509.s                                                            147892   147388   -504    -0.341%
cmd/go/internal/work.s                                                   306465   304950   -1515   -0.494%
cmd/go/internal/run.s                                                    4664     4657     -7      -0.150%
crypto/tls.s                                                             313130   311833   -1297   -0.414%
net/http/httptrace.s                                                     3979     3905     -74     -1.860%
net/smtp.s                                                               14413    14344    -69     -0.479%
cmd/link/internal/ld.s                                                   545343   542279   -3064   -0.562%
cmd/link/internal/mips.s                                                 6218     6215     -3      -0.048%
cmd/link/internal/mips64.s                                               6108     6103     -5      -0.082%
cmd/link/internal/amd64.s                                                18154    18112    -42     -0.231%
cmd/link/internal/arm64.s                                                22527    22494    -33     -0.146%
cmd/link/internal/arm.s                                                  22574    22494    -80     -0.354%
cmd/link/internal/s390x.s                                                20779    20746    -33     -0.159%
cmd/link/internal/wasm.s                                                 16531    16493    -38     -0.230%
cmd/link/internal/x86.s                                                  18906    18849    -57     -0.301%
cmd/link/internal/ppc64.s                                                26856    26778    -78     -0.290%
net/http.s                                                               559101   556513   -2588   -0.463%
net/http/cookiejar.s                                                     15912    15885    -27     -0.170%
expvar.s                                                                 9531     9525     -6      -0.063%
net/http/httptest.s                                                      16616    16475    -141    -0.849%
net/http/cgi.s                                                           23624    23458    -166    -0.703%
cmd/go/internal/web.s                                                    16546    16489    -57     -0.344%
cmd/vendor/golang.org/x/mod/sumdb.s                                      33197    33117    -80     -0.241%
net/http/fcgi.s                                                          19266    19169    -97     -0.503%
net/http/httputil.s                                                      39875    39728    -147    -0.369%
cmd/vendor/github.com/google/pprof/internal/symbolz.s                    5888     5867     -21     -0.357%
net/rpc.s                                                                34154    34003    -151    -0.442%
cmd/vendor/github.com/google/pprof/internal/transport.s                  2746     2716     -30     -1.092%
cmd/vendor/github.com/google/pprof/internal/binutils.s                   35999    35875    -124    -0.344%
net/rpc/jsonrpc.s                                                        6637     6598     -39     -0.588%
cmd/vendor/github.com/google/pprof/internal/symbolizer.s                 11533    11458    -75     -0.650%
cmd/go/internal/get.s                                                    62921    62803    -118    -0.188%
cmd/vendor/github.com/google/pprof/internal/report.s                     80364    80058    -306    -0.381%
cmd/go/internal/modfetch/codehost.s                                      89680    89066    -614    -0.685%
cmd/trace.s                                                              117171   116701   -470    -0.401%
cmd/vendor/github.com/google/pprof/internal/driver.s                     144268   143297   -971    -0.673%
cmd/go/internal/modfetch.s                                               126299   125860   -439    -0.348%
cmd/vendor/github.com/google/pprof/driver.s                              9042     9000     -42     -0.464%
cmd/go/internal/modconv.s                                                17947    17889    -58     -0.323%
cmd/pprof.s                                                              12399    12326    -73     -0.589%
cmd/go/internal/modload.s                                                151182   150389   -793    -0.525%
cmd/go/internal/generate.s                                               11738    11636    -102    -0.869%
cmd/go/internal/help.s                                                   6571     6531     -40     -0.609%
cmd/go/internal/clean.s                                                  11174    11142    -32     -0.286%
cmd/go/internal/vet.s                                                    7897     7867     -30     -0.380%
cmd/go/internal/envcmd.s                                                 22176    22095    -81     -0.365%
cmd/go/internal/list.s                                                   15216    15067    -149    -0.979%
cmd/go/internal/modget.s                                                 38698    38519    -179    -0.463%
cmd/go/internal/modcmd.s                                                 46674    46441    -233    -0.499%
cmd/go/internal/test.s                                                   64664    64456    -208    -0.322%
cmd/go.s                                                                 6730     6703     -27     -0.401%
cmd/compile/internal/ssa.s                                               3592565  3582500  -10065  -0.280%
cmd/compile/internal/gc.s                                                1549123  1537123  -12000  -0.775%
cmd/compile/internal/riscv64.s                                           14579    14483    -96     -0.658%
cmd/compile/internal/mips.s                                              20578    20419    -159    -0.773%
cmd/compile/internal/ppc64.s                                             25524    25359    -165    -0.646%
cmd/compile/internal/mips64.s                                            19795    19636    -159    -0.803%
cmd/compile/internal/wasm.s                                              13329    13290    -39     -0.293%
cmd/compile/internal/s390x.s                                             28097    27892    -205    -0.730%
cmd/compile/internal/arm.s                                               31489    31321    -168    -0.534%
cmd/compile/internal/arm64.s                                             29803    29590    -213    -0.715%
cmd/compile/internal/amd64.s                                             32961    33221    +260    +0.789%
cmd/compile/internal/x86.s                                               31029    30878    -151    -0.487%
total                                                                    18534966 18440341 -94625  -0.511%

Change-Id: I830d37364f14f0297800adc42c99f60a74c51aca
Reviewed-on: https://go-review.googlesource.com/c/go/+/226367
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
4 years agocmd/compile: fix constant conversion involving complex types
Matthew Dempsky [Fri, 27 Mar 2020 21:33:54 +0000 (14:33 -0700)]
cmd/compile: fix constant conversion involving complex types

In CL 187657, I refactored constant conversion logic without realizing
that conversions between int/float and complex types are allowed for
constants (assuming the constant values are representable by the
destination type), but are never allowed for non-constant expressions.

This CL expands convertop to take an extra srcConstant parameter to
indicate whether the source expression is a constant; and if so, to
allow any numeric-to-numeric conversion. (Conversions of values that
cannot be represented in the destination type are rejected by
evconst.)

Fixes #38117.

Change-Id: Id7077d749a14c8fd910be38da170fa5254819f2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/226197
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
4 years agocmd/go: add support for GOPROXY fallback on unexpected errors
Jay Conrod [Thu, 12 Mar 2020 22:56:40 +0000 (18:56 -0400)]
cmd/go: add support for GOPROXY fallback on unexpected errors

URLs in GOPROXY may now be separated with commas (,) or pipes (|). If
a request to a proxy fails with any error (including connection errors
and timeouts) and the proxy URL is followed by a pipe, the go command
will try the request with the next proxy in the list. If the proxy is
followed by a comma, the go command will only try the next proxy if
the error a 404 or 410 HTTP response.

The go command will determine how to connect to the checksum database
using the same logic. Before accessing the checksum database, the go
command sends a request to <proxyURL>/sumdb/<sumdb-name>/supported.
If a proxy responds with 404 or 410, or if any other error occurs and
the proxy URL in GOPROXY is followed by a pipe, the go command will
try the request with the next proxy. If all proxies respond with 404
or 410 or are configured to fall back on errors, the go command will
connect to the checksum database directly.

This CL does not change the default value or meaning of GOPROXY.

Fixes #37367

Change-Id: I35dd218823fe8cb9383e9ac7bbfec2cc8a358748
Reviewed-on: https://go-review.googlesource.com/c/go/+/226460
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
4 years agoos/signal: make TestStop resilient to initially-blocked signals
Bryan C. Mills [Mon, 30 Mar 2020 19:43:08 +0000 (15:43 -0400)]
os/signal: make TestStop resilient to initially-blocked signals

For reasons unknown, SIGUSR1 appears to be blocked at process start
for tests on the android-arm-corellium and android-arm64-corellium
builders. (This has been observed before, too: see CL 203957.)
Make the test resilient to blocked signals by always calling Notify
and waiting for potential signal delivery after sending any signal
that is not known to be unblocked.

Also remove the initial SIGWINCH signal from testCancel. The behavior
of an unhandled SIGWINCH is already tested in TestStop, so we don't
need to re-test that same case: waiting for an unhandled signal takes
a comparatively long time (because we necessarily don't know when it
has been delivered), so this redundancy makes the overall test binary
needlessly slow, especially since it is called from both TestReset and
TestIgnore.

Since each signal is always unblocked while we have a notification
channel registered for it, we don't need to modify any other tests:
TestStop and testCancel are the only functions that send signals
without a registered channel.

Fixes #38165
Updates #33174
Updates #15661

Change-Id: I215880894e954b62166024085050d34323431b63
Reviewed-on: https://go-review.googlesource.com/c/go/+/226461
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agoruntime: skip gdb tests on Plan 9
Richard Miller [Tue, 31 Mar 2020 18:44:19 +0000 (19:44 +0100)]
runtime: skip gdb tests on Plan 9

There's no gdb on Plan 9.

Change-Id: Ibeb0fbd3c096a69181c19b1fb2bc6291612b6da3
Reviewed-on: https://go-review.googlesource.com/c/go/+/226657
Reviewed-by: David du Colombier <0intro@gmail.com>
4 years agonet/http: treat a nil Body from a custom RoundTripper as an empty one
Bryan C. Mills [Fri, 27 Mar 2020 01:28:37 +0000 (21:28 -0400)]
net/http: treat a nil Body from a custom RoundTripper as an empty one

Fixes #38095

Change-Id: I4f65ce01e7aed22240eee979c41535d0b8b9a8dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/225717
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
4 years agocontext: fix a flaky timeout in TestLayersTimeout
Bryan C. Mills [Mon, 30 Mar 2020 18:04:08 +0000 (14:04 -0400)]
context: fix a flaky timeout in TestLayersTimeout

In CL 223019, I reduced the short timeout in the testLayers helper to
be even shorter than it was. That exposed a racy (time-dependent)
select later in the function, which failed in one of the slower
builders (android-386-emu).

Also streamline the test to make it easier to test with a very high -count flag:
- Run tests that sleep for shortDuration in parallel to reduce latency.
- Use shorter durations in examples to reduce test running time.
- Avoid mutating global state (in package math/rand) in testLayers.

After this change (but not before it),
'go test -run=TestLayersTimeout -count=100000 context' passes on my workstation.

Fixes #38161

Change-Id: Iaf4abe7ac308b2100d8828267cda9f4f8ae4be82
Reviewed-on: https://go-review.googlesource.com/c/go/+/226457
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agocrypto/rsa: reject invalid length PKCS#1v1.5 signatures
Roland Shoemaker [Sun, 29 Mar 2020 03:04:51 +0000 (03:04 +0000)]
crypto/rsa: reject invalid length PKCS#1v1.5 signatures

Per RFC 8017, reject signatures which are not the same length as the RSA
modulus. This matches the behavior of SignPKCS1v15 which properly left pads
the signatures it generates to the size of the modulus.

Fixes #21896

Change-Id: I2c42a0b24cf7fff158ece604b6f0c521a856d932
GitHub-Last-Rev: 6040f7990633630a0ad157cb17e016bb7db98a27
GitHub-Pull-Request: golang/go#38140
Reviewed-on: https://go-review.googlesource.com/c/go/+/226203
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agoRevert "cmd/asm: align an instruction or a function's address"
Bryan C. Mills [Tue, 31 Mar 2020 15:35:28 +0000 (15:35 +0000)]
Revert "cmd/asm: align an instruction or a function's address"

This reverts CL 212767.

Reason for revert: new test is persistently failing on freebsd-arm64-dmgk builder.

Change-Id: Ifd1227628e0e747688ddb4dc580170b2a103a89e
Reviewed-on: https://go-review.googlesource.com/c/go/+/226597
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agocmd/asm,cmd/internal/obj/riscv: provide branch pseudo-instructions
Joel Sing [Mon, 30 Mar 2020 14:57:52 +0000 (01:57 +1100)]
cmd/asm,cmd/internal/obj/riscv: provide branch pseudo-instructions

Implement various branch pseudo-instructions for riscv64. These make it easier
to read/write assembly and will also make it easier for the compiler to generate
optimised code.

Change-Id: Ic31a7748c0e1495522ebecf34b440842b8d12c04
Reviewed-on: https://go-review.googlesource.com/c/go/+/226397
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agoruntime, internal/poll: name error codes
Ian Lance Taylor [Tue, 31 Mar 2020 01:25:47 +0000 (18:25 -0700)]
runtime, internal/poll: name error codes

Use explicit names for the error code returned by pollReset
and pollWait, rather than just 0, 1, 2, 3.

Change-Id: I0ab12cae57693deab7cca9cdd2fadd597e23a956
Reviewed-on: https://go-review.googlesource.com/c/go/+/226537
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
4 years agocmd/asm: align an instruction or a function's address
fanzha02 [Thu, 19 Dec 2019 08:15:06 +0000 (08:15 +0000)]
cmd/asm: align an instruction or a function's address

Recently, the gVisor project needs an instruction's address
with 128 bytes alignment and a function's start address with
2K bytes alignment to fit the architecture requirement for
interrupt table.

This patch allows aligning the address of an instruction to be
aligned to a specific value (2^n and not higher than 2048) and
the address of a function to be 2048 bytes.

The main changes include:

1. Adds ALIGN2048 flag to align a function's address with
2048 bytes.
e.g. "TEXT ·Add(SB),NOSPLIT|ALIGN2048" indicates that the
address of Add function should be aligned to 2048 bytes.

2. Adds a new element in the FuncInfo structure defined in
cmd/internal/obj/link.go file to record the alignment
information.

3. Adds a new element in the Func structure defined in
cmd/internal/goobj/read.go file to read the alignment
information.

4. Because go introduces a new object file format, also add
a new element in the FuncInfo structure defined in
cmd/internal/goobj2/funcinfo.go to record the alignment
information.

5. Adds the assembler support to align an intruction's offset
with a specific value (2^n and not higher than 2048).
e.g. "PCALIGN $256" indicates that the next instruction should
be aligned to 256 bytes.

This CL also adds a test.

Change-Id: I31cfa6fb5bc35dee2c44bf65913e90cddfcb492a
Reviewed-on: https://go-review.googlesource.com/c/go/+/212767
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agoos/signal: in TestStop, skip the final "unexpected signal" check for SIGUSR1 on Android
Bryan C. Mills [Mon, 30 Mar 2020 19:01:33 +0000 (15:01 -0400)]
os/signal: in TestStop, skip the final "unexpected signal" check for SIGUSR1 on Android

In CL 226138, I updated TestStop to have more uniform behavior for its signals.
However, that test seems to always fail for SIGUSR1 on the Android ARM builders.

I'm not sure what's special about Android for this particular case,
but let's skip the test to unbreak the builders while I investigate.

For #38165
Updates #33174

Change-Id: I35a70346cd9757a92acd505a020bf95e6871405c
Reviewed-on: https://go-review.googlesource.com/c/go/+/226458
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agocmd/objdump: test disassembly on ARM and ARM64
Cherry Zhang [Mon, 30 Mar 2020 19:11:52 +0000 (15:11 -0400)]
cmd/objdump: test disassembly on ARM and ARM64

We support disassembly on both ARM and ARM64. Tests are only
enabled on one or the other. This CL enables both.

Change-Id: If89d78b975c241c2b14f72b714dcdc771b4b382c
Reviewed-on: https://go-review.googlesource.com/c/go/+/226459
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
4 years agocmd/compile: avoid zero extensions after 32-bit shifts
Giovanni Bajo [Sun, 29 Mar 2020 12:21:12 +0000 (14:21 +0200)]
cmd/compile: avoid zero extensions after 32-bit shifts

zeroUpper32Bits wasn't checking for shift-extension ops. This would not
check shifts that were marking as bounded by prove (normally, shifts
are wrapped in a sequence that ends with an ANDL, and zeroUpper32Bits
would see the ANDL).

This produces no changes on generated output right now, but will be
important once CL196679 lands because many shifts will be marked
as bounded, and lower will stop generating the masking code sequence
around them.

Change-Id: Iaea94acc5b60bb9a5021c9fb7e4a1e2e5244435e
Reviewed-on: https://go-review.googlesource.com/c/go/+/226338
Reviewed-by: Keith Randall <khr@golang.org>
4 years agocmd/cgo, misc/cgo: only cache anonymous struct typedefs with parent name
Tobias Klauser [Sun, 29 Mar 2020 22:38:09 +0000 (00:38 +0200)]
cmd/cgo, misc/cgo: only cache anonymous struct typedefs with parent name

CL 181857 broke the translation of certain C types using cmd/cgo -godefs
because it stores each typedef, array and qualified type with their
parent type name in the translation cache.

Fix this by only considering the parent type for typedefs of anonymous
structs which is the only case where types might become ambiguous.

Updates #31891
Fixes #37479
Fixes #37621

Change-Id: I301a749ec89585789cb0d213593bb8b7341beb88
Reviewed-on: https://go-review.googlesource.com/c/go/+/226341
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agoos/signal: rework test timeouts and concurrency
Bryan C. Mills [Fri, 27 Mar 2020 19:04:09 +0000 (15:04 -0400)]
os/signal: rework test timeouts and concurrency

Use a uniform function (named “quiesce”) to wait for possible signals
in a way that gives the kernel many opportunities to deliver them.

Simplify channel usage and concurrency in stress tests.

Use (*testing.T).Deadline instead of parsing the deadline in TestMain.

In TestStop, sleep forever in a loop if we expect the test to die from
a signal. That should reduce the flakiness of TestNohup, since
TestStop will no longer spuriously pass when run as a subprocess of
TestNohup.

Since independent signals should not interfere, run the different
signals in TestStop in parallel when testing in short mode.

Since TestNohup runs TestStop as a subprocess, and TestStop needs to
wait many times for signals to quiesce, run its test subprocesses
concurrently and in short mode — reducing the latency of that test by
more than a factor of 2.

The above two changes reduce the running time of TestNohup on my
workstation to ~345ms, making it possible to run much larger counts of
the test in the same amount of wall time. If the test remains flaky
after this CL, we can spend all or part of that latency improvement on
a longer settle time.

Updates #33174

Change-Id: I09206f213d8c1888b50bf974f965221a5d482419
Reviewed-on: https://go-review.googlesource.com/c/go/+/226138
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agocmd/compile: fix ephemeral pointer problem on amd64
Keith Randall [Sat, 28 Mar 2020 05:03:33 +0000 (22:03 -0700)]
cmd/compile: fix ephemeral pointer problem on amd64

Make sure we don't use the rewrite ptr + (c + x) -> c + (ptr + x), as
that may create an ephemeral out-of-bounds pointer.

I have not seen an actual bug caused by this yet, but we've seen
them in the 386 port so I'm fixing this issue for amd64 as well.

The load-combining rules needed to be reworked somewhat to still
work without the above broken rule.

Update #37881

Change-Id: I8046d170e89e2035195f261535e34ca7d8aca68a
Reviewed-on: https://go-review.googlesource.com/c/go/+/226437
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agocmd/objdump: add support for -gnu option on Go objdump
Lynn Boger [Wed, 25 Mar 2020 17:47:43 +0000 (13:47 -0400)]
cmd/objdump: add support for -gnu option on Go objdump

This adds support for the -gnu option on Go objdump. When
this option is used, then output will include gnu
assembly in comments alongside the Go assembly.

The objdump test was updated to test this new option.

This option is supported for the arches found in
golang.org/x that provide the GNUsyntax function.

Updates #34372

Change-Id: I9e60e1691526607dda3c857c4564dcef408b8391
Reviewed-on: https://go-review.googlesource.com/c/go/+/225459
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agoruntime: check the correct sanity condition in the page allocator
Michael Anthony Knyszek [Sat, 28 Mar 2020 16:11:15 +0000 (16:11 +0000)]
runtime: check the correct sanity condition in the page allocator

Currently there are a few sanity checks in the page allocator which
should fail immediately but because it's a check for a negative number
on a uint, it's actually dead-code.

If there's a bug in the page allocator which would cause the sanity
check to fail, this could cause memory corruption by returning an
invalid address (more precisely, one might either see a segfault, or
span overlap).

This change fixes these sanity checks to check the correct condition.

Fixes #38130.

Change-Id: Ia19786cece783d39f26df24dec8788833a6a3f21
Reviewed-on: https://go-review.googlesource.com/c/go/+/226297
Reviewed-by: Giovanni Bajo <rasky@develer.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agostrings: make variable/type association consistent in function signatures
Alexander Greim [Sun, 29 Mar 2020 15:10:44 +0000 (17:10 +0200)]
strings: make variable/type association consistent in function signatures

The type annotation of some trim functions are inconsistent with all
other function signatures of the strings package.

Example:
func TrimRight(s string, cutset string) string

To be:
func TrimRight(s, cutset string) string

Change-Id: I456a33287bfb4ad6a7962e30a6424f209ac320c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/226339
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agonet/http: use DOMException.message property in error text
Dmitri Shuralyov [Sun, 29 Mar 2020 03:25:18 +0000 (23:25 -0400)]
net/http: use DOMException.message property in error text

Previously, details about the underlying fetch error
were not visible in the net/http error text:

net/http: fetch() failed: <object>

When using the message property, they are:

net/http: fetch() failed: Failed to fetch
net/http: fetch() failed: The user aborted a request.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/DOMException/message.

Change-Id: Iecf7c6bac01abb164731a4d5c9af6582c250a1a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/226205
Reviewed-by: Johan Brandhorst <johan.brandhorst@gmail.com>
4 years agodoc: fix path to make.bash
Michał Łowicki [Sun, 29 Mar 2020 16:59:08 +0000 (17:59 +0100)]
doc: fix path to make.bash

Change-Id: I78c7197b8b93590470a782b492bba177a14d80ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/226340
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agotest, test/fixedbugs, crypto/x509, go/internal/gccgoimporter: fix typos
alex-semenyuk [Sun, 29 Mar 2020 08:12:06 +0000 (08:12 +0000)]
test, test/fixedbugs, crypto/x509, go/internal/gccgoimporter: fix typos

Change-Id: Ie2d605ca8cc3bde2e26c6865642ff4e6412cd075
GitHub-Last-Rev: ce5c3ba369b2ef476e7c63e4404baa256584f357
GitHub-Pull-Request: golang/go#38137
Reviewed-on: https://go-review.googlesource.com/c/go/+/226201
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agodatabase/sql: add test for Conn.Validator interface
Daniel Theophanes [Wed, 18 Mar 2020 17:03:51 +0000 (10:03 -0700)]
database/sql: add test for Conn.Validator interface

This addresses comments made by Russ after
https://golang.org/cl/174122 was merged. It addes a test
for the connection validator and renames the interface to just
"Validator".

Change-Id: Iea53e9b250c9be2e86e9b75906e7353e26437c5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/223963
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
4 years agodoc: decrease prominence of GOROOT_BOOTSTRAP
Giovanni Bajo [Sat, 21 Mar 2020 12:22:14 +0000 (13:22 +0100)]
doc: decrease prominence of GOROOT_BOOTSTRAP

Go build scripts on UNIX (make.bash, all.bash) have not required
GOROOT_BOOTSTRAP since August 2017 (CL 57753). Windows build scripts
have followed suit since CL 96455. Most people building Go will have
a Go toolchain in their PATH and will not need to specify a different
toolchain.

This CL removes the GOROOT_BOOTSTRAP mention from the contribution guide
(it was there for Windows only, but it's not required anymore). The guide
is meant to be light and clear for beginners and is not supposed to be
a reference, so there's not need to keep mentioning GOROOT_BOOTSTRAP.

Also update install-source.html to reflect the current status quo,
where using the PATH is probably the first and most used default, and
GOROOT_BOOTSTRAP is just an option.

Change-Id: Iab453e61b0c749c256aaaf81ea9b2ae58822cb89
Reviewed-on: https://go-review.googlesource.com/c/go/+/224717
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
4 years agoruntime: avoid racing on pendingUpdates in AIX netpollBreak
Ian Lance Taylor [Sat, 28 Mar 2020 00:37:37 +0000 (17:37 -0700)]
runtime: avoid racing on pendingUpdates in AIX netpollBreak

Instead of calling netpollwakeup, just do the write in netpollBreak.
Use the same signaling we now use in other netpollBreak instances.

Change-Id: I53a65c22862ecc8484aee91d0e1ffb21a9e62d8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/226199
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
4 years agotime: remove some unnecessary/duplicated global slices
PetarDambovaliev [Sat, 28 Mar 2020 08:00:17 +0000 (08:00 +0000)]
time: remove some unnecessary/duplicated global slices

Removes two variables:

- days which is unused, and similar usage provided by longDayNames
- months in favour of using longMonthNames

Fixes #36359

Change-Id: I51b6b7408db9359c658462ba73e59ed432f655a6
GitHub-Last-Rev: 778d3ea157d363fcb5bced6d318381b44a1cac50
GitHub-Pull-Request: golang/go#36372
Reviewed-on: https://go-review.googlesource.com/c/go/+/213177
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agoRevert "runtime: lock mtxpoll in AIX netpollBreak"
Ian Lance Taylor [Sat, 28 Mar 2020 00:21:57 +0000 (00:21 +0000)]
Revert "runtime: lock mtxpoll in AIX netpollBreak"

This reverts CL 225618.

This is causing TestNetpollBreak to fail on AIX more often than not.

Change-Id: Ia3c24041ead4b320202f7f5b17a6b286f639a689
Reviewed-on: https://go-review.googlesource.com/c/go/+/226198
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agocmd/compile: add dark mode functionality to CFGs in the ssa.html output
Bradford Lamson-Scribner [Wed, 11 Mar 2020 03:26:42 +0000 (21:26 -0600)]
cmd/compile: add dark mode functionality to CFGs in the ssa.html output

add dark mode to CFGs in the ssa.html output by targeting individual
parts of each svg and applying dark mode styles to the stroke & fill.

Fixes #37767

Change-Id: Ic867e161c6837c26d9d735ea02bc94fdb56102f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/222877
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agocmd/go: avoid needing to manipulate ImportStack when constructing error
Michael Matloob [Thu, 27 Feb 2020 22:14:07 +0000 (17:14 -0500)]
cmd/go: avoid needing to manipulate ImportStack when constructing error

Simplify the printing of PackageErrors by pushing and popping packages
from the import stack when creating the error, rather than when printing
the error. In some cases, we don't have the same amount of information
to recreate the exact error, so we'll print the name of the package
the error is for, even when it's redundant. In the case of import cycle
errors, this change results in the addition of the position information
of the error.

This change supercedes CLs 220718 and 217106. It introduces a simpler
way to format errors.

Fixes #36173

Change-Id: Ie27011eb71f82e165ed4f9567bba6890a3849fc1
Reviewed-on: https://go-review.googlesource.com/c/go/+/224660
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
4 years agoruntime: refine netpollunblock by removing unreachable 'if' condition
Andy Pan [Wed, 25 Dec 2019 03:33:14 +0000 (03:33 +0000)]
runtime: refine netpollunblock by removing unreachable 'if' condition

Change-Id: I58ac10013cadd78618124cb7ff134384d158ea4f
GitHub-Last-Rev: 2dfff0d3d3d18ecb196d5357cdfec196424d9e3b
GitHub-Pull-Request: golang/go#36276
Reviewed-on: https://go-review.googlesource.com/c/go/+/212557
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agoruntime: lock mtxpoll in AIX netpollBreak
Ian Lance Taylor [Thu, 26 Mar 2020 16:13:11 +0000 (09:13 -0700)]
runtime: lock mtxpoll in AIX netpollBreak

netpollBreak calls netpollwakeup, and netpollwakeup expects the mtxpoll
lock to be held, so that it has exclusive access to pendingUpdates.
Not acquiring the lock was a mistake in CL 171824. Fortunately it
rarely matters in practice.

Change-Id: I32962ec2575c846ef3d6a91a4d821b2ff02d983c
Reviewed-on: https://go-review.googlesource.com/c/go/+/225618
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 years agoos/exec: add temporary debugging code for #25628
Ian Lance Taylor [Fri, 27 Mar 2020 17:09:26 +0000 (10:09 -0700)]
os/exec: add temporary debugging code for #25628

On linux-386 builders run the TestExtraFiles subprocess under strace,
in hopes of finding out where the unexpected descriptor is coming from.

For #25628

Change-Id: I9a62d6a5192a076525a616ccc71de74bbe7ebd58
Reviewed-on: https://go-review.googlesource.com/c/go/+/225799
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
4 years agocmd/compile: convert 386 port to use addressing modes pass (take 2)
Keith Randall [Tue, 24 Mar 2020 20:39:44 +0000 (13:39 -0700)]
cmd/compile: convert 386 port to use addressing modes pass (take 2)

Retrying CL 222782, with a fix that will hopefully stop the random crashing.

The issue with the previous CL is that it does pointer arithmetic
in a way that may briefly generate an out-of-bounds pointer. If an
interrupt happens to occur in that state, the referenced object may
be collected incorrectly.

Suppose there was code that did s[x+c].  The previous CL had a rule
to the effect of ptr + (x + c) -> c + (ptr + x).  But ptr+x is not
guaranteed to point to the same object as ptr. In contrast,
ptr+(x+c) is guaranteed to point to the same object as ptr, because
we would have already checked that x+c is in bounds.

For example, strconv.trim used to have this code:
  MOVZX -0x1(BX)(DX*1), BP
  CMPL $0x30, AL
After CL 222782, it had this code:
  LEAL 0(BX)(DX*1), BP
  CMPB $0x30, -0x1(BP)

An interrupt between those last two instructions could see BP pointing
outside the backing store of the slice involved.

It's really hard to actually demonstrate a bug. First, you need to
have an interrupt occur at exactly the right time. Then, there must
be no other pointers to the object in question. Since the interrupted
frame will be scanned conservatively, there can't even be a dead
pointer in another register or on the stack. (In the example above,
a bug can't happen because BX still holds the original pointer.)
Then, the object in question needs to be collected (or at least
scanned?) before the interrupted code continues.

This CL needs to handle load combining somewhat differently than CL 222782
because of the new restriction on arithmetic. That's the only real
difference (other than removing the bad rules) from that old CL.

This bug is also present in the amd64 rewrite rules, and we haven't
seen any crashing as a result. I will fix up that code similarly to
this one in a separate CL.

Update #37881

Change-Id: I5f0d584d9bef4696bfe89a61ef0a27c8d507329f
Reviewed-on: https://go-review.googlesource.com/c/go/+/225798
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agoruntime/pprof: increment fake overflow record PC
Michael Pratt [Thu, 26 Mar 2020 19:10:21 +0000 (15:10 -0400)]
runtime/pprof: increment fake overflow record PC

gentraceback generates PCs which are usually following the CALL
instruction. For those that aren't, it fixes up the PCs so that
functions processing the output can unconditionally decrement the PC.

runtime_expandInlineFrames does this unconditional decrement when
looking up the function. However, the fake stack frame generated for
overflow records fails to meet the contract, and decrementing the PC
results in a PC in the previous function. If that function contains
inlined call, runtime_expandInlineFrames will not short-circuit and will
panic trying to look up a PC that doesn't exist.

Note that the added test does not fail at HEAD. It will only fail (with
a panic) if the function preceeding lostProfileEvent contains inlined
function calls. At the moment (on linux/amd64), that is
runtime/pprof.addMaxRSS, which does not.

Fixes #38096

Change-Id: Iad0819f23c566011c920fd9a5b1254719228da0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/225661
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agonet/http: remove arbitrary timeouts from TestIdentityResponse and TestTLSHandshakeTimeout
Bryan C. Mills [Fri, 27 Mar 2020 16:11:21 +0000 (12:11 -0400)]
net/http: remove arbitrary timeouts from TestIdentityResponse and TestTLSHandshakeTimeout

These hard-coded timeouts make the tests flaky on slow builders (such
as solaris-amd64-oraclerel), and make test failures harder to diagnose
anyway (by replacing dumps of the stuck goroutine stacks with failure
messages that do not describe the stuck goroutines). Eliminate them
and simplify the tests.

Fixes #37327
Fixes #38112

Change-Id: Id40febe349d134ef53c702e36199bfbf2b6468ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/225977
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
4 years agoruntime: converge duplicate calls to netpollBreak into one
Andy Pan [Fri, 27 Mar 2020 03:21:17 +0000 (03:21 +0000)]
runtime: converge duplicate calls to netpollBreak into one

There might be some concurrent (maybe not concurrent, just sequential but in a short time window) and duplicate calls to `netpollBreak`, trying to wake up a net-poller. If one has called `netpollBreak` and that waking event hasn't been received by epollwait/kevent/..., then the subsequent calls of `netpollBreak` ought to be ignored or in other words, these calls should be converged into one.

Benchmarks go1.13.5 darwin/amd64:

benchmark-func           time/op (old)  time/op (new)  delta
BenchmarkNetpollBreak-4  29668ns ±1%    3131ns ±2%     -89.45%

mem/B (old)  mem/B (new)  delta
154B ±13%    0B ±0%       -100%

Change-Id: I3cf757a5d6edc5a99adad7aea3baee4b7f2a8f5c
GitHub-Last-Rev: 15bcfbab8a5db51f65da01315a5880a5dbf9e028
GitHub-Pull-Request: golang/go#36294
Reviewed-on: https://go-review.googlesource.com/c/go/+/212737
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agocmd/compile: add rules to eliminate unnecessary signed shifts
Lynn Boger [Thu, 26 Mar 2020 20:01:40 +0000 (16:01 -0400)]
cmd/compile: add rules to eliminate unnecessary signed shifts

This change to the rules removes some unnecessary signed shifts
that appear in the math/rand functions. Existing rules did not
cover some of the signed cases.

A little improvement seen in math/rand due to removing 1 of 2
instructions generated for Int31n, which is inlined quite a bit.

Intn1000                 46.9ns ± 0%  45.5ns ± 0%   -2.99%  (p=1.000 n=1+1)
Int63n1000               33.5ns ± 0%  32.8ns ± 0%   -2.09%  (p=1.000 n=1+1)
Int31n1000               32.7ns ± 0%  32.6ns ± 0%   -0.31%  (p=1.000 n=1+1)
Float32                  32.7ns ± 0%  30.3ns ± 0%   -7.34%  (p=1.000 n=1+1)
Float64                  21.7ns ± 0%  20.9ns ± 0%   -3.69%  (p=1.000 n=1+1)
Perm3                     205ns ± 0%   202ns ± 0%   -1.46%  (p=1.000 n=1+1)
Perm30                   1.71µs ± 0%  1.68µs ± 0%   -1.35%  (p=1.000 n=1+1)
Perm30ViaShuffle         1.65µs ± 0%  1.65µs ± 0%   -0.30%  (p=1.000 n=1+1)
ShuffleOverhead          2.83µs ± 0%  2.83µs ± 0%   -0.07%  (p=1.000 n=1+1)
Read3                    18.7ns ± 0%  16.1ns ± 0%  -13.90%  (p=1.000 n=1+1)
Read64                    126ns ± 0%   124ns ± 0%   -1.59%  (p=1.000 n=1+1)
Read1000                 1.75µs ± 0%  1.63µs ± 0%   -7.08%  (p=1.000 n=1+1)

Change-Id: I11502dfca7d65aafc76749a8d713e9e50c24a858
Reviewed-on: https://go-review.googlesource.com/c/go/+/225917
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agocmd/go/internal/modfetch/codehost: remove unused GitRepo function
Bryan C. Mills [Fri, 27 Mar 2020 15:26:37 +0000 (11:26 -0400)]
cmd/go/internal/modfetch/codehost: remove unused GitRepo function

For #37943

Change-Id: Ib8ba5d846f41afc0047c33b8145918d93326cdd0
Reviewed-on: https://go-review.googlesource.com/c/go/+/225937
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
4 years agocmd/go/internal/work: disallow testgo binary from installing to GOROOT
Bryan C. Mills [Fri, 27 Mar 2020 03:10:32 +0000 (23:10 -0400)]
cmd/go/internal/work: disallow testgo binary from installing to GOROOT

Installing to GOROOT makes tests non-parallelizable, since each test
depends on the installed contents of GOROOT already being up-to-date
and may reasonably assume that those contents do not change over the
course of the test.

Fixes #37573
Updates #30316

Change-Id: I2afe95ad11347bee3bb7c2d77a657db6d691cf05
Reviewed-on: https://go-review.googlesource.com/c/go/+/225897
Reviewed-by: Michael Matloob <matloob@golang.org>
4 years agorun.{bash,bat,rc}: use ../bin/go instead of the go binary in $PATH
Bryan C. Mills [Tue, 17 Mar 2020 14:22:39 +0000 (10:22 -0400)]
run.{bash,bat,rc}: use ../bin/go instead of the go binary in $PATH

https://golang.org/doc/contribute.html#quick_test currently suggests
running 'make.bash' and 'run.bash' separately, but 'run.bash'
potentially uses a 'go' command resolved from the wrong GOROOT,
which in turn sets the wrong GOROOT for further commands.

Updates #32674
Updates #17896

Change-Id: I4925d478d0fc7351c4f6d40830ab17d4d688348d
Reviewed-on: https://go-review.googlesource.com/c/go/+/223741
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
4 years agoRevert "cmd/go: add support for GOPROXY fallback on unexpected errors"
Bryan C. Mills [Fri, 27 Mar 2020 03:07:34 +0000 (03:07 +0000)]
Revert "cmd/go: add support for GOPROXY fallback on unexpected errors"

This reverts CL 223257.

Reason for revert: broke TestScript/mod_gonoproxy on the longtest builders.

Change-Id: I8637c52c5a7d5333a37ed1e9998c49786525ecb1
Reviewed-on: https://go-review.googlesource.com/c/go/+/225757
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agocmd/dist: skip API check on plan9 builders
Bryan C. Mills [Thu, 26 Mar 2020 16:00:07 +0000 (12:00 -0400)]
cmd/dist: skip API check on plan9 builders

The plan9-arm builder has a very slow filesystem and frequently times
out on this test. The api check verifies the API for all supported
GOOS/GOARCH/CGO_ENABLED combination anyway, so if we skip it on one
builder (or even most builders) there should be no loss of coverage.

Updates #37951

Change-Id: I86a93df2ec60a6af6d942e3954eef09ce67bb39e
Reviewed-on: https://go-review.googlesource.com/c/go/+/225662
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
4 years agocmd/go: add support for GOPROXY fallback on unexpected errors
Jay Conrod [Thu, 12 Mar 2020 22:56:40 +0000 (18:56 -0400)]
cmd/go: add support for GOPROXY fallback on unexpected errors

URLs in GOPROXY may now be separated with commas (,) or pipes (|). If
a request to a proxy fails with any error (including connection errors
and timeouts) and the proxy URL is followed by a pipe, the go command
will try the request with the next proxy in the list. If the proxy is
followed by a comma, the go command will only try the next proxy if
the error a 404 or 410 HTTP response.

The go command will determine how to connect to the checksum database
using the same logic. Before accessing the checksum database, the go
command sends a request to <proxyURL>/sumdb/<sumdb-name>/supported.
If a proxy responds with 404 or 410, or if any other error occurs and
the proxy URL in GOPROXY is followed by a pipe, the go command will
try the request with the next proxy. If all proxies respond with 404
or 410 or are configured to fall back on errors, the go command will
connect to the checksum database directly.

This CL does not change the default value or meaning of GOPROXY.

Fixes #37367

Change-Id: If53152ec1c3282c67d4909818b666af58884fb2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/223257
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
4 years agocmd/dist: do not skip 'cmd' tests in race mode
Bryan C. Mills [Thu, 19 Mar 2020 17:00:44 +0000 (13:00 -0400)]
cmd/dist: do not skip 'cmd' tests in race mode

Fixes #37940

Change-Id: Ib869a4bf84296dac201cc7252431d7161b9c96f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/224038
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
4 years agocmd/go/internal/base: rename EnvForDir to AppendPWD
Bryan C. Mills [Thu, 26 Mar 2020 02:17:04 +0000 (22:17 -0400)]
cmd/go/internal/base: rename EnvForDir to AppendPWD

EnvForDir does not immediately evoke “append”, and thus may not prompt
the reader to consider the possibility of aliasing bugs (as in
issue #38077). To make this behavior more obvious at the call site, rename
cmd/go/internal/base.EnvForDir to AppendPWD and swap the order of
arguments to a conventional “append” function (similar to those in the
strconv package).

For #38077

Change-Id: I16f09aa0fa8a269d51f0511eb402a44e2759eb94
Reviewed-on: https://go-review.googlesource.com/c/go/+/225578
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
4 years agocmd/go: do not append to the global cfg.OrigEnv slice
Bryan C. Mills [Thu, 26 Mar 2020 02:24:44 +0000 (22:24 -0400)]
cmd/go: do not append to the global cfg.OrigEnv slice

Appending to a global slice is only safe if its length is already
equal to its capacity. That property is not guaranteed for slices in
general, and empirically does not hold for this one.

This is a minimal fix to make it easier to backport.
A more robust cleanup of the base.EnvForDir function will be sent in a
subsequent CL.

Fixes #38077
Updates #37940

Change-Id: I731d5bbd0e516642c2cf43e713eeea15402604e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/225577
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
4 years agoruntime: improve MIPS64x memclr
Meng Zhuo [Tue, 24 Mar 2020 07:07:43 +0000 (15:07 +0800)]
runtime: improve MIPS64x memclr

Using MIPS MSA VLD/VST to improve mips64x large memclr.

name          old time/op    new time/op     delta
Memclr/5        23.2ns ± 0%     21.5ns ± 0%    -7.33%  (p=0.000 n=9+8)
Memclr/16       20.1ns ± 0%     17.1ns ± 0%   -14.93%  (p=0.000 n=10+10)
Memclr/64       27.2ns ± 0%     19.1ns ± 0%   -29.70%  (p=0.000 n=9+9)
Memclr/256      76.8ns ± 0%     24.1ns ± 0%   -68.66%  (p=0.000 n=10+10)
Memclr/4096     1.12µs ± 1%     0.18µs ± 0%   -84.32%  (p=0.000 n=10+8)
Memclr/65536    18.0µs ± 0%      2.8µs ± 0%   -84.29%  (p=0.000 n=10+10)
Memclr/1M        288µs ± 0%       45µs ± 0%   -84.20%  (p=0.000 n=10+10)
Memclr/4M       1.15ms ± 0%     0.18ms ± 0%   -84.21%  (p=0.000 n=9+10)
Memclr/8M       2.34ms ± 0%     1.39ms ± 0%   -40.55%  (p=0.000 n=10+8)
Memclr/16M      4.72ms ± 0%     4.74ms ± 0%    +0.52%  (p=0.000 n=9+10)
Memclr/64M      18.9ms ± 0%     18.9ms ± 0%      ~     (p=0.436 n=10+10)
GoMemclr/5      13.7ns ± 0%     16.9ns ± 0%   +23.36%  (p=0.000 n=10+10)
GoMemclr/16     14.3ns ± 0%      9.0ns ± 0%   -37.27%  (p=0.000 n=10+9)
GoMemclr/64     26.9ns ± 0%     13.7ns ± 0%   -49.07%  (p=0.000 n=10+10)
GoMemclr/256    77.8ns ± 0%     13.0ns ± 0%   -83.24%  (p=0.000 n=9+10)

name          old speed      new speed       delta
Memclr/5       215MB/s ± 0%    232MB/s ± 0%    +7.74%  (p=0.000 n=9+9)
Memclr/16      795MB/s ± 0%    935MB/s ± 0%   +17.60%  (p=0.000 n=10+10)
Memclr/64     2.35GB/s ± 0%   3.35GB/s ± 0%   +42.33%  (p=0.000 n=10+9)
Memclr/256    3.34GB/s ± 0%  10.65GB/s ± 0%  +219.16%  (p=0.000 n=10+10)
Memclr/4096   3.65GB/s ± 1%  23.30GB/s ± 0%  +538.36%  (p=0.000 n=10+10)
Memclr/65536  3.65GB/s ± 0%  23.21GB/s ± 0%  +536.59%  (p=0.000 n=10+10)
Memclr/1M     3.64GB/s ± 0%  23.07GB/s ± 0%  +532.96%  (p=0.000 n=10+10)
Memclr/4M     3.64GB/s ± 0%  23.08GB/s ± 0%  +533.36%  (p=0.000 n=9+10)
Memclr/8M     3.58GB/s ± 0%   6.02GB/s ± 0%   +68.20%  (p=0.000 n=10+8)
Memclr/16M    3.56GB/s ± 0%   3.54GB/s ± 0%    -0.51%  (p=0.000 n=9+10)
Memclr/64M    3.55GB/s ± 0%   3.55GB/s ± 0%      ~     (p=0.436 n=10+10)
GoMemclr/5     364MB/s ± 0%    296MB/s ± 0%   -18.76%  (p=0.000 n=9+10)
GoMemclr/16   1.12GB/s ± 0%   1.78GB/s ± 0%   +58.86%  (p=0.000 n=10+10)
GoMemclr/64   2.38GB/s ± 0%   4.66GB/s ± 0%   +96.27%  (p=0.000 n=10+9)
GoMemclr/256  3.29GB/s ± 0%  19.62GB/s ± 0%  +496.45%  (p=0.000 n=10+9)

Change-Id: I457858368f2875fd66818a41d2f0c190a850e8f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/218177
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agoruntime: ensure minTriggerRatio never exceeds maxTriggerRatio
Michael Anthony Knyszek [Wed, 18 Mar 2020 15:09:40 +0000 (15:09 +0000)]
runtime: ensure minTriggerRatio never exceeds maxTriggerRatio

Currently, the capping logic for the GC trigger ratio is such that if
gcpercent is low, we may end up setting the trigger ratio far too high,
breaking the promise of SetGCPercent and GOGC has a trade-off knob (we
won't start a GC early enough, and we will use more memory).

This change modifies the capping logic for the trigger ratio by scaling
the minTriggerRatio with gcpercent the same way we scale
maxTriggerRatio.

Fixes #37927.

Change-Id: I2a048c1808fb67186333d3d5a6bee328be2f35da
Reviewed-on: https://go-review.googlesource.com/c/go/+/223937
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
4 years agocrypto/rsa,crypto/ecdsa,crypto/ed25519: implement PublicKey.Equal
Filippo Valsorda [Wed, 18 Mar 2020 00:34:51 +0000 (20:34 -0400)]
crypto/rsa,crypto/ecdsa,crypto/ed25519: implement PublicKey.Equal

This makes all modern public keys in the standard library implement a
common interface (below) that can be used by applications for better
type safety and allows for checking that public (and private keys via
Public()) are equivalent.

interface {
    Equal(crypto.PublicKey) bool
}

Equality for ECDSA keys is complicated, we take a strict interpretation
that works for all secure applications (the ones not using the
unfortunate non-constant time CurveParams implementation) and fails
closed otherwise.

Tests in separate files to make them x_tests and avoid an import loop
with crypto/x509.

Re-landing of CL 223754. Dropped the test that was assuming named curves
are not implemented by CurveParams, because it's not true for all
curves, and anyway is not a property we need to test. There is still a
test to check that different curves make keys not Equal.

Fixes #21704
Fixes #38035

Reviewed-on: https://go-review.googlesource.com/c/go/+/223754
Reviewed-by: Katie Hockman <katie@golang.org>
Change-Id: I736759b145bfb4f7f8eecd78c324315d5a05385c
Reviewed-on: https://go-review.googlesource.com/c/go/+/225460
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agoruntime: fix threshold calculation of TestPhysicalMemoryUtilization
Xiangdong Ji [Thu, 5 Dec 2019 03:22:34 +0000 (03:22 +0000)]
runtime: fix threshold calculation of TestPhysicalMemoryUtilization

Variable 'procs' used to calculate the threshold of overuse in
TestPhysicalMemoryUtilization should be updated if GOMAXPROCS
gets changed, otherwise the threshold could be a large number,
making the test meaningless.

Change-Id: I876cbf11457529f56bae77af1e35f4538a721f95
Reviewed-on: https://go-review.googlesource.com/c/go/+/210297
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 years agoscan: for style, adjust code for bad scan read counts
Rob Pike [Wed, 25 Mar 2020 22:32:27 +0000 (09:32 +1100)]
scan: for style, adjust code for bad scan read counts

Make the code more consistent with the rest of the file.
Should have caught this in review of CL 225357.

Change-Id: I12824cb436539c31604684e043ebb7587cc92471
Reviewed-on: https://go-review.googlesource.com/c/go/+/225557
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

4 years agotest/chan: fix trivial typos
sjnam [Wed, 25 Mar 2020 21:02:44 +0000 (21:02 +0000)]
test/chan: fix trivial typos

Substition -> Substitution

Change-Id: Iede578d733d1c041133742b61eb0573c3bd3b17c
GitHub-Last-Rev: 7815bd346dbe23a5412d0602a4f6480b893c447d
GitHub-Pull-Request: golang/go#38059
Reviewed-on: https://go-review.googlesource.com/c/go/+/225417
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agocmd/internal/obj/arm64: write test output to temp dir
Cherry Zhang [Wed, 25 Mar 2020 15:47:02 +0000 (11:47 -0400)]
cmd/internal/obj/arm64: write test output to temp dir

Write the test output to the temporary directory, not the current
directory.

May fix linux-mips64le-mengzhuo builder.

Change-Id: Ibfeb3d2879c11d498abc31df4efe776fc09a6ad6
Reviewed-on: https://go-review.googlesource.com/c/go/+/225440
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
4 years agoruntime: prevent preemption while timer is in timerModifying
Michael Anthony Knyszek [Wed, 25 Mar 2020 16:41:20 +0000 (16:41 +0000)]
runtime: prevent preemption while timer is in timerModifying

Currently if a goroutine is preempted while owning a timer in the
timerModifying state, it could self-deadlock. When the goroutine is
preempted and calls into the scheduler, it could call checkTimers. If
checkTimers encounters the timerModifying timer and calls runtimer on
it, then runtimer will spin, waiting for that timer to leave the
timerModifying state, which it never will.

So far we got lucky that for the most part that there were no preemption
points while timerModifying is happening, however CL 221077 seems to
have introduced one, leading to sporadic self-deadlocks.

This change disables preemption explicitly while a goroutines holds a
timer in timerModifying. Since only checkTimers (and thus runtimer) is
called from the scheduler, this is sufficient to prevent
preemption-based self-deadlocks.

Fixes #38070.
Updates #37894.

Change-Id: Idbfac310889c92773023733ff7e2ff87e9896f0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/225497
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agobufio: don't panic when Scanner sees an impossible Read count
Ian Lance Taylor [Wed, 25 Mar 2020 03:09:11 +0000 (20:09 -0700)]
bufio: don't panic when Scanner sees an impossible Read count

Fixes #38053

Change-Id: Ib0f9777f37eeaa07eb8ecb6df3e97e9d4b46dcd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/225357
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
4 years agocmd/api: make NewWatcher populate its own package and import metadata
Bryan C. Mills [Fri, 20 Mar 2020 19:15:35 +0000 (15:15 -0400)]
cmd/api: make NewWatcher populate its own package and import metadata

This partially undoes the optimizations of CL 177597, but makes up
some of the difference by caching the package list and import metadata
and making the initial calls concurrently, including in TestMain.
That reduces the critical path from two sequential 'go list'
invocations to just one (run many times concurrently), and eliminates
the need for assumptions about the consistency of the 'std' dependency
graph across platforms (and hard-coded special cases for packages that
violate those assumptions).

In the process, this simplifies and fixes TestBenchmark (which has
been silently broken since CL 164623).

This increases 'time go tool dist test api' on my workstation from
0m8.4s / 0m13.8s / 0m1.7s to 0m10.5s / 0m23.1s / 0m5.1s,
compared to 0m12.4s / 0m23.2s / 0m4.7s before CL 177597.

(That is, this change retains about half of the wall-time speedup, but
almost none of the user-time speedup.)

Tested manually using 'go test -race -bench=. cmd/api'.

Fixes #37951

Change-Id: Icd537e035e725e1ee7c41d97da5c6651233b927e
Reviewed-on: https://go-review.googlesource.com/c/go/+/224619
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
4 years agocmd/link/internal/arm64: increase the function alignment to 16
fanzha02 [Wed, 25 Mar 2020 03:11:24 +0000 (11:11 +0800)]
cmd/link/internal/arm64: increase the function alignment to 16

On arm64, a function's address is 16 bytes aligned, and
the assembler aligns the size of function symbol to 16 bytes,
so to keep the consistent, this patch changes the function
alignment in the linker to 16 bytes.

Change-Id: I4d1e89a56200453b7b586fe3f4656bada7544214
Reviewed-on: https://go-review.googlesource.com/c/go/+/225397
Reviewed-by: eric fang <eric.fang@arm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agocmd/internal/obj/arm64: add support of PCALIGN directive
diaxu01 [Fri, 6 Sep 2019 09:55:54 +0000 (09:55 +0000)]
cmd/internal/obj/arm64: add support of PCALIGN directive

Recently, we get requirements of instructions and functions alignment
from the gVisor project. To fit the alignment requirement of interrupt
table, they require an instruction's address to be aligned 128 bytes
and a function's entry address to be aligned 2K bytes. Thus we add
support for PCALIGN directive first. Below is a discussion about this
topic. https://groups.google.com/forum/m/#!topic/golang-dev/RPj90l5x86I

Functions in Go are aligned to 16 bytes on arm64, thus now we only
support 8 and 16 bytes alignment.

This patch adds support for PCALIGN directive. This directive can be
used within Go asm to align instruction by padding NOOP directives.

This patch also adds a test to verify the correnctness of the PCALIGN
directive. The test is contributed by Fannie Zhang <Fannie.Zhang@arm.com>.

Change-Id: I709e6b94847fe9e1824f42f4155355f90c63d523
Reviewed-on: https://go-review.googlesource.com/c/go/+/207117
Reviewed-by: eric fang <eric.fang@arm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agotest: make runindir tests pass regardless of whether module mode is in use
Bryan C. Mills [Tue, 24 Mar 2020 20:18:02 +0000 (16:18 -0400)]
test: make runindir tests pass regardless of whether module mode is in use

The "runindir" tests used "go run", but relied on relative imports
(which are not supported by "go run" in module mode). Instead, such
tests must use fully-qualified imports, which require either a go.mod
file (in module mode) or that the package be in an appropriate
subdirectory of GOPATH/src (in GOPATH mode).

To set up such a directory, we use yet another copy of the same
overlayDir function currently found in the misc subdirectory of this
repository.

Fixes #33912
Updates #30228

Change-Id: If3d7ea2f7942ba496d98aaaf24a90bcdcf4df9f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/225205
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 years agocmd/compile: use load and test instructions on s390x
Ruixin(Peter) Bao [Tue, 26 Nov 2019 20:33:37 +0000 (15:33 -0500)]
cmd/compile: use load and test instructions on s390x

The load and test instructions compare the given value
against zero and will produce a condition code indicating
one of the following scenarios:

0: Result is zero
1: Result is less than zero
2: Result is greater than zero
3: Result is not a number (NaN)

The instruction can be used to simplify floating point comparisons
against zero, which can enable further optimizations.

This CL also reduces the size of .text section of math.test binary by around
0.7 KB (in hexadecimal, from 1358f0 to 135620).

Change-Id: I33cb714f0c6feebac7a1c46dfcc735e7daceff9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/209159
Reviewed-by: Michael Munday <mike.munday@ibm.com>
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agomath: correct Atan2(±y,+∞) = ±0 on s390x
Brian Kessler [Sat, 14 Mar 2020 05:24:38 +0000 (23:24 -0600)]
math: correct Atan2(±y,+∞) = ±0 on s390x

The s390x assembly implementation was previously only handling this
case correctly for x = -Pi.  Update the special case handling for
any y.

Fixes #35446

Change-Id: I355575e9ec8c7ce8bd9db10d74f42a22f39a2f38
Reviewed-on: https://go-review.googlesource.com/c/go/+/223420
Run-TryBot: Brian Kessler <brian.m.kessler@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Munday <mike.munday@ibm.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
4 years agocmd/compile: fold constants into immediate instructions on riscv64
Joel Sing [Mon, 9 Mar 2020 16:31:22 +0000 (03:31 +1100)]
cmd/compile: fold constants into immediate instructions on riscv64

Where possible, fold constants into versions of instructions that take
an immediate. This avoids the need to allocate a register and load the
immediate into it.

Change-Id: If911ca41235e218490679aed2ce5f48bf807a2b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/222639
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
4 years agotest: re-enable atomic intrinsic related tests on riscv64
Joel Sing [Sun, 15 Mar 2020 15:58:23 +0000 (02:58 +1100)]
test: re-enable atomic intrinsic related tests on riscv64

riscv64 now has atomic intrinsics, so re-enable the atomic intrinsic tests.

Fixes #36765

Change-Id: I838f27570a94d7fa5774c43f1ca5f4df2ca104cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/223560
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
4 years agocmd/compile: provide Add/Cas/Exchange atomic intrinsics on riscv64
Joel Sing [Sun, 15 Mar 2020 15:51:54 +0000 (02:51 +1100)]
cmd/compile: provide Add/Cas/Exchange atomic intrinsics on riscv64

Provide Add32, Add64, Cas32, Cas64, Exchange32 and Exchange64 atomic
intrinsics on riscv64.

Updates #36765

Change-Id: I9a3b7d2ce3d49f699171fd76a0fed891d149a6bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/223559
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
4 years agoos/exec: for TestExtraFiles failure, print readlink of unexpected fd
Ian Lance Taylor [Tue, 24 Mar 2020 20:13:38 +0000 (13:13 -0700)]
os/exec: for TestExtraFiles failure, print readlink of unexpected fd

For #25628

Change-Id: If1dce7ba9310e1418e67b9954c989471b775a28e
Reviewed-on: https://go-review.googlesource.com/c/go/+/225278
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agocmd/internal/obj/ppc64: fix PCALIGN on ppc64le
Lynn Boger [Tue, 17 Mar 2020 13:24:47 +0000 (09:24 -0400)]
cmd/internal/obj/ppc64: fix PCALIGN on ppc64le

This fixes a potential issue with the previous implementation
of PCALIGN on ppc64. Previously PCALIGN was processed inside of
asmout and indicated the padding size by setting the value in
the optab, changing it back after the alignment instructions
were added. Now PCALIGN is processed outside of asmout, and optab
is not changed.

Change-Id: I8b0093a0e2b7e06176af27e05150d04ae2c55d60
Reviewed-on: https://go-review.googlesource.com/c/go/+/225198
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agointernal/poll: assume we have CancelIoEX on Windows
Ian Lance Taylor [Tue, 24 Mar 2020 04:11:01 +0000 (21:11 -0700)]
internal/poll: assume we have CancelIoEX on Windows

As of the Go 1.11 release we require at least Windows 7, so CancelIoEx
is always available.  This lets us simplify the code to not require
dedicated threads to handle I/O requests.

Fixes #37956

Change-Id: If1dc4ac4acb61c43e4f2a9f26f225869050262a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/225060
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
4 years agoruntime: fix code so defer record is not added to g0 defer list during panic
Dan Scales [Fri, 20 Mar 2020 16:31:20 +0000 (09:31 -0700)]
runtime: fix code so defer record is not added to g0 defer list during panic

newdefer() actually adds the new defer to the current g's defer chain. That
happens even if we are on the system stack, in which case the g will be the g0
stack. For open-coded defers, we call newdefer() (only during panic processing)
while on the system stack, so the new defer is unintentionally added to the
g0._defer defer list. The code later correctly adds the defer to the user g's
defer list.

The g0._defer list is never used. However, that pointer on the g0._defer list can
keep a defer struct alive that is intended to be garbage-collected (smaller defers
use a defer pool, but larger-sized defer records are just GC'ed). freedefer() does
not zero out pointers when it intends that a defer become garbage-collected. So,
we can have the pointers in a defer that is held alive by g0._defer become invalid
(in particular d.link). This is the cause of the bad pointer bug in this issue

The fix is to change newdefer (only used in two places) to not add the new defer
to the gp._defer list. We just do it after the call with the correct gp pointer.
(As mentioned above, this code was already there after the newdefer in
addOneOpenDeferFrame.) That ensures that defers will be correctly
garbage-collected and eliminate the bad pointer.

This fix definitely fixes the original repro. I added a test and tried hard to
reproduce the bug (based on the original repro code), but awasn't actually able to
cause the bug. However, the test is still an interesting mix of heap-allocated,
stack-allocated, and open-coded defers.

Fixes #37688

Change-Id: I1a481b9d9e9b9ba4e8726ef718a1f4512a2d6faf
Reviewed-on: https://go-review.googlesource.com/c/go/+/224581
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
4 years agoruntime: always use GetQueuedCompletionStatusEx on Windows
Ian Lance Taylor [Tue, 24 Mar 2020 03:42:29 +0000 (20:42 -0700)]
runtime: always use GetQueuedCompletionStatusEx on Windows

We used to fall back to GetQueuedCompletionStatus if
GetQueuedCompletionStatus was not available, but as of Go 1.11 we
require Windows 7 or later, so GetQueuedCompletionStatusEx is always
available.

Fixes #37957

Change-Id: I7d8d49a92ab7b1f5afdc54a442f696aaf4a5168e
Reviewed-on: https://go-review.googlesource.com/c/go/+/225059
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
4 years agoruntime: don't call wakeNetPoller during timerModifying
Ian Lance Taylor [Mon, 23 Mar 2020 18:38:49 +0000 (11:38 -0700)]
runtime: don't call wakeNetPoller during timerModifying

Reduce the length of time that other timer functions can see timerModifying.
In particular avoid system calls.

Fixes #38023

Change-Id: I1b61229c668e6085d9ee6dca9488a90055386c36
Reviewed-on: https://go-review.googlesource.com/c/go/+/224902
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
4 years agocmd/go: clarify behavior with no arguments in 'go help mod download'
Jay Conrod [Tue, 24 Mar 2020 17:33:46 +0000 (13:33 -0400)]
cmd/go: clarify behavior with no arguments in 'go help mod download'

'go mod download' is equivalent to 'go mod download all'.

Fixes #38031

Change-Id: I7aec7e5a1370a3e248eba6daad9a75ec21f33a83
Reviewed-on: https://go-review.googlesource.com/c/go/+/225201
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agoRevert "cmd/compile: convert 386 port to use addressing modes pass"
Keith Randall [Tue, 24 Mar 2020 16:48:05 +0000 (16:48 +0000)]
Revert "cmd/compile: convert 386 port to use addressing modes pass"

This reverts commit CL 222782.

Reason for revert: Reverting to see if 386 errors go away

Update #37881

Change-Id: I74f287404c52414db1b6ff1649effa4ed9e5cc0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/225218
Reviewed-by: Bryan C. Mills <bcmills@google.com>
4 years agoRevert "cmd/compile: disable mem+op operations on 386"
Keith Randall [Tue, 24 Mar 2020 16:46:49 +0000 (16:46 +0000)]
Revert "cmd/compile: disable mem+op operations on 386"

This reverts commit CL 224837.

Reason for revert: Reverting partial reverts of 222782.

Update #37881

Change-Id: Ie9bf84d6e17ed214abe538965e5ff03936886826
Reviewed-on: https://go-review.googlesource.com/c/go/+/225217
Reviewed-by: Bryan C. Mills <bcmills@google.com>
4 years agoRevert "cmd/compile: disable addressingmodes pass for 386"
Keith Randall [Tue, 24 Mar 2020 16:45:38 +0000 (16:45 +0000)]
Revert "cmd/compile: disable addressingmodes pass for 386"

This reverts commit CL 225057.

Reason for revert: Undoing partial reverts of CL 222782

Update #37881

Change-Id: Iee024cab2a580a37a0fc355e0e3c5ad3d8fdaf7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/225197
Reviewed-by: Bryan C. Mills <bcmills@google.com>
4 years agocrypto: implement Hash.String
Katie Hockman [Mon, 23 Mar 2020 14:11:43 +0000 (10:11 -0400)]
crypto: implement Hash.String

Fixes #33430

Change-Id: I323323b3136dd7b408005c3bb5ea05e3b566bd38
Reviewed-on: https://go-review.googlesource.com/c/go/+/224937
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
4 years agocmd/compile: provide Load32/Load64/Store32/Store64 atomic intrinsics on riscv64
Joel Sing [Sun, 15 Mar 2020 15:47:40 +0000 (02:47 +1100)]
cmd/compile: provide Load32/Load64/Store32/Store64 atomic intrinsics on riscv64

Updates #36765

Change-Id: Id5ce5c5f60112e4f4cf9eec1b1ec120994934950
Reviewed-on: https://go-review.googlesource.com/c/go/+/223558
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

4 years agoruntime: negate errno value for mips pipe/pipe2
Ian Lance Taylor [Sun, 22 Mar 2020 19:57:36 +0000 (12:57 -0700)]
runtime: negate errno value for mips pipe/pipe2

The callers expect negative errno values, so negate them when necessary.

No test because there is no reasonable way to make pipe/pipe2 fail.
This was reported on a system on which pipe2 returned ENOSYS.

Fixes #37997

Change-Id: I3ad6cbbc2521cf495f8df6ec991a3f781122b508
Reviewed-on: https://go-review.googlesource.com/c/go/+/224592
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
4 years agosyscall/js: make wasm_exec.js compatible with Webpack
nao20010128nao [Sat, 21 Mar 2020 06:52:58 +0000 (06:52 +0000)]
syscall/js: make wasm_exec.js compatible with Webpack

In Webpack, require("fs") will always be empty. This behavior throws an error: "fs.writeSync is not function". It happens when you did "fmt.Println".
This PR avoids such problem and use polyfill in wasm_exec.js on Webpack.

Change-Id: I55f2c75ce86b7f84d2d92e8e217b5decfbe3c8a1
GitHub-Last-Rev: aecc847e3f9d5617ea4b00196ef2810c2458f085
GitHub-Pull-Request: golang/go#35805
Reviewed-on: https://go-review.googlesource.com/c/go/+/208600
Reviewed-by: Richard Musiol <neelance@gmail.com>