Robert Griesemer [Thu, 12 May 2022 03:52:05 +0000 (20:52 -0700)]
spec: use original terminology in metasyntax (cleanup)
The metasyntax used in the spec is exactly the Wirth Syntax
Notation (WSN), which eventually influenced EBNF. Add a link
but keep mentioning EBNF which is likely more commonly known.
Use the original terms in the productions. Specifically, use
the words "Term" and "Factor" rather than "Alternative" and
"Term".
The terminology cleanup also resolves an inconsistency in the
subsequent prose which is referring to the correct "terms" now.
While at it, add a production for the entire Syntax itself,
matching the original WSN definition.
Also, replace the two uses of "grammar" with "syntax" for
consistency ("syntax" is the prevalent term used throughout
the spec).
Fixes #50074.
Change-Id: If770d5f32f56f509f85893782c1dafbb0eb29b2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/405814 Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Robert Griesemer [Thu, 12 May 2022 01:22:51 +0000 (18:22 -0700)]
spec: use Unicode terminology consistently
- refer to character "categories" rather than "classes" per the
definitions in the Unicode standard
- use "uppercase", "lowercase" (one word) instead of "upper case"
or "upper-case", matching the spelling in the Unicode standard
- clarify that that the blank character "_" is considered a lowercase
letter for Go's purposes (export of identifiers)
Fixes #44715.
Change-Id: I54ef177d26c6c56624662fcdd6d1da60b9bb8d02
Reviewed-on: https://go-review.googlesource.com/c/go/+/405758 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Cherry Mui [Fri, 6 May 2022 17:52:23 +0000 (13:52 -0400)]
cmd/link: remove name expansion logic
Now both the compiler and the assembler require the -p flag and
emit full package path in symbol names, we no longer need to do
the name expansion in the linker. Delete it.
Change-Id: I771d4d97987a0a17414881b52806d600ef4cc351
Reviewed-on: https://go-review.googlesource.com/c/go/+/404300 Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Tobias Klauser [Thu, 12 May 2022 07:30:54 +0000 (09:30 +0200)]
net/netip: skip some TestAddrStringAllocs tests on noopt builders
CL 403914 introduced TestAddrStringAllocs which checks that there is
only 1 alloc in Addr.String for v4-in-v6 addresses. This requires
optimizations to be enabled, otherwise there are 2 allocs. Skip the
ipv4-in-ipv6 sub-tests on noopt builders to fix failing
TestAddrStringAllocs on the noopt builders.
Robert Griesemer [Wed, 11 May 2022 23:21:45 +0000 (16:21 -0700)]
spec: state that variable names must be unique in short var decls
Fixes #45652.
Change-Id: I5e1434480c12815369a6ce204f3729eb63139125
Reviewed-on: https://go-review.googlesource.com/c/go/+/405757 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Robert Griesemer [Wed, 11 May 2022 22:41:21 +0000 (15:41 -0700)]
spec: clarify "continue" statement
Taking into account the discussion and relevant feedback on a
change proposed in 2013 (see e-mail thread mentioned in issue).
Fixes #48864.
Change-Id: I811d518b7cbdf6b815695174f1da3d4251f491c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/405756 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Robert Griesemer [Wed, 11 May 2022 22:08:38 +0000 (15:08 -0700)]
spec: correct assignment rules with respect to type parameters
Fixes #52628.
Change-Id: If4261abc25868d62f7689253d40f872692c23a4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/405755 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Robert Griesemer [Wed, 11 May 2022 21:40:34 +0000 (14:40 -0700)]
spec: adjust scope of function/method type parameters
Change scope rules per the accepted proposal #52038.
Match prose for type parameters of type declarations.
Fixing the implementation is tracked by #51503.
Fixes #52038.
For #51503.
Change-Id: Iebd88a82c896b7b2e8520cd514ef6a2cc903e807
Reviewed-on: https://go-review.googlesource.com/c/go/+/405754 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Xiaodong Liu [Thu, 25 Nov 2021 03:59:37 +0000 (11:59 +0800)]
cmd/compile/internal/ssagen: enable intrinsic operation on loong64
Contributors to the loong64 port are:
Weining Lu <luweining@loongson.cn>
Lei Wang <wanglei@loongson.cn>
Lingqin Gong <gonglingqin@loongson.cn>
Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Meidan Li <limeidan@loongson.cn>
Xiaojuan Zhai <zhaixiaojuan@loongson.cn>
Qiyuan Pu <puqiyuan@loongson.cn>
Guoqi Chen <chenguoqi@loongson.cn>
This port has been updated to Go 1.15.6:
https://github.com/loongson/go
Updates #46229
Change-Id: If28fe03297e1de62f348373f2779dce07f54611c
Reviewed-on: https://go-review.googlesource.com/c/go/+/367042 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: 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@google.com>
Xiaodong Liu [Wed, 24 Nov 2021 09:48:09 +0000 (17:48 +0800)]
cmd/compile/internal/ssa: config functions used in lower pass for loong64
Contributors to the loong64 port are:
Weining Lu <luweining@loongson.cn>
Lei Wang <wanglei@loongson.cn>
Lingqin Gong <gonglingqin@loongson.cn>
Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Meidan Li <limeidan@loongson.cn>
Xiaojuan Zhai <zhaixiaojuan@loongson.cn>
Qiyuan Pu <puqiyuan@loongson.cn>
Guoqi Chen <chenguoqi@loongson.cn>
This port has been updated to Go 1.15.6:
https://github.com/loongson/go
Updates #46229
Change-Id: I50d20eb22f2108d245513de8ac95ebe0b7e1a1dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/367037 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Ian Lance Taylor <iant@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>
Xiaodong Liu [Thu, 25 Nov 2021 03:41:03 +0000 (11:41 +0800)]
cmd/compile/internal/ssa: add support on loong64 for schedule phase
Contributors to the loong64 port are:
Weining Lu <luweining@loongson.cn>
Lei Wang <wanglei@loongson.cn>
Lingqin Gong <gonglingqin@loongson.cn>
Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Meidan Li <limeidan@loongson.cn>
Xiaojuan Zhai <zhaixiaojuan@loongson.cn>
Qiyuan Pu <puqiyuan@loongson.cn>
Guoqi Chen <chenguoqi@loongson.cn>
This port has been updated to Go 1.15.6:
https://github.com/loongson/go
Updates #46229
Change-Id: Id533912c62d8c4e2aa3c124561772b543d685d7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/367041
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>
Xiaodong Liu [Thu, 25 Nov 2021 02:26:47 +0000 (10:26 +0800)]
cmd/compile/internal/ssa: inline memmove with known size
Contributors to the loong64 port are:
Weining Lu <luweining@loongson.cn>
Lei Wang <wanglei@loongson.cn>
Lingqin Gong <gonglingqin@loongson.cn>
Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Meidan Li <limeidan@loongson.cn>
Xiaojuan Zhai <zhaixiaojuan@loongson.cn>
Qiyuan Pu <puqiyuan@loongson.cn>
Guoqi Chen <chenguoqi@loongson.cn>
This port has been updated to Go 1.15.6:
https://github.com/loongson/go
Updates #46229
Change-Id: I1534b66b527efaf2bbaa8e6e6ac0618aac0b5930
Reviewed-on: https://go-review.googlesource.com/c/go/+/367040
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>
TryBot-Result: Gopher Robot <gobot@golang.org>
Xiaodong Liu [Wed, 24 Nov 2021 09:31:18 +0000 (17:31 +0800)]
cmd/compile/internal/ssa{,/gen}: define rules and operation on loong64
The rules and operation definition is used to generate rewrite functions
and OpKind type constant.
Contributors to the loong64 port are:
Weining Lu <luweining@loongson.cn>
Lei Wang <wanglei@loongson.cn>
Lingqin Gong <gonglingqin@loongson.cn>
Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Meidan Li <limeidan@loongson.cn>
Xiaojuan Zhai <zhaixiaojuan@loongson.cn>
Qiyuan Pu <puqiyuan@loongson.cn>
Guoqi Chen <chenguoqi@loongson.cn>
This port has been updated to Go 1.15.6:
https://github.com/loongson/go
Updates #46229
Change-Id: Ia362ed7ba5d84046697aadbc8d6d4cbe495f6076
Reviewed-on: https://go-review.googlesource.com/c/go/+/367039
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Tobias Klauser [Wed, 4 May 2022 19:45:02 +0000 (21:45 +0200)]
net/netip: reduce allocations in Addr.String for v4-in-v6 addresses
ip.Unmap will always return an Addr with ip.z == z4 in case of an
v4-in-v6 address. Thus, Addr.string4 can be called directly without the
additional indirection.
Xiaodong Liu [Wed, 24 Nov 2021 09:53:07 +0000 (17:53 +0800)]
cmd/compile/internal/ssa: increase the bit width of BlockKind type
After the BlockKind of loong64 is introduced, it exceeds the maximum
range that int8 can represent.
Contributors to the loong64 port are:
Weining Lu <luweining@loongson.cn>
Lei Wang <wanglei@loongson.cn>
Lingqin Gong <gonglingqin@loongson.cn>
Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Meidan Li <limeidan@loongson.cn>
Xiaojuan Zhai <zhaixiaojuan@loongson.cn>
Qiyuan Pu <puqiyuan@loongson.cn>
Guoqi Chen <chenguoqi@loongson.cn>
This port has been updated to Go 1.15.6:
https://github.com/loongson/go
Updates #46229
Change-Id: I246d9c22334d0ea9e1440d29df05c9ec2d472b30
Reviewed-on: https://go-review.googlesource.com/c/go/+/367038
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Cherry Mui [Thu, 5 May 2022 21:45:27 +0000 (17:45 -0400)]
cmd/asm: require -p flag
CL 391014 requires the compiler to be invoked with the -p flag, to
specify the package path. Later, CL 394217 makes the compiler to
produce an unlinkable object file, so "go tool compile x.go" can
still be used on the command line. This CL does the same for the
assembler, requiring -p, otherwise generating an unlinkable object.
No special case for the main package, as the main package cannot
be only assembly code, and there is no way to tell if it is the
main package from an assembly file.
Now we guarantee that we always have an expanded package path in
the object file. A later CL will delete the name expansion code
in the linker.
Change-Id: I8c10661aaea2ff794614924ead958d80e7e2487d
Reviewed-on: https://go-review.googlesource.com/c/go/+/404298
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Cherry Mui [Thu, 5 May 2022 21:22:17 +0000 (17:22 -0400)]
cmd/internal/obj: add a flag to not write referenced symbol names in object file
The Go object file references (some of) symbols from other
packages by indices, not by names. The linker doesn't need the
symbol names to do the linking. The names are included in the
object file so it is self-contained and tools (objdump, nm) can
read the referenced symbol names. Including the names increases
object file size. Add a flag to disable it on demand (off by
default).
Change-Id: I143a0eb656997497c750b8eb1541341b2aee8f30
Reviewed-on: https://go-review.googlesource.com/c/go/+/404297
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Xiaodong Liu [Sun, 15 Aug 2021 08:01:31 +0000 (16:01 +0800)]
cmd/internal/obj{,/loong64}: instructions and registers for loong64
Implemented an assembler for LoongArch64(loong64 is short name) -
this provides register definitions and instruction encoding as
defined in the LoongArch Instruction Set Manual.
LoongArch Instruction Set Manual:
https://github.com/loongson/LoongArch-Documentation/releases
Contributors to the linux/loong64 port are:
Weining Lu <luweining@loongson.cn>
Lei Wang <wanglei@loongson.cn>
Lingqin Gong <gonglingqin@loongson.cn>
Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Meidan Li <limeidan@loongson.cn>
Xiaojuan Zhai <zhaixiaojuan@loongson.cn>
Qiyuan Pu <puqiyuan@loongson.cn>
Guoqi Chen <chenguoqi@loongson.cn>
This port has been updated to Go 1.15.6:
https://github.com/loongson/go
Updates #46229
Change-Id: I930d2a19246496e3ca36d55539183c0f9f650ad9
Reviewed-on: https://go-review.googlesource.com/c/go/+/342309 Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
David Chase [Tue, 29 Mar 2022 17:16:35 +0000 (13:16 -0400)]
cmd/compile: convert merge to use appl. bal. trees for sharing
This CL replaces a not-very-shared linear-sized set
representation with a much more shared representation.
For the annoying test program in question, it reduces
the heap size by 95%, and the time slightly.
However, for some programs build time is longer.
This also includes at least one bug fix for problems
uncovered while ensuring compatibility with what it
replaces.
Fixes #51543.
Change-Id: Ie7a4c6ea460775faeed2b0378ab21ddffd15badc
Reviewed-on: https://go-review.googlesource.com/c/go/+/397318
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
Bryan C. Mills [Wed, 11 May 2022 14:42:39 +0000 (10:42 -0400)]
cmd/go: add timestamps to script test output
Go tests don't include timestamps by default, but we would like to
have them in order to correlate builder failures with server and
network logs.
Since many of the Go tests with external network and service
dependencies are script tests for the 'go' command, logging timestamps
here adds a lot of logging value with one simple and very low-risk
change.
Change-Id: I8ba0efcf5d42595d856082656b45f87bb3d7be0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/404696
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Charlie Vieth [Sat, 12 Mar 2022 22:27:42 +0000 (17:27 -0500)]
go/build: replace ioutil.ReadDir with os.ReadDir
Change go/build.readDir to use os.ReadDir instead of ioutil.ReadDir.
This addresses a TODO and improves performance on Darwin and Linux.
Darwin: Apple M1
name old time/op new time/op delta
ImportVendor-10 39.8µs ± 1% 37.0µs ± 1% -6.91% (p=0.000 n=10+10)
Linux: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
name old time/op new time/op delta
ImportVendor-16 22.9µs ±11% 21.2µs ± 5% -7.47% (p=0.001 n=10+9)
Updates #45557
Change-Id: Ib1bd2e66210e714e499a035847d6261b61b7e2c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/392074
Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Axel Busch [Tue, 10 May 2022 13:48:19 +0000 (13:48 +0000)]
runtime: enable vDSO support for s390x architecture
This change adds support for vDSO for s390x architecture. This avoids the use of system calls in nanotime and walltime and accelerates them by factor 4-5.
Keith Randall [Tue, 10 May 2022 23:15:35 +0000 (16:15 -0700)]
doc: mention jump tables and tsan upgrades in 1.19 release notes
Change-Id: I0ab34f2f931e0e712218e4eb086f4535cc17775c
Reviewed-on: https://go-review.googlesource.com/c/go/+/405614 Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Matthew Dempsky [Mon, 28 Mar 2022 16:30:41 +0000 (09:30 -0700)]
runtime: change maxSearchAddr into a helper function
This avoids a dependency on the compiler statically initializing
maxSearchAddr, which is necessary so we can disable the (overly
aggressive and spec non-conforming) optimizations in cmd/compile and
gccgo.
Updates #51913.
Change-Id: I424e62c81c722bb179ed8d2d8e188274a1aeb7b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/396194 Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Bryan C. Mills [Tue, 10 May 2022 13:07:34 +0000 (09:07 -0400)]
os/exec: eliminate some arbitrary short timeouts
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.
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>
nimelehin [Mon, 9 May 2022 20:22:14 +0000 (23:22 +0300)]
runtime: store pointer-size words in memclr
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>
Cherry Mui [Tue, 10 May 2022 20:09:54 +0000 (16:09 -0400)]
runtime: not mark save_g NOFRAME on ARM
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>
Paul E. Murphy [Thu, 5 May 2022 15:27:24 +0000 (10:27 -0500)]
internal/cpu: report CPU if known on PPC64
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>
Paul E. Murphy [Tue, 8 Jun 2021 18:16:01 +0000 (13:16 -0500)]
cmd/compile: lower Add64/Sub64 into ssa on PPC64
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:
Daniel Martí [Sun, 8 May 2022 22:29:23 +0000 (23:29 +0100)]
go/printer: align expression list elements containing tabs
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>
Bryan C. Mills [Thu, 24 Feb 2022 21:12:34 +0000 (16:12 -0500)]
cmd/go/internal/modfetch: simplify handling of weird version tags
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.
Ian Lance Taylor [Thu, 30 Dec 2021 06:02:45 +0000 (22:02 -0800)]
archive/zip: error if using io/fs on zip with duplicate entries
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>
Russ Cox [Tue, 3 May 2022 19:14:56 +0000 (15:14 -0400)]
os/exec: return clear error for missing cmd.Path
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.
Michael Anthony Knyszek [Tue, 10 May 2022 15:18:21 +0000 (15:18 +0000)]
runtime: add lock partial order edge for trace and wbufSpans and mheap
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.
Michael Anthony Knyszek [Tue, 10 May 2022 15:09:12 +0000 (15:09 +0000)]
runtime: profile finalizer G more carefully in goroutine profile
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>
Jonathan Amsterdam [Fri, 22 Apr 2022 17:18:15 +0000 (13:18 -0400)]
go/doc: remove brackets from receiver in example identifier
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.
Fixes golang/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>
Jonathan Amsterdam [Thu, 10 Feb 2022 15:32:58 +0000 (10:32 -0500)]
go/doc: group play example imports
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>
Alexander Yastrebov [Sun, 8 May 2022 09:46:10 +0000 (09:46 +0000)]
net/http: close accepted connection
Fixes #48642
Change-Id: I7bf00517bea43dcf38e15b778818a3a3f6ffe23e
GitHub-Last-Rev: a0e8b80f18dc8ae60944e01e5985c30d610efdf5
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>
Ian Lance Taylor [Mon, 9 May 2022 20:23:10 +0000 (13:23 -0700)]
go/doc/comment: don't crash if there are no words to wrap
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>
Ian Lance Taylor [Thu, 12 Aug 2021 22:51:26 +0000 (15:51 -0700)]
cmd/go: don't fail in ToSymbolFunc when using -n
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>
Robert Findley [Wed, 4 May 2022 21:41:39 +0000 (17:41 -0400)]
go/types, types2: use a type lookup by identity in method lookup
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 #52715
Fixes #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>
Dmitri Shuralyov [Mon, 9 May 2022 03:04:28 +0000 (23:04 -0400)]
os, syscall: don't consider stderr output as part of hostname
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>
nimelehin [Fri, 24 Dec 2021 12:29:18 +0000 (15:29 +0300)]
runtime: use ERMS in memclr_amd64
This patch adds support for REP STOSB in memclr(). The current
implementation uses REP STOSB when 1) ERMS is supported
2) size is bigger than 2kb and less than 32mb.
The threshold of 2kb is chosen based on benchmark results and is
close to what Intel mentioned in their comparison of ERMSB and AVX
(Table 3-4. Relative Performance of Memcpy() Using ERMSB Vs. 128-bit
AVX in the Intel Optimization Guide).
While REP STOS uses a no-RFO write protocol, ERMS could show the
same or slower performance comparing to Non-Temporal Stores when the
size is bigger than LLC depending on hardware.
Change-Id: I8f3533f88ebd303ae1666a77391fec304bea9724
Reviewed-on: https://go-review.googlesource.com/c/go/+/374396 Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Cherry Mui [Mon, 9 May 2022 16:57:31 +0000 (12:57 -0400)]
cmd/compile: more fix on boolean ops on ARM64
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>
Keith Randall [Tue, 15 Mar 2022 20:03:39 +0000 (13:03 -0700)]
runtime: make racereadrange ABIinternal
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>
Cherry Mui [Mon, 9 May 2022 15:29:36 +0000 (11:29 -0400)]
cmd/compile: fix If lowering on ARM64
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>
miller [Sun, 8 May 2022 12:29:27 +0000 (13:29 +0100)]
path/filepath: simplify EvalSymlinks for plan9
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>
Archana R [Mon, 10 Jan 2022 08:15:25 +0000 (02:15 -0600)]
internal/bytealg: optimize index function for ppc64le/power9
Optimized index2to16 loop by unrolling the loop by 4.
Multiple benchmark tests show performance improvement on
POWER9. Similar improvements are seen on POWER10. Added
tests to ensure changes work fine.
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:
Wayne Zuo [Sat, 7 May 2022 05:58:24 +0000 (13:58 +0800)]
cmd/compile: teach prove about and operation
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>
Robert Griesemer [Sat, 7 May 2022 23:18:57 +0000 (16:18 -0700)]
cmd/compile: don't crash in size computation for invalid type
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>
Jinzhu [Sat, 7 May 2022 13:04:41 +0000 (13:04 +0000)]
A+C: add Jinzhu Zhang
Change-Id: I655095874a90fc3e390df5609e68f0e48a042fea
GitHub-Last-Rev: 6d3199b4cfedf744f1485b119c8b40252031232b
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>
Ryan Leung [Tue, 23 Nov 2021 03:00:32 +0000 (03:00 +0000)]
all: fix some lint issues
Make some code more simple.
Change-Id: I801adf0dba5f6c515681345c732dbb907f945419
GitHub-Last-Rev: a505146baca00a1b3268d11d10510afa8cea6f1d
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>
Ian Lance Taylor [Fri, 25 Feb 2022 03:23:17 +0000 (19:23 -0800)]
archive/zip: permit zip files to have prefixes
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 #10464
Fixes #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>
Jason7602 [Mon, 1 Nov 2021 15:27:45 +0000 (23:27 +0800)]
sync: remove the redundant logic on sync.(*Pool).Put
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>
rlanhellas [Mon, 31 Jan 2022 22:47:42 +0000 (22:47 +0000)]
time: return ENOENT instead of ERROR_PATH_NOT_FOUND in windows
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: fe7fff90cbea06c4af41e5b2ecadea0d409e2c05
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>
Patrick Pokatilo [Mon, 29 Nov 2021 07:22:15 +0000 (07:22 +0000)]
cmd/cgo: add line info for return statements
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: 8b28646d2e25b19272ded7a3d54b9374108a54e2
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>
Nathan VanBenschoten [Sun, 9 Jan 2022 20:29:40 +0000 (20:29 +0000)]
math/big: don't force second arg to Jacobi and Int.ModSqrt to escape
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: 3ee07b5dc3292553cc0cd0eb2d38ef036c341a9d
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>
The assignment operation in the program seems to be redundant, the first judgment will continue to overwrite the previous value.
The subsequent slicing operation will cut all the values without frequency.
Change-Id: Id59fc36dd5bacfde881edaf0d9c1af5348286611
Reviewed-on: https://go-review.googlesource.com/c/go/+/244157
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Joe Tsai <joetsai@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
michael [Tue, 1 Feb 2022 14:41:20 +0000 (14:41 +0000)]
net: improve error handling in dnsclient_unix.go
In the file net/dnsclient_unix.go in the function newRequest
error handling is missing after calling b.Finish(). If
the implementation of dnsmessage.Builder.Finish changes
it is theoretically possible that the missing error handling
introduces a nil pointer exception.
Fixes #50946
Change-Id: I3f0785f71def6649d6089d0af71c9e50f5ccb259
GitHub-Last-Rev: 2a2197f7e6d18d5477967b299ed734a7b224536d
GitHub-Pull-Request: golang/go#50948
Reviewed-on: https://go-review.googlesource.com/c/go/+/381966 Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This provides clearer synchronization invariants: if it occurs at all,
the call to c.Process.Kill always occurs before Wait returns. It also
allows any unexpected errors from the goroutine to be propagated back
to Wait.
For #50436.
Change-Id: I7ddadc73e6e67399596e35393f5845646f6111ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/401896
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
cmd/go: mod tidy returns proper error with /tmp/go.mod
`go mod tidy` results in panic due to nil pointer dereference with the
current implementation. Though the panic occurs only in a limited situation
described as below, we had better fix it.
Situation:
- go.mod is in the exactly system's temporary directory (i.e. temp root)
- `go mod tidy` in temp root or in the child directory not having go.mod
No go.mod are found in the situation (i.e. *modFile is nil), however,
*modFile is referred without nil check.
Although just adding nil check works well, the better solution is using
ModFile() function. It works as same as the current implementation and,
in addition, it has either nil check and user friendly error indication.
With using it, users can get a proper error message like "go.mod file not
found in current directory or any parent directory" instead of a panic.
Wayne Zuo [Thu, 5 May 2022 13:46:51 +0000 (21:46 +0800)]
cmd/compile: allow exporting `.rcvr` ident
Noder pass will build a closure to implement generic function
instantiation which may produce `.dict` and `.rcvr` ident.
Since we allow `.dict` during exporting, we should allow `.rcvr` too.
Fixes #52241.
Change-Id: Ifc3912ba5155b5ac1887f20830da64f4fb3fceb6
Reviewed-on: https://go-review.googlesource.com/c/go/+/404314
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Cherry Mui [Fri, 6 May 2022 19:57:21 +0000 (15:57 -0400)]
cmd/link: resolve relocations to .TOC. symbol
CL 404296 breaks the PPC64LE build because the .TOC. symbol is
visibility hidden and was skipped from the "unresolved symbol"
check (the check needs to be fix). In face, the .TOC. symbol is
special in that it doesn't have a type but we have special logic
to assign a value to it in the address pass. So we can actually
resolve a relocation to .TOC.. We already have a special case
for PIE. It also applies to non-PIE as well.
Fix PPC64LE builds.
Change-Id: Iaf7e36f10c4d0a40fc56b2135e5ff38815e203b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/404302
Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
David Taylor [Mon, 17 Jan 2022 21:54:17 +0000 (21:54 +0000)]
crypto/tls: avoid extra allocations in steady-state Handshake calls
The Read and Write methods of *tls.Conn call Handshake
unconditionally, every time they are called, expecting it to only
perform a new handshake if required.
However in go 1.17 handshakeContext was extended to set up a
cancelable Context, and importantly did so prior to checking if a
handshake is required. This thus causes it to allocate on every call,
even in those that are no-ops when called in a Read or Write on an
established connection, sometimes leading to very large numbers of
allocations during reads.
This change adds an early return, prior to setting up the context or
proceeding into the handshakeMutex and checking the handshake error, if
the handshake status atomic indicates handshake is already complete.
Than McIntosh [Fri, 1 Apr 2022 15:12:22 +0000 (11:12 -0400)]
debug/pe: rework reading of aux symbols to fix endianity problems
This patch reworks CL 394534 to fix things so that reading auxiliary
symbol info works properly in a cross-endian mode (running
debug/pe-based tool on a big-endian system). The previous
implementation read in all symbol records using the primary symbol
format, then just used a pointer cast to convert to the auxiliary
format, which doesn't play well if host and target have different
endianness.
Fixes #52079.
Change-Id: I143d94d9313a265f11ca7befd254bdb150698834
Reviewed-on: https://go-review.googlesource.com/c/go/+/397485
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Paul E. Murphy [Fri, 15 Apr 2022 22:06:48 +0000 (17:06 -0500)]
cmd/link: generate PPC64 ABI register save/restore functions if needed
They are usually needed when internally linking gcc code
compiled with -Os. These are typically generated by ld
or gold, but are missing when linking internally.
The PPC64 ELF ABI describes a set of functions to save/restore
non-volatile, callee-save registers using R1/R0/R12:
_savegpr0_n: Save Rn-R31 relative to R1, save LR (in R0), return
_restgpr0_n: Restore Rn-R31 from R1, and return to saved LR
_savefpr_n: Save Fn-F31 based on R1, and save LR (in R0), return
_restfpr_n: Restore Fn-F31 from R1, and return to 16(R1)
_savegpr1_n: Save Rn-R31 based on R12, return
_restgpr1_n: Restore Rn-R31 based on R12, return
_savevr_m: Save VRm-VR31 based on R0, R12 is scratch, return
_restvr_m: Restore VRm-VR31 based on R0, R12 is scratch, return
m is a value 20<=m<=31
n is a value 14<=n<=31
Add several new functions similar to those suggested by the
PPC64 ELFv2 ABI. And update the linker to scan external relocs
for these calls, and redirect them to runtime.elf_<func>+offset
in runtime/asm_ppc64x.go.
Similarly, code which generates plt stubs is moved into
a dedicated function. This avoids an extra scan of relocs.
fixes #52336
Change-Id: I2f0f8b5b081a7b294dff5c92b4b1db8eba9a9400
Reviewed-on: https://go-review.googlesource.com/c/go/+/400796 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Paul E. Murphy [Thu, 21 Oct 2021 20:25:14 +0000 (15:25 -0500)]
cmd/compile,cmd/asm: fix ppc64 usage of BI argument of BC opcode
Avoid coercing the CR bit into a GPR register type argument, and
move the existing usage to CRx_y register types. And, update the
compiler usage to this. This transformation is done internally,
so it should not alter existing assembly code.
Likewise, add assembly tests for all optab entries of BC/BR. This
found some cases which were not possible to realize with handwritten
asm, or assemble to something very unexpected if generated by the
compiler. The following optab entries are removed, and the cases
simplified or removed:
This existed only to pass the BH hint to JMP (LR) from compiler
generated code. It cannot be matched with asm. Instead, add and
support 4-operand form "BC{,L} $BO, $BI, $BH, (LR)".
Could be used like "BR R1, (CTR)", but always compiles to bctr
irrespective of arg 1. Any usage should be rewritten as "JMP (CTR)",
or rewritten if this was not the intended behavior.
Only usable from the compiler. However, the compiler does not
generate this form today. Without a BO operand (usually in a1), it
is not clear what this should assemble to.
Change-Id: I1b5151f884a5877e4a610e6fd41261e8e64c5454
Reviewed-on: https://go-review.googlesource.com/c/go/+/357775 Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Run-TryBot: Paul Murphy <murp@ibm.com> Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
Cherry Mui [Thu, 5 May 2022 17:46:15 +0000 (13:46 -0400)]
cmd/link: fix handling of visibility hidden symbols
There is a TODO comment that checking hidden visibility is
probably not the right thing to do. I think it is indeed not. Here
we are not referencing symbols across DSO boundaries, just within
an executable binary. The hidden visibility is for references from
another DSO. So it doesn't actually matter.
This makes cgo internal linking tests work on ARM64 with newer
GCC. It failed and was disabled due to a visibility hidden symbol
in libgcc.a that we didn't handle correctly. Specifically, the
problem is that we didn't mark visibility hidden symbol references
SXREF, which caused the loader to not think it is an unresolved
external symbol, which in turn made it not loading an object file
from the libgcc.a archive which contains the actual definition.
Later stage when we try to resolve the relocation, we couldn't
resolve it. Enable the test as it works now.
Fixes #39466.
Change-Id: I2759e3ae15e7a7a1ab9a820223b688ad894509ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/404296 Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Ian Lance Taylor [Fri, 6 May 2022 00:19:07 +0000 (17:19 -0700)]
test: add test that crashed gofrontend
For #52535
Change-Id: I6798a8379163497ebebcdadf836b8569735c282b
Reviewed-on: https://go-review.googlesource.com/c/go/+/404496
Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Roland Shoemaker [Mon, 2 May 2022 19:00:36 +0000 (12:00 -0700)]
crypto/x509: fix EKU nesting enforcement
The path building rework broke the enforcement of EKU nesting, this
change goes back to using the old method of enforcement, since it ends
up being more efficient to check the chains after building, rather than
at each step during path building.
Fixes #52659
Change-Id: Ic7c3717a10c33905677cf7bc4bc0a20f5f15f259
Reviewed-on: https://go-review.googlesource.com/c/go/+/403554 Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Filippo Valsorda <valsorda@google.com>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Robert Griesemer [Thu, 5 May 2022 01:08:36 +0000 (18:08 -0700)]
go/printer: fix printing for possibly ambiguous type constraints
This is a port of the printer changes from CLs 402256 and 404397
in the syntax package to go/printer, with adjustments for the
different AST structure and test framework.
For #52559.
Change-Id: Ib7165979a4bd9df91f7f0f1c23b756a41ca31eb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/404194 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Findley <rfindley@google.com>