]> Cypherpunks repositories - gostls13.git/log
gostls13.git
5 years ago[dev.link] cmd/link: don't split container symbols when write blocks
Cherry Zhang [Sat, 11 Apr 2020 02:11:51 +0000 (22:11 -0400)]
[dev.link] cmd/link: don't split container symbols when write blocks

We split the output into blocks and write them in parallel. The
block boundary is placed at symbol boundary. In the case of outer
symbols and sub symbols, currently we may split an outer symbol
into two blocks. This will be bad, as the two blocks will have
overlapping address range, since outer symbol and its sub symbols
occupies the same address range.

Make sure we place block boundary only at top-level symbol
boundaries.

Fix boringcrypto build.

Change-Id: I56811d3969c65c6be97672d8e1f1ea36b2447465
Reviewed-on: https://go-review.googlesource.com/c/go/+/227957
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/link: fix aux symbol handling in Funcdata
Cherry Zhang [Fri, 10 Apr 2020 18:12:44 +0000 (14:12 -0400)]
[dev.link] cmd/link: fix aux symbol handling in Funcdata

If a Go symbol is cloned to external, we should preserve its Aux
symbols for FuncInfo, etc.. We already do this in
loader.FuncInfo, but not in FuncInfo.Funcdata. Do it in the
latter as well. In fact, since FuncInfo and Funcdata should use
the same set of auxs, just record the auxs and reuse.

Should fix PPC64 build.

Change-Id: Iab9020eaca15d98fe3bb41f50f0d5bdb4999e8c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/227848
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] all: merge branch 'master' into dev.link
Cherry Zhang [Fri, 10 Apr 2020 17:50:52 +0000 (13:50 -0400)]
[dev.link] all: merge branch 'master' into dev.link

Clean merge.

Change-Id: Ic3634fa450e42635e2daafb53b7dedc6c954d072

5 years ago[dev.link] cmd/internal/goobj2: remove "2"
Cherry Zhang [Fri, 10 Apr 2020 00:45:14 +0000 (20:45 -0400)]
[dev.link] cmd/internal/goobj2: remove "2"

Rename
Sym2 -> Sym
Reloc2 -> Reloc
Aux2 -> Aux

Also the Reader methods.

Change-Id: I49f29e2d1cb480f5309e01d7a74b5e0897d826fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/227900
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years ago[dev.link] cmd/link: use new-style Reloc accessors in loadpe
Cherry Zhang [Fri, 10 Apr 2020 00:21:13 +0000 (20:21 -0400)]
[dev.link] cmd/link: use new-style Reloc accessors in loadpe

Change-Id: I3601a5b4573e3e742a3e48c9709bbff616619d89
Reviewed-on: https://go-review.googlesource.com/c/go/+/227899
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/link: use new-style Reloc accessors in loadxcoff
Cherry Zhang [Thu, 9 Apr 2020 23:56:05 +0000 (19:56 -0400)]
[dev.link] cmd/link: use new-style Reloc accessors in loadxcoff

Change-Id: I606b60807b4a8b6e5c0f489db3c5d9e75bd1e728
Reviewed-on: https://go-review.googlesource.com/c/go/+/227898
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/link: use new-style Reloc accessors in loadelf
Cherry Zhang [Thu, 9 Apr 2020 23:45:48 +0000 (19:45 -0400)]
[dev.link] cmd/link: use new-style Reloc accessors in loadelf

Change-Id: I9c283aa2631dc21c0567a0708b26cdf95a6dc9fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/227897
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/link: convert pcln linker phase to use loader APIs
Than McIntosh [Tue, 7 Apr 2020 21:08:00 +0000 (17:08 -0400)]
[dev.link] cmd/link: convert pcln linker phase to use loader APIs

Rework the linker's pcln phase to work with the new loader. As part of
this set of changes the handling of "go.file..." symbols has been
revised somewhat -- previously they were treated as always live in the
loader, and now we no longer do this.

The original plan had been to have the new implementation generate
nameless "inltree" symbols, however the plan now is to keep them
named for now and convert them to nameless in a subsequent patch.

Change-Id: If71c93ff1f146dbb63b6ee2546308acdc94b643c
Reviewed-on: https://go-review.googlesource.com/c/go/+/227759
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
5 years agocmd/compile: use a Sym type instead of interface{} for symbolic offsets
Keith Randall [Fri, 10 Apr 2020 03:28:55 +0000 (20:28 -0700)]
cmd/compile: use a Sym type instead of interface{} for symbolic offsets

Will help with strongly typed rewrite rules.

Change-Id: Ifbf316a49f4081322b3b8f13bc962713437d9aba
Reviewed-on: https://go-review.googlesource.com/c/go/+/227785
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
5 years ago[dev.link] cmd/link: add IsWasm method for Target
Than McIntosh [Thu, 9 Apr 2020 00:05:31 +0000 (20:05 -0400)]
[dev.link] cmd/link: add IsWasm method for Target

Add Target.IsWasm method.

Change-Id: Ia3bfc359208b8e392b1a484c41aebce9761bc2f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/227758
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
5 years ago[dev.link] cmd/link/internal/loader: add another symbolbuilder method
Than McIntosh [Wed, 8 Apr 2020 11:35:58 +0000 (07:35 -0400)]
[dev.link] cmd/link/internal/loader: add another symbolbuilder method

Introduce SetAddrPlus method for use with SymbolBuilder.

Change-Id: Ieb2986b2fc1675b7a3a71c84b7219b3d564ac122
Reviewed-on: https://go-review.googlesource.com/c/go/+/227757
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
5 years ago[dev.link] cmd/link/internal/loader: expand methods for FuncInfo
Than McIntosh [Wed, 8 Apr 2020 15:56:43 +0000 (11:56 -0400)]
[dev.link] cmd/link/internal/loader: expand methods for FuncInfo

Expand the methods for the FuncInfo helper, to support reading the
contents of an object file FuncInfo aux symbol using the new style
(that is to say, incrementally and without allocating slices to hold
the various bits).

Change-Id: I953d72c4a53f98c840e6b25b08fd33dc4a833dd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/227585
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoregexp: add (*Regexp).SubexpIndex
Sylvain Zimmer [Mon, 29 Jul 2019 01:15:36 +0000 (03:15 +0200)]
regexp: add (*Regexp).SubexpIndex

SubexpIndex returns the index of the first subexpression with the given name,
or -1 if there is no subexpression with that name.

Fixes #32420

Change-Id: Ie1f9d22d50fb84e18added80a9d9a9f6dca8ffc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/187919
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
5 years agoruntime: replace the type of netpollWakeSig from a uintptr to a uint32
Andy Pan [Fri, 10 Apr 2020 02:45:58 +0000 (10:45 +0800)]
runtime: replace the type of netpollWakeSig from a uintptr to a uint32

There's no need for netpollWakeSig to use a uintptr type, a uint32 is enough.

Relevant CL: CL 212737

Change-Id: Ide24478b217a02bad62f7e000a9680c26a8c5366
Reviewed-on: https://go-review.googlesource.com/c/go/+/227798
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoos/exec: extend grace period in TestExtraFiles to 20% of overall deadline
Bryan C. Mills [Thu, 9 Apr 2020 15:09:00 +0000 (11:09 -0400)]
os/exec: extend grace period in TestExtraFiles to 20% of overall deadline

Updates #25628

Change-Id: I938a7646521b34779a3a57833e7ce9d508b58faf
Reviewed-on: https://go-review.googlesource.com/c/go/+/227765
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: start implementing strongly typed aux and auxint fields
Keith Randall [Thu, 19 Mar 2020 23:25:08 +0000 (16:25 -0700)]
cmd/compile: start implementing strongly typed aux and auxint fields

Right now the Aux and AuxInt fields of ssa.Values are typed as
interface{} and int64, respectively. Each rule that uses these values
must cast them to the type they actually are (*obj.LSym, or int32, or
ValAndOff, etc.), use them, and then cast them back to interface{} or
int64.

We know for each opcode what the types of the Aux and AuxInt fields
should be. So let's modify the rule generator to declare the types to
be what we know they should be, autoconverting to and from the generic
types for us. That way we can make the rules more type safe.

It's difficult to make a single CL for this, so I've coopted the "=>"
token to indicate a rule that is strongly typed. "->" rules are
processed as before. That will let us migrate a few rules at a time in
separate CLs.  Hopefully we can reach a state where all rules are
strongly typed and we can drop the distinction.

This CL changes just a few rules to get a feel for what this
transition would look like.

I've decided not to put explicit types in the rules. I think it
makes the rules somewhat clearer, but definitely more verbose.
In particular, the passthrough rules that don't modify the fields
in question are verbose for no real reason.

Change-Id: I63a1b789ac5702e7caf7934cd49f784235d1d73d
Reviewed-on: https://go-review.googlesource.com/c/go/+/190197
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
5 years ago[dev.link] cmd/link: use new-style Reloc accessors in loadmacho
Cherry Zhang [Thu, 9 Apr 2020 01:28:17 +0000 (21:28 -0400)]
[dev.link] cmd/link: use new-style Reloc accessors in loadmacho

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

5 years ago[dev.link] cmd/link: convert buildinfo pass to new style
Cherry Zhang [Thu, 9 Apr 2020 18:12:17 +0000 (14:12 -0400)]
[dev.link] cmd/link: convert buildinfo pass to new style

Change-Id: I2e1a6d2f1ef7402277c981282556c276ec0585ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/227771
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years agocmd/compile: use isel with variable shifts on ppc64x
Lynn Boger [Wed, 1 Apr 2020 14:30:05 +0000 (10:30 -0400)]
cmd/compile: use isel with variable shifts on ppc64x

This changes the code generated for variable length shift
counts to use isel instead of instructions that set and
read the carry flag.

This reduces the generated code for shifts like this
by 1 instruction and avoids the use of instructions to
set and read the carry flag.

This sequence can be found in strconv with these results
on power9:

Atof64Decimal                          71.6ns ± 0%  68.3ns ± 0%   -4.61%
Atof64Float                            95.3ns ± 0%  90.9ns ± 0%   -4.62%
Atof64FloatExp                          153ns ± 0%   149ns ± 0%   -2.61%
Atof64Big                               234ns ± 0%   232ns ± 0%   -0.85%
Atof64RandomBits                        348ns ± 0%   369ns ± 0%   +6.03%
Atof64RandomFloats                      262ns ± 0%   262ns ± 0%     ~
Atof32Decimal                          72.0ns ± 0%  68.2ns ± 0%   -5.28%
Atof32Float                            92.1ns ± 0%  87.1ns ± 0%   -5.43%
Atof32FloatExp                          159ns ± 0%   158ns ± 0%   -0.63%
Atof32Random                            194ns ± 0%   191ns ± 0%   -1.55%

Some tests in codegen/shift.go are enabled to verify the
expected instructions are generated.

Change-Id: I968715d10ada405a8c46132bf19b8ed9b85796d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/227337
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years ago[dev.link] cmd/link: convert typelink pass to new style
Cherry Zhang [Wed, 8 Apr 2020 23:46:00 +0000 (19:46 -0400)]
[dev.link] cmd/link: convert typelink pass to new style

Change-Id: If861409a5cc4e398496199a89498a141f106f44f
Reviewed-on: https://go-review.googlesource.com/c/go/+/227762
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/link: add methods for adding relocations in Reloc2 format
Cherry Zhang [Wed, 8 Apr 2020 23:45:12 +0000 (19:45 -0400)]
[dev.link] cmd/link: add methods for adding relocations in Reloc2 format

This is in prepration of removing the old loader.Reloc. This also
introduces a way of adding a slice of relocations more
efficiently (will be used in the next CL).

Change-Id: I3eaee7fb3a3e102a8670990f4a31c40d0b17b8c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/227761
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/internal/goobj2: remove old-style types
Cherry Zhang [Wed, 8 Apr 2020 18:30:55 +0000 (14:30 -0400)]
[dev.link] cmd/internal/goobj2: remove old-style types

They are no longer needed.

Also rewrite the test, as the old one no longer meaningful.

Change-Id: Id39ad6bb2a334cb6d61aa0a7c52837e0c3d62432
Reviewed-on: https://go-review.googlesource.com/c/go/+/227641
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/internal/obj: change writer to use new-style accessors
Cherry Zhang [Wed, 8 Apr 2020 17:24:27 +0000 (13:24 -0400)]
[dev.link] cmd/internal/obj: change writer to use new-style accessors

Introduce field setters and use them on the writer side. Now we
are able to eliminate the old-style types.

Change-Id: I650d837328dc02f9be839d16a31812be86721b91
Reviewed-on: https://go-review.googlesource.com/c/go/+/227640
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years agotest: deflaking measures for runtime gdb test
Than McIntosh [Fri, 13 Mar 2020 15:09:05 +0000 (11:09 -0400)]
test: deflaking measures for runtime gdb test

Tweak the runtime's GDB python test to try to reduce flake failures.

Background: the intent of the testpoint in question is to make sure
that python-supported commands like "info goroutines" or "goroutine 1
backtrace" work properly. The Go code being run under the debugger as
part of the test is single-threaded, but the test is written assuming
that in addition to the primary goroutine there will be other
background goroutines available (owned by the runtime). The flakiness
seems to crop up the most when requesting a backtrace for one of these
background goroutines; the speculation is that if we catch a
runtime-owned goroutine in an odd state, this could interfere with the
test.

The change in this patch is to explicitly start an additional
goroutine from the main thread, so that when the debugger stops the
main thread we can be sure that there is some other non-main goroutine
in a known state.

This change authored by Josh Bleecher Snyder <josharian@gmail.com>.

Updates #24616.

Change-Id: I45682323d5898e5187c0adada7c5d117e92f403b
Reviewed-on: https://go-review.googlesource.com/c/go/+/226558
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years ago[dev.link] cmd/link: delete darwin/386 host object loading support
Cherry Zhang [Thu, 9 Apr 2020 02:39:04 +0000 (22:39 -0400)]
[dev.link] cmd/link: delete darwin/386 host object loading support

In Go 1.15, the darwin/386 port is gone.

Updates #37610.

Change-Id: I308561848d90d9a649b3603ab1f7fc1117305ec1
Reviewed-on: https://go-review.googlesource.com/c/go/+/227763
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agocmd/oldlink: delete darwin/386 host object loading support
Cherry Zhang [Thu, 9 Apr 2020 15:35:24 +0000 (11:35 -0400)]
cmd/oldlink: delete darwin/386 host object loading support

In Go 1.15, the darwin/386 port is gone.

Updates #37610.

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

5 years agocmd/internal/obj/ppc64: leverage AND operation to calculate remainder
Andy Pan [Sun, 5 Apr 2020 14:21:11 +0000 (22:21 +0800)]
cmd/internal/obj/ppc64: leverage AND operation to calculate remainder

Change-Id: I03e2a573eb778591071db4f783585a5d71a14c03
Reviewed-on: https://go-review.googlesource.com/c/go/+/227005
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
5 years agonet: convert many Close tests to use parallel subtests
Bryan C. Mills [Wed, 8 Apr 2020 16:51:50 +0000 (12:51 -0400)]
net: convert many Close tests to use parallel subtests

Also set a deadline in TestCloseWrite so that we can more easily
determine which kind of connection is getting stuck on the
darwin-arm64-corellium builder (#34837).

Change-Id: I8ccacbf436e8e493fb2298a79b17e0af8fc6eb81
Reviewed-on: https://go-review.googlesource.com/c/go/+/227588
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: do not allocate bucket for non-escaping map
Cuong Manh Le [Tue, 7 Apr 2020 20:08:21 +0000 (03:08 +0700)]
cmd/compile: do not allocate bucket for non-escaping map

For map with hint larger than BUCKETSIZE, makemap ignore allocated
bucket and allocate buckets itself. So do not allocate bucket in
this case, save us the cost of zeroing+assignment to the bucket.

name                            old time/op    new time/op    delta
NewEmptyMap-12                    3.89ns ± 4%    3.88ns ± 2%    ~     (p=0.939 n=19+20)
NewSmallMap-12                    23.3ns ± 3%    23.1ns ± 2%    ~     (p=0.307 n=18+17)
NewEmptyMapHintLessThan8-12       6.43ns ± 3%    6.31ns ± 2%  -1.72%  (p=0.000 n=19+18)
NewEmptyMapHintGreaterThan8-12     159ns ± 2%     150ns ± 1%  -5.79%  (p=0.000 n=20+18)

Benchmark run with commit ab7c174 reverted, see #38314.

Fixes #20184

Change-Id: Ic021f57454c3a0dd50601d73bbd77b8faf8d93b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/227458
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agoencoding/xml: fix reserved namespace check to be case-insensitive
Tamás Gulácsi [Fri, 25 Oct 2019 11:48:02 +0000 (13:48 +0200)]
encoding/xml: fix reserved namespace check to be case-insensitive

Fixes the check for the reserved namespace prefix
"xml" to be case insensitive, so as to match all variants of:

    (('X'|'x')('M'|'m')('L'|'l'))

as mandated by Section 2.3 of https://www.w3.org/TR/REC-xml/

Fixes #35151.

Change-Id: Id5a98e5f9d69d3741dc16f567c4320f1ad0b3c70
Reviewed-on: https://go-review.googlesource.com/c/go/+/203417
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/compile: remove gdata layer in slicesym
Josh Bleecher Snyder [Wed, 8 Apr 2020 20:51:25 +0000 (13:51 -0700)]
cmd/compile: remove gdata layer in slicesym

The previous change moved code around to create slicesym.
This change simplifies slicesym and its callsites
by accepting an int64 for lencap instead of a node,
and by removing all the calls to gdata.
It also stops modifying n,
which avoids the need to make a copy of it.

Passes toolstash-check.

Change-Id: I4d25454d11b4bb8941000244443e3c99eef4bdd0
Reviewed-on: https://go-review.googlesource.com/c/go/+/227550
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agocmd/compile: refactor static slice symbol creation
Josh Bleecher Snyder [Wed, 8 Apr 2020 20:41:59 +0000 (13:41 -0700)]
cmd/compile: refactor static slice symbol creation

This change mostly moves code around to unify it.
A subsequent change will simplify and improve slicesym.

Passes toolstash-check.

Change-Id: I84a877ea747febb2b571d4089ba6d905b51b27ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/227549
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agocmd/compile: clean up slice and string offsets/sizes
Josh Bleecher Snyder [Wed, 8 Apr 2020 19:36:35 +0000 (12:36 -0700)]
cmd/compile: clean up slice and string offsets/sizes

Minor cleanup:

* Modernize comments.
* Change from int to int64 to avoid conversions.
* Use idiomatic names.

Passes toolstash-check.

Change-Id: I93560c81926c0f4e00f33129cb4846b53bea99e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/227548
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agocmd/compile: use math/bits for bvec
Josh Bleecher Snyder [Tue, 28 May 2019 17:35:26 +0000 (10:35 -0700)]
cmd/compile: use math/bits for bvec

And delete some dead code.

Minor cleanup. Passes toolstash-check.

Change-Id: Ia3c77c6bf14942654d00d125a6221e63a442f3c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/227317
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agocmd/compile: use optimized slice zeroing in deadcode
Josh Bleecher Snyder [Tue, 28 May 2019 21:29:28 +0000 (14:29 -0700)]
cmd/compile: use optimized slice zeroing in deadcode

Minor cleanup. Passes toolstash-check.

Change-Id: I97a027c4ca49ded593e9c7989e9e091ab9336fa3
Reviewed-on: https://go-review.googlesource.com/c/go/+/227318
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agocmd/compile,runtime: pass only ptr and len to some runtime calls
Josh Bleecher Snyder [Sat, 1 Feb 2020 05:01:55 +0000 (21:01 -0800)]
cmd/compile,runtime: pass only ptr and len to some runtime calls

Some runtime calls accept a slice, but only use ptr and len.
This change modifies most such routines to accept only ptr and len.

After this change, the only runtime calls that accept an unnecessary
cap arg are concatstrings and slicerunetostring.
Neither is particularly common, and both are complicated to modify.

Negligible compiler performance impact. Shrinks binaries a little.
There are only a few regressions; the one I investigated was
due to register allocation fluctuation.

Passes 'go test -race std cmd', modulo #38265 and #38266.
Wow, does that take a long time to run.

Updates #36890

file      before    after     Δ       %
compile   19655024  19655152  +128    +0.001%
cover     5244840   5236648   -8192   -0.156%
dist      3662376   3658280   -4096   -0.112%
link      6680056   6675960   -4096   -0.061%
pprof     14789844  14777556  -12288  -0.083%
test2json 2824744   2820648   -4096   -0.145%
trace     11647876  11639684  -8192   -0.070%
vet       8260472   8256376   -4096   -0.050%
total     115163736 115118808 -44928  -0.039%

Change-Id: Idb29fa6a81d6a82bfd3b65740b98cf3275ca0a78
Reviewed-on: https://go-review.googlesource.com/c/go/+/227163
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/compile: handle some additional phis in shortcircuit
Josh Bleecher Snyder [Wed, 11 Mar 2020 12:39:08 +0000 (05:39 -0700)]
cmd/compile: handle some additional phis in shortcircuit

Prior to this change, the shortcircuit pass could only
handle blocks containing only a single phi control value,
possibly wrapped in some OpNot and OpCopy values.

This change partially lifts this limitation.
It handles some cases in which the block contains other phi values.
This appears to happen most commonly in cases in which
the conditionals being checked involve the memory state,
in which case there is a phi memory value in the block.

The general idea here is to use the information we have about
the CFG to (1) move the other phi values into other blocks
and/or (2) rewrite uses of the other phi values in other blocks.

For example, consider this CFG:

p   q
 \ /
  b
 / \
t   u

And consider a phi value v in block b.
We'll write v = Phi(p: x, q: y) to say that v has value x corresponding
to inbound block p, and value y for block q.

We will rewrite this CFG to:

p    q
|   /
|  b
|/  \
t    u

What should we do with v?

Any uses of v in u can be replaced with y. Why?
If we are in block u, we came from b, and before that from q.
If prior to b we came from p, then we would have gone to t, not u.
Since we came from q, we know that v took the value y.

Uses of v in t are a bit more complicated.
It is going to end up being a phi value: Phi(p: ?, b: ?).

Suppose, after the rewrite, we came from block p.
Then, before the rewrite, we would have gone to b,
where v would have the value x.
So we have Phi(p: x, b: ?).

Suppose, after the rewrite, we came from block b.
Then we must have come from block q.
If we come from block q, v has value y.
So we have Phi(p: x, b: y).
Uses of v in t can thus be replaced with a new phi value,
with the same values as v, but with altered predecessors.

Similar reasoning can be employed to rewrite or replace
other uses of v elsewhere in the CFG, so that v itself can be eliminated,
and the CFG rewrite can proceed.

This change sets up the infrastructure for such optimizations
and adds a few cheap ones. All optimizations in this change depend
only on the shape of the CFG; future changes may also depend on where
v's uses are. That analysis is more powerful but more expensive,
and should be done incrementally.

The use of closures here is perhaps a bit unusual,
but during development it proved critical to having readable code.
We must decide early on whether we can safely do the CFG modifications,
and then later fix up the phis if so.
Safely storing state and decisions across these two phases is hard to do readably.
Closures solve the problem neatly.

I manually instrumented the code paths in shortcircuitPhiPlan.
During make.bash there are nearly 6000 invocations.
The least-visited code path gets run 85 times,
so all the code in this CL is reasonably well-exercised.

Here is a concrete example of code improved by this change:

func f(e interface{}) int {
if x, ok := e.(int); ok {
return x
}
return 0
}

Omitting PCDATA, FUNCDATA, and the like, it used to compile to:

"".f STEXT nosplit size=50 args=0x18 locals=0x0
0x0000 00000 (x.go:4) LEAQ type.int(SB), AX
0x0007 00007 (x.go:4) MOVQ "".e+8(SP), CX
0x000c 00012 (x.go:4) CMPQ AX, CX
0x000f 00015 (x.go:4) JNE 43
0x0011 00017 (x.go:4) MOVQ "".e+16(SP), AX
0x0016 00022 (x.go:4) MOVQ (AX), AX
0x0019 00025 (x.go:4) JNE 33
0x001b 00027 (x.go:5) MOVQ AX, "".~r1+24(SP)
0x0020 00032 (x.go:5) RET
0x0021 00033 (x.go:7) MOVQ $0, "".~r1+24(SP)
0x002a 00042 (x.go:7) RET
0x002b 00043 (x.go:7) MOVL $0, AX
0x0030 00048 (x.go:4) JMP 25

Afterwards, it compiles to:

"".f STEXT nosplit size=41 args=0x18 locals=0x0
0x0000 00000 (x.go:4) LEAQ type.int(SB), AX
0x0007 00007 (x.go:4) MOVQ "".e+8(SP), CX
0x000c 00012 (x.go:4) CMPQ AX, CX
0x000f 00015 (x.go:4) JNE 31
0x0011 00017 (x.go:4) MOVQ "".e+16(SP), AX
0x0016 00022 (x.go:4) MOVQ (AX), AX
0x0019 00025 (x.go:5) MOVQ AX, "".~r1+24(SP)
0x001e 00030 (x.go:5) RET
0x001f 00031 (x.go:7) MOVQ $0, "".~r1+24(SP)
0x0028 00040 (x.go:7) RET

Note that there is now only a single JNE and a single RET $0 path.

Updates #37608

Has a minor good effect on compilation speed and memory use.

Provides widespread improvements to generated code.
The rare, minor regressions I have investigated are due to
register allocation fluctuations.

file      before    after     Δ       %
addr2line 4376080   4371984   -4096   -0.094%
api       5945400   5933112   -12288  -0.207%
asm       5034312   5030216   -4096   -0.081%
buildid   2844952   2840856   -4096   -0.144%
cgo       4812872   4804680   -8192   -0.170%
compile   19622064  19610368  -11696  -0.060%
cover     5236648   5232552   -4096   -0.078%
dist      3658312   3654216   -4096   -0.112%
doc       4653512   4649416   -4096   -0.088%
fix       3370072   3365976   -4096   -0.122%
link      6671864   6667768   -4096   -0.061%
pprof     14781652  14761172  -20480  -0.139%
trace     11639684  11627396  -12288  -0.106%
vet       8252280   8231800   -20480  -0.248%
total     115052984 114934792 -118192 -0.103%

file                                                                     before   after    Δ       %
internal/cpu.s                                                           3298     3296     -2      -0.061%
internal/bytealg.s                                                       1730     1737     +7      +0.405%
cmd/vendor/golang.org/x/mod/semver.s                                     7332     7283     -49     -0.668%
image/color.s                                                            8248     8156     -92     -1.115%
math.s                                                                   35966    35956    -10     -0.028%
math/cmplx.s                                                             6596     6575     -21     -0.318%
runtime.s                                                                480566   480053   -513    -0.107%
sync.s                                                                   16408    16385    -23     -0.140%
math/rand.s                                                              10447    10406    -41     -0.392%
internal/reflectlite.s                                                   28408    28366    -42     -0.148%
errors.s                                                                 2736     2701     -35     -1.279%
sort.s                                                                   17031    17036    +5      +0.029%
io.s                                                                     16993    16964    -29     -0.171%
container/heap.s                                                         2006     1997     -9      -0.449%
text/tabwriter.s                                                         9570     9552     -18     -0.188%
bytes.s                                                                  31823    31594    -229    -0.720%
strconv.s                                                                52760    52717    -43     -0.082%
vendor/golang.org/x/text/transform.s                                     16713    16706    -7      -0.042%
strings.s                                                                42590    42563    -27     -0.063%
bufio.s                                                                  22883    22785    -98     -0.428%
encoding/base32.s                                                        9586     9531     -55     -0.574%
syscall.s                                                                82237    82243    +6      +0.007%
image.s                                                                  37465    37452    -13     -0.035%
regexp/syntax.s                                                          82827    82769    -58     -0.070%
image/draw.s                                                             18698    18584    -114    -0.610%
image/jpeg.s                                                             36560    36549    -11     -0.030%
time.s                                                                   82557    82526    -31     -0.038%
context.s                                                                10863    10820    -43     -0.396%
regexp.s                                                                 64114    64049    -65     -0.101%
os.s                                                                     51751    51524    -227    -0.439%
reflect.s                                                                168240   168049   -191    -0.114%
cmd/go/internal/lockedfile/internal/filelock.s                           2317     2290     -27     -1.165%
path/filepath.s                                                          17831    17766    -65     -0.365%
io/ioutil.s                                                              6994     6990     -4      -0.057%
encoding/binary.s                                                        30791    30726    -65     -0.211%
cmd/vendor/golang.org/x/sys/unix.s                                       78055    78033    -22     -0.028%
encoding/pem.s                                                           9280     9247     -33     -0.356%
crypto/cipher.s                                                          20376    20374    -2      -0.010%
os/exec.s                                                                29229    29140    -89     -0.304%
internal/goroot.s                                                        4588     4579     -9      -0.196%
cmd/internal/browser.s                                                   2246     2240     -6      -0.267%
cmd/vendor/golang.org/x/crypto/ssh/terminal.s                            27183    27149    -34     -0.125%
fmt.s                                                                    76625    76484    -141    -0.184%
encoding/hex.s                                                           6154     6152     -2      -0.032%
compress/lzw.s                                                           7063     7059     -4      -0.057%
database/sql/driver.s                                                    18875    18862    -13     -0.069%
debug/plan9obj.s                                                         8268     8266     -2      -0.024%
net/url.s                                                                29724    29719    -5      -0.017%
encoding/csv.s                                                           12872    12856    -16     -0.124%
debug/gosym.s                                                            25303    25268    -35     -0.138%
compress/flate.s                                                         50952    51019    +67     +0.131%
compress/zlib.s                                                          7277     7266     -11     -0.151%
archive/zip.s                                                            42155    42111    -44     -0.104%
debug/dwarf.s                                                            107632   107541   -91     -0.085%
database/sql.s                                                           98373    98028    -345    -0.351%
os/user.s                                                                14722    14708    -14     -0.095%
encoding/json.s                                                          105836   105711   -125    -0.118%
debug/macho.s                                                            32598    32560    -38     -0.117%
encoding/gob.s                                                           136478   135755   -723    -0.530%
debug/pe.s                                                               31160    30869    -291    -0.934%
debug/elf.s                                                              63495    63302    -193    -0.304%
vendor/golang.org/x/text/unicode/bidi.s                                  27220    27217    -3      -0.011%
vendor/golang.org/x/text/secure/bidirule.s                               3363     3352     -11     -0.327%
go/token.s                                                               12036    12035    -1      -0.008%
flag.s                                                                   22277    22256    -21     -0.094%
mime.s                                                                   39696    39509    -187    -0.471%
go/scanner.s                                                             19033    19020    -13     -0.068%
archive/tar.s                                                            70936    70581    -355    -0.500%
internal/xcoff.s                                                         22823    22820    -3      -0.013%
text/scanner.s                                                           11631    11629    -2      -0.017%
encoding/xml.s                                                           110534   110408   -126    -0.114%
math/big.s                                                               183636   183545   -91     -0.050%
image/gif.s                                                              27376    27343    -33     -0.121%
crypto/dsa.s                                                             6029     5969     -60     -0.995%
image/png.s                                                              42947    42939    -8      -0.019%
crypto/rand.s                                                            6866     6854     -12     -0.175%
vendor/golang.org/x/text/unicode/norm.s                                  66394    66354    -40     -0.060%
runtime/trace.s                                                          2603     2521     -82     -3.150%
crypto/ed25519.s                                                         6321     6300     -21     -0.332%
text/template/parse.s                                                    93910    93844    -66     -0.070%
crypto/rsa.s                                                             31460    31369    -91     -0.289%
encoding/asn1.s                                                          57021    57023    +2      +0.004%
crypto/elliptic.s                                                        51382    51363    -19     -0.037%
crypto/x509/pkix.s                                                       10386    10342    -44     -0.424%
vendor/golang.org/x/net/idna.s                                           24482    24466    -16     -0.065%
vendor/golang.org/x/crypto/cryptobyte.s                                  33479    33280    -199    -0.594%
crypto/ecdsa.s                                                           11936    11883    -53     -0.444%
go/constant.s                                                            43670    42663    -1007   -2.306%
go/ast.s                                                                 80383    80191    -192    -0.239%
testing.s                                                                68069    68057    -12     -0.018%
runtime/pprof.s                                                          59613    59603    -10     -0.017%
testing/iotest.s                                                         4895     4891     -4      -0.082%
internal/trace.s                                                         78136    78089    -47     -0.060%
cmd/internal/goobj2.s                                                    13158    13154    -4      -0.030%
cmd/internal/src.s                                                       17661    17657    -4      -0.023%
go/parser.s                                                              79046    78880    -166    -0.210%
cmd/internal/objabi.s                                                    16367    16343    -24     -0.147%
text/template.s                                                          94899    94486    -413    -0.435%
go/printer.s                                                             77267    76992    -275    -0.356%
cmd/internal/goobj.s                                                     25988    25947    -41     -0.158%
runtime/pprof/internal/profile.s                                         102066   101933   -133    -0.130%
go/format.s                                                              5419     5371     -48     -0.886%
cmd/vendor/golang.org/x/arch/ppc64/ppc64asm.s                            37181    37149    -32     -0.086%
go/doc.s                                                                 74533    74132    -401    -0.538%
html/template.s                                                          88743    88389    -354    -0.399%
cmd/asm/internal/lex.s                                                   24881    24872    -9      -0.036%
cmd/internal/buildid.s                                                   18263    18256    -7      -0.038%
cmd/vendor/golang.org/x/arch/x86/x86asm.s                                80036    79980    -56     -0.070%
go/build.s                                                               68905    68737    -168    -0.244%
cmd/cover.s                                                              46070    45950    -120    -0.260%
cmd/internal/obj.s                                                       117001   116991   -10     -0.009%
cmd/doc.s                                                                62700    62419    -281    -0.448%
cmd/internal/obj/arm.s                                                   66745    66687    -58     -0.087%
cmd/compile/internal/syntax.s                                            145406   145062   -344    -0.237%
cmd/internal/obj/wasm.s                                                  44049    44027    -22     -0.050%
net.s                                                                    291835   291020   -815    -0.279%
cmd/dist.s                                                               209020   208807   -213    -0.102%
cmd/cgo.s                                                                241564   241102   -462    -0.191%
vendor/golang.org/x/net/http/httpproxy.s                                 9407     9399     -8      -0.085%
log/syslog.s                                                             7921     7909     -12     -0.151%
go/types.s                                                               319325   317513   -1812   -0.567%
vendor/golang.org/x/net/http/httpguts.s                                  3834     3825     -9      -0.235%
mime/multipart.s                                                         21414    21343    -71     -0.332%
cmd/internal/obj/ppc64.s                                                 119949   119938   -11     -0.009%
cmd/compile/internal/logopt.s                                            10158    10118    -40     -0.394%
vendor/golang.org/x/net/nettest.s                                        28012    27991    -21     -0.075%
go/internal/srcimporter.s                                                6405     6380     -25     -0.390%
go/internal/gcimporter.s                                                 34525    34493    -32     -0.093%
net/mail.s                                                               23937    23720    -217    -0.907%
go/internal/gccgoimporter.s                                              56095    56038    -57     -0.102%
cmd/compile/internal/types.s                                             47247    47207    -40     -0.085%
cmd/api.s                                                                39582    39558    -24     -0.061%
cmd/go/internal/base.s                                                   12572    12551    -21     -0.167%
cmd/vendor/golang.org/x/xerrors.s                                        17846    17814    -32     -0.179%
cmd/vendor/golang.org/x/mod/sumdb/note.s                                 18142    18070    -72     -0.397%
cmd/go/internal/search.s                                                 19994    19876    -118    -0.590%
cmd/go/internal/imports.s                                                16457    16428    -29     -0.176%
cmd/vendor/golang.org/x/mod/module.s                                     17838    17759    -79     -0.443%
cmd/go/internal/cache.s                                                  30551    30514    -37     -0.121%
cmd/vendor/golang.org/x/mod/sumdb/tlog.s                                 36356    36321    -35     -0.096%
cmd/internal/test2json.s                                                 9452     9408     -44     -0.466%
cmd/go/internal/mvs.s                                                    25136    25092    -44     -0.175%
cmd/go/internal/txtar.s                                                  3488     3461     -27     -0.774%
cmd/vendor/golang.org/x/mod/zip.s                                        18811    18800    -11     -0.058%
cmd/go/internal/version.s                                                11213    11171    -42     -0.375%
cmd/link/internal/benchmark.s                                            4941     4949     +8      +0.162%
cmd/internal/obj/s390x.s                                                 126865   126849   -16     -0.013%
cmd/gofmt.s                                                              30684    30596    -88     -0.287%
cmd/fix.s                                                                87450    86906    -544    -0.622%
cmd/internal/obj/x86.s                                                   88578    88556    -22     -0.025%
cmd/vendor/golang.org/x/mod/modfile.s                                    72450    72363    -87     -0.120%
cmd/oldlink/internal/loader.s                                            16743    16741    -2      -0.012%
cmd/pack.s                                                               14863    14861    -2      -0.013%
cmd/go/internal/load.s                                                   106742   106568   -174    -0.163%
cmd/oldlink/internal/objfile.s                                           21787    21780    -7      -0.032%
cmd/oldlink/internal/loadmacho.s                                         29309    29317    +8      +0.027%
cmd/oldlink/internal/loadelf.s                                           35013    35021    +8      +0.023%
cmd/asm/internal/asm.s                                                   68550    68538    -12     -0.018%
cmd/link/internal/loader.s                                               94765    94564    -201    -0.212%
cmd/link/internal/loadelf.s                                              35663    35667    +4      +0.011%
cmd/link/internal/loadmacho.s                                            29501    29509    +8      +0.027%
cmd/vendor/golang.org/x/tools/go/analysis.s                              4983     4976     -7      -0.140%
cmd/vendor/golang.org/x/tools/go/analysis/internal/analysisflags.s       16771    16709    -62     -0.370%
cmd/vendor/golang.org/x/tools/go/types/objectpath.s                      18481    18456    -25     -0.135%
cmd/vendor/golang.org/x/tools/go/analysis/passes/internal/analysisutil.s 2100     2085     -15     -0.714%
cmd/vendor/github.com/google/pprof/profile.s                             150141   149620   -521    -0.347%
cmd/vendor/github.com/google/pprof/internal/measurement.s                10420    10404    -16     -0.154%
cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl.s               36814    36755    -59     -0.160%
cmd/vendor/golang.org/x/tools/go/analysis/passes/bools.s                 6688     6673     -15     -0.224%
cmd/vendor/golang.org/x/tools/go/analysis/passes/cgocall.s               9856     9784     -72     -0.731%
cmd/vendor/golang.org/x/tools/go/analysis/passes/composite.s             3011     2979     -32     -1.063%
cmd/vendor/golang.org/x/tools/go/analysis/passes/copylock.s              9737     9682     -55     -0.565%
cmd/vendor/golang.org/x/tools/go/cfg.s                                   30738    30725    -13     -0.042%
cmd/vendor/github.com/ianlancetaylor/demangle.s                          175195   174513   -682    -0.389%
cmd/vendor/golang.org/x/tools/go/analysis/passes/httpresponse.s          3625     3520     -105    -2.897%
cmd/vendor/golang.org/x/tools/go/analysis/passes/loopclosure.s           2987     2971     -16     -0.536%
cmd/vendor/golang.org/x/tools/go/analysis/passes/shift.s                 4372     4340     -32     -0.732%
cmd/vendor/golang.org/x/tools/go/analysis/passes/stdmethods.s            8634     8611     -23     -0.266%
cmd/vendor/golang.org/x/tools/go/analysis/passes/tests.s                 6189     6164     -25     -0.404%
cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag.s             8089     8073     -16     -0.198%
cmd/vendor/golang.org/x/tools/go/analysis/passes/unsafeptr.s             2208     2177     -31     -1.404%
cmd/vendor/golang.org/x/tools/go/analysis/passes/unreachable.s           8050     8047     -3      -0.037%
cmd/vendor/golang.org/x/tools/go/analysis/passes/unusedresult.s          3665     3629     -36     -0.982%
cmd/vendor/golang.org/x/tools/go/ast/astutil.s                           65773    65680    -93     -0.141%
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.s                  13328    13286    -42     -0.315%
cmd/vendor/golang.org/x/tools/go/types/typeutil.s                        12263    12162    -101    -0.824%
cmd/vendor/golang.org/x/tools/go/analysis/passes/errorsas.s              1459     1421     -38     -2.605%
cmd/vendor/golang.org/x/tools/go/analysis/passes/ctrlflow.s              5208     5191     -17     -0.326%
cmd/vendor/golang.org/x/tools/go/analysis/passes/unmarshal.s             1801     1782     -19     -1.055%
cmd/vendor/golang.org/x/tools/go/analysis/passes/lostcancel.s            9569     9528     -41     -0.428%
cmd/go/internal/work.s                                                   304928   304756   -172    -0.056%
crypto/x509.s                                                            147340   147139   -201    -0.136%
cmd/vendor/golang.org/x/tools/go/analysis/passes/printf.s                34287    34019    -268    -0.782%
crypto/tls.s                                                             311603   310644   -959    -0.308%
cmd/oldlink/internal/ld.s                                                533115   532651   -464    -0.087%
cmd/oldlink/internal/wasm.s                                              16484    16458    -26     -0.158%
cmd/oldlink/internal/x86.s                                               18832    18830    -2      -0.011%
cmd/link/internal/ld.s                                                   548200   547626   -574    -0.105%
cmd/link/internal/wasm.s                                                 16760    16734    -26     -0.155%
cmd/link/internal/arm64.s                                                20850    20840    -10     -0.048%
cmd/link/internal/x86.s                                                  17437    17435    -2      -0.011%
net/http.s                                                               556647   555519   -1128   -0.203%
net/http/cookiejar.s                                                     15849    15833    -16     -0.101%
expvar.s                                                                 9521     9508     -13     -0.137%
net/http/httptest.s                                                      16471    16452    -19     -0.115%
cmd/vendor/github.com/google/pprof/internal/plugin.s                     4266     4264     -2      -0.047%
net/http/cgi.s                                                           23448    23428    -20     -0.085%
cmd/go/internal/web.s                                                    16472    16428    -44     -0.267%
net/http/httputil.s                                                      39672    39670    -2      -0.005%
net/rpc.s                                                                33989    33965    -24     -0.071%
net/http/fcgi.s                                                          19167    19162    -5      -0.026%
cmd/vendor/github.com/google/pprof/internal/symbolz.s                    5861     5857     -4      -0.068%
cmd/vendor/github.com/google/pprof/internal/binutils.s                   35842    35823    -19     -0.053%
cmd/vendor/github.com/google/pprof/internal/symbolizer.s                 11449    11404    -45     -0.393%
cmd/go/internal/get.s                                                    62726    62582    -144    -0.230%
cmd/vendor/github.com/google/pprof/internal/report.s                     80032    80022    -10     -0.012%
cmd/go/internal/modfetch/codehost.s                                      89005    88871    -134    -0.151%
cmd/trace.s                                                              116607   116496   -111    -0.095%
cmd/vendor/github.com/google/pprof/internal/driver.s                     143234   143207   -27     -0.019%
cmd/vendor/github.com/google/pprof/driver.s                              9000     8998     -2      -0.022%
cmd/go/internal/modfetch.s                                               126300   125726   -574    -0.454%
cmd/pprof.s                                                              12317    12312    -5      -0.041%
cmd/go/internal/modconv.s                                                17878    17861    -17     -0.095%
cmd/go/internal/modload.s                                                150261   149763   -498    -0.331%
cmd/go/internal/clean.s                                                  11122    11091    -31     -0.279%
cmd/go/internal/help.s                                                   6523     6521     -2      -0.031%
cmd/go/internal/generate.s                                               11627    11614    -13     -0.112%
cmd/go/internal/envcmd.s                                                 22034    21986    -48     -0.218%
cmd/go/internal/modget.s                                                 38478    38398    -80     -0.208%
cmd/go/internal/modcmd.s                                                 46430    46229    -201    -0.433%
cmd/go/internal/test.s                                                   64399    64374    -25     -0.039%
cmd/compile/internal/ssa.s                                               3615264  3608276  -6988   -0.193%
cmd/compile/internal/gc.s                                                1538865  1537625  -1240   -0.081%
cmd/compile/internal/amd64.s                                             33593    33574    -19     -0.057%
cmd/compile/internal/x86.s                                               30871    30852    -19     -0.062%
total                                                                    19343565 19311284 -32281  -0.167%

Change-Id: Ib030eb79458827a5a5b6d0d2f98765f8325a4d7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/222923
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agoruntime: simplify typedmemmovepartial
Ian Lance Taylor [Wed, 8 Apr 2020 04:39:39 +0000 (21:39 -0700)]
runtime: simplify typedmemmovepartial

The offset is always a multiple of the pointer size.

Change-Id: I790e087e89a081044a3ec35d99880533a4c929bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/227540
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agoos/signal: increase settle time in tests
Bryan C. Mills [Wed, 8 Apr 2020 20:28:33 +0000 (16:28 -0400)]
os/signal: increase settle time in tests

I noticed a timeout in TestIgnore in
https://build.golang.org/log/52d83a72f3a5ea9a16eb5d670c729694144f9624,
which suggests that the settle time is currently set too low.

I've also added a check for the same GO_TEST_TIMEOUT_SCALE used in
TestTerminalSignal, so that if this builder remains too slow we can
increase the builder's scale factor rather than the test's baseline
running time.

Updates #33174

Change-Id: I18b10eaa3bb5ae2f604300aedaaf6f79ee7ad567
Reviewed-on: https://go-review.googlesource.com/c/go/+/227649
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoos/exec: use subprocess deadline in TestExtraFiles
Ian Lance Taylor [Tue, 7 Apr 2020 23:39:42 +0000 (16:39 -0700)]
os/exec: use subprocess deadline in TestExtraFiles

Try to get some output even if the subprocess hangs.

For #25628

Change-Id: I4cc0a8f2c52b03a322b8fd0a620cba37b06ff10a
Reviewed-on: https://go-review.googlesource.com/c/go/+/227517
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agonet/url: add URL.Redacted to return a password scrubbed string
nrxr [Wed, 8 Apr 2020 10:21:40 +0000 (10:21 +0000)]
net/url: add URL.Redacted to return a password scrubbed string

Returning an URL.String() without the password is very useful for
situations where the URL is supposed to be logged and the password is
not useful to be shown.

This method re-uses URL.String() but with the password scrubbed and
substituted for a "xxxxx" in order to make it obvious that there was a
password. If the URL had no password then no "xxxxx" will be shown.

Fixes #34855

Change-Id: I7f17d81aa09a7963d2731d16fe15c6ae8e2285fc
GitHub-Last-Rev: 46d06dbc4f9e30a57667bb8d0627bc1abed83bdc
GitHub-Pull-Request: golang/go#35578
Reviewed-on: https://go-review.googlesource.com/c/go/+/207082
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years agocmd/compile: allow floating point Ops to produce flags on s390x
Ruixin(Peter) Bao [Thu, 21 Nov 2019 15:44:23 +0000 (10:44 -0500)]
cmd/compile: allow floating point Ops to produce flags on s390x

On s390x, some floating point arithmetic instructions (FSUB, FADD)  generate flag.
This patch allows those related SSA ops to return a tuple, where the second argument of
the tuple is the generated flag. We can use the flag and remove the
subsequent comparison instruction (e.g: LTDBR).

This CL also reduces the .text section for math.test binary by 0.4KB.

Benchmarks:
name                    old time/op  new time/op  delta
Acos-18                 12.1ns ± 0%  12.1ns ± 0%     ~     (all equal)
Acosh-18                18.5ns ± 0%  18.5ns ± 0%     ~     (all equal)
Asin-18                 13.1ns ± 0%  13.1ns ± 0%     ~     (all equal)
Asinh-18                19.4ns ± 0%  19.5ns ± 1%     ~     (p=0.444 n=5+5)
Atan-18                 10.0ns ± 0%  10.0ns ± 0%     ~     (all equal)
Atanh-18                19.1ns ± 1%  19.2ns ± 2%     ~     (p=0.841 n=5+5)
Atan2-18                16.4ns ± 0%  16.4ns ± 0%     ~     (all equal)
Cbrt-18                 14.8ns ± 0%  14.8ns ± 0%     ~     (all equal)
Ceil-18                 0.78ns ± 0%  0.78ns ± 0%     ~     (all equal)
Copysign-18             0.80ns ± 0%  0.80ns ± 0%     ~     (all equal)
Cos-18                  7.19ns ± 0%  7.19ns ± 0%     ~     (p=0.556 n=4+5)
Cosh-18                 12.4ns ± 0%  12.4ns ± 0%     ~     (all equal)
Erf-18                  10.8ns ± 0%  10.8ns ± 0%     ~     (all equal)
Erfc-18                 11.0ns ± 0%  11.0ns ± 0%     ~     (all equal)
Erfinv-18               23.0ns ±16%  26.8ns ± 1%  +16.90%  (p=0.008 n=5+5)
Erfcinv-18              23.3ns ±15%  26.1ns ± 7%     ~     (p=0.087 n=5+5)
Exp-18                  8.67ns ± 0%  8.67ns ± 0%     ~     (p=1.000 n=4+4)
ExpGo-18                50.8ns ± 3%  52.4ns ± 2%     ~     (p=0.063 n=5+5)
Expm1-18                9.49ns ± 1%  9.47ns ± 0%     ~     (p=1.000 n=5+5)
Exp2-18                 52.7ns ± 1%  50.5ns ± 3%   -4.10%  (p=0.024 n=5+5)
Exp2Go-18               50.6ns ± 1%  48.4ns ± 3%   -4.39%  (p=0.008 n=5+5)
Abs-18                  0.67ns ± 0%  0.67ns ± 0%     ~     (p=0.444 n=5+5)
Dim-18                  1.02ns ± 0%  1.03ns ± 0%   +0.98%  (p=0.008 n=5+5)
Floor-18                0.78ns ± 0%  0.78ns ± 0%     ~     (all equal)
Max-18                  3.09ns ± 1%  3.05ns ± 0%   -1.42%  (p=0.008 n=5+5)
Min-18                  3.32ns ± 1%  3.30ns ± 0%   -0.72%  (p=0.016 n=5+4)
Mod-18                  62.3ns ± 1%  65.8ns ± 3%   +5.55%  (p=0.008 n=5+5)
Frexp-18                5.05ns ± 2%  4.98ns ± 0%     ~     (p=0.683 n=5+5)
Gamma-18                24.4ns ± 0%  24.1ns ± 0%   -1.23%  (p=0.008 n=5+5)
Hypot-18                10.3ns ± 0%  10.3ns ± 0%     ~     (all equal)
HypotGo-18              10.2ns ± 0%  10.2ns ± 0%     ~     (all equal)
Ilogb-18                3.56ns ± 1%  3.54ns ± 0%     ~     (p=0.595 n=5+5)
J0-18                    113ns ± 0%   108ns ± 1%   -4.42%  (p=0.016 n=4+5)
J1-18                    115ns ± 0%   109ns ± 1%   -4.87%  (p=0.016 n=4+5)
Jn-18                    240ns ± 0%   230ns ± 2%   -4.41%  (p=0.008 n=5+5)
Ldexp-18                6.19ns ± 0%  6.19ns ± 0%     ~     (p=0.444 n=5+5)
Lgamma-18               32.2ns ± 0%  32.2ns ± 0%     ~     (all equal)
Log-18                  13.1ns ± 0%  13.1ns ± 0%     ~     (all equal)
Logb-18                 4.23ns ± 0%  4.22ns ± 0%     ~     (p=0.444 n=5+5)
Log1p-18                12.7ns ± 0%  12.7ns ± 0%     ~     (all equal)
Log10-18                18.1ns ± 0%  18.2ns ± 0%     ~     (p=0.167 n=5+5)
Log2-18                 14.0ns ± 0%  14.0ns ± 0%     ~     (all equal)
Modf-18                 10.4ns ± 0%  10.5ns ± 0%   +0.96%  (p=0.016 n=4+5)
Nextafter32-18          11.3ns ± 0%  11.3ns ± 0%     ~     (all equal)
Nextafter64-18          4.01ns ± 1%  3.97ns ± 0%     ~     (p=0.333 n=5+4)
PowInt-18               32.7ns ± 0%  32.7ns ± 0%     ~     (all equal)
PowFrac-18              33.2ns ± 0%  33.1ns ± 0%     ~     (p=0.095 n=4+5)
Pow10Pos-18             1.58ns ± 0%  1.58ns ± 0%     ~     (all equal)
Pow10Neg-18             5.81ns ± 0%  5.81ns ± 0%     ~     (all equal)
Round-18                0.78ns ± 0%  0.78ns ± 0%     ~     (all equal)
RoundToEven-18          0.78ns ± 0%  0.78ns ± 0%     ~     (all equal)
Remainder-18            40.6ns ± 0%  40.7ns ± 0%     ~     (p=0.238 n=5+4)
Signbit-18              1.57ns ± 0%  1.57ns ± 0%     ~     (all equal)
Sin-18                  6.75ns ± 0%  6.74ns ± 0%     ~     (p=0.333 n=5+4)
Sincos-18               29.5ns ± 0%  29.5ns ± 0%     ~     (all equal)
Sinh-18                 14.4ns ± 0%  14.4ns ± 0%     ~     (all equal)
SqrtIndirect-18         3.97ns ± 0%  4.15ns ± 0%   +4.59%  (p=0.008 n=5+5)
SqrtLatency-18          8.01ns ± 0%  8.01ns ± 0%     ~     (all equal)
SqrtIndirectLatency-18  11.6ns ± 0%  11.6ns ± 0%     ~     (all equal)
SqrtGoLatency-18        44.7ns ± 0%  45.0ns ± 0%   +0.67%  (p=0.008 n=5+5)
SqrtPrime-18            1.26µs ± 0%  1.27µs ± 0%   +0.63%  (p=0.029 n=4+4)
Tan-18                  11.1ns ± 0%  11.1ns ± 0%     ~     (all equal)
Tanh-18                 15.8ns ± 0%  15.8ns ± 0%     ~     (all equal)
Trunc-18                0.78ns ± 0%  0.78ns ± 0%     ~     (all equal)
Y0-18                    113ns ± 2%   108ns ± 3%   -5.11%  (p=0.008 n=5+5)
Y1-18                    112ns ± 3%   107ns ± 0%   -4.29%  (p=0.000 n=5+4)
Yn-18                    229ns ± 0%   220ns ± 1%   -3.76%  (p=0.016 n=4+5)
Float64bits-18          1.09ns ± 0%  1.09ns ± 0%     ~     (all equal)
Float64frombits-18      0.55ns ± 0%  0.55ns ± 0%     ~     (all equal)
Float32bits-18          0.96ns ±16%  0.86ns ± 0%     ~     (p=0.563 n=5+5)
Float32frombits-18      1.03ns ±28%  0.84ns ± 0%     ~     (p=0.167 n=5+5)
FMA-18                  1.60ns ± 0%  1.60ns ± 0%     ~     (all equal)
[Geo mean]              10.0ns        9.9ns        -0.41%
Change-Id: Ief7e63ea5a8ba404b0a4696e12b9b7e0b05a9a03
Reviewed-on: https://go-review.googlesource.com/c/go/+/209160
Reviewed-by: Michael Munday <mike.munday@ibm.com>
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/compile: simplify s390x 'operation with memory operand' rules
Michael Munday [Mon, 6 Apr 2020 22:42:55 +0000 (23:42 +0100)]
cmd/compile: simplify s390x 'operation with memory operand' rules

The generated code remains exactly the same.

Change-Id: Id70af46b6c3c18153789961e5589eab717c3316e
Reviewed-on: https://go-review.googlesource.com/c/go/+/227164
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agomath/big: correct off-by-one access in divBasic
Rémy Oudompheng [Thu, 5 Mar 2020 06:59:00 +0000 (07:59 +0100)]
math/big: correct off-by-one access in divBasic

The divBasic function computes the quotient of big nats u/v word by word.
It estimates each word qhat by performing a long division (top 2 words of u
divided by top word of v), looks at the next word to correct the estimate,
then perform a full multiplication (qhat*v) to catch any inaccuracy in the
estimate.

In the latter case, "negative" values appear temporarily and carries
must be carefully managed, and the recursive division refactoring
introduced a case where qhat*v has the same length as v, triggering an
out-of-bounds write in the case it happens when computing the top word
of the quotient.

Fixes #37499

Change-Id: I15089da4a4027beda43af497bf6de261eb792f94
Reviewed-on: https://go-review.googlesource.com/c/go/+/221980
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years agoruntime: add a couple of writeBarrier.needed checks
Ian Lance Taylor [Wed, 8 Apr 2020 04:47:13 +0000 (21:47 -0700)]
runtime: add a couple of writeBarrier.needed checks

Make typedmemmove, typedmemclr, typedmemclrpartial look more like other
callers of bulkBarrierPreWrite.

Change-Id: Ic47030d88bf07d290f91198b7810ffc16d9769e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/227541
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocrypto/x509: tidy darwin/arm64 build tags
Austin Clements [Wed, 8 Apr 2020 16:16:38 +0000 (12:16 -0400)]
crypto/x509: tidy darwin/arm64 build tags

The cgo build tag is not necessary for root_darwin_arm64.go. We can't
build for darwin/arm64 without cgo, and even if we did 1) this code
would work fine 2) the no-cgo code that shells out to
/usr/bin/security would not work.

(Suggested by Filippo.)

Change-Id: I98cac2ea96ec5ac1ae60b7e32d195d5e86e2bd66
Reviewed-on: https://go-review.googlesource.com/c/go/+/227583
Reviewed-by: Filippo Valsorda <filippo@golang.org>
5 years agocmd/compile/internal/ssa: skip TestNexting
Bryan C. Mills [Wed, 8 Apr 2020 15:57:53 +0000 (11:57 -0400)]
cmd/compile/internal/ssa: skip TestNexting

This test is currently flaky in the builders.
Skip it while we investigate.

For #37404

Change-Id: I53721d383a4cafbe8d031ed25a3b1be2ae8b4285
Reviewed-on: https://go-review.googlesource.com/c/go/+/227587
Reviewed-by: David Chase <drchase@google.com>
5 years agoall: remove scattered remnants of darwin/386
Austin Clements [Mon, 6 Apr 2020 20:16:48 +0000 (16:16 -0400)]
all: remove scattered remnants of darwin/386

This removes all conditions and conditional code (that I could find)
that depended on darwin/386.

Fixes #37610.

Change-Id: I630d9ea13613fb7c0bcdb981e8367facff250ba0
Reviewed-on: https://go-review.googlesource.com/c/go/+/227582
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoall: remove darwin/386 build-tags and files
Austin Clements [Mon, 6 Apr 2020 17:43:17 +0000 (13:43 -0400)]
all: remove darwin/386 build-tags and files

This removes all files that are only used on darwin/386 and cleans up
build tags in files that are still used on other platforms.

Updates #37610.

Change-Id: If246642476c12d15f59a474e2b91a29c0c02fe75
Reviewed-on: https://go-review.googlesource.com/c/go/+/227581
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoall: remove scattered remnants of darwin/arm
Austin Clements [Fri, 3 Apr 2020 16:22:27 +0000 (12:22 -0400)]
all: remove scattered remnants of darwin/arm

This removes all conditions and conditional code (that I could find)
that depended on darwin/arm.

Fixes #35439 (since that only happened on darwin/arm)
Fixes #37611.

Change-Id: Ia4c32a5a4368ed75231075832b0b5bfb1ad11986
Reviewed-on: https://go-review.googlesource.com/c/go/+/227198
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoall: remove darwin/arm build-tags and files
Austin Clements [Fri, 3 Apr 2020 15:58:51 +0000 (11:58 -0400)]
all: remove darwin/arm build-tags and files

This removes all files that are only used on darwin/arm and cleans up
build tags in files that are still used on other platforms.

Updates #37611.

Change-Id: Ic9490cf0edfc157c6276a7ca950c1768b34a998f
Reviewed-on: https://go-review.googlesource.com/c/go/+/227197
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agodoc: remove darwin/386, darwin/arm from ports list
Austin Clements [Fri, 3 Apr 2020 13:23:19 +0000 (09:23 -0400)]
doc: remove darwin/386, darwin/arm from ports list

Updates #37611.

Change-Id: I7ae5a61d2e2189fd48ac3548e370e0de1dd79832
Reviewed-on: https://go-review.googlesource.com/c/go/+/227343
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoRevert "runtime/pprof: try to use real stack in TestTryAdd"
Bryan C. Mills [Wed, 8 Apr 2020 15:52:01 +0000 (15:52 +0000)]
Revert "runtime/pprof: try to use real stack in TestTryAdd"

This reverts CL 227484.

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

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

5 years agocmd/go: allow configuring module cache directory with GOMODCACHE
Michael Matloob [Fri, 14 Feb 2020 22:44:00 +0000 (17:44 -0500)]
cmd/go: allow configuring module cache directory with GOMODCACHE

Adds a GOMODCACHE environment variable that's used by cmd/go to determine the
location of the module cache. The default value of GOMODCACHE will be
GOPATH[0]/pkg/mod, the default location of the module cache before this change.

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

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

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

Fixes #34527

Change-Id: Id4d31d217b3507d6057c8ef7c52af1a0606603e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/219538
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years ago[dev.link] cmd/link: ignore undefined symbols in trampoline generation
Cherry Zhang [Wed, 8 Apr 2020 15:54:11 +0000 (11:54 -0400)]
[dev.link] cmd/link: ignore undefined symbols in trampoline generation

Don't emit an error for undefined symbol in trampoline
generation pass, which will be duplicate as we'll emit a better
one later.

Fix TestUndefinedRelocErrors on PPC64.

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

5 years agoruntime: skip TestPingPongHog in race mode
Josh Bleecher Snyder [Mon, 6 Apr 2020 16:07:03 +0000 (09:07 -0700)]
runtime: skip TestPingPongHog in race mode

TestPingPongHog tests properties of the scheduler.
But the race detector intentionally does randomized scheduling,
so the test is not applicable.

Fixes #38266

Change-Id: Ib06aa317b2776cb1faa641c4e038e2599cf70b2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/227344
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years ago[dev.link] cmd/link: gofmt
Cherry Zhang [Wed, 8 Apr 2020 15:45:00 +0000 (11:45 -0400)]
[dev.link] cmd/link: gofmt

I somehow messed up my local environment for the pre-commit hook.
Fix the format.

Change-Id: I6161ad1fce7714e8f311be5315d854f8c9bd7664
Reviewed-on: https://go-review.googlesource.com/c/go/+/227579
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years agonet/textproto, sync: unlock mutexes appropriately before panics
BurtonQin [Wed, 8 Apr 2020 16:03:18 +0000 (16:03 +0000)]
net/textproto, sync: unlock mutexes appropriately before panics

Ensure mutexes are unlocked right before panics, where defers aren’t easily usable.

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

5 years ago[dev.link] cmd/link: convert text address assignment to new style
Cherry Zhang [Mon, 6 Apr 2020 19:58:21 +0000 (15:58 -0400)]
[dev.link] cmd/link: convert text address assignment to new style

Implement text address assignment and trampoline generation using
the loader.

Note: the trampoline insertion part doesn't actually work. It
also needs to propagate Aux symbols for external symbols in
LoadFull.  But it won't be needed after converting pclntab
generation, so I'll leave it out for now. This could break
linking large binaries on PPC64 and ARM.

Change-Id: Ie46a35b25d7c027983dd877207cfa8f67c32530b
Reviewed-on: https://go-review.googlesource.com/c/go/+/227482
Reviewed-by: Than McIntosh <thanm@google.com>
5 years ago[dev.link] cmd/link: return package path in SymFile
Cherry Zhang [Tue, 7 Apr 2020 00:56:34 +0000 (20:56 -0400)]
[dev.link] cmd/link: return package path in SymFile

SymFile, derived from sym.Symbol.File, is supposed to return the
package path, instead of the file name (arguably the name is
confusing). Make it so, and rename it to SymPkg.

Change-Id: I67bcd12f67cea271f2a2ce3c5724e5d228f5b2f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/227481
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
5 years agoruntime/race: update ppc64 .syso file
Keith Randall [Tue, 7 Apr 2020 19:03:31 +0000 (12:03 -0700)]
runtime/race: update ppc64 .syso file

Update #14881
Update #37355

Change-Id: I5edd53b7532836cfe6037fb668b1b8fe8f7a32f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/227443
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
5 years agoruntime/pprof: try to use real stack in TestTryAdd
Michael Pratt [Tue, 7 Apr 2020 16:12:44 +0000 (12:12 -0400)]
runtime/pprof: try to use real stack in TestTryAdd

TestTryAdd is particularly brittle because it tests some real cases by
constructing fake sample stack frames. If those frames don't correctly
represent what the runtime would generate then they may fail to catch
regressions.

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

Change-Id: I62522a9ded5544b06d1bf28550af5400f3af667b
Reviewed-on: https://go-review.googlesource.com/c/go/+/227484
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
5 years agoruntime: only check for pointers up to ptrdata, not size
Ian Lance Taylor [Fri, 3 Apr 2020 00:14:25 +0000 (17:14 -0700)]
runtime: only check for pointers up to ptrdata, not size

Change-Id: I166cf253b7f2483d652c98d2fba36c380e2f3347
Reviewed-on: https://go-review.googlesource.com/c/go/+/227177
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agoruntime: fix infinite callstack of cgo on arm64
Xiangdong Ji [Fri, 27 Mar 2020 11:04:21 +0000 (11:04 +0000)]
runtime: fix infinite callstack of cgo on arm64

This change adds CFA information to the assembly function 'crosscall1'
and reorgnizes its code to establish well-formed prologue and epilogue.
It will fix an infinite callstack issue when debugging cgo program with
GDB on arm64.

Brief root cause analysis:

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

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

Fixes #37238
Change-Id: Ia6bd8555828541a3a61f7dc9b94dfa00775ec52a
Reviewed-on: https://go-review.googlesource.com/c/go/+/226999
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoruntime: static lock ranking for the runtime (enabled by GOEXPERIMENT)
Dan Scales [Thu, 14 Nov 2019 01:34:47 +0000 (17:34 -0800)]
runtime:  static lock ranking for the runtime (enabled by GOEXPERIMENT)

I took some of the infrastructure from Austin's lock logging CR
https://go-review.googlesource.com/c/go/+/192704 (with deadlock
detection from the logs), and developed a setup to give static lock
ranking for runtime locks.

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

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

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

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

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

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

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

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

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

Fixes #38029

Change-Id: I154217ff307c47051f8dae9c2a03b53081acd83a
Reviewed-on: https://go-review.googlesource.com/c/go/+/207619
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/compile: delete the floating point Greater and Geq ops
Michael Munday [Fri, 6 Mar 2020 22:20:45 +0000 (22:20 +0000)]
cmd/compile: delete the floating point Greater and Geq ops

Extend CL 220417 (which removed the integer Greater and Geq ops) to
floating point comparisons. Greater and Geq can always be
implemented using Less and Leq.

Fixes #37316.

Change-Id: Ieaddb4877dd0ff9037a1dd11d0a9a9e45ced71e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/222397
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years ago[dev.link] cmd/link: convert gentext for ppc64
Than McIntosh [Thu, 2 Apr 2020 12:27:09 +0000 (08:27 -0400)]
[dev.link] cmd/link: convert gentext for ppc64

Convert the ppc64 architecture's version of gentext to use the new
loader APIs.

Change-Id: Ib4af2608f4b246cb6dde07ceaa4a1f7ced45a700
Reviewed-on: https://go-review.googlesource.com/c/go/+/227021
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/compile: use MOVBQZX for OpAMD64LoweredHasCPUFeature
Josh Bleecher Snyder [Sun, 5 Apr 2020 02:22:28 +0000 (19:22 -0700)]
cmd/compile: use MOVBQZX for OpAMD64LoweredHasCPUFeature

In the commit message of CL 212360, I wrote:

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

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

For the benchmark in #36196, on my machine:

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

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

Updates #15808
Updates #36351
Updates #36196

Change-Id: I8a326289a963b1939aaa7eaa2fab2ec536467c7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/227238
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/compile/internal/logopt: preserve env while running command
Egon Elbre [Tue, 7 Apr 2020 12:52:05 +0000 (15:52 +0300)]
cmd/compile/internal/logopt: preserve env while running command

The test was not preserving temporary directory flags leading to a
failure on windows with:

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

Fixes #38251

Change-Id: I6ee31b31e84b7f6e75ea6ee0f3b8c094835bf5d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/227497
Reviewed-by: David Chase <drchase@google.com>
5 years ago[dev.link] cmd/link: fix bugs in setArchSyms
Than McIntosh [Sun, 5 Apr 2020 16:40:20 +0000 (12:40 -0400)]
[dev.link] cmd/link: fix bugs in setArchSyms

The code in setArchsyms that sets up TOC symbols was buggy; it was
kicking in only for aix-ppc64 and not linux-ppc64. These symbols are
required for both ABIs, so change the guard in question from
"ctx.IsAIX()" to "ctxt.IsPPC64()". Also, the code to create versioned
".TOC." syms was not passing the correct symbol version to the loader
(now fixed).

Change-Id: I356071e528beadad20f61d067059eaf26f06e06b
Reviewed-on: https://go-review.googlesource.com/c/go/+/227257
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years ago[dev.link] cmd/link: convert gentext for S390
Than McIntosh [Thu, 2 Apr 2020 11:47:12 +0000 (07:47 -0400)]
[dev.link] cmd/link: convert gentext for S390

Convert the gentext() hooks for the S390 architecture (requires
generation of relocation variants).

Change-Id: I468957eb9f909fb4e371ea4fcf7b52bbed22b755
Reviewed-on: https://go-review.googlesource.com/c/go/+/227019
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
5 years agocmd/internal: add MVCIN instruction to s390x assembler
Ruixin(Peter) Bao [Tue, 7 Apr 2020 13:20:08 +0000 (09:20 -0400)]
cmd/internal: add MVCIN instruction to s390x assembler

On s390x, we already have MVCIN opcode in asmz.go,
but we did not use it. This CL uses that opcode and adds MVCIN
instruction.

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

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

5 years ago[dev.link] cmd/link/internal/loader: speed up Loader.RelocVariant
Than McIntosh [Tue, 7 Apr 2020 12:01:24 +0000 (08:01 -0400)]
[dev.link] cmd/link/internal/loader: speed up Loader.RelocVariant

Remove some extra sanity-checking code from the loader's RelocVariant
method, since it was yielding a slowdown of 1-2% linking kubernetes
hyperkube (once again a reminder that relocation processing is a very
performance-sensitive part of the linker).

Change-Id: Ifbc0662f3f96c5f54131103ce6f7439ecfb9b9dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/227477
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
5 years agocmd/go: report scan error position in 'go list -e'
Jay Conrod [Wed, 11 Dec 2019 18:16:35 +0000 (13:16 -0500)]
cmd/go: report scan error position in 'go list -e'

This CL extracts some error handling code into a common method for
presenting errors encountered when loading package data.

Fixes #36087
Fixes #36762

Change-Id: I87c8d41e3cc6e6afa152d9c067bc60923bf19fbe
Reviewed-on: https://go-review.googlesource.com/c/go/+/210938
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/link: remove darwin/arm test
Cherry Zhang [Mon, 6 Apr 2020 15:39:44 +0000 (11:39 -0400)]
cmd/link: remove darwin/arm test

The darwin/arm port is removed in Go 1.15. Setting GOOS=darwin
GOARCH=arm will fail, therefore "go test cmd/link" on macOS will
fail (in non -short mode). Remove this test point.

Updates #37611.

Change-Id: Ia9531c4b4a6692a0c49153517af9fdddd1f3e0bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/227341
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: lay out exit post-dominated blocks at the end
Josh Bleecher Snyder [Sat, 4 Apr 2020 01:23:04 +0000 (18:23 -0700)]
cmd/compile: lay out exit post-dominated blocks at the end

Complete a long-standing TODO in the code.

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

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

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

Binary size impact:

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

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

Change-Id: I3d262c4f5cb80626a67a5c17285e2fa09f423c00
Reviewed-on: https://go-review.googlesource.com/c/go/+/227217
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
5 years agocmd/link: fix data race in testDWARF
Cherry Zhang [Mon, 6 Apr 2020 15:41:23 +0000 (11:41 -0400)]
cmd/link: fix data race in testDWARF

Multiple instances of testDWARF run in parallel, with a shared
backing store of the env input slice. Do modification of the
environment locally, instead of on the shared slice.

Fixes #38265.

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

5 years agocmd/go: report 'go get' errors for absolute paths outside module root
Jay Conrod [Wed, 1 Apr 2020 17:08:41 +0000 (13:08 -0400)]
cmd/go: report 'go get' errors for absolute paths outside module root

'go get' will now check absolute paths without wildcards the same way
it checks relative paths. modload.DirImportPath may be used for both
without converting path separators.

Fixes #38038

Change-Id: I453299898ece58f3b5002a5e80021d6bfe815fdd
Reviewed-on: https://go-review.googlesource.com/c/go/+/226857
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
5 years agocmd/compile: make logopt test skip if cannot create scratch directory
David Chase [Mon, 6 Apr 2020 15:12:26 +0000 (11:12 -0400)]
cmd/compile: make logopt test skip if cannot create scratch directory

Fixes #38251.

Change-Id: Ic635843fb503484a1c9a230b0cca571393d3da5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/227339
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
5 years ago[dev.link] all: merge branch 'master' into dev.link
Cherry Zhang [Mon, 6 Apr 2020 14:59:39 +0000 (10:59 -0400)]
[dev.link] all: merge branch 'master' into dev.link

Clean merge.

Change-Id: I94ac733fd3147abf42d89ccbfcc68f54ed5f4d13

5 years ago[dev.link] cmd/link/internal/loader: support 'variant' relocations
Than McIntosh [Wed, 1 Apr 2020 19:57:46 +0000 (15:57 -0400)]
[dev.link] cmd/link/internal/loader: support 'variant' relocations

Add support to the loader for getting/setting the 'variant' property
of a symbol relocation. The variant property handles unusual or
infrequently used relocations that have both a type and a variant of
that type (this is needed for S390).

In the sym.Symbol world, a relocation variant is a field on the
'relocExt' extension that is part of sym.Reloc. In this new
implementation for the loader, reloc variants are stored in a side
table (a map) in the loader, and accessed via loader methods.

Change-Id: I62bf54ae7ff6d500c0ea8d2dbe759b2431087378
Reviewed-on: https://go-review.googlesource.com/c/go/+/227018
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years ago[dev.link] cmd/link: begin converting gentext to loader APIs
Than McIntosh [Wed, 1 Apr 2020 17:42:20 +0000 (13:42 -0400)]
[dev.link] cmd/link: begin converting gentext to loader APIs

Begin the job of converting the linker's "gentext" phase over to use
loader APIs. This patch includes most architectures except for s390x
and PPC (these will be added in subsequent patches, since they require
a couple of loader changes first).

Change-Id: Ic7f55c207dcdbbba657330ef007a72ff7c837416
Reviewed-on: https://go-review.googlesource.com/c/go/+/227017
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: print block auxint value in HTML output
Michael Munday [Sat, 4 Apr 2020 21:51:15 +0000 (22:51 +0100)]
cmd/compile: print block auxint value in HTML output

The auxint value was being printed in LongString() but not LongHTML().

Fixes #38250.

Change-Id: I28e819feef8710f912bee424d1b900eb07f3abb8
Reviewed-on: https://go-review.googlesource.com/c/go/+/227160
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: improve lowered moves and zeros for ppc64le
Lynn Boger [Mon, 30 Mar 2020 19:23:19 +0000 (15:23 -0400)]
cmd/compile: improve lowered moves and zeros for ppc64le

This change includes the following:
- Generate LXV/STXV sequences instead of LXVD2X/STXVD2X on power9.
These instructions do not require an index register, which
allows more loads and stores within a loop without initializing
multiple index registers. The LoweredQuadXXX generate LXV/STXV.
- Create LoweredMoveXXXShort and LoweredZeroXXXShort for short
moves that don't generate loops, and therefore don't clobber the
address registers or flags.
- Use registers other than R3 and R4 to avoid conflicting with
registers that have already been allocated to avoid unnecessary
register moves.
- Eliminate the use of R14 as scratch register and use R31
instead.
- Add PCALIGN when the LoweredMoveXXX or LoweredZeroXXX generates a
loop with more than 3 iterations.

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

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

Change-Id: Iecad3a39ae55280286e42760a5c9d5c1168f5858
Reviewed-on: https://go-review.googlesource.com/c/go/+/226539
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agotime, runtime: only call resetTimer from (*Timer).Reset
Ian Lance Taylor [Fri, 3 Apr 2020 19:52:17 +0000 (12:52 -0700)]
time, runtime: only call resetTimer from (*Timer).Reset

Previously we stopped the timer and then reset it. With the current
timer implementation that is no longer required.

Change-Id: Ie7aba61ad53ce835f6fcd0b6bce7fe0a15b10e24
Reviewed-on: https://go-review.googlesource.com/c/go/+/227180
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
5 years agocmd/compile: restore missing columns in ssa.html
Bradford Lamson-Scribner [Sun, 5 Apr 2020 22:12:05 +0000 (16:12 -0600)]
cmd/compile: restore missing columns in ssa.html

If the final pass(es) are identical during ssa.html generation,
they are persisted in-memory as "pendingPhases" but never get
written as a column in the html. This change flushes those
in-memory phases.

Fixes #38242

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

5 years agoA+C: add Andy Pan (individual CLA)
Andy Pan [Sun, 5 Apr 2020 08:51:10 +0000 (16:51 +0800)]
A+C: add Andy Pan (individual CLA)

https://go-review.googlesource.com/q/author:panjf2000%2540gmail.com

Change-Id: I05c73d848b8f40dc864a18c733ca3f47b1eab54d
Reviewed-on: https://go-review.googlesource.com/c/go/+/227004
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: refactor around HTMLWriter removing logger in favor of Func
Bradford Lamson-Scribner [Sun, 5 Apr 2020 18:44:02 +0000 (12:44 -0600)]
cmd/compile: refactor around HTMLWriter removing logger in favor of Func

Replace HTMLWriter's Logger field with a *Func. Implement Fatalf method
for HTMLWriter which gets the Frontend() from the Func and calls down
into it's Fatalf method, passing the msg and args along. Replace
remaining calls to the old Logger with calls to logging methods on
the Func.

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

5 years agocmd/compile: enable -d=checkptr even on windows
Alex Brainman [Sat, 4 Apr 2020 07:36:58 +0000 (18:36 +1100)]
cmd/compile: enable -d=checkptr even on windows

CL 201783 enable -d=checkptr when -race or -msan is specified
everywhere but windows.

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

Updates #34964
Updates #34972

Change-Id: Id912fa83b0d5b46c6f1c134c742fd94d2d185835
Reviewed-on: https://go-review.googlesource.com/c/go/+/227003
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/dist: remove darwin/386, darwin/arm as valid ports
Brad Fitzpatrick [Fri, 3 Apr 2020 05:44:25 +0000 (22:44 -0700)]
cmd/dist: remove darwin/386, darwin/arm as valid ports

This only removes the ability to build it, and removes it as a
src/buildall.bash target (which uses go tool dist list).

Now:

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

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

Updates #37610
Updates #37611

Change-Id: I00f03b2355c2e152f75e57abd3063be243529d2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/226985
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
5 years agocmd/compile: add intrinsic HasCPUFeature for checking cpu features
Josh Bleecher Snyder [Thu, 19 Dec 2019 18:58:28 +0000 (10:58 -0800)]
cmd/compile: add intrinsic HasCPUFeature for checking cpu features

Before using some CPU instructions, we must check for their presence.
We use global variables in the runtime package to record features.

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

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

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

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

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

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

Updates #15808
Updates #36196

Change-Id: I75e2fcfcf5a6df1bdb80657a7143bed69fca6deb
Reviewed-on: https://go-review.googlesource.com/c/go/+/212360
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Giovanni Bajo <rasky@develer.com>
5 years agocmd/compile: allow mid-stack inlining when there is a cycle of recursion
Dan Scales [Wed, 1 Apr 2020 03:24:05 +0000 (20:24 -0700)]
cmd/compile: allow mid-stack inlining when there is a cycle of recursion

We still disallow inlining for an immediately-recursive function, but allow
inlining if a function is in a recursion chain.

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

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

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

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

Fixes #29737

Change-Id: I892fa84bb07a947b3125ec8f25ed0e508bf2bdf5
Reviewed-on: https://go-review.googlesource.com/c/go/+/226818
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocrypto/sha512: optimize sha512 by removing function literal
Xiangdong Ji [Fri, 13 Dec 2019 10:30:29 +0000 (10:30 +0000)]
crypto/sha512: optimize sha512 by removing function literal

The function 'block' called indirectly via function literal 'blockGeneric' prevents
'gc' performing an accurate escape analysis to its arguments, that will result in
unnecessary heap object allocation and GC cost.

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

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

[Geo mean]                                           9.81ms          9.59ms         -2.30%

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

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

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

[Geo mean]                                           3.39kB          4.08kB        +20.24%

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

[Geo mean]                                             35.7            53.6        +50.15%

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

[Geo mean]                                          9.85ms         9.82ms         -0.36%

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

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

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

[Geo mean]                                          3.34kB         4.01kB        +20.04%

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

[Geo mean]                                            35.7           53.6        +50.17%

Change-Id: Ibbda2d9bdff4eea4f611d4590abceb8764c44f2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/211617
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agoflag: fix TestExitCode on Plan 9
David du Colombier [Fri, 3 Apr 2020 16:57:46 +0000 (18:57 +0200)]
flag: fix TestExitCode on Plan 9

CL 221427 added TestExitCode. This test is failing
on Plan 9 because ExitCode is always equal to 1
on error since Plan 9 use error strings.

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

Fixes #38237.

Change-Id: Ie269722e731e275e5bfc51644c1fa6be76525f1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/227158
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: report original module path in error parsing replaced go.mod
Jay Conrod [Fri, 3 Apr 2020 14:42:55 +0000 (10:42 -0400)]
cmd/go: report original module path in error parsing replaced go.mod

MVS reports an error when a go.mod file declares a module path that
doesn't match the path it was required with. If the module is a
replacement, its declared path may be the original path (preferred) or
the replacement path.

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

Fixes #38220

Change-Id: I08b50a100679a447c8803cca1d1b32bc115ec1b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/227097
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agorun.bat: check go.exe instead of go
Egon Elbre [Fri, 3 Apr 2020 17:01:25 +0000 (20:01 +0300)]
run.bat: check go.exe instead of go

Windows requires checking with the .exe extension.

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

5 years agocmd/compile: add logging for large (>= 128 byte) copies
David Chase [Sun, 3 Nov 2019 03:57:11 +0000 (23:57 -0400)]
cmd/compile: add logging for large (>= 128 byte) copies

For 1.15, unless someone really wants it in 1.14.

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

Includes test.

Change-Id: I81f20c62da59d37072429f3a22c1809e6fb2946d
Reviewed-on: https://go-review.googlesource.com/c/go/+/205066
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoruntime: eliminate redundant load in Xchg and Xadd on arm64
Xiangdong Ji [Fri, 6 Mar 2020 08:44:23 +0000 (08:44 +0000)]
runtime: eliminate redundant load in Xchg and Xadd on arm64

Loading arguments of Xchg(64) and Xadd(64) functions to registers
could be done only once.

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

5 years agocmd/link: in stack bound check, don't check a call repetitively
Cherry Zhang [Fri, 3 Apr 2020 02:47:29 +0000 (22:47 -0400)]
cmd/link: in stack bound check, don't check a call repetitively

In stack bound check pass, check a call once, not over and over
again. Fix an accidental quadratic behavior...

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

Change-Id: Idd00c79e80af6278652c92a1d9d7bb2d194e9490
Reviewed-on: https://go-review.googlesource.com/c/go/+/227078
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Austin Clements <austin@google.com>
5 years agocmd/internal/obj/mips: don't emit spurious CALLIND relocations
Cherry Zhang [Fri, 3 Apr 2020 02:12:38 +0000 (22:12 -0400)]
cmd/internal/obj/mips: don't emit spurious CALLIND relocations

Generate a CALLIND relocation only for indirect calls, not for
indirect jumps. In particular, the RET instruction is lowered to
JMP (LR), an indirect jump, and occurs frequently. The large
amount of spurious relocations causes the linker to do a lot of
extra work.

Change-Id: Ie0edc04609788f5a687fd00c22558c3f83867697
Reviewed-on: https://go-review.googlesource.com/c/go/+/227079
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>