When we synthesize a playable example, prune declarations that may be
in the original example file but aren't used by the example.
This is ported from pkgsite, where it fixed#43658.
Change-Id: I41e6d4c28afa993c77c8a82b47bd86ba15ed13b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/401758
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
These tests appear to be using timeouts to check for deadlocks or to
cause the test to fail earlier. However, on slower machines these
short timeouts can cause spurious failures, and even on faster
machines if the test locks up we usually want a goroutine dump instead
of a short failure message anyway.
Fixes#52818 (maybe).
Change-Id: Ib8f18d679f9443721e8a924caef6dc8d214fca1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/405434
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
go get -d golang.org/x/tools@bc0e26ea127539a752b3a1849d05e007bb549def
go mod tidy
go mod vendor
Change-Id: I42e41c3348b18ffdfe511b34970340f7c7245b04
Reviewed-on: https://go-review.googlesource.com/c/go/+/405554
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Remove one link which isn't very interesting, and update another to
point to the current location.
Fixes#52753
Change-Id: I5f53ede35b0ded197bc0e6d41eabf28d736de5b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/405296
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
GC requires the whole zeroed word to be visible for a memory subsystem.
While the implementation of Enhanced REP STOSB tries to use as efficient
stores as possible, e.g writing the whole cache line and not byte-after-byte,
we should use REP STOSQ to guarantee the requirements of the GC.
The performance is not affected.
Change-Id: I1b0fd1444a40bfbb661541291ab96eba11bcc762
Reviewed-on: https://go-review.googlesource.com/c/go/+/405274
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
On ARM, when GOARM<=6 the TLS pointer is fetched via a call to a
kernel helper. This call clobbers LR, even just temporarily. If
the function is NOFRAME, if a profiling signal lands right after
the call returns, the unwinder will find the wrong LR. Not mark it
NOFRAME, so the LR will be saved in the usual way and stack
unwinding should work.
May fix#52829.
Change-Id: I419a31dcf4afbcff8d7ab8f179eec3c477589e60
Reviewed-on: https://go-review.googlesource.com/c/go/+/405482
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
This adds the code to allow the gcm assembler code to work on
big endian ppc64.
Updates #18499
Change-Id: Iab1ffc9b8af38a0605a91f2621dd9f4a9397b945
Reviewed-on: https://go-review.googlesource.com/c/go/+/404795
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Paul Murphy <murp@ibm.com>
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
The PPC64 maintainers are testing on P10 hardware, so it is helpful
to report the correct cpu, even if this information is not used
elsewhere yet.
Note, AIX will report the current CPU of the host system, so a
POWER10 will not set the IsPOWER9 flag. This is existing behavior,
and should be fixed in a separate patch.
Change-Id: Iebe23dd96ebe03c8a1c70d1ed2dc1506bad3c330
Reviewed-on: https://go-review.googlesource.com/c/go/+/404394
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
math/bits.Add64 and math/bits.Sub64 now lower and optimize
directly in SSA form.
The optimization of carry chains focuses around eliding
XER<->GPR transfers of the CA bit when used exclusively as an
input to a single carry operations, or when the CA value is
known.
This also adds support for handling XER spills in the assembler
which could happen if carry chains contain inter-dependencies
on each other (which seems very unlikely with practical usage),
or a clobber happens (SRAW/SRAD/SUBFC operations clobber CA).
With PPC64 Add64/Sub64 lowering into SSA and this patch, the net
performance difference in crypto/elliptic benchmarks on P9/ppc64le
are:
name old time/op new time/op delta
ScalarBaseMult/P256 46.3µs ± 0% 46.9µs ± 0% +1.34%
ScalarBaseMult/P224 356µs ± 0% 209µs ± 0% -41.14%
ScalarBaseMult/P384 1.20ms ± 0% 0.57ms ± 0% -52.14%
ScalarBaseMult/P521 3.38ms ± 0% 1.44ms ± 0% -57.27%
ScalarMult/P256 199µs ± 0% 199µs ± 0% -0.17%
ScalarMult/P224 357µs ± 0% 212µs ± 0% -40.56%
ScalarMult/P384 1.20ms ± 0% 0.58ms ± 0% -51.86%
ScalarMult/P521 3.37ms ± 0% 1.44ms ± 0% -57.32%
MarshalUnmarshal/P256/Uncompressed 2.59µs ± 0% 2.52µs ± 0% -2.63%
MarshalUnmarshal/P256/Compressed 2.58µs ± 0% 2.52µs ± 0% -2.06%
MarshalUnmarshal/P224/Uncompressed 1.54µs ± 0% 1.40µs ± 0% -9.42%
MarshalUnmarshal/P224/Compressed 1.54µs ± 0% 1.39µs ± 0% -9.87%
MarshalUnmarshal/P384/Uncompressed 2.40µs ± 0% 1.80µs ± 0% -24.93%
MarshalUnmarshal/P384/Compressed 2.35µs ± 0% 1.81µs ± 0% -23.03%
MarshalUnmarshal/P521/Uncompressed 3.79µs ± 0% 2.58µs ± 0% -31.81%
MarshalUnmarshal/P521/Compressed 3.80µs ± 0% 2.60µs ± 0% -31.67%
Note, P256 uses an asm implementation, thus, little variation is expected.
Change-Id: I88a24f6bf0f4f285c649e40243b1ab69cc452b71
Reviewed-on: https://go-review.googlesource.com/c/go/+/346870
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This issue has been fixed in CL 403837.
Fixes#51840.
Change-Id: I282062bb06278696fe25e9ede333c64539dc964e
Reviewed-on: https://go-review.googlesource.com/c/go/+/404914
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
A user noticed that, given the input
{
S: "Hello World",
Integer: 42,
},
{
S: " ", // an actual <tab>
Integer: 42,
},
gofmt would incorrectly format the code as
{
S: "Hello World",
Integer: 42,
},
{
S: " ", // an actual <tab>
Integer: 42,
},
The problem was in the nodeSize method, used to get the printed length
of a node before it's actually printed to the final buffer.
The exprList method calls nodeSize to see if one expression in a list
changes too drastically in size from the previous, which means the
vertical alignment should be broken.
It is worth noting that nodeSize only reports valid lengths if the node
fits into a single line; otherwise, it returns a large number, larger
than an "infinity" currently set to 1e6.
However, the "does it fit in a single line" logic was broken;
it checked if any of the to-be-printed characters is less than ' ',
which does include '\n' and '\f' (the latter used by tabwriter as well),
but also includes '\t', which would make nodeSize incorrectly conclude
that our key-value expression with a tab does not fit into a single line.
While here, make the testdata test cases run as sub-tests,
as I used "-run TestRewrite/tabs.input" to help debug this.
Fixes#51910.
Change-Id: Ib7936e02652bc58f99772b06384ae271fddf09e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/404955
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
When a fully instantiated generic method is exported, be sure to also
export the types in its signature.
Fixes#52279.
Change-Id: Icc6bca05b01f914cf67faaf1bf184eaa5484f521
Reviewed-on: https://go-review.googlesource.com/c/go/+/405118
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
CL 404296 removes the hidden visibility checks, but a few of them
were left. Remove them as well.
Change-Id: Idbcf37429709c91403803d32684239d398e43543
Reviewed-on: https://go-review.googlesource.com/c/go/+/404303
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
This fixes an obscure bug in 'go list -versions' if the repo contains
a tag with an explicit "+incompatible" suffix. However, I've never
seen such a repo in the wild; mostly it's an attempt to wrap my brain
around the code and simplify things a bit for the future.
Updates #51324
Updates #51312
Change-Id: I1b078b5db36470cf61aaa85b5244c99b5ee2c842
Reviewed-on: https://go-review.googlesource.com/c/go/+/387917
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
This CL updates the description of the frontend packages of the
compiler, which I'm more familiar with.
Updates #30074.
Change-Id: Ic279007f6102b21072d6558fa9035f0fcc267d93
Reviewed-on: https://go-review.googlesource.com/c/go/+/404694
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Fixes#50390
Change-Id: I92787cdb3fa198ff88dcaadeccfcb49a3a6a88cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/374954
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Following up on CL 403694, there is a bit of confusion about
when Path is and isn't set, along with now the exported Err field.
Catch the case where Path and Err (and lookPathErr) are all unset
and give a helpful error.
Fixes#52574
Followup after #43724.
Change-Id: I03205172aef3801c3194f5098bdb93290c02b1b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/403759
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
This edge represents the case of executing a write barrier under the
trace lock: we might use the wbufSpans lock to get a new trace buffer,
or mheap to allocate a totally new one.
Fixes#52794.
Change-Id: Ia1ac2c744b8284ae29f4745373df3f9675ab1168
Reviewed-on: https://go-review.googlesource.com/c/go/+/405476
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
The playExample function is very long. Move the code that finds
top-level declarations and unresolved identifiers to a separate
function.
In a future CL, we will be improving that function by removing
unused declarations.
Change-Id: I5632012674687f23094b2bc90615daaecb2cf525
Reviewed-on: https://go-review.googlesource.com/c/go/+/401757
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Move the test cases for doc.Examples from example_test.go into
their own files under testdata/examples.
This makes example_test.go easier to read and collapses several
similar test functions into one.
It will also make it less cumbersome to add large examples later.
Change-Id: Id220c1205e94027d14291898e541b69344842686
Reviewed-on: https://go-review.googlesource.com/c/go/+/401756
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
If SetFinalizer is never called, we might readgstatus on a nil fing
variable, resulting in a crash. This change guards code that accesses
fing by a nil check.
Fixes#52821.
Change-Id: I3e8e7004f97f073dc622e801a1d37003ea153a29
Reviewed-on: https://go-review.googlesource.com/c/go/+/405475
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rhys Hiltner <rhys@justin.tv>
When constructing a string for a method that will match an example
function's name, remove brackets from the receiver. This makes it
possible to write an example associated with a method of a generic
type.
Also, modify the test for classifying examples to check that all the
expected examples actually appear.
Fixesgolang/go#52496.
Change-Id: Iebc5768f6cb91df9671dd701b97958fb8081f986
Reviewed-on: https://go-review.googlesource.com/c/go/+/401761
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
When synthesizing a program from a playable example, preserve
the grouping of imports. That is, maintain blank lines between
imports while removing unused ones.
People are used to having those groups because that is what goimports
does. It's disconcerting to see the all imports placed together, as
the existing code does, especially when the user has already grouped
them.
For an example, see golang/go#43658.
This is an improvement to a fix in pkgsite's fork of go/doc
(https://go.googlesource.com/pkgsite/+/7b10ef3861af4a863bf215f63b6de94c681d5af0/internal/godoc/internal/doc/example_pkgsite.go#405).
Here I've managed to avoid using a token.FileSet.
Change-Id: I65605e6dd53d742a3fe1210c3f982b54e3706198
Reviewed-on: https://go-review.googlesource.com/c/go/+/384837
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Fixes#48642
Change-Id: I7bf00517bea43dcf38e15b778818a3a3f6ffe23e
GitHub-Last-Rev: a0e8b80f18
GitHub-Pull-Request: golang/go#48753
Reviewed-on: https://go-review.googlesource.com/c/go/+/353714
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Fixes#52783
Change-Id: I12e3da40d49cd92776052bf19cb07ee8a07f3ee0
Reviewed-on: https://go-review.googlesource.com/c/go/+/405215
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
CL 214429, among other things, created gccgo_link_c.txt as a copy of a
test formerly in go_test.go, but accidentally did so incorrectly:
it used -r instead of -n. This was not noticed because the new test
also incorrectly used [gccgo] when it should have used [exec:gccgo].
Fixing both of those, and also fixing the test to use a go.mod file,
revealed that "go build -n -compiler gccgo" doesn't work, because
it passes a non-existent tmpdir to pkgpath.ToSymbolFunc. This CL
fixes that too.
Change-Id: Id89296803b55412af3bd87aab992f32e26dbce0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/341969
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Named type identity is no longer canonical. For correctness, named types
need to be compared with types.Identical. Our method set algorithm was
not doing this: it was using a map to de-duplicate named types, relying
on their pointer identity. As a result it was possible to get incorrect
results or even infinite recursion, as encountered in #52715.
To fix this, look up types by identity in NewMethodSet and
LookupFieldOrMethod. This does a linear search among types with equal
origin. Alternatively we could use a *Context to do a hash lookup, but
in practice we will be considering a small number of types, and so
performance is not a concern and a linear lookup is simpler. This also
means we don't have to rely on our type hash being perfect, which we
don't depend on elsewhere.
Also add more tests for NewMethodSet and LookupFieldOrMethod involving
generics.
Fixes#52715Fixes#51580
Change-Id: I04dfeff54347bc3544d95a30224c640ef448e9b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/404099
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
CL 394576 removed FuncBody, which is the only caller of CheckUnused and
CheckReturn. CL 394556 removed all usages of curpkg.
controlLabel was added (un-intentionally?) in Cl 277920 but never used.
Change-Id: I7f47f93b4b9ae9c1a681ff4717920f8d2e7c19c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/405094
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
A successful invocation of the hostname command prints the hostname
to stdout and exits with code 0. No part of the hostname is printed
to stderr, so don't consider it.
This avoids false positive failures in environments where hostname
prints some extraneous information (such as performance warnings)
to stderr, and makes the test a bit more robust.
Fixes#52781.
Change-Id: I46aa6fbf95b6616bacf9c2b5e412b0851b230744
Reviewed-on: https://go-review.googlesource.com/c/go/+/405014
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Jason Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Since when CL 29244 did remove it.
Change-Id: I5f96d7404209cbc336b0541502943871461cb72e
Reviewed-on: https://go-review.googlesource.com/c/go/+/403714
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Following CL 405114, the extension rule is also wrong. It is safe
to drop the extension if the value is from a boolean-generating
instruction, but not a boolean-typed Value in general (e.g. a Phi
or a in-register parameter). Fix it.
Updates #52788.
Change-Id: Icf3028fe8e90806f9f57fbe2b38d47da27a97e2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/405115
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
CL 266638 marked racewriterange (and some other race functions) as
ABIinternal but missed racereadrange.
arm64 and ppc64le (the other two register ABI platforms at the moment)
already have racereadrange marked as such.
The other two instrumented calls are to racefuncenter/racefuncexit.
Do you think they would need this treatment as well? arm64 already does,
but amd64 and ppc64le do not.
Fixes#51459
Change-Id: I3f54e1298433b6d67bfe18120d9f86205ff66a73
Reviewed-on: https://go-review.googlesource.com/c/go/+/393154
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
On ARM64, an If block is lowered to (NZ cond yes no). This is
incorrect because cond is a boolean value and therefore only the
last byte is meaningful (same as AMD64, see ARM64Ops.go). But here
we are comparing a full register width with 0. Correct it by
comparing only the last bit.
Fixes#52788.
Change-Id: I2cacf9f3d2f45e149c361a290f511b2d4ed845c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/405114
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Plan 9 doesn't have symbolic links, so EvalSymlinks can be simplified
just to check validity of the path and call Clean. This saves a lot
of redundant file system activity.
Updates #50775
Change-Id: I84c24ef1d5e6e38fd19df2d37c72fbf883f0140d
Reviewed-on: https://go-review.googlesource.com/c/go/+/404954
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: David du Colombier <0intro@gmail.com>
Fix up a test to insure that it does the right thing when
"go test -cover" is in effect.
Fixes#52761.
Change-Id: I0c141181e2dcaefd592fb04813f812f2800511da
Reviewed-on: https://go-review.googlesource.com/c/go/+/404715
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
This results in a 1.7-2.4x improvement in native go crypto/elliptic
multiplication operations on PPC64, and similar improvements might
be possible on other architectures which use flags or similar to
represent the carry bit in SSA form.
If it is possible, schedule carry chains independently of each
other to avoid clobbering the carry flag. This is very expensive.
This is done by:
1. Identifying carry bit using, but not creating ops, and lowering
their priority below all other ops which do not need to be
placed at the top of a block. This effectively ensures only
one carry chain will be placed at a time in most important
cases (crypto/elliptic/internal/fiat contains most of them).
2. Raising the priority of carry bit generating ops to schedule
later in a block to ensure they are placed as soon as they
are ready.
Likewise, tuple ops which separate carrying ops are scored
similar to 2 above. This prevents unrelated ops from being
scheduled between carry-dependent operations. This occurs
when unrelated ops are ready to schedule alongside such
tuple ops. This reduces the chances a flag clobbering op
might be placed between two carry-dependent operations.
With PPC64 Add64/Sub64 lowering into SSA and this patch, the net
performance difference in crypto/elliptic benchmarks on P9/ppc64le
are:
name old time/op new time/op delta
ScalarBaseMult/P256 46.3µs ± 0% 46.9µs ± 0% +1.34%
ScalarBaseMult/P224 356µs ± 0% 209µs ± 0% -41.14%
ScalarBaseMult/P384 1.20ms ± 0% 0.57ms ± 0% -52.14%
ScalarBaseMult/P521 3.38ms ± 0% 1.44ms ± 0% -57.27%
ScalarMult/P256 199µs ± 0% 199µs ± 0% -0.17%
ScalarMult/P224 357µs ± 0% 212µs ± 0% -40.56%
ScalarMult/P384 1.20ms ± 0% 0.58ms ± 0% -51.86%
ScalarMult/P521 3.37ms ± 0% 1.44ms ± 0% -57.32%
MarshalUnmarshal/P256/Uncompressed 2.59µs ± 0% 2.52µs ± 0% -2.63%
MarshalUnmarshal/P256/Compressed 2.58µs ± 0% 2.52µs ± 0% -2.06%
MarshalUnmarshal/P224/Uncompressed 1.54µs ± 0% 1.40µs ± 0% -9.42%
MarshalUnmarshal/P224/Compressed 1.54µs ± 0% 1.39µs ± 0% -9.87%
MarshalUnmarshal/P384/Uncompressed 2.40µs ± 0% 1.80µs ± 0% -24.93%
MarshalUnmarshal/P384/Compressed 2.35µs ± 0% 1.81µs ± 0% -23.03%
MarshalUnmarshal/P521/Uncompressed 3.79µs ± 0% 2.58µs ± 0% -31.81%
MarshalUnmarshal/P521/Compressed 3.80µs ± 0% 2.60µs ± 0% -31.67%
Note, P256 uses an asm implementation, thus, little variation is expected.
Updates #40171
Change-Id: I810850e8ff429505424c92d6fe37f99aaa0c6e84
Reviewed-on: https://go-review.googlesource.com/c/go/+/393656
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Filippo Valsorda <valsorda@google.com>
For this code:
z &= 63
_ = x<<z | x>>(64-z)
Now can prove 'x<<z' in bound. In ppc64 lowering pass, it will not
produce an extra '(ANDconst <typ.Int64> [63] z)' causing
codegen/rotate.go failed. Just remove the type check in rewrite rules
as the workaround.
Removes 32 bounds checks during make.bat.
Fixes#52563.
Change-Id: I14ed2c093ff5638dfea7de9bc7649c0f756dd71a
Reviewed-on: https://go-review.googlesource.com/c/go/+/404315
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
An invalid program may produce invalid types. If the program
calls unsafe.Sizeof on such a type, which is a compile-time
computation, the size-computation must be able to handle it.
Add the invalid type to the list of permissible basic types
and give it a size of 1 (word).
Fixes#52748.
Change-Id: I6c409628f9b77044758caf71cdcb199f9e77adea
Reviewed-on: https://go-review.googlesource.com/c/go/+/404894
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Change-Id: I655095874a90fc3e390df5609e68f0e48a042fea
GitHub-Last-Rev: 6d3199b4cf
GitHub-Pull-Request: golang/go#52759
Reviewed-on: https://go-review.googlesource.com/c/go/+/404814
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Make some code more simple.
Change-Id: I801adf0dba5f6c515681345c732dbb907f945419
GitHub-Last-Rev: a505146bac
GitHub-Pull-Request: golang/go#49626
Reviewed-on: https://go-review.googlesource.com/c/go/+/364634
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
A Java jar file is a zip file, but it can have a prefix that is a bash
script that unpacks the zip file. Most zip programs ignore such prefixes.
This CL changes the archive/zip package to do the same.
Fixes#10464Fixes#51337
Change-Id: I976e9c64684644317bd21077bc5b4a2baf626ee6
Reviewed-on: https://go-review.googlesource.com/c/go/+/387976
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Ian Lance Taylor <iant@google.com>
When the procUnpin is placed after shared.pushHead, there is
no need for x as a flag to indicate the previous process.
This CL can make the logic clear, and at the same time reduce
a redundant judgment.
Change-Id: I34ec9ba4cb5b5dbdf13a8f158b90481fed248cf5
Reviewed-on: https://go-review.googlesource.com/c/go/+/360059
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
When using windows some users got a weird error (File not found) when the timezone database is not found. It happens because some methods in the time package don't treat ERROR_PATH_NOT_FOUND and ENOTDIR. To solve it was added a conversion to ENOTENT error.
Fixes#50248
Change-Id: I11c84cf409e01eafb932aea43c7293c8218259b8
GitHub-Last-Rev: fe7fff90cb
GitHub-Pull-Request: golang/go#50906
Reviewed-on: https://go-review.googlesource.com/c/go/+/381957
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
When calling a C function, line information will be
incorrect if the function call's closing parenthesis
is not on the same line as the last argument. We add
a comment with the line info for the return statement
to guide debuggers to the correct line.
Fixes#49839.
Change-Id: I8bc2ce35fec9cbcafbbe8536d5a79dc487eb24bb
GitHub-Last-Rev: 8b28646d2e
GitHub-Pull-Request: golang/go#49840
Reviewed-on: https://go-review.googlesource.com/c/go/+/367454
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This CL updates big.Jacobi to avoid forcing its y argument to escape
to the heap. The argument was escaping because it was being passed
through an empty interface to fmt.Sprintf during an assertion failure.
As a result, callers of Jacobi and Int.ModSqrt (which calls Jacobi)
could not keep this value on the stack.
Noticed when working on https://github.com/cockroachdb/apd/pull/103.
Change-Id: I5db9ee2149bf13b921886929425861721b53b085
GitHub-Last-Rev: 3ee07b5dc3
GitHub-Pull-Request: golang/go#50527
Reviewed-on: https://go-review.googlesource.com/c/go/+/377014
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>