Commit graph

53742 commits

Author SHA1 Message Date
cuiweixie 1f8e94e9f6 crypto/internal/boring/fipstls: convert required to atomic type
Change-Id: I73081b85e763122be1f5c0dbab25cecc9cf809df
Reviewed-on: https://go-review.googlesource.com/c/go/+/426087
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: xie cui <523516579@qq.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2022-09-01 17:06:14 +00:00
Daniel Martí 5bc8fa74f5 cmd/go: support long commands in asm and cgo
We have supported passing lists of arguments to the compiler and linker
for some time, since https://go.dev/issue/18468 was fixed.
The reason behind it is that some systems like Windows have relatively
small limits for commands, and some Go packages contain many source files.

This wasn't done for other Go toolchain programs like cgo and asm,
as there wasn't an initial need for it. A TODO was left for them.
The need has now arisen in the form of a bug report for a build of a
large Go package involving cgo.

Do asm as well, which could be triggered by lots of asm files.

I rebuilt Go itself with some basic logging to tell if any other
commands were being run with moderately large command lengths.
I only found one other: gcc being invoked with 300-500 bytes.

I didn't spot any length close to 1KiB, and we can't safely assume that
a user's CC compiler supports these "response files", so leave that as
another TODO for the future. Just like cgo and asm, we can revisit this
if any user reports a bug on the issue tracker.

Fixes #47235.

Change-Id: Ifcc099d7c0dfac3ed2c4e9e7a2d6e3d69b0ccb63
Reviewed-on: https://go-review.googlesource.com/c/go/+/427015
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-01 16:55:25 +00:00
Cuong Manh Le b5b2cf519f go/types,types2: exclude tests that need cgo.Incomplete
Since when go/types,types2 do not know about build constraints, and
runtime/cgo.Incomplete is only available on platforms that support cgo.

These tests are also failing on aix with failure from linker, so disable
them on aix to make builder green. The fix for aix is tracked in #54814

Updates #46731
Updates #54814

Change-Id: I5d6f6e29a8196efc6c457ea64525350fc6b20309
Reviewed-on: https://go-review.googlesource.com/c/go/+/427394
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-09-01 15:27:07 +00:00
Joe Tsai 91ef076562 reflect: fix Value.SetIterXXX to check for the read-only bit
v.SetIterXXX(i) is semantically identical to v.Set(i.XXX()).
If the latter panics for unexported values, so should the former.

This change may breaking some programs, but the change is justified
under the "Go 1 and the Future of Go Programs" document because
the "library has a bug that violates the specification".
In this case, the "reflect" package does not accurately match
the behavior of the Go language specification.
Also, this API was recently released, so the number of users
who could be depending on this behavior is hopefully lower.

Fixes #54628

Change-Id: If86ede51f286e38093f6697944c089f616525115
Reviewed-on: https://go-review.googlesource.com/c/go/+/425184
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: David Chase <drchase@google.com>
2022-09-01 02:24:14 +00:00
Cuong Manh Le 64b260dbde test: use cgo.Incomplete instead of go:notinheap for "run" tests
Same as CL 421880, but for test directory.

Updates #46731

Change-Id: If8d18df013a6833adcbd40acc1a721bbc23ca6b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/421881
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-01 00:42:27 +00:00
Matthew Dempsky ca634fa2c5 cmd/compile: reject not-in-heap types as type arguments
After running the types2 type checker, walk info.Instances to reject
any not-in-heap type arguments. This is feasible to check using the
types2 API now, thanks to #46731.

Fixes #54765.

Change-Id: Idd2acc124d102d5a76f128f13c21a6e593b6790b
Reviewed-on: https://go-review.googlesource.com/c/go/+/427235
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2022-08-31 23:52:00 +00:00
Matthew Dempsky e4b624eae5 cmd/compile: use HaveInlineBody for unified IR
In go.dev/cl/419674 I added a mechanism to the inliner to allow
inlining to fail gracefully when a function body is missing, but I
missed we already have a mechanism for that: typecheck.HaveInlineBody.

This CL makes it overridable so that unified IR can plug in its
appropriate logic, like it does with the logic for building the
ir.InlinedCallExpr node.

While here, rename inline.NewInline to inline.InlineCall, because the
name "NewInline" is now a misnomer since we initialize it to oldInline
(now named oldInlineCall).

Change-Id: I4e65618d3725919f69e6f43cf409699d20fb797c
Reviewed-on: https://go-review.googlesource.com/c/go/+/427234
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
2022-08-31 22:22:43 +00:00
Keith Randall 33a7e5a4b4 cmd/compile: combine multiple rotate instructions
Rotating by c, then by d, is the same as rotating by c+d.

Change-Id: I36df82261460ff80f7c6d39bcdf0e840cef1c91a
Reviewed-on: https://go-review.googlesource.com/c/go/+/424894
Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ruinan Sun <Ruinan.Sun@arm.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-08-31 22:10:52 +00:00
Keith Randall 5f5c018ca4 cmd/compile: redo mknode.go
The current mknode has a few problems:
1) It tends not to run successfully if the tree is in a broken state.
2) It requires that it be run by the go tool in the tree (somewhat related to 1)
3) It requires setting GOROOT
4) It imports code outside the tree (x/packages)

This makes mknode.go very fragile. In particular, I've spent lots of
time fighting mknode when adding or removing code, related to 1.

Rewrite to just use go/ast and friends. No typechecking, no importing,
etc. It can run with any go version, it doesn't need to be the one
corresponding to the code in which it is run. (e.g. you can use go
1.16 to run mknode). It will work as long as the ir package is parseable.

When run, it generates identical output to the old mknode.

Fixes #53959

Change-Id: I5ce0b55572ebcd2fcd11af57a5f29bbf9fa4ed33
Reviewed-on: https://go-review.googlesource.com/c/go/+/418375
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-08-31 22:09:44 +00:00
Keith Randall 69aed4712d cmd/compile: use better splitting condition for string binary search
Currently we use a full cmpstring to do the comparison for each
split in the binary search for a string switch.

Instead, split by comparing a single byte of the input string with a
constant. That will give us a much faster split (although it might be
not quite as good a split).

Fixes #53333

R=go1.20

Change-Id: I28c7209342314f367071e4aa1f2beb6ec9ff7123
Reviewed-on: https://go-review.googlesource.com/c/go/+/414894
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-08-31 22:08:26 +00:00
Keith Randall af7f067e0d cmd/compile: tighten bounds for induction variables in strided loops
for i := 0; i < 9; i += 3

Currently we compute bounds of [0,8]. Really we know that it is [0,6].

CL 415874 computed the better bound as part of overflow detection.
This CL just incorporates that better info to the prove pass.

R=go1.20

Change-Id: Ife82cc415321f6652c2b5d132a40ec23e3385766
Reviewed-on: https://go-review.googlesource.com/c/go/+/415937
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
2022-08-31 22:04:55 +00:00
cuiweixie 52d9e7f543 runtime: convert consistentHeapStats.gen to atomic type
For #53821

Change-Id: I9f57b84f6a2c29d750fb20420daef903a9311a83
Reviewed-on: https://go-review.googlesource.com/c/go/+/425781
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 21:10:41 +00:00
Cuong Manh Le ce77a46405 cmd/dist: disable cgo when testing internal linking of PIE
Since when internal linking cgo on some platforms, like android, is not
fully supported.

Updates #46731

Change-Id: I344a763f8dfb0cce04371d9305eee634bfd9ee77
Reviewed-on: https://go-review.googlesource.com/c/go/+/426199
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-08-31 20:33:16 +00:00
Wayne Zuo da6556968f cmd/compile: simplify bounded shift on riscv64
The prove pass will mark some shifts bounded, and then we can use that
information to generate better code on riscv64.

Change-Id: Ia22f43d0598453c9417adac7017db28d7240948b
Reviewed-on: https://go-review.googlesource.com/c/go/+/422616
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-08-31 20:21:00 +00:00
Joel Sing 971373f56a cmd/compile: remove NEG when used with SEQZ/SNEZ on riscv64
The negation does not change the comparison to zero.

Also remove unnecessary x.Uses == 1 condition from equivalent BEQZ/BNEZ rules.

Change-Id: I62dd8e383e42bfe5c46d11bbf78d8e5ff862a1d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/426262
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-08-31 20:08:03 +00:00
Joel Sing 239115c3ef cmd/compile: avoid extending floating point comparision on riscv64
The result of these operations are already extended.

Change-Id: Ifc8ba362dda7035d8fd0d40046a96f61d3082877
Reviewed-on: https://go-review.googlesource.com/c/go/+/426260
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-08-31 20:05:46 +00:00
Joel Sing 9085ff5859 cmd/compile: avoid extending when already sufficiently masked on riscv64
Removes more than 2000 instructions from the Go binary on linux/risv64.

Change-Id: I6db3e3b1c93f29f00869adcba7c6192bfb90b25c
Reviewed-on: https://go-review.googlesource.com/c/go/+/426259
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-08-31 20:05:06 +00:00
cuiweixie 3f65ddbfd3 runtime: convert rwmutex.{readerCount,readerWait} to atomic type
For #53821

Change-Id: Ib10a745799e8bc0dc1d02a9c3e5d00b2842a9edd
Reviewed-on: https://go-review.googlesource.com/c/go/+/425779
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 19:54:04 +00:00
cuiweixie c708532936 cmd/compile: add support for unsafe.{String,StringData,SliceData}
For #53003

Change-Id: I13a761daca8b433b271a1feb711c103d9820772d
Reviewed-on: https://go-review.googlesource.com/c/go/+/423774
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: hopehook <hopehook@golangcn.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 17:15:15 +00:00
cuiweixie 301ca7513f runtime: convert worldIsStopped to atomic type
For #53821

Change-Id: I246b65ddb1171d2cab42f98092c64f20ecef392a
Reviewed-on: https://go-review.googlesource.com/c/go/+/425778
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-08-31 17:15:13 +00:00
Tobias Klauser 0d6a7f9d2e internal/poll, internal/syscall/unix, net, runtime: convert openbsd (except mips64) to direct libc calls
Call libc wrappers directly rather than calling using syscall(2).

Updates golang/go#36435

Change-Id: I40be410c7472f7d89cbec2ebdc7c841c7726ca4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/425637
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
2022-08-31 16:59:38 +00:00
Archana R 59b15726d1 cmd/asm: fix condition check to work on ppc64
A condition check was added to parse.go in CL 405542 to prevent
usage of scaled operands on ppc64. However while trying to improve
the error notification message, an if-condition was left out by
oversight. This CL corrects that.

Change-Id: I8cef3dd194c75343354ffe888b5e639e694badde
Reviewed-on: https://go-review.googlesource.com/c/go/+/426994
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 16:39:34 +00:00
eric fang ebc75ac1c6 cmd/internal/obj/arm64: allow transition from $0 to ZR for MSR
Previously the first operand of MSR could be $0, which would be
converted to the ZR register. This is prohibited by CL 404316,
this CL restores this instruction format.

Change-Id: I5b5be59e76aa58423a0fb96942d1b2a9de62e311
Reviewed-on: https://go-review.googlesource.com/c/go/+/426198
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
2022-08-31 16:37:20 +00:00
bqyang bc0a033266 runtime: fix comment typo in mpagealloc.go
leve --> level

Change-Id: Ia5ff46c79c4dda2df426ec75d69e8fcede909b47
GitHub-Last-Rev: e57cad22d9
GitHub-Pull-Request: golang/go#54788
Reviewed-on: https://go-review.googlesource.com/c/go/+/426974
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Keith Randall <khr@google.com>
2022-08-31 16:27:09 +00:00
cuiweixie fa0e3bffb4 runtime: convert semaRoot.nwait to atomic type
For #53821

Change-Id: I686fe81268f70acc6a4c3e6b1d3ed0e07bb0d61c
Reviewed-on: https://go-review.googlesource.com/c/go/+/425775
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
2022-08-31 15:33:00 +00:00
Andy Pan 6e74c4116a runtime: convert p.numTimers and p.deletedTimers to internal atomic types
Note that this changes the non-atomic operations in p.destroy() to atomic operations.

For #53821

Change-Id: I7bba77c9a2287ba697c87cce2c79293e4d1b3334
Reviewed-on: https://go-review.googlesource.com/c/go/+/425774
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-08-31 15:31:21 +00:00
cuiweixie d01200e772 runtime: convert sig.{state,delivering} to atomic type
For #53821

Change-Id: I1c8df255ce9e2345d4fa45bd4d1761b73b9fa064
Reviewed-on: https://go-review.googlesource.com/c/go/+/425780
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 15:30:57 +00:00
cuiweixie a25a34abe9 runtime: convert mcache.flushGen to atomic type
For #53821

Change-Id: I90ab52a45b7fb6b9e3ff1d6ea97251549306c7aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/425435
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 15:30:26 +00:00
Andy Pan d3b35a4242 runtime: convert mOS.profileTimerValid to internal atomic type
For #53821

Change-Id: I6ef90867e918d4907baa83c5a811f1f93e8c09a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/426196
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-08-31 15:12:21 +00:00
Andy Pan 28e388589b runtime: convert workType.cycles to internal atomic types
Note that this changes a non-atomic operation to atomic operation in gcStart().

For #53821

Change-Id: I754d254f6f190855144ff62151b6bae673b47867
Reviewed-on: https://go-review.googlesource.com/c/go/+/425776
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
2022-08-31 15:12:18 +00:00
Andy Pan 5634629f0b runtime: convert extram and extraMWaiters to internal atomic type
Updates #53821

Change-Id: Id579b2f8e48dfbe9f37e02d2fa8c94354f9887a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/425480
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: hopehook <hopehook@golangcn.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 15:01:49 +00:00
Sean Liao 3486735bf2 net/http/pprof: link docs to runtime/pprof
And add some documentation for the debug query param.

Fixes #27737
Fixes #53971

Change-Id: I629aaa2d4a43175381eb04872f1caad238519a41
Reviewed-on: https://go-review.googlesource.com/c/go/+/421635
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 09:38:38 +00:00
Wayne Zuo 3680b5e9c4 cmd/compile: teach prove about bitwise OR operation
Fixes #45928.

Change-Id: Ifbb0effbca4ab7c0eb56069fee40edb564553c35
Reviewed-on: https://go-review.googlesource.com/c/go/+/410336
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 09:35:45 +00:00
Wayne Zuo d2e0587f77 cmd/compile: derive relation between x+delta and x in prove
If x+delta cannot overflow/underflow, we can derive:
  x+delta < x if delta<0 (this CL included)
  x+delta > x if delta>0 (this CL not included due to
  a recursive stack overflow)

Remove 95 bounds checks during ./make.bat

Fixes #51622

Change-Id: I60d9bd84c5d7e81bbf808508afd09be596644f09
Reviewed-on: https://go-review.googlesource.com/c/go/+/406175
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-08-31 09:35:10 +00:00
Khaled Yakdan 6b113c0fec cmd/compile: avoid excessive libfuzzer instrumentation of int compares
Do not intercept integer compares that are used to increment libFuzzer's
8-bit counters. This is unnecessary and has a negative impact on the
fuzzing performance. This fixes #53760.

Change-Id: Id22efac968b18014eedabb6f0762e1456897024e
GitHub-Last-Rev: 52f69fd68c
GitHub-Pull-Request: golang/go#53786
Reviewed-on: https://go-review.googlesource.com/c/go/+/416796
Run-TryBot: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2022-08-31 07:49:01 +00:00
shaoliming 2f103873c5 cmd/compile/internal/noder: reuse package scope's names
Change-Id: I2cc62efb7bb3b47f1ee3ed0bb77e35c47e2df9a1
GitHub-Last-Rev: 106cb494de
GitHub-Pull-Request: golang/go#54718
Reviewed-on: https://go-review.googlesource.com/c/go/+/426297
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-08-31 06:12:44 +00:00
Cuong Manh Le ee0e40aaef reflect: use cgo.Incomplete instead of go:notinheap in tests
go:notinheap will be replaced by runtime/internal/sys.NotInHeap, and for
longer term, we want to restrict all of its usages inside the runtime
package only.

Updates #46731

Change-Id: I267adc2a19f0dc8a1ed29b5b4aeec1a7dc7318d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/421880
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-31 01:16:54 +00:00
Keith Randall bd56cb90a7 cmd/compile: regenerate node_gen.go
Looks like CL 413361 which added CaseClause.RTypes missed the need
to regenerate this file.

Also CL 413357 added DynamicTypeAssertExpr.SrcRType, same issue.

Change-Id: I45e4d0685cc2f9bdcef1fad2cfc92e7005ef363e
Reviewed-on: https://go-review.googlesource.com/c/go/+/426675
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-08-30 21:30:15 +00:00
cuiweixie 8a3d167f5b testing: increment tempDirSeq non-atomically
It's unnecessary to to call atomic.AddInt32 since there is a mutex lock.

Change-Id: I31fcece17c34f99a95772d744aebd3f6a8cf1d23
Reviewed-on: https://go-review.googlesource.com/c/go/+/426081
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2022-08-30 19:42:56 +00:00
Zeke Lu 3c6a5cdb9a cmd/go/internal/imports: recognize "unix" build tag
For #20322
For #51572
Fixes #54712

Change-Id: I22fcfa820e83323bfdf1a40deee7286240f02b3e
GitHub-Last-Rev: cd2c6536b0
GitHub-Pull-Request: golang/go#54716
Reviewed-on: https://go-review.googlesource.com/c/go/+/426296
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-08-30 19:01:26 +00:00
Cuong Manh Le f21514c7f8 cmd/compile: only inline method wrapper if method don't contain closures
CL 327871 changes methodWrapper to always perform inlining after global
escape analysis. However, inlining the method may reveal closures, which
require walking all function bodies to decide whether to capture free
variables by value or by ref.

To fix it, just not doing inline if the method contains any closures.

Fixes #53702

Change-Id: I4b0255b86257cc6fe7e5fafbc545cc5cff9113e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/426334
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2022-08-30 18:02:22 +00:00
Cuong Manh Le ddc93a536f cmd/compile: fix unified IR shapifying recursive instantiated types
Shape-based stenciling in unified IR is done by converting type argument
to its underlying type. So it agressively check that type argument is
not a TFORW. However, for recursive instantiated type argument, it may
still be a TFORW when shapifying happens. Thus the assertion failed,
causing the compiler crashing.

To fix it, just allow fully instantiated type when shapifying.

Fixes #54512
Fixes #54722

Change-Id: I527e3fd696388c8a37454e738f0324f0c2ec16cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/426335
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-08-30 17:23:27 +00:00
cuiweixie c22865fcfa cmd/go: go clean should not accept flags like -modcache with packages
For #53725

Change-Id: I99a85b437d5f918dba74c4eccefcf8087193646a
Reviewed-on: https://go-review.googlesource.com/c/go/+/425874
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-08-30 17:22:49 +00:00
Archana R 67d85ad00f cmd/asm: add new classification for index memory operands on PPC64
When a base+displacement kind of operand is given in an index-mode
instruction, the assembler does not flag it as an invalid instruction
causing the user to get an incorrect encoding of that instruction
leading to incorrect execution of the program.
Enable assembler to recognize valid and invalid operands used in index
mode instructions by classifying SOREG type into two further types
XOREG (used uniquely in index addressing mode instructions) and SOREG
for instructions working on base+displacement operands.
Also cleaned up usage of obj.Addr.Scale on PPC64.

Change-Id: Ib4d84343ae57477c6c074f44c4c2749496e11b91
Reviewed-on: https://go-review.googlesource.com/c/go/+/405542
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
2022-08-30 12:42:54 +00:00
Meng Zhuo 4381c61c58 crypto/sha512: optimize ARM64 sha512 implemention
This CL enable sha512 for arm64 and ~390% performance
improvement.

Contributed under the Go License with permission of
Linaro by Carlos Eduardo Seo <carlos.seo@linaro.org>

https://perf.golang.org/search?q=upload:20220526.18

Hash8Bytes/New		16.0MB/s ± 0%	61.3MB/s ± 0%	+283.97% (p=0.000 n=9+9)
Hash8Bytes/Sum384	16.4MB/s ± 0%	64.8MB/s ± 0%	+295.31% (p=0.000 n=8+9)
Hash8Bytes/Sum512	16.3MB/s ± 0%	64.2MB/s ± 0%	+293.37% (p=0.000 n=10+10)
Hash1K/New		252MB/s ± 0%	1217MB/s ± 0%	+383.00% (p=0.000 n=9+10)
Hash1K/Sum384		253MB/s ± 0%	1237MB/s ± 0%	+389.25% (p=0.000 n=10+10)
Hash1K/Sum512		253MB/s ± 0%	1231MB/s ± 0%	+387.37% (p=0.000 n=10+8)
Hash8K/New		284MB/s ± 0%	1405MB/s ± 2%	+395.19% (p=0.000 n=9+8)
Hash8K/Sum384		284MB/s ± 0%	1413MB/s ± 0%	+397.76% (p=0.000 n=10+8)
Hash8K/Sum512		284MB/s ± 0%	1411MB/s ± 0%	+397.19% (p=0.000 n=10+10)

Change-Id: I4476da23d8cd376bf1f75d946d6b0c58470df1b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/180257
Reviewed-by: Carlos Eduardo Seo <carlos.seo@linaro.org>
Reviewed-by: Ard Biesheuvel <ardb@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-30 03:43:15 +00:00
Wayne Zuo e8f0340fa4 cmd/compile: intrinsify RotateLeft{32,64} on loong64
Benchmark on crypto/sha256 (provided by Xiaodong Liu):
name               old time/op    new time/op    delta
Hash8Bytes/New       1.19µs ± 0%    0.97µs ± 0%  -18.75%  (p=0.000 n=9+9)
Hash8Bytes/Sum224    1.21µs ± 0%    0.97µs ± 0%  -20.04%  (p=0.000 n=9+10)
Hash8Bytes/Sum256    1.21µs ± 0%    0.98µs ± 0%  -19.16%  (p=0.000 n=10+7)
Hash1K/New           15.9µs ± 0%    12.4µs ± 0%  -22.10%  (p=0.000 n=10+10)
Hash1K/Sum224        15.9µs ± 0%    12.4µs ± 0%  -22.18%  (p=0.000 n=8+10)
Hash1K/Sum256        15.9µs ± 0%    12.4µs ± 0%  -22.15%  (p=0.000 n=10+9)
Hash8K/New            119µs ± 0%      92µs ± 0%  -22.40%  (p=0.000 n=10+9)
Hash8K/Sum224         119µs ± 0%      92µs ± 0%  -22.41%  (p=0.000 n=9+10)
Hash8K/Sum256         119µs ± 0%      92µs ± 0%  -22.40%  (p=0.000 n=9+9)

name               old speed      new speed      delta
Hash8Bytes/New     6.70MB/s ± 0%  8.25MB/s ± 0%  +23.13%  (p=0.000 n=10+10)
Hash8Bytes/Sum224  6.60MB/s ± 0%  8.26MB/s ± 0%  +25.06%  (p=0.000 n=10+10)
Hash8Bytes/Sum256  6.59MB/s ± 0%  8.15MB/s ± 0%  +23.67%  (p=0.000 n=10+7)
Hash1K/New         64.3MB/s ± 0%  82.5MB/s ± 0%  +28.36%  (p=0.000 n=10+10)
Hash1K/Sum224      64.3MB/s ± 0%  82.6MB/s ± 0%  +28.51%  (p=0.000 n=10+10)
Hash1K/Sum256      64.3MB/s ± 0%  82.6MB/s ± 0%  +28.46%  (p=0.000 n=9+9)
Hash8K/New         69.0MB/s ± 0%  89.0MB/s ± 0%  +28.87%  (p=0.000 n=10+8)
Hash8K/Sum224      69.0MB/s ± 0%  89.0MB/s ± 0%  +28.88%  (p=0.000 n=9+10)
Hash8K/Sum256      69.0MB/s ± 0%  88.9MB/s ± 0%  +28.87%  (p=0.000 n=8+9)

Benchmark on crypto/sha512 (provided by Xiaodong Liu):
name               old time/op    new time/op     delta
Hash8Bytes/New       1.55µs ± 0%     1.31µs ± 0%  -15.67%  (p=0.000 n=10+10)
Hash8Bytes/Sum384    1.59µs ± 0%     1.35µs ± 0%  -14.97%  (p=0.000 n=10+10)
Hash8Bytes/Sum512    1.62µs ± 0%     1.39µs ± 0%  -14.02%  (p=0.000 n=10+10)
Hash1K/New           10.7µs ± 0%      8.6µs ± 0%  -19.60%  (p=0.000 n=8+8)
Hash1K/Sum384        10.8µs ± 0%      8.7µs ± 0%  -19.40%  (p=0.000 n=9+9)
Hash1K/Sum512        10.8µs ± 0%      8.7µs ± 0%  -19.35%  (p=0.000 n=9+10)
Hash8K/New           74.6µs ± 0%     59.6µs ± 0%  -20.08%  (p=0.000 n=10+9)
Hash8K/Sum384        74.7µs ± 0%     59.7µs ± 0%  -20.04%  (p=0.000 n=9+8)
Hash8K/Sum512        74.7µs ± 0%     59.7µs ± 0%  -20.01%  (p=0.000 n=10+10)

name               old speed      new speed       delta
Hash8Bytes/New     5.16MB/s ± 0%   6.12MB/s ± 0%  +18.60%  (p=0.000 n=10+8)
Hash8Bytes/Sum384  5.02MB/s ± 0%   5.90MB/s ± 0%  +17.56%  (p=0.000 n=10+10)
Hash8Bytes/Sum512  4.94MB/s ± 0%   5.74MB/s ± 0%  +16.29%  (p=0.000 n=10+9)
Hash1K/New         95.4MB/s ± 0%  118.6MB/s ± 0%  +24.38%  (p=0.000 n=10+10)
Hash1K/Sum384      95.0MB/s ± 0%  117.9MB/s ± 0%  +24.06%  (p=0.000 n=8+9)
Hash1K/Sum512      94.8MB/s ± 0%  117.5MB/s ± 0%  +23.99%  (p=0.000 n=8+9)
Hash8K/New          110MB/s ± 0%    137MB/s ± 0%  +25.11%  (p=0.000 n=9+6)
Hash8K/Sum384       110MB/s ± 0%    137MB/s ± 0%  +25.07%  (p=0.000 n=9+8)
Hash8K/Sum512       110MB/s ± 0%    137MB/s ± 0%  +25.01%  (p=0.000 n=10+10)

Change-Id: I28ccfce634659305a336c8e0a3f8589f7361d661
Reviewed-on: https://go-review.googlesource.com/c/go/+/422317
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
2022-08-30 03:21:44 +00:00
Wayne Zuo 7d574466a9 cmd/internal/obj/loong64: add ROTR, ROTRV instructions support
Reference: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html

Change-Id: I29adb84eb70bffd963c79ed6957a5197896fb2bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/422316
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-08-30 03:21:06 +00:00
Cuong Manh Le 629ae1cee6 cmd/compile: fix wrong position when rewriting to OpArg/OpArgXXX
When spilling arg to stack or register, if it's a newly created value,
the arg position should be preserved. Otherwise, we may end up using
position information from deadcode lines.

This fixes the minimized test case in #54625 by mdempsky@, and make
building std successfully. However, the inline trees for these tests
still be corrupted:

 - fixedbugs/issue53982.go
 - typeparam/issue47775.go
 - typeparam/issue47775b.go
 - typeparam/issue49432.go

We probably still mess up the inline position somewhere else.

Updates #54625

Change-Id: I0d87e26b9ab451b85b6e79787da74a2b79a16209
Reviewed-on: https://go-review.googlesource.com/c/go/+/425785
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-08-30 00:49:19 +00:00
Cuong Manh Le 47f8db368c reflect: clarify Value.Equal behavior for non-comparable values
The current implementation always returns false for non-comparable
values, update the doc to reflect that.

Change-Id: I87f2da408874b0a209c8f51949e3310da15c5904
Reviewed-on: https://go-review.googlesource.com/c/go/+/426195
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: hopehook <hopehook@golangcn.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-08-30 00:37:15 +00:00
Bryan C. Mills 65535581aa cmd/go: skip gccgo cgo tests in TestScript/build_overlay
cgo builds with -compiler=gccgo are broken as of CL 421879.

For #54761.
Updates #46731.

Change-Id: I0306b0bd96669f70279fc96814cc72d934a1ad6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/426496
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-08-29 22:04:21 +00:00