1
0
mirror of https://github.com/golang/go synced 2024-11-15 03:00:36 -07:00
Commit Graph

61269 Commits

Author SHA1 Message Date
apocelipes
a92c80eb40 net,net/netip: implement the encoding.(Binary|Text)Appender
Implement the encoding.TextAppender interface for "net.IP".

Implement the encoding.(Binary|Text)Appender interfaces for
"netip.Addr", "netip.AddrPort" and "netip.Prefix".

"net.IP.MarshalText" also gets some performance improvements:

                          │     old      │                 new                 │
                          │    sec/op    │   sec/op     vs base                │
IPMarshalText/IPv4-8         66.06n ± 1%   14.55n ± 1%  -77.97% (p=0.000 n=10)
IPMarshalText/IPv6-8        117.00n ± 1%   63.18n ± 1%  -46.00% (p=0.000 n=10)
IPMarshalText/IPv6_long-8    137.8n ± 1%   111.3n ± 1%  -19.27% (p=0.000 n=10)
geomean                      102.1n        46.77n       -54.21%

                          │    old     │                   new                   │
                          │    B/op    │    B/op     vs base                     │
IPMarshalText/IPv4-8        32.00 ± 0%    0.00 ± 0%  -100.00% (p=0.000 n=10)
IPMarshalText/IPv6-8        48.00 ± 0%    0.00 ± 0%  -100.00% (p=0.000 n=10)
IPMarshalText/IPv6_long-8   96.00 ± 0%   48.00 ± 0%   -50.00% (p=0.000 n=10)

                          │    old     │                   new                   │
                          │ allocs/op  │ allocs/op   vs base                     │
IPMarshalText/IPv4-8        2.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=10)
IPMarshalText/IPv6-8        2.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=10)
IPMarshalText/IPv6_long-8   2.000 ± 0%   1.000 ± 0%   -50.00% (p=0.000 n=10)

All exported types in the standard library that implement the
"encoding.(Binary|Text)Marshaler" now also implement the
"encoding.(Binary|Text)Appender".

Fixes #62384

Change-Id: I7d3da8c5736a1ab9c54b9ac4bd2fbf850f9d1bd0
GitHub-Last-Rev: 5d27854725
GitHub-Pull-Request: golang/go#69022
Reviewed-on: https://go-review.googlesource.com/c/go/+/607520
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-09-23 18:10:51 +00:00
Jes Cok
c9ad32bd9f encoding/asn1: unmarshal bool values correctly dealing with the ANY type
Fixes #68241

Change-Id: I1ee81aa50c2f39f535ad27309e855f19acb2f2ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/595796
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2024-09-23 18:05:24 +00:00
yincong
7d114b5b71 text/template/parse: use correct line number in error after comment
Fixes #69526

Change-Id: I42467ddec02e91f24bce87185bf8d7f16f8811b0
GitHub-Last-Rev: 039a5b6884
GitHub-Pull-Request: golang/go#69532
Reviewed-on: https://go-review.googlesource.com/c/go/+/614375
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2024-09-23 18:02:15 +00:00
wanggang
530fbb283c fmt: fix incorrect doc comment
I noticed that the comment incorrectly stated 'WriteString implemented WriteString', it should be 'implemented io.StringWriter' instead.

Change-Id: I844a8c805e5f0c32b5aea68c4bba6982f6fcc8a7
GitHub-Last-Rev: a0d93b6e9d
GitHub-Pull-Request: golang/go#69546
Reviewed-on: https://go-review.googlesource.com/c/go/+/614575
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Rob Pike <r@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>
2024-09-23 18:01:36 +00:00
qmuntal
dfd0f0d8eb os: skip TestReadlink sub-tests requiring symlinks when not enough
permissions are held

Some of the TestReadlink sub-tests require os.Symlink to succeed.
If the user doesn't have enough permissions to create symlinks, then
there is no point in running the test.

Change-Id: I06ec7e3ddf0016e804667bba0ee6ebe6baa01872
Reviewed-on: https://go-review.googlesource.com/c/go/+/614655
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2024-09-23 18:00:57 +00:00
封幼林
ab5c22e7ed cmd/compile: remove obj.LSym(s) for assertI2I and assertI2I2
Change-Id: I85993a34b115a700ccdfea29df4e78c360e68b03
Reviewed-on: https://go-review.googlesource.com/c/go/+/615075
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-23 16:29:31 +00:00
Felix Geisendörfer
6eb40d158a cmd/trace,internal/trace,runtime: refactor to access frames via range over func
Change-Id: Id0be0eb35ae8560bd5338ec296a086aaf4617db0
Reviewed-on: https://go-review.googlesource.com/c/go/+/608856
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-09-23 15:02:42 +00:00
Felix Geisendörfer
89a5a60da6 internal/trace: refactor Stack.Frames to return iter.Seq
The Frames function is almost an iter.Seq, except for its bool return
value.

Since none of the callers in the Go tree rely on the bool, we can remove
it. However, doing so might still obscure the intended usage as an iterator.

This refactor changes the API to return iter.Seq, making the intended
usage explicit. Refactoring the existing callers to take advantage of
the new interface will be done in a follow-up CL.

Change-Id: I03e4d6d762910e418cc37d59a6c519eb7f39b3b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/608855
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-09-23 15:02:19 +00:00
qiulaidongfeng
cfbd2e7b40 text/template: support range-over-func
For #66107

Change-Id: I2fcd04bebe80346dbd244ab7ea09cbe6010b9d8e
GitHub-Last-Rev: 5ebf615db5
GitHub-Pull-Request: golang/go#68329
Reviewed-on: https://go-review.googlesource.com/c/go/+/596956
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-09-23 14:35:44 +00:00
Song Gao
0081f17f14 archive/{zip,tar}: fix Writer.AddFS to include empty directories
This change modifies the `(*Writer).AddFS` implementation in both `archive/zip`
and `archive/tar` to always write a directory header. This fixes a bug where
any empty directories in the fs were omitted when a zip or tar archive was
created from `AddFS` method.

Fixes #66831

Change-Id: Id32c9c747f9f65ec7db4aeefeaffa83567215bfc
Reviewed-on: https://go-review.googlesource.com/c/go/+/578415
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-23 14:32:33 +00:00
Jes Cok
7678fe1e58 lib/time: update to 2024b/2024b
Commit generated by update.bash.

For #22487.

Change-Id: Ib54b6ea0b4422710ea64c63b16a6aea62b232835
GitHub-Last-Rev: f02cb1788f
GitHub-Pull-Request: golang/go#69558
Reviewed-on: https://go-review.googlesource.com/c/go/+/614716
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2024-09-23 14:25:08 +00:00
David du Colombier
7c72dc77a9 cmd/go: skip TestScript on Plan 9 in short mode
TestScript is very slow on Plan 9 because this test
is particularly i/o intensive.

This is leading the plan9/386 and plan9/amd64 builders
to time out. This test was already skipped on plan9/arm
because arm is part of the "slow architectures" list.

This change skips TestScript on Plan 9 on short mode.

Change-Id: I3e68046dac825cd14fa8daca601c492cf11c6fff
Reviewed-on: https://go-review.googlesource.com/c/go/+/614855
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Bypass: Ian Lance Taylor <iant@golang.org>
2024-09-23 05:36:30 +00:00
Conrad Irwin
097b7162ad cmd/mod/edit: disallow relative tool paths
Allowing relative paths in `go.mod` introduced an inconsistency as we do
not allow relative package paths anywhere else.

For golang/go#48429

Change-Id: I5ef88aec4fe35f7e94a0cf6288e94099f3ca7a0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/614555
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-20 20:19:15 +00:00
sunnymilk
402dc98759 testing: enable better loop time measurement for benchmarking.
With b.Loop() in place, the time measurement of loop scaling could be improved to be tighter. By identifying the first call to b.Loop(), we can avoid measuring the expensive ramp-up time by reset the timer tightly before the loop starts. The remaining loop scaling logic of b.N style loop is largely reused.

For #61515.

Change-Id: Ia7b8f0a8838f57c00ac6c5ef779d86f8d713c9b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/612835
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-20 19:10:01 +00:00
sunnymilk
6600a871ef testing: implement testing.B.Loop
Initial implementation for testing.B.Loop,
right now the calculation of b.N are still done in the old fasion way,
as of now b.Loop is merely an alias for the old loop over b.N.

For #61515.

Change-Id: If211d0acc5f0c33df530096dceafe0b947ab0c8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/608798
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Run-TryBot: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-09-20 19:09:41 +00:00
Alan Donovan
c208b91395 go/types, types2: clarify Named, Alias, TypeName, Object
Updates #65855
Updates #66890

Change-Id: I167c9de818049cae02f0d99f8e0fb4017e07bea9
Reviewed-on: https://go-review.googlesource.com/c/go/+/604476
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-09-20 13:54:44 +00:00
Guoqi Chen
165bf241f2 cmd/objdump: add loong64 disassembler support
This CL provides vendor support for loong64 disassembler gnu and plan9 syntax.

cd $GOROOT/src/cmd
go get golang.org/x/arch@master
go mod tidy
go mod vendor

Change-Id: Ic8b888de0aa11cba58cbf559f8f69337d1d69309
Reviewed-on: https://go-review.googlesource.com/c/go/+/609015
Reviewed-by: Meidan Li <limeidan@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
2024-09-19 00:40:50 +00:00
Kyle Xiao
7ba074fe43 reflect: remove calling mapiterkey, mapiterelem
It makes use of the hiter structure which matches runtime.hiter's.

This change mainly improves the performance of Next method of MapIter.

goos: darwin
goarch: arm64
pkg: reflect
cpu: Apple M2
              │  ./old.txt  │              ./new.txt              │
              │   sec/op    │   sec/op     vs base                │
MapIterNext-8   61.95n ± 0%   54.95n ± 0%  -11.28% (p=0.000 n=10)

for the change of `test/escape_reflect.go`:
removing mapiterkey, mapiterelem would cause leaking MapIter content
when calling SetIterKey and SetIterValue,
and this may cause map bucket to be allocated on heap instead of stack.
Reproduce:
```
{
  m := map[int]int{1: 2} // escapes to heap after this change
  it := reflect.ValueOf(m).MapRange()
  it.Next()
  var k, v int
  reflect.ValueOf(&k).Elem().SetIterKey(it)
  reflect.ValueOf(&v).Elem().SetIterValue(it)
  println(k, v)
}
```
This CL would not introduce abi.NoEscape to fix this. It may need futher
optimization and tests on hiter field usage and its escape analysis.

Fixes #69416

Change-Id: Ibaa33bcf86228070b4a505b9512680791aa59f04
Reviewed-on: https://go-review.googlesource.com/c/go/+/612616
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-18 20:57:20 +00:00
Sam Thanawalla
c71b5ff76a cmd/go: print toolchain switching with GODEBUG=toolchaintrace
This CL introduces the ability to print information about the toolchain switch used in the
go command, controlled by the `toolchaintrace` setting. This setting defaults to `toolchaintrace=0`,
meaning no information is printed. Setting it to `toolchaintrace=1` will cause the go command
to print a message indicating the toolchain used and where it was found.

Fixes: #63939
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: Idc58e3d5bc76573aa48e1f7df352caa13004c25e
Reviewed-on: https://go-review.googlesource.com/c/go/+/610235
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-18 19:48:13 +00:00
Tobias Klauser
e190638f20 net/netip: cover more AddrPort.String cases in tests
TestInvalidAddrPortString currently only tests for invalid AddrPorts.
Add some valid cases as well to improve test coverage.

Change-Id: Iaa9192e48a61daed6f7ce7d680d602a021570bdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/613795
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-18 19:24:44 +00:00
Cuong Manh Le
db40d1a4c4 cmd/compile: fix wrong esacpe analysis for rangefunc
CL 584596 "-range<N>" suffix to the name of closure generated for a
rangefunc loop body. However, this breaks the condition that escape
analysis uses for checking whether a closure contains within function,
which is "F.funcN" for outer function "F" and closure "funcN".

Fixing this by adding new "-rangeN" to the condition.

Fixes #69434
Fixes #69507

Change-Id: I411de8f63b69a6514a9e9504d49d62e00ce4115d
Reviewed-on: https://go-review.googlesource.com/c/go/+/614096
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-09-18 16:23:28 +00:00
Srinivas Pokala
889178d5b6 cmd/internal/obj/s390x: fix m6 field encoding for VSTRC instruction on s390x
M6 field for all extended mnemonics of VSTRC set to zero
This fixes VSTRC codegen to emit correctly  and added testcases for all
the extended mnemonics.

Fixes #69216

Change-Id: I2a1b7fb61d6bd6444286eab56a506225c90b75e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/612315
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2024-09-18 15:49:24 +00:00
Tobias Klauser
6cce1911b7 cmd/cgo: use strings.CutPrefix
Change-Id: Ie3f35183e88d544559743394c34b55483fdf59aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/613775
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-09-18 15:07:34 +00:00
qiulaidongfeng
3dc146da7f go/types, types2: better error message when type argument cannot use operator
Fixes #63524

Change-Id: Id33936b9bcfb6a7333c6d084247044bba2f29219
Reviewed-on: https://go-review.googlesource.com/c/go/+/613756
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-09-18 14:38:21 +00:00
Mateusz Poliwczak
d682a9dfbe net/netip: use const for max address length
Makes it consistent with other code in net/netip, also constants
are visible through LSP hover, which makes it easier to see the size.

Change-Id: I3d02c860ac3c61cc037eaca5418297f78698c3f8
GitHub-Last-Rev: 785a8d58c3
GitHub-Pull-Request: golang/go#69468
Reviewed-on: https://go-review.googlesource.com/c/go/+/613356
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-09-18 13:16:39 +00:00
Tobias Klauser
b28b263a91 os/signal: use slices.Delete
Change-Id: I212a0f4f97e1c938f56981f278464081cfd75e85
Reviewed-on: https://go-review.googlesource.com/c/go/+/613875
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-09-18 03:57:34 +00:00
Michael Matloob
b049837d97 cmd/go: update go help packages doc on all pattern to focus on modules
Reword the paragraph to focus on modules rather than GOPATH mode.

Change-Id: Ide33d502311b3539018f167386a92a94ff955f1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/613555
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-17 20:44:51 +00:00
sunnymilk
efbf4b0713 cmd/compile: improve the ssa documentation.
The auxiliary field could be better documented as it appears in a lot of the operands.
This CL documents and points the user to the code for further information.

Change-Id: I34a73af488358c9799e286f3b5ee4b08639ce608
Reviewed-on: https://go-review.googlesource.com/c/go/+/613615
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-09-17 17:43:29 +00:00
Michael Pratt
d1c3f255fd runtime: move getclosureptr to internal/runtime/sys
Moving these intrinsics to a base package enables other internal/runtime
packages to use them.

There is no immediate need for getclosureptr outside of runtime, but it
is moved for consistency with the other intrinsics.

For #54766.

Change-Id: Ia68b16a938c8cb84cb222469db28e3a83861be5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/613262
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-09-17 17:01:26 +00:00
Michael Pratt
4f881115d4 runtime: move getcallersp to internal/runtime/sys
Moving these intrinsics to a base package enables other internal/runtime
packages to use them.

For #54766.

Change-Id: I45a530422207dd94b5ad4eee51216c9410a84040
Reviewed-on: https://go-review.googlesource.com/c/go/+/613261
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-17 17:01:20 +00:00
Kir Kolyshkin
41ca2637d4 os: TestPipeThreads: remove openbsd special case
Since CL 393354 this should no longer be necessary.

Change-Id: Ifec4ef483f9c06d9b49827327dd6708db146d886
Reviewed-on: https://go-review.googlesource.com/c/go/+/613157
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-09-17 15:51:23 +00:00
Michael Pratt
81c92352a7 runtime: move getcallerpc to internal/runtime/sys
Moving these intrinsics to a base package enables other internal/runtime
packages to use them.

For #54766.

Change-Id: I0b3eded3bb45af53e3eb5bab93e3792e6a8beb46
Reviewed-on: https://go-review.googlesource.com/c/go/+/613260
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-09-17 15:14:14 +00:00
Robert Griesemer
f6c89abf89 go/types, types2: slightly simplify rangeKeyVal function
Compute the signature type of an iterator function argument
only once. This eliminates the need for two separate toSig
calls.

Change-Id: Ifeb33d21e381010d2012d74eac045856f1cca312
Reviewed-on: https://go-review.googlesource.com/c/go/+/613635
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Tim King <taking@google.com>
2024-09-16 21:21:10 +00:00
qmuntal
ae8708f744 os/user: fix Current().GroupIds() for AD joined users on Windows
This CL special-case User.GroupIds to get the group IDs from the user's
token when the user is the current user.

This approach is more efficient than calling NetUserGetLocalGroups.
It is also more reliable for users joined to an Active Directory domain,
where NetUserGetLocalGroups is likely to fail.

Updates #26041.
Fixes #62712.

Cq-Include-Trybots: luci.golang.try:gotip-windows-arm64
Change-Id: If7c30287192872077b98a514bd6346dbd1a64fb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/611116
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-16 20:48:56 +00:00
Cuong Manh Le
2927aa10ab unique: handle zero-size types
Fixes #69458

Change-Id: Ic7fda7f556522780b2819138dfc1277137398692
Reviewed-on: https://go-review.googlesource.com/c/go/+/613397
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-09-16 20:25:08 +00:00
Robert Griesemer
aa06c94054 math/big: add clarifying (internal) comment
Follow-up on CL 467555.

Change-Id: I1815b5def656ae4b86c31385ad0737f0465fa2d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/613535
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Tim King <taking@google.com>
2024-09-16 19:10:55 +00:00
Michael Pratt
a02516a379 runtime: remove go:noescape from getcallerpc/sp
getcallerpc and getcallerps dropped their arguments in CL 65474 and CL
109596, respectively.

Without an argument there is nothing to escape.

Change-Id: I24f300d039a2a0615ca0c3ea247125676a6237d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/613497
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2024-09-16 19:10:52 +00:00
Michael Pratt
72739bbfa6 cmd/compile: remove ir.OGETCALLERPC
Nothing ever creates this op, so it can be safely removed. Note that SSA
still intrinsifies runtime.getcallerpc.

The similar ir.OGETCALLERSP is still used for defer handling in
typecheck/func.go:tcRecover.

For #54766.

Change-Id: I6bdb2072af2c068080ae977c0cbd4684d0c7c752
Reviewed-on: https://go-review.googlesource.com/c/go/+/613496
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2024-09-16 19:10:50 +00:00
Michael Pratt
5b2f71a2c3 cmd/compile/internal/typecheck: remove getcallerpc/sp builtin signature
The compiler never does a lookup of these (LookupRuntime), so they
aren't needed here.

getcallerpc is only used in intrinsification. getcallersp is used in
intrinsification and defer handling via a direct OGETCALLERSP op.

For #54766.

Change-Id: I1666ceef3360a84573ae5b41b1c51d9205de7235
Reviewed-on: https://go-review.googlesource.com/c/go/+/613495
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-16 18:49:05 +00:00
Joel Sing
5367d696f7 math/big: simplify divBasic ujn assignment
Rather than conditionally assigning ujn, initialise ujn above the
loop to invent the leading 0 for u, then unconditionally load ujn
at the bottom of the loop. This code operates on the basis that
n >= 2, hence j+n-1 is always greater than zero.

Change-Id: I1272ef30c787ed8707ae8421af2adcccc776d389
Reviewed-on: https://go-review.googlesource.com/c/go/+/467555
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Robert Griesemer <gri@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2024-09-16 17:33:18 +00:00
Dmitri Shuralyov
4f95ad8ca2 cmd/preprofile, runtime/coverage: add package comment
As https://go.dev/doc/comment#package says, every package
should have a package comment. Command cmd/preprofile had
one, it was just not being recognized due to a blank line.

For #51430.
For #58102.

Change-Id: I73e31158e0f244f6453728ab68c5c8da4cfb38b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/613375
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-16 17:07:00 +00:00
Cuong Manh Le
3d33437c45 unicode/utf8: speedup RuneCount
CL 612617 did speedup RuneCountInString, thus we can now use it to
speedup RuneCount, too.

name                         old time/op    new time/op    delta
RuneCountTenASCIIChars-8       8.69ns ± 1%    3.59ns ± 2%  -58.66%  (p=0.000 n=9+9)
RuneCountTenJapaneseChars-8    49.8ns ± 2%    40.9ns ± 0%  -17.94%  (p=0.000 n=10+8)

Change-Id: I311750c00efc79af35fb0ca3b482a5d94e0a7977
Reviewed-on: https://go-review.googlesource.com/c/go/+/612955
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-15 02:05:37 +00:00
Cuong Manh Le
9bd34ebb7e unicode/utf8: add test that RuneCount does zero allocations
See disccusion in CL 612955.

Change-Id: I2de582321648f1798929ffb80d2f087e41146ead
Reviewed-on: https://go-review.googlesource.com/c/go/+/613315
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-09-15 02:04:55 +00:00
Cuong Manh Le
f117d1c9b5 test: add test for issue 24755
Fixes #24755

Change-Id: I00b276c5c2acb227d42a069d1af6027e4b499d31
Reviewed-on: https://go-review.googlesource.com/c/go/+/613115
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-09-13 21:24:10 +00:00
Cuong Manh Le
8343980c70 all: add test for issue 20027
Fixes #20027

Change-Id: Ia616d43c0affa7b927ddfb53755072c94ba27917
Reviewed-on: https://go-review.googlesource.com/c/go/+/612618
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
2024-09-13 21:21:33 +00:00
Jes Cok
0a2cc74f5a cmd: make use of maps.{Copy, Clone}
Change-Id: I8a38b4c71c34d3544ee32be9c6e767bb1099a720
GitHub-Last-Rev: ff4cb4e91b
GitHub-Pull-Request: golang/go#69424
Reviewed-on: https://go-review.googlesource.com/c/go/+/612735
Reviewed-by: Keith Randall <khr@golang.org>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-09-13 21:05:31 +00:00
Jes Cok
76e44f42c8 encoding/gob: make use of maps.Clone
Change-Id: I6a23219a9e05350bdd9205e19165d5944f15de31
GitHub-Last-Rev: 8c295bf55f
GitHub-Pull-Request: golang/go#69429
Reviewed-on: https://go-review.googlesource.com/c/go/+/612719
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-09-13 21:04:06 +00:00
Jes Cok
bc7c35a6d3 archive/tar: make use of maps.Clone
Change-Id: I2a9d849410002dae1f49a53597298c1903954d12
GitHub-Last-Rev: 20a56b4161
GitHub-Pull-Request: golang/go#69427
Reviewed-on: https://go-review.googlesource.com/c/go/+/612737
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-09-13 21:03:27 +00:00
Xiaolin Zhao
f243cf6016 cmd/compile: optimize math.Float64(32)bits and math.Float64(32)frombits on loong64
Use float <-> int register moves without conversion instead of stores
and loads to move float <-> int values like arm64 and mips64.

goos: linux
goarch: loong64
pkg: math
cpu: Loongson-3A6000 @ 2500.00MHz
                    │  bench.old   │               bench.new                │
                    │    sec/op    │    sec/op     vs base                  │
Acos                   15.98n ± 0%    15.94n ± 0%   -0.25% (p=0.000 n=20)
Acosh                  27.75n ± 0%    25.56n ± 0%   -7.89% (p=0.000 n=20)
Asin                   15.85n ± 0%    15.76n ± 0%   -0.57% (p=0.000 n=20)
Asinh                  39.79n ± 0%    37.69n ± 0%   -5.28% (p=0.000 n=20)
Atan                   7.261n ± 0%    7.242n ± 0%   -0.27% (p=0.000 n=20)
Atanh                  28.30n ± 0%    27.62n ± 0%   -2.40% (p=0.000 n=20)
Atan2                  15.85n ± 0%    15.75n ± 0%   -0.63% (p=0.000 n=20)
Cbrt                   27.02n ± 0%    21.08n ± 0%  -21.98% (p=0.000 n=20)
Ceil                   2.830n ± 1%    2.896n ± 1%   +2.31% (p=0.000 n=20)
Copysign              0.8022n ± 0%   0.8004n ± 0%   -0.22% (p=0.000 n=20)
Cos                    11.64n ± 0%    11.61n ± 0%   -0.26% (p=0.000 n=20)
Cosh                   35.98n ± 0%    33.44n ± 0%   -7.05% (p=0.000 n=20)
Erf                    10.09n ± 0%    10.08n ± 0%   -0.10% (p=0.000 n=20)
Erfc                   11.40n ± 0%    11.35n ± 0%   -0.44% (p=0.000 n=20)
Erfinv                 12.31n ± 0%    12.29n ± 0%   -0.16% (p=0.000 n=20)
Erfcinv                12.16n ± 0%    12.17n ± 0%   +0.08% (p=0.000 n=20)
Exp                    28.41n ± 0%    26.44n ± 0%   -6.95% (p=0.000 n=20)
ExpGo                  28.68n ± 0%    27.07n ± 0%   -5.60% (p=0.000 n=20)
Expm1                  17.21n ± 0%    16.75n ± 0%   -2.67% (p=0.000 n=20)
Exp2                   24.71n ± 0%    23.01n ± 0%   -6.88% (p=0.000 n=20)
Exp2Go                 25.17n ± 0%    23.91n ± 0%   -4.99% (p=0.000 n=20)
Abs                   0.8004n ± 0%   0.8004n ± 0%        ~ (p=0.224 n=20)
Dim                    1.201n ± 0%    1.201n ± 0%        ~ (p=1.000 n=20) ¹
Floor                  2.848n ± 0%    2.859n ± 0%   +0.39% (p=0.000 n=20)
Max                    3.074n ± 0%    3.071n ± 0%        ~ (p=0.481 n=20)
Min                    3.179n ± 0%    3.176n ± 0%   -0.09% (p=0.003 n=20)
Mod                    49.62n ± 0%    44.82n ± 0%   -9.67% (p=0.000 n=20)
Frexp                  7.604n ± 0%    6.803n ± 0%  -10.53% (p=0.000 n=20)
Gamma                  18.01n ± 0%    17.61n ± 0%   -2.22% (p=0.000 n=20)
Hypot                  7.204n ± 0%    7.604n ± 0%   +5.55% (p=0.000 n=20)
HypotGo                7.204n ± 0%    7.604n ± 0%   +5.56% (p=0.000 n=20)
Ilogb                  6.003n ± 0%    6.003n ± 0%        ~ (p=0.407 n=20)
J0                     76.43n ± 0%    76.24n ± 0%   -0.25% (p=0.000 n=20)
J1                     76.44n ± 0%    76.44n ± 0%        ~ (p=1.000 n=20)
Jn                     168.2n ± 0%    168.5n ± 0%   +0.18% (p=0.000 n=20)
Ldexp                  8.804n ± 0%    7.604n ± 0%  -13.63% (p=0.000 n=20)
Lgamma                 19.01n ± 0%    19.01n ± 0%        ~ (p=0.695 n=20)
Log                    19.38n ± 0%    19.12n ± 0%   -1.34% (p=0.000 n=20)
Logb                   6.003n ± 0%    6.003n ± 0%        ~ (p=1.000 n=20)
Log1p                  18.57n ± 0%    16.72n ± 0%   -9.96% (p=0.000 n=20)
Log10                  20.67n ± 0%    20.45n ± 0%   -1.06% (p=0.000 n=20)
Log2                   9.605n ± 0%    8.804n ± 0%   -8.34% (p=0.000 n=20)
Modf                   4.402n ± 0%    4.402n ± 0%        ~ (p=1.000 n=20)
Nextafter32            7.204n ± 0%    5.603n ± 0%  -22.22% (p=0.000 n=20)
Nextafter64            6.803n ± 0%    6.003n ± 0%  -11.76% (p=0.000 n=20)
PowInt                 39.62n ± 0%    37.22n ± 0%   -6.06% (p=0.000 n=20)
PowFrac                120.9n ± 0%    108.9n ± 0%   -9.93% (p=0.000 n=20)
Pow10Pos               1.601n ± 0%    1.601n ± 0%        ~ (p=0.487 n=20)
Pow10Neg               2.675n ± 0%    2.675n ± 0%        ~ (p=1.000 n=20)
Round                  3.018n ± 0%    2.401n ± 0%  -20.46% (p=0.000 n=20)
RoundToEven            3.822n ± 0%    3.001n ± 0%  -21.48% (p=0.000 n=20)
Remainder              45.62n ± 0%    42.42n ± 0%   -7.01% (p=0.000 n=20)
Signbit               0.9075n ± 0%   0.8004n ± 0%  -11.81% (p=0.000 n=20)
Sin                    12.65n ± 0%    12.65n ± 0%        ~ (p=0.503 n=20)
Sincos                 14.81n ± 0%    14.60n ± 0%   -1.42% (p=0.000 n=20)
Sinh                   36.75n ± 0%    35.11n ± 0%   -4.46% (p=0.000 n=20)
SqrtIndirect           1.201n ± 0%    1.201n ± 0%        ~ (p=1.000 n=20) ¹
SqrtLatency            4.002n ± 0%    4.002n ± 0%        ~ (p=1.000 n=20)
SqrtIndirectLatency    4.002n ± 0%    4.002n ± 0%        ~ (p=1.000 n=20)
SqrtGoLatency          52.85n ± 0%    40.82n ± 0%  -22.76% (p=0.000 n=20)
SqrtPrime              887.4n ± 0%    887.4n ± 0%        ~ (p=0.751 n=20)
Tan                    13.95n ± 0%    13.97n ± 0%   +0.18% (p=0.000 n=20)
Tanh                   36.79n ± 0%    34.89n ± 0%   -5.16% (p=0.000 n=20)
Trunc                  2.849n ± 0%    2.861n ± 0%   +0.42% (p=0.000 n=20)
Y0                     77.44n ± 0%    77.64n ± 0%   +0.26% (p=0.000 n=20)
Y1                     74.41n ± 0%    74.33n ± 0%   -0.11% (p=0.000 n=20)
Yn                     158.7n ± 0%    159.0n ± 0%   +0.19% (p=0.000 n=20)
Float64bits           0.8774n ± 0%   0.4002n ± 0%  -54.39% (p=0.000 n=20)
Float64frombits       0.8042n ± 0%   0.4002n ± 0%  -50.24% (p=0.000 n=20)
Float32bits           1.1230n ± 0%   0.5336n ± 0%  -52.48% (p=0.000 n=20)
Float32frombits       1.0670n ± 0%   0.8004n ± 0%  -24.99% (p=0.000 n=20)
FMA                    2.001n ± 0%    2.001n ± 0%        ~ (p=0.605 n=20)
geomean                10.87n         10.10n        -7.15%
¹ all samples are equal

goos: linux
goarch: loong64
pkg: math
cpu: Loongson-3A5000 @ 2500.00MHz
                    │  bench.old   │              bench.new               │
                    │    sec/op    │    sec/op     vs base                │
Acos                   33.10n ± 0%    31.95n ± 2%   -3.46% (p=0.000 n=20)
Acosh                  58.38n ± 0%    50.44n ± 0%  -13.60% (p=0.000 n=20)
Asin                   32.70n ± 0%    31.94n ± 0%   -2.32% (p=0.000 n=20)
Asinh                  57.65n ± 0%    50.83n ± 0%  -11.82% (p=0.000 n=20)
Atan                   14.21n ± 0%    14.21n ± 0%        ~ (p=0.501 n=20)
Atanh                  60.86n ± 0%    54.44n ± 0%  -10.56% (p=0.000 n=20)
Atan2                  32.02n ± 0%    34.02n ± 0%   +6.25% (p=0.000 n=20)
Cbrt                   55.58n ± 0%    40.64n ± 0%  -26.88% (p=0.000 n=20)
Ceil                   9.566n ± 0%    9.566n ± 0%        ~ (p=0.463 n=20)
Copysign              0.8005n ± 0%   0.8005n ± 0%        ~ (p=0.806 n=20)
Cos                    18.02n ± 0%    18.02n ± 0%        ~ (p=0.191 n=20)
Cosh                   64.44n ± 0%    65.64n ± 0%   +1.86% (p=0.000 n=20)
Erf                    16.15n ± 0%    16.16n ± 0%        ~ (p=0.770 n=20)
Erfc                   18.71n ± 0%    18.83n ± 0%   +0.61% (p=0.000 n=20)
Erfinv                 19.33n ± 0%    19.34n ± 0%        ~ (p=0.513 n=20)
Erfcinv                18.90n ± 0%    19.78n ± 0%   +4.63% (p=0.000 n=20)
Exp                    50.04n ± 0%    49.66n ± 0%   -0.75% (p=0.000 n=20)
ExpGo                  50.03n ± 0%    50.03n ± 0%        ~ (p=0.723 n=20)
Expm1                  28.41n ± 0%    28.27n ± 0%   -0.49% (p=0.000 n=20)
Exp2                   50.08n ± 0%    51.23n ± 0%   +2.31% (p=0.000 n=20)
Exp2Go                 49.77n ± 0%    49.89n ± 0%   +0.24% (p=0.000 n=20)
Abs                   0.8009n ± 0%   0.8006n ± 0%        ~ (p=0.317 n=20)
Dim                    1.987n ± 0%    1.993n ± 0%   +0.28% (p=0.001 n=20)
Floor                  8.543n ± 0%    8.548n ± 0%        ~ (p=0.509 n=20)
Max                    6.670n ± 0%    6.672n ± 0%        ~ (p=0.335 n=20)
Min                    6.694n ± 0%    6.694n ± 0%        ~ (p=0.459 n=20)
Mod                    56.44n ± 0%    53.23n ± 0%   -5.70% (p=0.000 n=20)
Frexp                  8.409n ± 0%    7.606n ± 0%   -9.55% (p=0.000 n=20)
Gamma                  35.64n ± 0%    35.23n ± 0%   -1.15% (p=0.000 n=20)
Hypot                  11.21n ± 0%    10.61n ± 0%   -5.31% (p=0.000 n=20)
HypotGo                11.50n ± 0%    11.01n ± 0%   -4.30% (p=0.000 n=20)
Ilogb                  7.606n ± 0%    6.804n ± 0%  -10.54% (p=0.000 n=20)
J0                     125.3n ± 0%    126.5n ± 0%   +0.96% (p=0.000 n=20)
J1                     124.9n ± 0%    125.3n ± 0%   +0.32% (p=0.000 n=20)
Jn                     264.3n ± 0%    265.9n ± 0%   +0.61% (p=0.000 n=20)
Ldexp                  9.606n ± 0%    9.204n ± 0%   -4.19% (p=0.000 n=20)
Lgamma                 38.82n ± 0%    38.85n ± 0%   +0.06% (p=0.019 n=20)
Log                    38.44n ± 0%    28.04n ± 0%  -27.06% (p=0.000 n=20)
Logb                   8.405n ± 0%    7.605n ± 0%   -9.52% (p=0.000 n=20)
Log1p                  31.62n ± 0%    27.11n ± 0%  -14.26% (p=0.000 n=20)
Log10                  38.83n ± 0%    28.42n ± 0%  -26.81% (p=0.000 n=20)
Log2                   11.21n ± 0%    10.41n ± 0%   -7.14% (p=0.000 n=20)
Modf                   5.204n ± 0%    5.205n ± 0%        ~ (p=0.983 n=20)
Nextafter32            8.809n ± 0%    7.208n ± 0%  -18.18% (p=0.000 n=20)
Nextafter64            8.405n ± 0%    8.406n ± 0%   +0.01% (p=0.007 n=20)
PowInt                 48.83n ± 0%    44.78n ± 0%   -8.28% (p=0.000 n=20)
PowFrac                146.9n ± 0%    142.1n ± 0%   -3.23% (p=0.000 n=20)
Pow10Pos               2.334n ± 0%    2.333n ± 0%        ~ (p=0.110 n=20)
Pow10Neg               4.803n ± 0%    4.803n ± 0%        ~ (p=0.130 n=20)
Round                  4.816n ± 0%    3.819n ± 0%  -20.70% (p=0.000 n=20)
RoundToEven            5.735n ± 0%    5.204n ± 0%   -9.26% (p=0.000 n=20)
Remainder              52.05n ± 0%    49.64n ± 0%   -4.63% (p=0.000 n=20)
Signbit                1.201n ± 0%    1.001n ± 0%  -16.65% (p=0.000 n=20)
Sin                    20.63n ± 0%    20.64n ± 0%   +0.05% (p=0.040 n=20)
Sincos                 23.82n ± 0%    24.62n ± 0%   +3.36% (p=0.000 n=20)
Sinh                   71.25n ± 0%    68.44n ± 0%   -3.94% (p=0.000 n=20)
SqrtIndirect           2.001n ± 0%    2.001n ± 0%        ~ (p=0.182 n=20)
SqrtLatency            4.003n ± 0%    4.003n ± 0%        ~ (p=0.754 n=20)
SqrtIndirectLatency    4.003n ± 0%    4.003n ± 0%        ~ (p=0.773 n=20)
SqrtGoLatency          60.84n ± 0%    81.26n ± 0%  +33.56% (p=0.000 n=20)
SqrtPrime              1.791µ ± 0%    1.791µ ± 0%        ~ (p=0.784 n=20)
Tan                    27.22n ± 0%    27.22n ± 0%        ~ (p=0.819 n=20)
Tanh                   70.88n ± 0%    69.04n ± 0%   -2.60% (p=0.000 n=20)
Trunc                  8.543n ± 0%    8.543n ± 0%        ~ (p=0.784 n=20)
Y0                     122.9n ± 0%    122.9n ± 0%        ~ (p=0.559 n=20)
Y1                     123.3n ± 0%    121.7n ± 0%   -1.30% (p=0.000 n=20)
Yn                     263.0n ± 0%    262.6n ± 0%   -0.15% (p=0.000 n=20)
Float64bits           1.2010n ± 0%   0.6004n ± 0%  -50.01% (p=0.000 n=20)
Float64frombits       1.2010n ± 0%   0.6004n ± 0%  -50.01% (p=0.000 n=20)
Float32bits           1.7010n ± 0%   0.8005n ± 0%  -52.94% (p=0.000 n=20)
Float32frombits       1.5010n ± 0%   0.8005n ± 0%  -46.67% (p=0.000 n=20)
FMA                    2.001n ± 0%    2.001n ± 0%        ~ (p=0.238 n=20)
geomean                17.41n         16.15n        -7.19%

Change-Id: I0a0c263af2f07203eab1782e69c706f20c689d8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/604737
Auto-Submit: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2024-09-13 19:29:23 +00:00
Mark Ryan
5752a94677 crypto/md5: provide optimised assembly for riscv64
Provide an optimised assembly implementation of MD5 for RISC-V.
There are significant performance improvements.  The assembler takes
advantage of Zbb instructions when they are available.

Results for the VisionFive 2 running Ubuntu 24.04 with
GORISCV64=rva20u64.

goos: linux
goarch: riscv64
pkg: crypto/md5
                    │ md5_go.txt  │             md5_ass.txt             │
                    │   sec/op    │   sec/op     vs base                │
Hash8Bytes            1.202µ ± 0%   1.220µ ± 0%   +1.50% (p=0.000 n=10)
Hash64                1.665µ ± 0%   1.518µ ± 0%   -8.83% (p=0.000 n=10)
Hash128               2.165µ ± 0%   1.885µ ± 0%  -12.94% (p=0.000 n=10)
Hash256               3.162µ ± 0%   2.613µ ± 0%  -17.38% (p=0.000 n=10)
Hash512               5.146µ ± 0%   4.063µ ± 0%  -21.05% (p=0.000 n=10)
Hash1K                9.115µ ± 0%   6.959µ ± 0%  -23.65% (p=0.000 n=10)
Hash8K                64.68µ ± 0%   47.52µ ± 0%  -26.54% (p=0.000 n=10)
Hash1M                8.131m ± 0%   5.936m ± 0%  -27.00% (p=0.000 n=10)
Hash8M                65.06m ± 0%   47.50m ± 0%  -26.99% (p=0.000 n=10)
Hash8BytesUnaligned   1.210µ ± 0%   1.199µ ± 0%   -0.91% (p=0.000 n=10)
Hash1KUnaligned       9.114µ ± 0%   8.266µ ± 0%   -9.30% (p=0.000 n=10)
Hash8KUnaligned       64.68µ ± 0%   57.97µ ± 0%  -10.38% (p=0.000 n=10)
geomean               22.37µ        18.83µ       -15.82%

Results for the VisionFive 2 running Ubuntu 24.04 with
GORISCV64=rva22u64.

goos: linux
goarch: riscv64
pkg: crypto/md5
                    │ md5_g22.txt │             md5_a22.txt             │
                    │   sec/op    │   sec/op     vs base                │
Hash8Bytes            1.175µ ± 0%   1.002µ ± 0%  -14.72% (p=0.000 n=10)
Hash64                1.575µ ± 0%   1.274µ ± 0%  -19.11% (p=0.000 n=10)
Hash128               2.033µ ± 0%   1.587µ ± 0%  -21.92% (p=0.000 n=10)
Hash256               2.943µ ± 0%   2.209µ ± 0%  -24.93% (p=0.000 n=10)
Hash512               4.755µ ± 0%   3.443µ ± 0%  -27.58% (p=0.000 n=10)
Hash1K                8.378µ ± 0%   5.910µ ± 0%  -29.46% (p=0.000 n=10)
Hash8K                59.12µ ± 0%   40.45µ ± 0%  -31.58% (p=0.000 n=10)
Hash1M                7.426m ± 0%   5.056m ± 0%  -31.92% (p=0.000 n=10)
Hash8M                59.41m ± 0%   40.45m ± 0%  -31.91% (p=0.000 n=10)
Hash8BytesUnaligned   1.169µ ± 0%   1.012µ ± 0%  -13.43% (p=0.000 n=10)
Hash1KUnaligned       8.379µ ± 0%   7.213µ ± 0%  -13.91% (p=0.000 n=10)
Hash8KUnaligned       59.12µ ± 0%   50.90µ ± 0%  -13.91% (p=0.000 n=10)
geomean               20.83µ        15.99µ       -23.21%

Change-Id: I61e3fa802c2cc50e0b5f71f151b4741691ccb481
Reviewed-on: https://go-review.googlesource.com/c/go/+/527936
Reviewed-by: Joel Sing <joel@sing.id.au>
Auto-Submit: Tim King <taking@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
2024-09-13 17:51:27 +00:00