]> Cypherpunks repositories - gostls13.git/log
gostls13.git
8 months agocmd/compile/internal: write type parameters for aliases
Tim King [Tue, 20 Aug 2024 19:43:59 +0000 (12:43 -0700)]
cmd/compile/internal: write type parameters for aliases

Writes the field for type parameter names for aliases when
the bitstream is >= V2.

This is a no-op at the moment as the writer is hardwired to V1.

Updates #68778

Change-Id: I5887e3608239b9a6a47e3cc21cacb75b84e1d186
Reviewed-on: https://go-review.googlesource.com/c/go/+/607235
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
8 months agotest/codegen: add initial codegen tests for integer min/max
Joel Sing [Tue, 20 Aug 2024 13:41:40 +0000 (23:41 +1000)]
test/codegen: add initial codegen tests for integer min/max

Change-Id: I006370053748edbec930c7279ee88a805009aa0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/606976
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agocrypto/aes: add missing aes-gcm buffer overlap checks to PPC64
Paul E. Murphy [Thu, 22 Aug 2024 14:50:08 +0000 (09:50 -0500)]
crypto/aes: add missing aes-gcm buffer overlap checks to PPC64

The tests added by CL 601778 highlighted missing buffer overlap
checks in the ppc64 specific aes-gcm implementation.

Fixes #69007

Change-Id: I80c3b5628c5079cfed2c3dace7298512c16a8f46
Reviewed-on: https://go-review.googlesource.com/c/go/+/607519
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
8 months agomath/big: implement addMulVVW in riscv64 assembly
Joel Sing [Thu, 27 Jun 2024 10:03:28 +0000 (20:03 +1000)]
math/big: implement addMulVVW in riscv64 assembly

This provides an assembly implementation of addMulVVW for riscv64,
processing up to four words per loop, resulting in a significant
performance gain.

On a StarFive VisionFive 2:

                   │ addmulvvw.1  │             addmulvvw.2             │
                   │    sec/op    │   sec/op     vs base                │
AddMulVVW/1-4         65.49n ± 0%   50.79n ± 0%  -22.44% (p=0.000 n=10)
AddMulVVW/2-4         82.81n ± 0%   66.83n ± 0%  -19.29% (p=0.000 n=10)
AddMulVVW/3-4        100.20n ± 0%   82.87n ± 0%  -17.30% (p=0.000 n=10)
AddMulVVW/4-4        117.50n ± 0%   84.20n ± 0%  -28.34% (p=0.000 n=10)
AddMulVVW/5-4         134.9n ± 0%   100.3n ± 0%  -25.69% (p=0.000 n=10)
AddMulVVW/10-4        221.7n ± 0%   164.4n ± 0%  -25.85% (p=0.000 n=10)
AddMulVVW/100-4       1.794µ ± 0%   1.250µ ± 0%  -30.32% (p=0.000 n=10)
AddMulVVW/1000-4      17.42µ ± 0%   12.08µ ± 0%  -30.68% (p=0.000 n=10)
AddMulVVW/10000-4     254.9µ ± 0%   214.8µ ± 0%  -15.75% (p=0.000 n=10)
AddMulVVW/100000-4    2.569m ± 0%   2.178m ± 0%  -15.20% (p=0.000 n=10)
geomean               1.443µ        1.107µ       -23.29%

                   │ addmulvvw.1  │              addmulvvw.2              │
                   │     B/s      │      B/s       vs base                │
AddMulVVW/1-4        932.0Mi ± 0%   1201.6Mi ± 0%  +28.93% (p=0.000 n=10)
AddMulVVW/2-4        1.440Gi ± 0%    1.784Gi ± 0%  +23.90% (p=0.000 n=10)
AddMulVVW/3-4        1.785Gi ± 0%    2.158Gi ± 0%  +20.87% (p=0.000 n=10)
AddMulVVW/4-4        2.029Gi ± 0%    2.832Gi ± 0%  +39.59% (p=0.000 n=10)
AddMulVVW/5-4        2.209Gi ± 0%    2.973Gi ± 0%  +34.55% (p=0.000 n=10)
AddMulVVW/10-4       2.689Gi ± 0%    3.626Gi ± 0%  +34.86% (p=0.000 n=10)
AddMulVVW/100-4      3.323Gi ± 0%    4.770Gi ± 0%  +43.54% (p=0.000 n=10)
AddMulVVW/1000-4     3.421Gi ± 0%    4.936Gi ± 0%  +44.27% (p=0.000 n=10)
AddMulVVW/10000-4    2.338Gi ± 0%    2.776Gi ± 0%  +18.69% (p=0.000 n=10)
AddMulVVW/100000-4   2.320Gi ± 0%    2.736Gi ± 0%  +17.93% (p=0.000 n=10)
geomean              2.109Gi         2.749Gi       +30.36%

Change-Id: I6c7ee48233c53ff9b6a5a9002675886cd9bff5af
Reviewed-on: https://go-review.googlesource.com/c/go/+/595400
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agomath/big: implement mulAddVWW in riscv64 assembly
Joel Sing [Thu, 27 Jun 2024 10:03:13 +0000 (20:03 +1000)]
math/big: implement mulAddVWW in riscv64 assembly

This provides an assembly implementation of mulAddVWW for riscv64,
processing up to four words per loop, resulting in a significant
performance gain.

On a StarFive VisionFive 2:

                   │ muladdvww.1  │             muladdvww.2             │
                   │    sec/op    │   sec/op     vs base                │
MulAddVWW/1-4         68.18n ± 0%   65.49n ± 0%   -3.95% (p=0.000 n=10)
MulAddVWW/2-4         82.81n ± 0%   78.85n ± 0%   -4.78% (p=0.000 n=10)
MulAddVWW/3-4         97.49n ± 0%   72.18n ± 0%  -25.96% (p=0.000 n=10)
MulAddVWW/4-4        112.20n ± 0%   85.54n ± 0%  -23.76% (p=0.000 n=10)
MulAddVWW/5-4        126.90n ± 0%   98.90n ± 0%  -22.06% (p=0.000 n=10)
MulAddVWW/10-4        200.3n ± 0%   144.3n ± 0%  -27.96% (p=0.000 n=10)
MulAddVWW/100-4      1532.0n ± 0%   860.0n ± 0%  -43.86% (p=0.000 n=10)
MulAddVWW/1000-4     14.757µ ± 0%   8.076µ ± 0%  -45.27% (p=0.000 n=10)
MulAddVWW/10000-4     204.0µ ± 0%   137.1µ ± 0%  -32.77% (p=0.000 n=10)
MulAddVWW/100000-4    2.066m ± 0%   1.382m ± 0%  -33.12% (p=0.000 n=10)
geomean               1.311µ        950.0n       -27.51%

                   │ muladdvww.1  │             muladdvww.2              │
                   │     B/s      │     B/s       vs base                │
MulAddVWW/1-4        895.1Mi ± 0%   932.0Mi ± 0%   +4.11% (p=0.000 n=10)
MulAddVWW/2-4        1.440Gi ± 0%   1.512Gi ± 0%   +5.02% (p=0.000 n=10)
MulAddVWW/3-4        1.834Gi ± 0%   2.477Gi ± 0%  +35.07% (p=0.000 n=10)
MulAddVWW/4-4        2.125Gi ± 0%   2.787Gi ± 0%  +31.15% (p=0.000 n=10)
MulAddVWW/5-4        2.349Gi ± 0%   3.013Gi ± 0%  +28.28% (p=0.000 n=10)
MulAddVWW/10-4       2.975Gi ± 0%   4.130Gi ± 0%  +38.79% (p=0.000 n=10)
MulAddVWW/100-4      3.891Gi ± 0%   6.930Gi ± 0%  +78.11% (p=0.000 n=10)
MulAddVWW/1000-4     4.039Gi ± 0%   7.380Gi ± 0%  +82.72% (p=0.000 n=10)
MulAddVWW/10000-4    2.922Gi ± 0%   4.346Gi ± 0%  +48.74% (p=0.000 n=10)
MulAddVWW/100000-4   2.884Gi ± 0%   4.313Gi ± 0%  +49.52% (p=0.000 n=10)
geomean              2.321Gi        3.202Gi       +37.95%

Change-Id: If08191607913ce5c7641f34bae8fa5c9dfb44777
Reviewed-on: https://go-review.googlesource.com/c/go/+/595399
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
8 months agocrypto/sha256: provide optimised assembly for riscv64
Joel Sing [Tue, 15 Aug 2023 15:03:51 +0000 (01:03 +1000)]
crypto/sha256: provide optimised assembly for riscv64

Provide an optimised assembly implementation of sha256 for riscv64.
This results in considerable performance gains.

On a StarFive VisionFive 2:

                    │   sha256.1   │              sha256.2               │
                    │    sec/op    │   sec/op     vs base                │
Hash8Bytes/New-4       7.820µ ± 0%   5.193µ ± 0%  -33.59% (p=0.000 n=10)
Hash8Bytes/Sum224-4    7.918µ ± 0%   5.294µ ± 0%  -33.15% (p=0.000 n=10)
Hash8Bytes/Sum256-4    7.950µ ± 0%   5.320µ ± 0%  -33.08% (p=0.000 n=10)
Hash1K/New-4          108.03µ ± 0%   66.12µ ± 0%  -38.79% (p=0.000 n=10)
Hash1K/Sum224-4       108.12µ ± 0%   66.22µ ± 0%  -38.76% (p=0.000 n=10)
Hash1K/Sum256-4       108.15µ ± 0%   66.24µ ± 0%  -38.75% (p=0.000 n=10)
Hash8K/New-4           808.5µ ± 0%   493.0µ ± 0%  -39.02% (p=0.000 n=10)
Hash8K/Sum224-4        808.6µ ± 0%   493.1µ ± 0%  -39.02% (p=0.000 n=10)
Hash8K/Sum256-4        808.6µ ± 0%   493.1µ ± 0%  -39.02% (p=0.000 n=10)
geomean                88.37µ        55.61µ       -37.08%

                    │   sha256.1   │               sha256.2                │
                    │     B/s      │      B/s       vs base                │
Hash8Bytes/New-4      996.1Ki ± 0%   1503.9Ki ± 0%  +50.98% (p=0.000 n=10)
Hash8Bytes/Sum224-4   986.3Ki ± 0%   1474.6Ki ± 0%  +49.50% (p=0.000 n=10)
Hash8Bytes/Sum256-4   986.3Ki ± 0%   1464.8Ki ± 0%  +48.51% (p=0.000 n=10)
Hash1K/New-4          9.041Mi ± 0%   14.772Mi ± 0%  +63.40% (p=0.000 n=10)
Hash1K/Sum224-4       9.031Mi ± 0%   14.744Mi ± 0%  +63.25% (p=0.000 n=10)
Hash1K/Sum256-4       9.031Mi ± 0%   14.744Mi ± 0%  +63.25% (p=0.000 n=10)
Hash8K/New-4          9.661Mi ± 0%   15.850Mi ± 0%  +64.07% (p=0.000 n=10)
Hash8K/Sum224-4       9.661Mi ± 0%   15.841Mi ± 0%  +63.97% (p=0.000 n=10)
Hash8K/Sum256-4       9.661Mi ± 0%   15.841Mi ± 0%  +63.97% (p=0.000 n=10)
geomean               4.386Mi         6.966Mi       +58.85%

Change-Id: Ieead7b7c02291d70ddc472a7a8cf3c044c1da4b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/519695
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
8 months agoos: improve Getwd documentation
Kir Kolyshkin [Wed, 21 Aug 2024 19:47:04 +0000 (12:47 -0700)]
os: improve Getwd documentation

1. Replace "rooted path name" with a more accurate "absolute path name".
Using "absolute" seems to be preferred terminology on Unix. On Windows,
there are multiple roots in Windows, thus "a rooted path name" can be
one relative to a drive letter or a server name. Note that Windows'
GetCurrentDirectory documentation [1] also says "the absolute path to the
current directory".

2. Add a note about using $PWD on Unix.

[1]: https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getcurrentdirectory

Change-Id: Ic310f0f8776ff059544789306ae5cfa1fa267b12
Reviewed-on: https://go-review.googlesource.com/c/go/+/607615
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
8 months agocmd/internal/obj/loong64: add support for instructions BSTRPICK.{W/D} and BSTRINS...
Xiaolin Zhao [Mon, 12 Aug 2024 07:18:45 +0000 (15:18 +0800)]
cmd/internal/obj/loong64: add support for instructions BSTRPICK.{W/D} and BSTRINS.{W/D}

Go asm syntax:
BSTRPICK{W/V} $msb, RJ, $lsb, RD
BSTRINS{W/V} $msb, RJ, $lsb, RD

Equivalent platform assembler syntax:
bstrpick.{w/d} rd, rj, $msb, $lsb
bstrins.{w/d} rd, rj, $msb, $lsb

Ref: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html

Change-Id: I8b89b766ed22a96da7d8d5b2b2873382a49208de
Reviewed-on: https://go-review.googlesource.com/c/go/+/604735
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
8 months agoos: improve Windows fixLongPath
Kir Kolyshkin [Wed, 21 Aug 2024 22:11:38 +0000 (15:11 -0700)]
os: improve Windows fixLongPath

CL 574695 added caching the os.Chdir argument for Windows, and used the
cached value to assess the length of the current working directory in
addExtendedPrefix (used by fixLongPath).

It did not take into account that Chdir can accept relative paths, and
thus the pathLength calculation in addExtendedPrefix can be wrong.

Let's only cache the os.Chdir argument if it's absolute, and clean the
cache otherwise, thus improving the correctness of fixLongPath.

For #41734
For #21782
For #36375

Change-Id: Ie24a5ed763a7aacc310666d2e4cbb8e298768670
Reviewed-on: https://go-review.googlesource.com/c/go/+/607437
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agocmd/go: document unsettable GOTELEMETRY and GOTELEMETRYDIR go env vars
Michael Matloob [Thu, 22 Aug 2024 16:00:10 +0000 (12:00 -0400)]
cmd/go: document unsettable GOTELEMETRY and GOTELEMETRYDIR go env vars

This change adds documentation to "go help telemetry" and "go help
environment" for the unsettable GOTELEMETRY and GOTELEMETRYDIR go env
variables.

For #68928

Change-Id: I8c139bd8585ffb0c45b9dd722ef6e7a9a33df192
Reviewed-on: https://go-review.googlesource.com/c/go/+/607855
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agocmd/dist: set go version in bootstrap go.mod file
Michael Matloob [Tue, 13 Aug 2024 17:53:50 +0000 (13:53 -0400)]
cmd/dist: set go version in bootstrap go.mod file

The commands to build the bootstrap toolchains and go commands are run
from modules created by two bootstrap go.mod files: one is used when
building toolchain1 and go_bootstrap, and the other is used for
toolchain2 and toolchain3, and the final build. Currently the first has
a go directive specifying go 1.20, and the second one does not have a go
directive at all. This affects the default GODEBUG setting when building
the final toolchain: the default GODEBUG value is based on the go
version of the go.mod file, and when the go.mod file does not have a
version it defaults to go1.16. We should set the go directive on the
bootstrap used for the second half of the builds to use the current go
verison from the std's go.mod file (which is the same as the version on
cmd's go.mod file).

The go.mod file used for the initial bootstrap should have a go
directive with the minimum version of the toolchain required for
bootstrapping. That version is the current version - 2 rounded down to
an even number.

For #64751
Fixes #68797

Change-Id: Ibdddf4bc36dc963291979d603c4f3fc55264f65b
Reviewed-on: https://go-review.googlesource.com/c/go/+/604799
Reviewed-by: 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>
8 months agoruntime: fix nanotime1 on windows/arm
qmuntal [Thu, 22 Aug 2024 13:02:49 +0000 (15:02 +0200)]
runtime: fix nanotime1 on windows/arm

nanotime1 is broken on windows/arm since CL 526358, which
unintentionally removed a necessary instruction. It hasn't been
noticed till now because the there is no windows/arm builder.

This CL restores the instruction.

Fixes #68996.

Change-Id: I52ef6891a3bd8e608b8538f456d181e08f93efaa
Reviewed-on: https://go-review.googlesource.com/c/go/+/607776
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
8 months agocrypto/sha1: implement sha1block in hardware on loong64
Xiaolin Zhao [Mon, 3 Jun 2024 09:54:18 +0000 (17:54 +0800)]
crypto/sha1: implement sha1block in hardware on loong64

goos: linux
goarch: loong64
pkg: crypto/sha1
cpu: Loongson-3A6000 @ 2500.00MHz
                 │  bench.old   │              bench.new              │
                 │    sec/op    │   sec/op     vs base                │
Hash8Bytes/New      489.8n ± 0%   280.6n ± 0%  -42.71% (p=0.000 n=20)
Hash8Bytes/Sum      496.6n ± 0%   288.9n ± 0%  -41.82% (p=0.000 n=20)
Hash320Bytes/New   2251.0n ± 0%   992.0n ± 0%  -55.93% (p=0.000 n=20)
Hash320Bytes/Sum   2258.0n ± 0%   998.0n ± 0%  -55.80% (p=0.000 n=20)
Hash1K/New          6.113µ ± 0%   2.583µ ± 0%  -57.75% (p=0.000 n=20)
Hash1K/Sum          6.117µ ± 0%   2.588µ ± 0%  -57.69% (p=0.000 n=20)
Hash8K/New          45.42µ ± 0%   18.79µ ± 0%  -58.63% (p=0.000 n=20)
Hash8K/Sum          45.43µ ± 0%   18.80µ ± 0%  -58.62% (p=0.000 n=20)
geomean             4.192µ        1.926µ       -54.05%

                 │  bench.old   │               bench.new               │
                 │     B/s      │     B/s       vs base                 │
Hash8Bytes/New     15.57Mi ± 0%   27.19Mi ± 0%   +74.59% (p=0.000 n=20)
Hash8Bytes/Sum     15.36Mi ± 0%   26.41Mi ± 0%   +71.88% (p=0.000 n=20)
Hash320Bytes/New   135.6Mi ± 0%   307.6Mi ± 0%  +126.90% (p=0.000 n=20)
Hash320Bytes/Sum   135.2Mi ± 0%   305.8Mi ± 0%  +126.22% (p=0.000 n=20)
Hash1K/New         159.8Mi ± 0%   378.1Mi ± 0%  +136.69% (p=0.000 n=20)
Hash1K/Sum         159.7Mi ± 0%   377.4Mi ± 0%  +136.38% (p=0.000 n=20)
Hash8K/New         172.0Mi ± 0%   415.8Mi ± 0%  +141.75% (p=0.000 n=20)
Hash8K/Sum         172.0Mi ± 0%   415.6Mi ± 0%  +141.65% (p=0.000 n=20)
geomean            87.09Mi        189.5Mi       +117.64%

goos: linux
goarch: loong64
pkg: crypto/sha1
cpu: Loongson-3A5000 @ 2500.00MHz
                 │  bench.old  │              bench.new              │
                 │   sec/op    │   sec/op     vs base                │
Hash8Bytes/New     565.9n ± 0%   374.5n ± 1%  -33.82% (p=0.000 n=20)
Hash8Bytes/Sum     571.3n ± 0%   366.7n ± 1%  -35.81% (p=0.000 n=20)
Hash320Bytes/New   2.662µ ± 0%   1.201µ ± 0%  -54.88% (p=0.000 n=20)
Hash320Bytes/Sum   2.662µ ± 0%   1.194µ ± 0%  -55.15% (p=0.000 n=20)
Hash1K/New         7.171µ ± 0%   3.084µ ± 0%  -56.99% (p=0.000 n=20)
Hash1K/Sum         7.171µ ± 0%   3.076µ ± 0%  -57.11% (p=0.000 n=20)
Hash8K/New         53.10µ ± 0%   22.24µ ± 0%  -58.12% (p=0.000 n=20)
Hash8K/Sum         53.09µ ± 0%   22.23µ ± 0%  -58.12% (p=0.000 n=20)
geomean            4.900µ        2.348µ       -52.08%

                 │  bench.old   │               bench.new               │
                 │     B/s      │     B/s       vs base                 │
Hash8Bytes/New     13.48Mi ± 0%   20.38Mi ± 1%   +51.10% (p=0.000 n=20)
Hash8Bytes/Sum     13.35Mi ± 0%   20.80Mi ± 1%   +55.82% (p=0.000 n=20)
Hash320Bytes/New   114.6Mi ± 0%   254.0Mi ± 1%  +121.61% (p=0.000 n=20)
Hash320Bytes/Sum   114.6Mi ± 0%   255.6Mi ± 0%  +123.00% (p=0.000 n=20)
Hash1K/New         136.2Mi ± 0%   316.7Mi ± 0%  +132.54% (p=0.000 n=20)
Hash1K/Sum         136.2Mi ± 0%   317.5Mi ± 0%  +133.19% (p=0.000 n=20)
Hash8K/New         147.1Mi ± 0%   351.3Mi ± 0%  +138.79% (p=0.000 n=20)
Hash8K/Sum         147.2Mi ± 0%   351.4Mi ± 0%  +138.78% (p=0.000 n=20)
geomean            74.51Mi        155.5Mi       +108.69%

Change-Id: I716babd19c18dc2c3314d972ced9d83de2d93cb2
Reviewed-on: https://go-review.googlesource.com/c/go/+/589775
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
8 months agoos: openDir: add O_DIRECTORY flag for unix
Kir Kolyshkin [Wed, 29 May 2024 00:23:15 +0000 (17:23 -0700)]
os: openDir: add O_DIRECTORY flag for unix

With this, ReadDir will fail a tad earlier (on open rather than on
readdir syscall). This should be the only effect of this change.

Change-Id: Icf2870f47ea6c19aad29670e78ba9bfcc13c0ac3
Reviewed-on: https://go-review.googlesource.com/c/go/+/588915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

8 months agomath/big: implement subVW in riscv64 assembly
Joel Sing [Thu, 27 Jun 2024 10:02:57 +0000 (20:02 +1000)]
math/big: implement subVW in riscv64 assembly

This provides an assembly implementation of subVW for riscv64,
processing up to four words per loop, resulting in a significant
performance gain.

On a StarFive VisionFive 2:

                  │   subvw.1    │               subvw.2               │
                  │    sec/op    │   sec/op     vs base                │
SubVW/1-4            57.43n ± 0%   41.45n ± 0%  -27.82% (p=0.000 n=10)
SubVW/2-4            69.31n ± 0%   48.15n ± 0%  -30.53% (p=0.000 n=10)
SubVW/3-4            76.12n ± 0%   54.87n ± 0%  -27.92% (p=0.000 n=10)
SubVW/4-4            85.47n ± 0%   56.14n ± 0%  -34.32% (p=0.000 n=10)
SubVW/5-4            96.15n ± 0%   62.83n ± 0%  -34.65% (p=0.000 n=10)
SubVW/10-4          149.60n ± 0%   89.55n ± 0%  -40.14% (p=0.000 n=10)
SubVW/100-4         1115.0n ± 0%   549.3n ± 0%  -50.74% (p=0.000 n=10)
SubVW/1000-4        10.732µ ± 0%   5.071µ ± 0%  -52.75% (p=0.000 n=10)
SubVW/10000-4        153.0µ ± 0%   103.7µ ± 0%  -32.21% (p=0.000 n=10)
SubVW/100000-4       1.542m ± 0%   1.046m ± 0%  -32.13% (p=0.000 n=10)
SubVWext/1-4         57.42n ± 0%   41.45n ± 0%  -27.81% (p=0.000 n=10)
SubVWext/2-4         69.33n ± 0%   48.15n ± 0%  -30.55% (p=0.000 n=10)
SubVWext/3-4         76.12n ± 0%   54.93n ± 0%  -27.84% (p=0.000 n=10)
SubVWext/4-4         85.47n ± 0%   56.14n ± 0%  -34.32% (p=0.000 n=10)
SubVWext/5-4         96.15n ± 0%   62.83n ± 0%  -34.65% (p=0.000 n=10)
SubVWext/10-4       149.60n ± 0%   89.56n ± 0%  -40.14% (p=0.000 n=10)
SubVWext/100-4      1115.0n ± 0%   549.3n ± 0%  -50.74% (p=0.000 n=10)
SubVWext/1000-4     10.732µ ± 0%   5.061µ ± 0%  -52.84% (p=0.000 n=10)
SubVWext/10000-4     152.5µ ± 0%   103.7µ ± 0%  -32.02% (p=0.000 n=10)
SubVWext/100000-4    1.533m ± 0%   1.046m ± 0%  -31.75% (p=0.000 n=10)
geomean              1.005µ        633.7n       -36.92%

                  │   subvw.1    │                subvw.2                 │
                  │     B/s      │      B/s       vs base                 │
SubVW/1-4           132.9Mi ± 0%    184.1Mi ± 0%   +38.54% (p=0.000 n=10)
SubVW/2-4           220.1Mi ± 0%    316.9Mi ± 0%   +43.95% (p=0.000 n=10)
SubVW/3-4           300.7Mi ± 0%    417.1Mi ± 0%   +38.72% (p=0.000 n=10)
SubVW/4-4           357.1Mi ± 0%    543.6Mi ± 0%   +52.24% (p=0.000 n=10)
SubVW/5-4           396.7Mi ± 0%    607.2Mi ± 0%   +53.03% (p=0.000 n=10)
SubVW/10-4          510.1Mi ± 0%    851.9Mi ± 0%   +67.01% (p=0.000 n=10)
SubVW/100-4         684.2Mi ± 0%   1388.9Mi ± 0%  +102.99% (p=0.000 n=10)
SubVW/1000-4        710.9Mi ± 0%   1504.5Mi ± 0%  +111.63% (p=0.000 n=10)
SubVW/10000-4       498.7Mi ± 0%    735.7Mi ± 0%   +47.52% (p=0.000 n=10)
SubVW/100000-4      494.8Mi ± 0%    729.1Mi ± 0%   +47.34% (p=0.000 n=10)
SubVWext/1-4        132.9Mi ± 0%    184.1Mi ± 0%   +38.53% (p=0.000 n=10)
SubVWext/2-4        220.1Mi ± 0%    316.9Mi ± 0%   +44.00% (p=0.000 n=10)
SubVWext/3-4        300.7Mi ± 0%    416.7Mi ± 0%   +38.57% (p=0.000 n=10)
SubVWext/4-4        357.1Mi ± 0%    543.6Mi ± 0%   +52.24% (p=0.000 n=10)
SubVWext/5-4        396.7Mi ± 0%    607.2Mi ± 0%   +53.04% (p=0.000 n=10)
SubVWext/10-4       510.1Mi ± 0%    851.9Mi ± 0%   +67.01% (p=0.000 n=10)
SubVWext/100-4      684.2Mi ± 0%   1388.9Mi ± 0%  +102.99% (p=0.000 n=10)
SubVWext/1000-4     710.9Mi ± 0%   1507.6Mi ± 0%  +112.07% (p=0.000 n=10)
SubVWext/10000-4    500.1Mi ± 0%    735.7Mi ± 0%   +47.10% (p=0.000 n=10)
SubVWext/100000-4   497.8Mi ± 0%    729.4Mi ± 0%   +46.52% (p=0.000 n=10)
geomean             387.6Mi         614.5Mi        +58.51%

Change-Id: I9d7fac719e977710ad9db9121fa298db6df605de
Reviewed-on: https://go-review.googlesource.com/c/go/+/595398
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agomath/big: implement addVW in riscv64 assembly
Joel Sing [Thu, 27 Jun 2024 10:02:38 +0000 (20:02 +1000)]
math/big: implement addVW in riscv64 assembly

This provides an assembly implementation of addVW for riscv64,
processing up to four words per loop, resulting in a significant
performance gain.

On a StarFive VisionFive 2:

                  │   addvw.1    │               addvw.2               │
                  │    sec/op    │   sec/op     vs base                │
AddVW/1-4            57.43n ± 0%   41.45n ± 0%  -27.83% (p=0.000 n=10)
AddVW/2-4            69.31n ± 0%   48.15n ± 0%  -30.53% (p=0.000 n=10)
AddVW/3-4            76.12n ± 0%   54.97n ± 0%  -27.79% (p=0.000 n=10)
AddVW/4-4            85.47n ± 0%   56.14n ± 0%  -34.32% (p=0.000 n=10)
AddVW/5-4            96.16n ± 0%   62.82n ± 0%  -34.67% (p=0.000 n=10)
AddVW/10-4          149.60n ± 0%   89.55n ± 0%  -40.14% (p=0.000 n=10)
AddVW/100-4         1115.0n ± 0%   549.3n ± 0%  -50.74% (p=0.000 n=10)
AddVW/1000-4        10.732µ ± 0%   5.060µ ± 0%  -52.85% (p=0.000 n=10)
AddVW/10000-4        151.7µ ± 0%   103.7µ ± 0%  -31.63% (p=0.000 n=10)
AddVW/100000-4       1.523m ± 0%   1.050m ± 0%  -31.03% (p=0.000 n=10)
AddVWext/1-4         57.42n ± 0%   41.45n ± 0%  -27.81% (p=0.000 n=10)
AddVWext/2-4         69.32n ± 0%   48.15n ± 0%  -30.54% (p=0.000 n=10)
AddVWext/3-4         76.12n ± 0%   54.87n ± 0%  -27.92% (p=0.000 n=10)
AddVWext/4-4         85.47n ± 0%   56.14n ± 0%  -34.32% (p=0.000 n=10)
AddVWext/5-4         96.15n ± 0%   62.82n ± 0%  -34.66% (p=0.000 n=10)
AddVWext/10-4       149.60n ± 0%   89.55n ± 0%  -40.14% (p=0.000 n=10)
AddVWext/100-4      1115.0n ± 0%   549.3n ± 0%  -50.74% (p=0.000 n=10)
AddVWext/1000-4     10.732µ ± 0%   5.060µ ± 0%  -52.85% (p=0.000 n=10)
AddVWext/10000-4     150.5µ ± 0%   103.7µ ± 0%  -31.10% (p=0.000 n=10)
AddVWext/100000-4    1.530m ± 0%   1.049m ± 0%  -31.41% (p=0.000 n=10)
geomean              1.003µ        633.9n       -36.79%

                  │   addvw.1    │                addvw.2                 │
                  │     B/s      │      B/s       vs base                 │
AddVW/1-4           132.8Mi ± 0%    184.1Mi ± 0%   +38.55% (p=0.000 n=10)
AddVW/2-4           220.1Mi ± 0%    316.9Mi ± 0%   +43.96% (p=0.000 n=10)
AddVW/3-4           300.7Mi ± 0%    416.4Mi ± 0%   +38.48% (p=0.000 n=10)
AddVW/4-4           357.1Mi ± 0%    543.6Mi ± 0%   +52.25% (p=0.000 n=10)
AddVW/5-4           396.7Mi ± 0%    607.2Mi ± 0%   +53.06% (p=0.000 n=10)
AddVW/10-4          510.1Mi ± 0%    852.0Mi ± 0%   +67.02% (p=0.000 n=10)
AddVW/100-4         684.1Mi ± 0%   1389.0Mi ± 0%  +103.03% (p=0.000 n=10)
AddVW/1000-4        710.9Mi ± 0%   1507.8Mi ± 0%  +112.08% (p=0.000 n=10)
AddVW/10000-4       503.1Mi ± 0%    735.8Mi ± 0%   +46.26% (p=0.000 n=10)
AddVW/100000-4      501.0Mi ± 0%    726.5Mi ± 0%   +45.00% (p=0.000 n=10)
AddVWext/1-4        132.9Mi ± 0%    184.1Mi ± 0%   +38.55% (p=0.000 n=10)
AddVWext/2-4        220.1Mi ± 0%    316.9Mi ± 0%   +43.98% (p=0.000 n=10)
AddVWext/3-4        300.7Mi ± 0%    417.1Mi ± 0%   +38.73% (p=0.000 n=10)
AddVWext/4-4        357.1Mi ± 0%    543.6Mi ± 0%   +52.25% (p=0.000 n=10)
AddVWext/5-4        396.7Mi ± 0%    607.2Mi ± 0%   +53.05% (p=0.000 n=10)
AddVWext/10-4       510.1Mi ± 0%    852.0Mi ± 0%   +67.02% (p=0.000 n=10)
AddVWext/100-4      684.2Mi ± 0%   1389.0Mi ± 0%  +103.02% (p=0.000 n=10)
AddVWext/1000-4     710.9Mi ± 0%   1507.7Mi ± 0%  +112.08% (p=0.000 n=10)
AddVWext/10000-4    506.9Mi ± 0%    735.8Mi ± 0%   +45.15% (p=0.000 n=10)
AddVWext/100000-4   498.6Mi ± 0%    727.0Mi ± 0%   +45.79% (p=0.000 n=10)
geomean             388.3Mi         614.3Mi        +58.19%

Change-Id: Ib14a4b8c1d81e710753bbf6dd5546bbca44fe3f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/595397
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
8 months agocmd/compile/internal/ssagen: add initial test coverage for intrinsics
Joel Sing [Fri, 2 Aug 2024 17:09:13 +0000 (03:09 +1000)]
cmd/compile/internal/ssagen: add initial test coverage for intrinsics

Add basic test coverage for the intrinisic table - this at least allows
us to tell if intrinsics are added or removed unexpectedly. Code
generation changes resulting from intrinsics is not covered and is
left for test/codegen and others.

Change-Id: I3d538708b90cd04d3f449945e0fd9388097d683e
Reviewed-on: https://go-review.googlesource.com/c/go/+/605475
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
8 months agocrypto/md5: implement md5block in hardware on loong64
Xiaolin Zhao [Mon, 3 Jun 2024 09:04:53 +0000 (17:04 +0800)]
crypto/md5: implement md5block in hardware on loong64

goos: linux
goarch: loong64
pkg: crypto/md5
cpu: Loongson-3A6000 @ 2500.00MHz
                    │  bench.old   │              bench.new              │
                    │    sec/op    │   sec/op     vs base                │
Hash8Bytes             276.6n ± 0%   219.7n ± 0%  -20.57% (p=0.000 n=20)
Hash64                 445.8n ± 0%   339.9n ± 0%  -23.76% (p=0.000 n=20)
Hash128                632.0n ± 0%   468.1n ± 0%  -25.93% (p=0.000 n=20)
Hash256               1005.0n ± 0%   723.8n ± 0%  -27.98% (p=0.000 n=20)
Hash512                1.749µ ± 0%   1.238µ ± 0%  -29.22% (p=0.000 n=20)
Hash1K                 3.238µ ± 0%   2.265µ ± 0%  -30.05% (p=0.000 n=20)
Hash8K                 24.09µ ± 0%   16.66µ ± 0%  -30.83% (p=0.000 n=20)
Hash1M                 3.049m ± 0%   2.105m ± 0%  -30.97% (p=0.000 n=20)
Hash8M                 24.39m ± 0%   16.84m ± 0%  -30.97% (p=0.000 n=20)
Hash8BytesUnaligned    284.1n ± 0%   227.2n ± 0%  -20.03% (p=0.000 n=20)
Hash1KUnaligned        3.238µ ± 0%   2.265µ ± 0%  -30.05% (p=0.000 n=20)
Hash8KUnaligned        24.09µ ± 0%   16.66µ ± 0%  -30.82% (p=0.000 n=20)
geomean                7.142µ        5.164µ       -27.70%

                    │  bench.old   │              bench.new               │
                    │     B/s      │     B/s       vs base                │
Hash8Bytes            27.58Mi ± 0%   34.73Mi ± 0%  +25.93% (p=0.000 n=20)
Hash64                136.9Mi ± 0%   179.6Mi ± 0%  +31.15% (p=0.000 n=20)
Hash128               193.1Mi ± 0%   260.8Mi ± 0%  +35.03% (p=0.000 n=20)
Hash256               243.0Mi ± 0%   337.3Mi ± 0%  +38.82% (p=0.000 n=20)
Hash512               279.1Mi ± 0%   394.3Mi ± 0%  +41.25% (p=0.000 n=20)
Hash1K                301.6Mi ± 0%   431.1Mi ± 0%  +42.94% (p=0.000 n=20)
Hash8K                324.3Mi ± 0%   468.9Mi ± 0%  +44.56% (p=0.000 n=20)
Hash1M                327.9Mi ± 0%   475.0Mi ± 0%  +44.86% (p=0.000 n=20)
Hash8M                328.0Mi ± 0%   475.1Mi ± 0%  +44.86% (p=0.000 n=20)
Hash8BytesUnaligned   26.86Mi ± 0%   33.58Mi ± 0%  +25.04% (p=0.000 n=20)
Hash1KUnaligned       301.6Mi ± 0%   431.1Mi ± 0%  +42.95% (p=0.000 n=20)
Hash8KUnaligned       324.3Mi ± 0%   468.9Mi ± 0%  +44.56% (p=0.000 n=20)
geomean               182.5Mi        252.4Mi       +38.31%

goos: linux
goarch: loong64
pkg: crypto/md5
cpu: Loongson-3A5000 @ 2500.00MHz
                    │  bench.old   │              bench.new              │
                    │    sec/op    │   sec/op     vs base                │
Hash8Bytes             346.0n ± 0%   289.1n ± 0%  -16.45% (p=0.000 n=20)
Hash64                 521.2n ± 0%   409.3n ± 0%  -21.47% (p=0.000 n=20)
Hash128                707.1n ± 0%   537.8n ± 0%  -23.94% (p=0.000 n=20)
Hash256               1080.0n ± 0%   795.8n ± 0%  -26.31% (p=0.000 n=20)
Hash512                1.826µ ± 0%   1.311µ ± 0%  -28.20% (p=0.000 n=20)
Hash1K                 3.315µ ± 0%   2.342µ ± 0%  -29.35% (p=0.000 n=20)
Hash8K                 24.19µ ± 0%   16.78µ ± 0%  -30.65% (p=0.000 n=20)
Hash1M                 3.052m ± 0%   2.110m ± 0%  -30.86% (p=0.000 n=20)
Hash8M                 24.41m ± 0%   16.88m ± 0%  -30.85% (p=0.000 n=20)
Hash8BytesUnaligned    345.9n ± 0%   289.0n ± 0%  -16.45% (p=0.000 n=20)
Hash1KUnaligned        3.316µ ± 0%   2.342µ ± 0%  -29.37% (p=0.000 n=20)
Hash8KUnaligned        24.19µ ± 0%   16.78µ ± 0%  -30.66% (p=0.000 n=20)
geomean                7.673µ        5.648µ       -26.39%

                    │  bench.old   │              bench.new               │
                    │     B/s      │     B/s       vs base                │
Hash8Bytes            22.05Mi ± 0%   26.39Mi ± 0%  +19.68% (p=0.000 n=20)
Hash64                117.1Mi ± 0%   149.1Mi ± 0%  +27.32% (p=0.000 n=20)
Hash128               172.6Mi ± 0%   227.0Mi ± 0%  +31.49% (p=0.000 n=20)
Hash256               226.0Mi ± 0%   306.8Mi ± 0%  +35.77% (p=0.000 n=20)
Hash512               267.4Mi ± 0%   372.5Mi ± 0%  +39.26% (p=0.000 n=20)
Hash1K                294.6Mi ± 0%   417.0Mi ± 0%  +41.53% (p=0.000 n=20)
Hash8K                322.9Mi ± 0%   465.7Mi ± 0%  +44.20% (p=0.000 n=20)
Hash1M                327.7Mi ± 0%   474.0Mi ± 0%  +44.64% (p=0.000 n=20)
Hash8M                327.8Mi ± 0%   474.1Mi ± 0%  +44.62% (p=0.000 n=20)
Hash8BytesUnaligned   22.06Mi ± 0%   26.40Mi ± 0%  +19.67% (p=0.000 n=20)
Hash1KUnaligned       294.5Mi ± 0%   417.0Mi ± 0%  +41.60% (p=0.000 n=20)
Hash8KUnaligned       322.9Mi ± 0%   465.7Mi ± 0%  +44.21% (p=0.000 n=20)
geomean               169.9Mi        230.8Mi       +35.85%

Change-Id: Iffddd60e3fc0b3bb265289f836a2d875f0805f64
Reviewed-on: https://go-review.googlesource.com/c/go/+/589540
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
8 months agosyscall: optimize Getwd on aix
Kir Kolyshkin [Tue, 20 Aug 2024 00:40:55 +0000 (17:40 -0700)]
syscall: optimize Getwd on aix

When looking for \0, use clen which may be optimized.

Also, return EINVAL when returned string is empty.

This makes it similar to how it is implemented in *bsd and solaris.

Change-Id: I3e37ed25f47110eafd12c80291f7746de9db7b23
Reviewed-on: https://go-review.googlesource.com/c/go/+/606902
TryBot-Bypass: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>

8 months agosort: drop implementation for Go <1.21
Tobias Klauser [Wed, 21 Aug 2024 21:17:26 +0000 (23:17 +0200)]
sort: drop implementation for Go <1.21

Now that Go 1.22.6 is the minimum bootstrap toolchain (cf. CL 606156),
the fallback implementation for Go versions <1.21 can be dropped.

For #61180
For #64751

Change-Id: Idfeca0a6e9f490e1ab0f308ead372612402923ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/607315
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>

8 months agotesting: rename testContext to testState
Vladimir Varankin [Wed, 21 Aug 2024 18:47:11 +0000 (20:47 +0200)]
testing: rename testContext to testState

Following up to CL 603959, update internals of testing package to
reduce the confusion around "context". The changes rename
testContext/benchContext/fuzzContext to testState/benchState/fuzzState.

Change-Id: Ib8855dab456d41ab343488fcf5fefff2431f7b72
Reviewed-on: https://go-review.googlesource.com/c/go/+/607555
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agocrypto/internal/cryptotest: add tests for the cipher.AEAD interface
Manuel Sabin [Mon, 1 Jul 2024 14:49:11 +0000 (10:49 -0400)]
crypto/internal/cryptotest: add tests for the cipher.AEAD interface

This CL creates tests for the cipher.AEAD interface in the new
cryptotest package.  This set of tests is called from the tests of
implementations of the AEAD interface, such as the GCM blockmode.

Updates #25309

Change-Id: I7612fa6fb6c1505bdf1a2cd71180dd43dc50bf4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/601778
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Russell Webb <russell.webb@protonmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
8 months agocmd/objdump: add s390x GNU disasm support
Srinivas Pokala [Tue, 23 Apr 2024 05:24:51 +0000 (07:24 +0200)]
cmd/objdump: add s390x GNU disasm support

This CL provides vendor support for s390x disassembler gnu syntax.
go get golang.org/x/arch@master
go mod tidy
go mod vendor

For #15255

Change-Id: Ia75fa515e7ea7d56913a28147c65650a7ab3062c
Reviewed-on: https://go-review.googlesource.com/c/go/+/581015
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
8 months agoos/user: document Current improvements
qmuntal [Fri, 9 Aug 2024 08:28:52 +0000 (10:28 +0200)]
os/user: document Current improvements

Update #21867.
Update #68312.
Update #68647.

Change-Id: Ic41d6747c5a54ba28c1292258aa4d318ccb9fe40
Reviewed-on: https://go-review.googlesource.com/c/go/+/604395
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
8 months agoos/user: speed up Current on Windows
qmuntal [Tue, 13 Aug 2024 13:08:32 +0000 (15:08 +0200)]
os/user: speed up Current on Windows

[This is a roll-forward of CL 597255, which had to be rolled back
because it broke the windows-arm64 builder, whose current user display
name is unavailable. This new CL fixes the issue by reintroducing the
historical behavior of falling back to the user name instead of
returning an error].

user.Current is slow on Windows sessions connected to an Active
Directory domain. This is because it uses Windows APIs that do RPC
calls to the domain controller, such as TranslateAccountW and
NetUserGetInfo.

This change speeds up user.Current by using the GetUserNameEx API
instead, which is already optimized for retrieving the current user
name in different formats.

These are the improvements I see with the new implementation:

goos: windows
goarch: amd64
pkg: os/user
cpu: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
           │   old.txt   │               new.txt                │
           │   sec/op    │    sec/op     vs base                │
Current-12   501.8µ ± 7%   118.6µ ± 11%  -76.36% (p=0.000 n=10)

           │  old.txt   │              new.txt              │
           │    B/op    │    B/op     vs base               │
Current-12   888.0 ± 0%   832.0 ± 0%  -6.31% (p=0.000 n=10)

           │  old.txt   │              new.txt               │
           │ allocs/op  │ allocs/op   vs base                │
Current-12   15.00 ± 0%   11.00 ± 0%  -26.67% (p=0.000 n=10)

Updates #5298
Fixes #21867
Fixes #68312

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-arm64
Change-Id: Ib7f77086d389cccb9d91cb77ea688d438a0ee5fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/605135
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agocrypto/x509,math/rand/v2: implement the encoding.(Binary|Text)Appender
apocelipes [Wed, 21 Aug 2024 09:30:14 +0000 (09:30 +0000)]
crypto/x509,math/rand/v2: implement the encoding.(Binary|Text)Appender

Implement the encoding.(Binary|Text)Appender interfaces for "x509.OID".

Implement the encoding.BinaryAppender interface for "rand/v2.PCG" and "rand/v2.ChaCha8".

"rand/v2.ChaCha8.MarshalBinary" alse gains some performance benefits:

                           │     old      │                 new                 │
                           │    sec/op    │   sec/op     vs base                │
ChaCha8MarshalBinary-8       33.730n ± 2%   9.786n ± 1%  -70.99% (p=0.000 n=10)
ChaCha8MarshalBinaryRead-8    99.86n ± 1%   17.79n ± 0%  -82.18% (p=0.000 n=10)
geomean                       58.04n        13.19n       -77.27%

                           │    old     │                  new                   │
                           │    B/op    │   B/op     vs base                     │
ChaCha8MarshalBinary-8       48.00 ± 0%   0.00 ± 0%  -100.00% (p=0.000 n=10)
ChaCha8MarshalBinaryRead-8   83.00 ± 0%   0.00 ± 0%  -100.00% (p=0.000 n=10)

                           │    old     │                   new                   │
                           │ allocs/op  │ allocs/op   vs base                     │
ChaCha8MarshalBinary-8       1.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=10)
ChaCha8MarshalBinaryRead-8   2.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=10)

For #62384

Change-Id: I604bde6dad90a916012909c7260f4bb06dcf5c0a
GitHub-Last-Rev: 78abf9c5dfb74838985637798bcd5cb957541d20
GitHub-Pull-Request: golang/go#68987
Reviewed-on: https://go-review.googlesource.com/c/go/+/607079
Reviewed-by: Cherry Mui <cherryyz@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>
8 months agosyscall: add O_DIRECTORY for wasip1
Kir Kolyshkin [Tue, 20 Aug 2024 00:29:19 +0000 (17:29 -0700)]
syscall: add O_DIRECTORY for wasip1

Change-Id: Iadd69360fb09714a280c4dae26639834df28a7dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/606659
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: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
8 months agosyscall: add O_DIRECTORY for js
Kir Kolyshkin [Tue, 20 Aug 2024 00:13:00 +0000 (17:13 -0700)]
syscall: add O_DIRECTORY for js

Change-Id: I2022fa27b072f9b34413a04a794aeb6d3c02166c
Reviewed-on: https://go-review.googlesource.com/c/go/+/606658
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

8 months agointernal/pkgbits: fix incorrect doc comment
Robert Griesemer [Wed, 21 Aug 2024 16:54:36 +0000 (09:54 -0700)]
internal/pkgbits: fix incorrect doc comment

Change-Id: I71d1dfec11657ffa8ffe12e87f6dbd65cbb1854b
Reviewed-on: https://go-review.googlesource.com/c/go/+/607475
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>

8 months agounique: clean up handle test code
Michael Anthony Knyszek [Wed, 21 Aug 2024 14:42:33 +0000 (14:42 +0000)]
unique: clean up handle test code

Currently the handle test code has a lot of duplicate type parameters
that are already inferred. This results in IDE warnings which are
annoying. Clean this up by consistently explicitly calling out the type
in the argument, not the type parameter.

Change-Id: I756203f37fc97c793cd5c5e612c6fd1802a84bc1
Reviewed-on: https://go-review.googlesource.com/c/go/+/607356
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

8 months agounique: use TypeFor instead of TypeOf to get type in Make
Michael Anthony Knyszek [Wed, 21 Aug 2024 14:38:30 +0000 (14:38 +0000)]
unique: use TypeFor instead of TypeOf to get type in Make

Currently the first thing Make does it get the abi.Type of its argument,
and uses abi.TypeOf to do it. However, this has a problem for interface
types, since the type of the value stored in the interface value will
bleed through. This is a classic reflection mistake.

Fix this by implementing and using a generic TypeFor which matches
reflect.TypeFor. This gets the type of the type parameter, which is far
less ambiguous and error-prone.

Fixes #68990.

Change-Id: Idd8d9a1095ef017e9cd7c7779314f7d4034f01a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/607355
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agocmd/link: support wasmexport on js/wasm
Cherry Mui [Mon, 19 Aug 2024 19:17:04 +0000 (15:17 -0400)]
cmd/link: support wasmexport on js/wasm

Add export functions to the wasm module on GOOS=js. (Other parts
work the same way as wasip1.)

Add a test.

Fixes #65199.

Change-Id: Ia22580859fe40631d487f70ee293c12867e0c988
Reviewed-on: https://go-review.googlesource.com/c/go/+/606855
Reviewed-by: Zxilly Chou <zxilly@outlook.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
8 months agocmd/compile: deprecate has init and derived func instance
Tim King [Thu, 15 Aug 2024 20:57:53 +0000 (13:57 -0700)]
cmd/compile: deprecate has init and derived func instance

Removes 'has init' and 'derived func instance' fields from unified IR
starting with V2.

This should be a no-op at the moment as the writer is hardwired to create V1.

Updates #68778

Change-Id: I84a606cbc27cd6d8bd6eee2aff44c89f4aa7413c
Reviewed-on: https://go-review.googlesource.com/c/go/+/606035
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agocmd/compile/internal/noder: reduce clutter a bit (cosmetic changes)
Robert Griesemer [Tue, 20 Aug 2024 17:35:23 +0000 (10:35 -0700)]
cmd/compile/internal/noder: reduce clutter a bit (cosmetic changes)

- introduce index alias
- inline the two short tables in stmt.go (removes a TODO)
- move assert out of stencil.go and remove that file
  (we can always re-introduce it)

Also, replace two if's with a simpler switch.

Change-Id: I25c3104164574999dd9826dee6166dd8a8488908
Reviewed-on: https://go-review.googlesource.com/c/go/+/607236
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Tim King <taking@google.com>
8 months agoruntime: deprecate GOROOT
Dmitri Shuralyov [Thu, 15 Feb 2024 00:08:02 +0000 (19:08 -0500)]
runtime: deprecate GOROOT

Fixes #51473.

Change-Id: Ic868790f480b21b472c98b39be797bcffb1fa892
Reviewed-on: https://go-review.googlesource.com/c/go/+/564142
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agointernal/pkgbits: add Version type
Tim King [Wed, 14 Aug 2024 19:34:32 +0000 (12:34 -0700)]
internal/pkgbits: add Version type

Adds a new Version type to pkgbits to represent the version of the
bitstream. Versions let readers and writers know when different data is
expected to be present or not in the bitstream. These different pieces
of data are called Fields, as an analogy with fields of a struct.
Fields can be added, removed or changed in a Version. Extends Encoder
and Decoder to report which version they are.

Updates #68778

Change-Id: Iaffa1828544fb4cbc47a905de853449bc8e5b91f
Reviewed-on: https://go-review.googlesource.com/c/go/+/605655
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
8 months agosrc: fix typos
Alexander Cyon [Tue, 20 Aug 2024 17:54:39 +0000 (17:54 +0000)]
src: fix typos

Fix typos in ~30 files

Change-Id: Ie433aea01e7d15944c1e9e103691784876d5c1f9
GitHub-Last-Rev: bbaeb3d1f88a5fa6bbb69607b1bd075f496a7894
GitHub-Pull-Request: golang/go#68964
Reviewed-on: https://go-review.googlesource.com/c/go/+/606955
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
8 months agocmd/dist: require Go 1.22.6 as minimum bootstrap toolchain
Dmitri Shuralyov [Fri, 16 Aug 2024 18:01:15 +0000 (14:01 -0400)]
cmd/dist: require Go 1.22.6 as minimum bootstrap toolchain

This is a minimal change to start to require the new minimum bootstrap.
Taking advantage of the newer bootstap to simplify and improve code is
left to be done in separate CLs.

For #64751.

Change-Id: I1d4f883fae3026354a199174d51e79a36cd2dc53
Reviewed-on: https://go-review.googlesource.com/c/go/+/606156
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

8 months agodoc/next: update 36532.md to wording suggested in CL
Ian Lance Taylor [Tue, 20 Aug 2024 16:38:47 +0000 (09:38 -0700)]
doc/next: update 36532.md to wording suggested in CL

Change-Id: If7a2aa45770d19ee15f8fe99cab62624c2e29ef6
Reviewed-on: https://go-review.googlesource.com/c/go/+/606958
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
8 months agocmd/internal/testdir: add a -gomodversion flag
Tim King [Fri, 9 Aug 2024 20:32:12 +0000 (13:32 -0700)]
cmd/internal/testdir: add a -gomodversion flag

Adds a -gomodversion flag to testdir. This sets the go version
in generated go.mod files. This is just runindir tests at the moment.
This is a building block so that tests can be written for exported
type parameterized aliases (like reproducing #68526).

This also adds a test that uses this feature. A type parameterized
alias is used so aliastypeparams and gotypesalias must be enabled.
gotypesalias is enabled by the go module version. The alias is not
exported and will not appear in exportdata. The test shows the
package containing the alias can be imported. This encapsulates
the level of support of type parameterized aliases in 1.23.

Updates #68526
Updates #68778

Change-Id: I8e20df6baa178e1d427d0fff627a16714d9c3b18
Reviewed-on: https://go-review.googlesource.com/c/go/+/604102
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
8 months agotesting: use temp dir without symlinks in TestChdir/relative
Dmitri Shuralyov [Tue, 20 Aug 2024 14:07:05 +0000 (10:07 -0400)]
testing: use temp dir without symlinks in TestChdir/relative

When paths with symlinks are involved, it's not viable to compare them
with string equality. Don't use a temporary directory with symlinks in
it as input, so the test works in more environments.

For #62516.

Change-Id: I95d774365cc2f90eb0ffcffa61229ed5cee43e3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/607035
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
8 months agodoc/next: revert incorrect change to 62516.md made in CL 603959
Ian Lance Taylor [Tue, 20 Aug 2024 16:27:14 +0000 (09:27 -0700)]
doc/next: revert incorrect change to 62516.md made in CL 603959

Change-Id: I0d19f77f8c4b99350e3ed1e7f92db6ae198e812a
Reviewed-on: https://go-review.googlesource.com/c/go/+/607077
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agotime: implement the encoding.(Binary|Text)Appender for Time
apocelipes [Mon, 19 Aug 2024 20:02:37 +0000 (20:02 +0000)]
time: implement the encoding.(Binary|Text)Appender for Time

"Time.Marshal(Binary|Text)" could also gain some performance
improvements. Here is the benchmark highlight:

                │     old      │                 new                 │
                │    sec/op    │   sec/op     vs base                │
MarshalText-8     104.00n ± 3%   67.27n ± 2%  -35.32% (p=0.000 n=10)
MarshalBinary-8    31.77n ± 2%   12.13n ± 1%  -61.82% (p=0.000 n=10)
geomean            57.48n        28.57n       -50.30%

                │    old     │                  new                   │
                │    B/op    │   B/op     vs base                     │
MarshalText-8     48.00 ± 0%   0.00 ± 0%  -100.00% (p=0.000 n=10)
MarshalBinary-8   16.00 ± 0%   0.00 ± 0%  -100.00% (p=0.000 n=10)

                │    old     │                   new                   │
                │ allocs/op  │ allocs/op   vs base                     │
MarshalText-8     1.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=10)
MarshalBinary-8   1.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=10)

For #62384

Change-Id: I320421878a341abf8d668fd57b27292cdfa61330
GitHub-Last-Rev: e04f8df9c277481f5678208d3f1f59643bf5e429
GitHub-Pull-Request: golang/go#68942
Reviewed-on: https://go-review.googlesource.com/c/go/+/606655
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

8 months agogo/types, types2: unalias tilde terms in underIs
Tim King [Thu, 15 Aug 2024 23:48:42 +0000 (16:48 -0700)]
go/types, types2: unalias tilde terms in underIs

Unalias the ~T terms during underIs. Before, if T was an alias
of U, it may pass T to the iteration function. The iterator
function expects an underlying type, under(U), to be passed.
This caused several bugs where underIs is used without
eventually taking the underlying type.

Updates #68935
Fixes #68903

Change-Id: Ie8691d8dddaea00e1dcba94d17c0f1b021fc49a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/606075
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
8 months agointernal/poll: raise Linux's maxCopyFileRangeRound to MAX_RW_COUNT
Andy Pan [Mon, 19 Aug 2024 06:06:40 +0000 (14:06 +0800)]
internal/poll: raise Linux's maxCopyFileRangeRound to MAX_RW_COUNT

Change-Id: I23c0c850ba57e7a49b78159d9293d1d25e1d2340
Reviewed-on: https://go-review.googlesource.com/c/go/+/606637
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Commit-Queue: Ian Lance Taylor <iant@golang.org>

8 months agotime: fix godoc links; remove redundant Sub mention
Oleksandr Redko [Sun, 18 Aug 2024 20:20:15 +0000 (23:20 +0300)]
time: fix godoc links; remove redundant Sub mention

The Time.Sub function is mentioned in the previous sentence.

Change-Id: Ic79958cea4d1f9f9014f6dafd8e749c204db4f50
Reviewed-on: https://go-review.googlesource.com/c/go/+/606575
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

8 months agoos: rm reiserfs exception from TestSeek
Kir Kolyshkin [Sun, 9 Jun 2024 20:46:40 +0000 (13:46 -0700)]
os: rm reiserfs exception from TestSeek

This exception was originally added by CL 152108 in November 2009. I'm
pretty sure no one uses reiserfs nowadays (and if someone does, this bug
must have been fixed by now).

Change-Id: I274ebe2f7910cab81b70a44b2da3f6fe761073bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/591417
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

8 months agoos: use t.TempDir in TestMkdirTemp, TestCreateTemp
Kir Kolyshkin [Mon, 19 Aug 2024 22:46:15 +0000 (15:46 -0700)]
os: use t.TempDir in TestMkdirTemp, TestCreateTemp

This simplifies tests a little bit.

Change-Id: I910e3c97cfd20b26951d2a4909d86b5be06bde56
Reviewed-on: https://go-review.googlesource.com/c/go/+/606899
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
8 months agoos: use t.TempDir in TestReadOnlyWriteFile
Kir Kolyshkin [Mon, 19 Aug 2024 22:21:46 +0000 (15:21 -0700)]
os: use t.TempDir in TestReadOnlyWriteFile

This test is checking WriteFile, not MkdirTemp, and using t.TempDir
makes the test case code a tad smaller and simpler.

Change-Id: I48837f77572f375d56f3a387efa9a4ee1d3706fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/606898
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agoos: simplify TestRemoveAllDot
Kir Kolyshkin [Mon, 19 Aug 2024 21:28:41 +0000 (14:28 -0700)]
os: simplify TestRemoveAllDot

Use t.Chdir and t.TempDir to simplify test case code.

Change-Id: If4de06d2373100ce53a5b8f6702d5f4866e3b23d
Reviewed-on: https://go-review.googlesource.com/c/go/+/606897
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
8 months agoos: simplify TestRemoveAllLongPath
Kir Kolyshkin [Mon, 19 Aug 2024 20:23:09 +0000 (13:23 -0700)]
os: simplify TestRemoveAllLongPath

Simplify the test logic by using t.TempDir, t.Chdir, and Chdir to
startPath parent.

Change-Id: Ibe71a8c26b8e54c22eb93510037605b69c67bc7a
Reviewed-on: https://go-review.googlesource.com/c/go/+/606896
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
8 months agotesting: add Context
Vladimir Varankin [Tue, 20 Aug 2024 09:19:22 +0000 (09:19 +0000)]
testing: add Context

Adds a new Context method to testing.T, that returns a context, that is
canceled before the end of its test function.

Fixes #36532.

Change-Id: I9315ad4dad25529d0b5be809e2d9db4e7528b5f2
GitHub-Last-Rev: 1c3fd6c4d8a9cc68a61f2df284d04d3d080216be
GitHub-Pull-Request: golang/go#68828
Reviewed-on: https://go-review.googlesource.com/c/go/+/603959
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
8 months agocmd/compile/internal/ssagen: factor out intrinsics code
Joel Sing [Fri, 2 Aug 2024 15:22:58 +0000 (01:22 +1000)]
cmd/compile/internal/ssagen: factor out intrinsics code

The intrinsic handling code is a good thousand lines in the fairly
large ssa.go file. This code is already reasonably self-contained - factor
it out into a separate file so that future changes are easier to manage
(and it becomes easier to add/change intrinsics for an architecture).

Change-Id: I3c18d3d1bb6332f1817d902150e736373bf1ac81
Reviewed-on: https://go-review.googlesource.com/c/go/+/605477
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
8 months agocmd/compile/internal/ssagen: improve intrinsic architecture handling
Joel Sing [Sun, 4 Aug 2024 04:19:57 +0000 (14:19 +1000)]
cmd/compile/internal/ssagen: improve intrinsic architecture handling

The architecture handling code for intrinsics is more complex than
it needs to be. sys.Archs is already an array of *sys.Arch and the
existing InFamily function can be used instead of a reimplementation.

Add some test coverage for sys.Arch.InFamily while here.

Change-Id: Ia764f211114fea65424c09a421c5ccb02b7187b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/605476
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agoruntime: on AIX, fix call to _cgo_sys_thread_create in _rt0_ppc64_aix_lib
Paul E. Murphy [Mon, 19 Aug 2024 20:08:14 +0000 (15:08 -0500)]
runtime: on AIX, fix call to _cgo_sys_thread_create in _rt0_ppc64_aix_lib

The AIX ABI requires allocating parameter save space when calling
a function, even if the arguments are passed via registers.

gcc sometimes uses this space. In the case of the cgo c-archive
tests, it clobbered the storage space of argc/argv which prevented
the test program from running the expected test.

Fixes #68957

Change-Id: I8a267b463b1abb2b37ac85231f6c328f406b7515
Reviewed-on: https://go-review.googlesource.com/c/go/+/606895
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

8 months agointernal/pkgbits: s/errorf/panicf/ because that's what it is
Robert Griesemer [Mon, 19 Aug 2024 21:15:04 +0000 (14:15 -0700)]
internal/pkgbits: s/errorf/panicf/ because that's what it is

Make it obvious that this function panics.

Change-Id: I272142d2cf7132aa8915f8f4b5945834376db062
Reviewed-on: https://go-review.googlesource.com/c/go/+/606935
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agoos.Getwd: wrap error on windows and plan9
Kir Kolyshkin [Mon, 19 Aug 2024 20:08:32 +0000 (13:08 -0700)]
os.Getwd: wrap error on windows and plan9

The errors from os are supposed to be wrapped to add some context,
but in this particular case a raw syscall error is returned.

Change-Id: I1b98dbd7b385c5c1cea79a1b0ec7201ca9bdca40
Reviewed-on: https://go-review.googlesource.com/c/go/+/606657
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
8 months agomath/rand: make calls to Seed no-op
Paschalis T [Thu, 15 Aug 2024 22:29:18 +0000 (01:29 +0300)]
math/rand: make calls to Seed no-op

Makes calls to the global Seed a no-op. The GODEBUG=randseednop=0
setting can be used to revert this behavior.

Fixes #67273

Change-Id: I79c1b2b23f3bc472fbd6190cb916a9d7583250f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/606055
Auto-Submit: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agoall: remove duplicated words in comments
Oleksandr Redko [Sun, 18 Aug 2024 21:07:37 +0000 (00:07 +0300)]
all: remove duplicated words in comments

Change-Id: Id991ec0826a4e2857f00330b4b7ff2b71907b789
Reviewed-on: https://go-review.googlesource.com/c/go/+/606615
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>

8 months agoruntime: store zero-delay mutex contention events
Rhys Hiltner [Fri, 16 Aug 2024 01:47:38 +0000 (18:47 -0700)]
runtime: store zero-delay mutex contention events

Mutex contention events with delay of 0 need more than CL 604355 added:
When deciding which event to store in the M's single available slot,
always choose to drop the zero-delay event. Store an explicit flag for
whether we have an event to store, rather than relying on a non-zero
delay.

And, fix a test of sync.Mutex contention that expects those events to
have non-zero delay. The reporting of non-runtime contention like this
has long allowed zero-delay events, which we see when cputicks has low
resolution.

Fixes #68892
Fixes #68906

Change-Id: Id412141e4eb09724f3ce195899a20d59c92d7b78
Reviewed-on: https://go-review.googlesource.com/c/go/+/606115
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Rhys Hiltner <rhys.hiltner@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
8 months agocmd/compile: use integer min/max instructions on riscv64
Joel Sing [Wed, 31 Jan 2024 13:39:30 +0000 (00:39 +1100)]
cmd/compile: use integer min/max instructions on riscv64

When GORISCV64 enables rva22u64, make use of integer MIN/MINU/MAX/MAXU
instructions in compiler rewrite rules.

Change-Id: I4e7c514516acad03f2869d4c8936f06582cf7ea9
Reviewed-on: https://go-review.googlesource.com/c/go/+/559660
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
8 months agocmd/mod/edit: add -tool and -droptool support
Conrad Irwin [Fri, 19 Jul 2024 02:26:13 +0000 (20:26 -0600)]
cmd/mod/edit: add -tool and -droptool support

For golang/go#48429

Change-Id: I1a7bd8ffddbc65e3b687dc1d40f3853702e1b5dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/521958
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

8 months agostrings: fix typo in examples
Gökhan Özeloğlu [Fri, 16 Aug 2024 20:41:25 +0000 (23:41 +0300)]
strings: fix typo in examples

The correct word can be seen in lines 381-382.

Change-Id: If3876bd34b6433b69531763f63af88d60a0bfad0
Reviewed-on: https://go-review.googlesource.com/c/go/+/606375
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
8 months agotesting: add Chdir
Kir Kolyshkin [Fri, 8 Sep 2023 00:08:56 +0000 (17:08 -0700)]
testing: add Chdir

Some tests need to use os.Chdir, but the use is complicated because
 - they must change back to the old working directory;
 - they must not use t.Parallel.

Add Chdir that covers these cases, and sets PWD environment variable
to the new directory for the duration of the test for Unix platforms.
Unify the panic message when t.Parallel is used together with t.Setenv
or t.Chdir.

Add some tests.

For #62516.

Change-Id: Ib050d173b26eb28a27dba5a206b2d0d877d761c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/529895
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>

8 months agocmd/cgo: enable #cgo noescape/nocallback
doujiang24 [Fri, 16 Aug 2024 07:32:00 +0000 (07:32 +0000)]
cmd/cgo: enable #cgo noescape/nocallback

In Go 1.22 we added code to the go/build package to ignore #cgo noescape
and nocallback directives. That permits us to enable these directives in Go 1.24.

Also, this fixed a Bug in CL 497837:
After retiring _Cgo_use for parameters, the compiler will treat the
parameters, start from the second, as non-alive. Then, they will be marked
as scalar in stackmap, which means the pointer won't be copied correctly
in copystack.

Fixes #56378.
Fixes #63739.

Change-Id: I46e773240f8a467c3c4ba201dc5b4ee473cf6e3e
GitHub-Last-Rev: 42fcc506d6a7681ef24ac36a5904b57bda4b15cd
GitHub-Pull-Request: golang/go#66879
Reviewed-on: https://go-review.googlesource.com/c/go/+/579955
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>

8 months agoos: only employ sendfile(3ext) on illumos when target is regular file
Andy Pan [Fri, 16 Aug 2024 03:42:25 +0000 (11:42 +0800)]
os: only employ sendfile(3ext) on illumos when target is regular file

Follows up CL 605355
Fixes #68863

Change-Id: I56e05822502e66eed610d5e924d110607ce146b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/606135
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>

8 months agoos: use O_EXCL instead of O_TRUNC in CopyFS to disallow rewriting existing files
Andy Pan [Fri, 16 Aug 2024 00:04:57 +0000 (08:04 +0800)]
os: use O_EXCL instead of O_TRUNC in CopyFS to disallow rewriting existing files

On Linux, a call to creat() is equivalent to calling open() with flags
equal to O_CREAT|O_WRONLY|O_TRUNC, which applies to other platforms
as well in a similar manner. Thus, to force CopyFS's behavior to
comply with the function comment, we need to replace O_TRUNC with O_EXCL.

Fixes #68895

Change-Id: I3e2ab153609d3c8cf20ce5969d6f3ef593833cd1
Reviewed-on: https://go-review.googlesource.com/c/go/+/606095
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
8 months agogo/internal/gcimporter: indexed format imports for type parameters aliases
Tim King [Fri, 9 Aug 2024 21:36:21 +0000 (14:36 -0700)]
go/internal/gcimporter: indexed format imports for type parameters aliases

Add support for importing a new 'B' tag for type parameters aliases
in the indexed data format.

Updates #68778

Change-Id: I3bd82870d4c4619a3771de30baf6d54f6ee5959e
Reviewed-on: https://go-review.googlesource.com/c/go/+/604635
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
8 months agoruntime: use .Pointers() instead of .PtrBytes != 0
zhangyunhao [Thu, 15 Aug 2024 10:04:00 +0000 (10:04 +0000)]
runtime: use .Pointers() instead of .PtrBytes != 0

Change-Id: I512808d3cf91466eb6f2c21b49b39ff2e08a9b8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/605498
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
8 months agogo/types, types2: Named.cleanup must also handle *Alias types
Robert Griesemer [Thu, 15 Aug 2024 23:07:04 +0000 (16:07 -0700)]
go/types, types2: Named.cleanup must also handle *Alias types

Named.cleanup is called at the end of type-checking to ensure that
a named type is fully set up; specifically that it's underlying
field is not (still) a Named type. Now it can also be an *Alias
type. Add this case to the respective type switch.

Fixes #68877.

Change-Id: I29bc0024ac9d8b0152a3d97c82dd28d09d5dbd66
Reviewed-on: https://go-review.googlesource.com/c/go/+/605977
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agomath/big,regexp: implement the encoding.TextAppender interface
apocelipes [Thu, 15 Aug 2024 18:13:58 +0000 (18:13 +0000)]
math/big,regexp: implement the encoding.TextAppender interface

For #62384

Change-Id: I1557704c6a0f9c6f3b9aad001374dd5cdbc99065
GitHub-Last-Rev: c258d18ccedab5feeb481a2431d5647bde7e5c58
GitHub-Pull-Request: golang/go#68893
Reviewed-on: https://go-review.googlesource.com/c/go/+/605758
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>

8 months agoencoding/json: merge FieldStack if the error's Field exists.
j2gg0s [Thu, 15 Aug 2024 02:11:44 +0000 (02:11 +0000)]
encoding/json: merge FieldStack if the error's Field exists.

When people return UnmarshalTypeError in UnmarshalJSON, we should append error's Field to FieldStack.

Fixes #68750

Change-Id: I0a5a9b259a1b569de1bebc815ec936c913e10469
GitHub-Last-Rev: 18796addc3fa0d367ba1a3f4bd268ca246890fe0
GitHub-Pull-Request: golang/go#68870
Reviewed-on: https://go-review.googlesource.com/c/go/+/605455
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agoos: increase the amount of data transfer for sendfile(2) to reduce syscalls
Andy Pan [Tue, 13 Aug 2024 11:11:58 +0000 (19:11 +0800)]
os: increase the amount of data transfer for sendfile(2) to reduce syscalls

For the moment, Go calls sendfile(2) to transfer at most 4MB at a time
while sendfile(2) actually allows a larger amount of data on one call.
To reduce system calls of sendfile(2) during data copying, we should
specify the number of bytes to copy as large as possible.

This optimization is especially advantageous for bulky file-to-file copies,
it would lead to a performance boost, the magnitude of this performance
increase may not be very exciting, but it can also cut down the CPU overhead
by decreasing the number of system calls.

This is also how we've done in sendfile_windows.go with TransmitFile.

goos: linux
goarch: amd64
pkg: os
cpu: DO-Premium-AMD
           │    old     │                new                │
           │   sec/op   │   sec/op    vs base               │
SendFile-8   1.135 ± 4%   1.052 ± 3%  -7.24% (p=0.000 n=10)

           │     old      │                 new                 │
           │     B/s      │     B/s       vs base               │
SendFile-8   902.5Mi ± 4%   973.0Mi ± 3%  +7.81% (p=0.000 n=10)

           │    old     │              new               │
           │    B/op    │    B/op     vs base            │
SendFile-8   272.0 ± 0%   272.0 ± 0%  ~ (p=1.000 n=10) ¹
¹ all samples are equal

           │    old     │              new               │
           │ allocs/op  │ allocs/op   vs base            │
SendFile-8   20.00 ± 0%   20.00 ± 0%  ~ (p=1.000 n=10) ¹
¹ all samples are equal

Change-Id: Ib4d4c6bc693e23db24697363b29226f0c9776bb0
Reviewed-on: https://go-review.googlesource.com/c/go/+/605235
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
8 months agocrypto,hash: add t.Helper calls to test helpers
apocelipes [Wed, 14 Aug 2024 03:49:33 +0000 (03:49 +0000)]
crypto,hash: add t.Helper calls to test helpers

Use t.Helper to make the reported failure lines more helpful.

Change-Id: I6593924b3892b2441a197aee4e05f71ea236d426
GitHub-Last-Rev: 2e020ea85cf44c6cc0e90cb919eb0d7bb5a1c315
GitHub-Pull-Request: golang/go#68843
Reviewed-on: https://go-review.googlesource.com/c/go/+/604755
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>

8 months agocmd/compile/internal/importer: enable aliases
Tim King [Fri, 9 Aug 2024 17:50:00 +0000 (10:50 -0700)]
cmd/compile/internal/importer: enable aliases

Flips the pkgReader.enableAlias flag to true when reading unified IR.
This was disabled while resolving #66873. This resolves the TODO to
flip it back to true.

Updates #66873
Updates #68778

Change-Id: Ifd52b0f9510d6bcf151de1c9a18d71ab548c14e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/604099
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
8 months agointernal,os: employ copy_file_range(2) for file-to-file copying on FreeBSD
Andy Pan [Sat, 10 Aug 2024 03:26:02 +0000 (11:26 +0800)]
internal,os: employ copy_file_range(2) for file-to-file copying on FreeBSD

FreeBSD 13.0 introduced the Linux-compatible copy_file_range(2) system call,
we should make use of it.

Ref:
https://www.gnu.org/software/gnulib/manual/html_node/copy_005ffile_005frange.html
https://reviews.freebsd.org/D20584?id=60021
https://man.freebsd.org/cgi/man.cgi?copy_file_range(2)

Change-Id: I75edb5629717289c8887be436613d3a8b3820bdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/604655
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

8 months agoRevert "go/types, types2: only use fileVersion if 1.21 or greater"
Michael Matloob [Wed, 14 Aug 2024 20:04:08 +0000 (20:04 +0000)]
Revert "go/types, types2: only use fileVersion if 1.21 or greater"

This reverts CL 603895

Reason for revert: We've decided to change the logic for how upgrades are done and want to submit the new logic in a self contained CL that can be cherry-picked onto release-branch.go1.23

Change-Id: I366af8e95ce1de7311b0385a23f9dd3df175745a
Reviewed-on: https://go-review.googlesource.com/c/go/+/605675
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agomath/big: implement subVV in riscv64 assembly
Joel Sing [Thu, 27 Jun 2024 10:02:04 +0000 (20:02 +1000)]
math/big: implement subVV in riscv64 assembly

This provides an assembly implementation of subVV for riscv64,
processing up to four words per loop, resulting in a significant
performance gain.

On a StarFive VisionFive 2:

               │   subvv.1    │               subvv.2               │
               │    sec/op    │   sec/op     vs base                │
SubVV/1-4         73.46n ± 0%   48.08n ± 0%  -34.55% (p=0.000 n=10)
SubVV/2-4         88.13n ± 0%   58.76n ± 0%  -33.33% (p=0.000 n=10)
SubVV/3-4        102.80n ± 0%   69.45n ± 0%  -32.44% (p=0.000 n=10)
SubVV/4-4        117.50n ± 0%   72.11n ± 0%  -38.63% (p=0.000 n=10)
SubVV/5-4        132.20n ± 0%   82.80n ± 0%  -37.37% (p=0.000 n=10)
SubVV/10-4        216.3n ± 0%   126.9n ± 0%  -41.33% (p=0.000 n=10)
SubVV/100-4      1659.0n ± 0%   886.5n ± 0%  -46.56% (p=0.000 n=10)
SubVV/1000-4     16.089µ ± 0%   8.401µ ± 0%  -47.78% (p=0.000 n=10)
SubVV/10000-4     244.7µ ± 0%   176.8µ ± 0%  -27.74% (p=0.000 n=10)
SubVV/100000-4    2.562m ± 0%   1.871m ± 0%  -26.96% (p=0.000 n=10)
geomean           1.436µ        904.4n       -37.04%

               │   subvv.1    │                subvv.2                │
               │     B/s      │      B/s       vs base                │
SubVV/1-4        830.9Mi ± 0%   1269.5Mi ± 0%  +52.79% (p=0.000 n=10)
SubVV/2-4        1.353Gi ± 0%    2.029Gi ± 0%  +49.99% (p=0.000 n=10)
SubVV/3-4        1.739Gi ± 0%    2.575Gi ± 0%  +48.06% (p=0.000 n=10)
SubVV/4-4        2.029Gi ± 0%    3.306Gi ± 0%  +62.96% (p=0.000 n=10)
SubVV/5-4        2.254Gi ± 0%    3.600Gi ± 0%  +59.67% (p=0.000 n=10)
SubVV/10-4       2.755Gi ± 0%    4.699Gi ± 0%  +70.53% (p=0.000 n=10)
SubVV/100-4      3.594Gi ± 0%    6.723Gi ± 0%  +87.08% (p=0.000 n=10)
SubVV/1000-4     3.705Gi ± 0%    7.095Gi ± 0%  +91.52% (p=0.000 n=10)
SubVV/10000-4    2.436Gi ± 0%    3.372Gi ± 0%  +38.39% (p=0.000 n=10)
SubVV/100000-4   2.327Gi ± 0%    3.185Gi ± 0%  +36.91% (p=0.000 n=10)
geomean          2.118Gi         3.364Gi       +58.84%

Change-Id: I361cb3f4195b27a9f1e9486c9e1fdbeaa94d32b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/595396
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
8 months agocmd/internal/obj/loong64: add testcases for assembler
limeidan [Wed, 7 Aug 2024 09:59:54 +0000 (17:59 +0800)]
cmd/internal/obj/loong64: add testcases for assembler

Change-Id: Ib2c8e0bc314c0f2b58f69a5340355cac4786a91f
Reviewed-on: https://go-review.googlesource.com/c/go/+/604175
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agocmd/dist, internal/platform: mark windows/arm (32-bit ARM) broken
Dmitri Shuralyov [Tue, 30 Jul 2024 16:11:23 +0000 (12:11 -0400)]
cmd/dist, internal/platform: mark windows/arm (32-bit ARM) broken

The port is reportedly broken, and there isn't a builder testing it.

For #68552.
For #67308.

Change-Id: Iababa17cdf855b675aaf85642a667e8081ef5dfe
Reviewed-on: https://go-review.googlesource.com/c/go/+/601777
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

8 months agoos: only employ sendfile(3ext) on illumos when target is regular file
Andy Pan [Wed, 14 Aug 2024 01:41:28 +0000 (09:41 +0800)]
os: only employ sendfile(3ext) on illumos when target is regular file

Fixes #68863

Change-Id: I0ca324137d1f7510bd0b245791fef07d3b5b401a
Reviewed-on: https://go-review.googlesource.com/c/go/+/605355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
8 months agoruntime: record all sampled mutex profile events
Rhys Hiltner [Thu, 8 Aug 2024 22:24:15 +0000 (15:24 -0700)]
runtime: record all sampled mutex profile events

The block and mutex profiles have slightly different behaviors when a
sampled event has a negative (or zero) duration. The block profile
enforces a minimum duration for each event of "1" in the cputicks unit.
It does so by clamping the duration to 1 if it was originally reported
as being smaller. The mutex profile for app-level contention enforces a
minimum duration of 0 in a similar way: by reporting any negative values
as 0 instead.

The mutex profile for runtime-internal contention had a different
behavior: to enforce a minimum event duration of "1" by dropping any
non-conforming samples.

Stop dropping samples, and use the same minimum (0) that's in place for
the other mutex profile events.

Fixes #64253
Fixes #68453
Fixes #68781

Change-Id: I4c5d23a2675501226eef5b9bc1ada2efc1a55b9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/604355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Rhys Hiltner <rhys.hiltner@gmail.com>

8 months agomaps, slices: fix variable name and comment in example
cuishuang [Wed, 14 Aug 2024 07:33:00 +0000 (15:33 +0800)]
maps, slices: fix variable name and comment in example

Change-Id: I1c837820bdd64b61fca46d45677664b2bb2be606
Reviewed-on: https://go-review.googlesource.com/c/go/+/605356
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
8 months agobyte,strings: improve IndexRune performance by ~45%
Charlie Vieth [Thu, 2 Nov 2023 04:18:59 +0000 (00:18 -0400)]
byte,strings: improve IndexRune performance by ~45%

Change IndexRune to search for the last byte of a multi-byte rune
instead of using the first byte. This improves search performance
by 45% on average when dealing with Unicode text.

The rationale here is that the last byte of a UTF-8 encoded multi-byte
rune is significantly more unique (evenly distributed) than the first
byte which has a 78% chance of being [240, 243, 244].

This approach is typically much faster, but can be slower when there
are a large number of false positives (see Han benchmarks) because
the more even distribution of bytes can delay/prevent falling back
to a brute-force search using bytealg.Index, which is particularly
powerful on amd64/x86_64 (particularly Skylake, but less so with
newer processors).

bytes package benchmarks:

goos: darwin
goarch: arm64
pkg: bytes
cpu: Apple M1 Max
                                 │ base.10.txt  │             new.10.txt              │
                                 │    sec/op    │   sec/op     vs base                │
IndexRune/10-10                     9.784n ± 0%   8.470n ± 0%  -13.43% (p=0.000 n=10)
IndexRune/32-10                    11.660n ± 0%   8.473n ± 0%  -27.34% (p=0.000 n=10)
IndexRune/4K-10                     83.96n ± 0%   81.08n ± 0%   -3.44% (p=0.000 n=10)
IndexRune/4M-10                     63.92µ ± 0%   64.67µ ± 0%   +1.17% (p=0.000 n=10)
IndexRune/64M-10                    1.121m ± 1%   1.125m ± 1%        ~ (p=0.218 n=10)
IndexRuneUnicode/Latin/10-10       10.125n ± 0%   7.347n ± 0%  -27.43% (p=0.000 n=10)
IndexRuneUnicode/Latin/32-10       11.435n ± 0%   7.349n ± 0%  -35.73% (p=0.000 n=10)
IndexRuneUnicode/Latin/4K-10        882.6n ± 0%   334.9n ± 1%  -62.06% (p=0.000 n=10)
IndexRuneUnicode/Latin/4M-10        977.2µ ± 0%   370.9µ ± 1%  -62.04% (p=0.000 n=10)
IndexRuneUnicode/Latin/64M-10      15.649m ± 1%   6.028m ± 1%  -61.48% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/10-10    10.070n ± 0%   8.701n ± 0%  -13.59% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/32-10    19.045n ± 0%   8.704n ± 1%  -54.30% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/4K-10     2.734µ ± 0%   1.046µ ± 1%  -61.75% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/4M-10     2.671m ± 0%   1.143m ± 1%  -57.22% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/64M-10    43.12m ± 1%   18.26m ± 1%  -57.64% (p=0.000 n=10)
IndexRuneUnicode/Han/10-10          10.10n ± 0%   10.82n ± 1%   +7.08% (p=0.000 n=10)
IndexRuneUnicode/Han/32-10          38.29n ± 1%   10.87n ± 1%  -71.62% (p=0.000 n=10)
IndexRuneUnicode/Han/4K-10         1409.0n ± 0%   489.1n ± 1%  -65.28% (p=0.000 n=10)
IndexRuneUnicode/Han/4M-10         1338.4µ ± 0%   821.1µ ± 2%  -38.65% (p=0.000 n=10)
IndexRuneUnicode/Han/64M-10         21.42m ± 1%   13.42m ± 2%  -37.34% (p=0.000 n=10)
geomean                             3.983µ        2.305µ       -42.14%

                                 │ base.10.txt  │               new.10.txt               │
                                 │     B/s      │      B/s       vs base                 │
IndexRune/10-10                    974.8Mi ± 0%   1126.1Mi ± 0%   +15.52% (p=0.000 n=10)
IndexRune/32-10                    2.556Gi ± 0%    3.517Gi ± 0%   +37.62% (p=0.000 n=10)
IndexRune/4K-10                    45.43Gi ± 0%    47.05Gi ± 0%    +3.56% (p=0.000 n=10)
IndexRune/4M-10                    61.12Gi ± 0%    60.41Gi ± 0%    -1.16% (p=0.000 n=10)
IndexRune/64M-10                   55.74Gi ± 1%    55.57Gi ± 1%         ~ (p=0.218 n=10)
IndexRuneUnicode/Latin/10-10       942.0Mi ± 0%   1297.9Mi ± 0%   +37.78% (p=0.000 n=10)
IndexRuneUnicode/Latin/32-10       2.606Gi ± 0%    4.055Gi ± 0%   +55.61% (p=0.000 n=10)
IndexRuneUnicode/Latin/4K-10       4.322Gi ± 0%   11.392Gi ± 1%  +163.57% (p=0.000 n=10)
IndexRuneUnicode/Latin/4M-10       3.998Gi ± 0%   10.532Gi ± 1%  +163.47% (p=0.000 n=10)
IndexRuneUnicode/Latin/64M-10      3.994Gi ± 1%   10.369Gi ± 1%  +159.61% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/10-10    947.2Mi ± 0%   1096.1Mi ± 0%   +15.72% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/32-10    1.565Gi ± 0%    3.424Gi ± 1%  +118.80% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/4K-10    1.396Gi ± 0%    3.649Gi ± 1%  +161.43% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/4M-10    1.462Gi ± 0%    3.418Gi ± 1%  +133.76% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/64M-10   1.450Gi ± 1%    3.422Gi ± 1%  +136.08% (p=0.000 n=10)
IndexRuneUnicode/Han/10-10         944.6Mi ± 0%    881.7Mi ± 1%    -6.66% (p=0.000 n=10)
IndexRuneUnicode/Han/32-10         797.0Mi ± 1%   2809.3Mi ± 1%  +252.47% (p=0.000 n=10)
IndexRuneUnicode/Han/4K-10         2.707Gi ± 0%    7.798Gi ± 1%  +188.04% (p=0.000 n=10)
IndexRuneUnicode/Han/4M-10         2.919Gi ± 0%    4.757Gi ± 2%   +63.01% (p=0.000 n=10)
IndexRuneUnicode/Han/64M-10        2.917Gi ± 1%    4.656Gi ± 2%   +59.60% (p=0.000 n=10)
geomean                            3.036Gi         5.246Gi        +72.82%

goos: linux
goarch: amd64
pkg: bytes
                                │   old.txt    │                new.txt                │
                                │    sec/op    │    sec/op      vs base                │
IndexRune/10-4                    10.805n ± 0%    6.999n ±  0%  -35.22% (p=0.000 n=10)
IndexRune/32-4                    12.515n ± 0%    7.539n ±  0%  -39.76% (p=0.000 n=10)
IndexRune/4K-4                     71.69n ± 0%    68.39n ±  0%   -4.60% (p=0.000 n=10)
IndexRune/4M-4                    125.19µ ± 2%    63.05µ ±  0%  -49.63% (p=0.000 n=10)
IndexRune/64M-4                    1.050m ± 1%    1.053m ±  0%        ~ (p=0.353 n=10)
IndexRuneUnicode/Latin/10-4        9.471n ± 0%    6.144n ±  1%  -35.13% (p=0.000 n=10)
IndexRuneUnicode/Latin/32-4       12.540n ± 0%    6.655n ±  0%  -46.93% (p=0.000 n=10)
IndexRuneUnicode/Latin/4K-4        522.1n ± 0%    207.2n ±  0%  -60.32% (p=0.000 n=10)
IndexRuneUnicode/Latin/4M-4        626.1µ ± 0%    297.2µ ±  0%  -52.54% (p=0.000 n=10)
IndexRuneUnicode/Latin/64M-4      13.866m ± 3%    5.069m ±  4%  -63.44% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/10-4    10.920n ± 0%    7.213n ±  0%  -33.95% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/32-4    12.515n ± 0%    7.780n ±  0%  -37.83% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/4K-4    2650.0n ± 0%    621.5n ±  0%  -76.55% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/4M-4    2744.7µ ± 0%    723.2µ ±  0%  -73.65% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/64M-4    44.18m ± 0%    14.22m ± 14%  -67.82% (p=0.000 n=10)
IndexRuneUnicode/Han/10-4         10.795n ± 0%    9.734n ±  1%   -9.83% (p=0.000 n=10)
IndexRuneUnicode/Han/32-4          12.79n ± 0%    10.42n ±  1%  -18.46% (p=0.000 n=10)
IndexRuneUnicode/Han/4K-4          519.7n ± 0%    288.4n ±  0%  -44.51% (p=0.000 n=10)
IndexRuneUnicode/Han/4M-4          498.2µ ± 0%    443.0µ ±  0%  -11.07% (p=0.000 n=10)
IndexRuneUnicode/Han/64M-4         9.654m ± 2%   12.223m ±  1%  +26.61% (p=0.000 n=10)
geomean                            3.168µ         1.828µ        -42.30%

                                │    old.txt    │                 new.txt                 │
                                │      B/s      │      B/s        vs base                 │
IndexRune/10-4                     882.5Mi ± 0%   1362.6Mi ±  0%   +54.41% (p=0.000 n=10)
IndexRune/32-4                     2.381Gi ± 0%    3.953Gi ±  0%   +66.00% (p=0.000 n=10)
IndexRune/4K-4                     53.21Gi ± 0%    55.77Gi ±  0%    +4.82% (p=0.000 n=10)
IndexRune/4M-4                     31.20Gi ± 2%    61.95Gi ±  0%   +98.55% (p=0.000 n=10)
IndexRune/64M-4                    59.54Gi ± 1%    59.37Gi ±  0%         ~ (p=0.353 n=10)
IndexRuneUnicode/Latin/10-4       1006.9Mi ± 0%   1552.3Mi ±  1%   +54.17% (p=0.000 n=10)
IndexRuneUnicode/Latin/32-4        2.376Gi ± 0%    4.478Gi ±  0%   +88.45% (p=0.000 n=10)
IndexRuneUnicode/Latin/4K-4        7.306Gi ± 0%   18.411Gi ±  0%  +152.01% (p=0.000 n=10)
IndexRuneUnicode/Latin/4M-4        6.239Gi ± 0%   13.145Gi ±  0%  +110.70% (p=0.000 n=10)
IndexRuneUnicode/Latin/64M-4       4.507Gi ± 3%   12.329Gi ±  4%  +173.54% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/10-4     873.0Mi ± 0%   1322.2Mi ±  0%   +51.46% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/32-4     2.382Gi ± 0%    3.831Gi ±  0%   +60.84% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/4K-4     1.439Gi ± 0%    6.138Gi ±  0%  +326.43% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/4M-4     1.423Gi ± 0%    5.401Gi ±  0%  +279.52% (p=0.000 n=10)
IndexRuneUnicode/Cyrillic/64M-4    1.415Gi ± 0%    4.396Gi ± 17%  +210.79% (p=0.000 n=10)
IndexRuneUnicode/Han/10-4          883.4Mi ± 0%    979.7Mi ±  1%   +10.90% (p=0.000 n=10)
IndexRuneUnicode/Han/32-4          2.331Gi ± 0%    2.858Gi ±  1%   +22.61% (p=0.000 n=10)
IndexRuneUnicode/Han/4K-4          7.340Gi ± 0%   13.226Gi ±  0%   +80.19% (p=0.000 n=10)
IndexRuneUnicode/Han/4M-4          7.841Gi ± 0%    8.817Gi ±  0%   +12.44% (p=0.000 n=10)
IndexRuneUnicode/Han/64M-4         6.474Gi ± 2%    5.113Gi ±  1%   -21.02% (p=0.000 n=10)
geomean                            3.816Gi         6.614Gi         +73.32%

strings package benchmarks:

goos: darwin
goarch: arm64
pkg: strings
                       │ base.index_rune.10.txt │        new.index_rune.10.txt        │
                       │         sec/op         │   sec/op     vs base                │
IndexRune-10                       11.905n ± 5%   6.633n ± 6%  -44.28% (p=0.000 n=10)
IndexRuneLongString-10             13.800n ± 1%   7.330n ± 2%  -46.88% (p=0.000 n=10)
IndexRuneFastPath-10                3.477n ± 0%   3.481n ± 1%        ~ (p=0.468 n=10)
geomean                             8.297n        5.531n       -33.34%

Change-Id: I59357fda1c8ac85315b759930f620dbce1ba4721
Reviewed-on: https://go-review.googlesource.com/c/go/+/539116
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>
Auto-Submit: Ian Lance Taylor <iant@google.com>

8 months agobytes, strings: add Lines, SplitSeq, SplitAfterSeq, FieldsSeq, FieldsFuncSeq
aimuz [Fri, 9 Aug 2024 07:33:36 +0000 (07:33 +0000)]
bytes, strings: add Lines, SplitSeq, SplitAfterSeq, FieldsSeq, FieldsFuncSeq

Fixes #61901.

Change-Id: I4db21c91fd21079f2aa3bc81fb03dd6f40423a38
GitHub-Last-Rev: ed3df560a40ea10cdcb8ad476ba6849463f3c761
GitHub-Pull-Request: golang/go#67543
Reviewed-on: https://go-review.googlesource.com/c/go/+/587095
Auto-Submit: Ian Lance Taylor <iant@google.com>
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>
8 months agocmd/internal/obj/arm64: Emit UDF instruction for undefined Prog nodes
Sebastian Nickolls [Tue, 13 Aug 2024 10:47:40 +0000 (11:47 +0100)]
cmd/internal/obj/arm64: Emit UDF instruction for undefined Prog nodes

UDF provides a stronger guarantee for generating the Undefined
Instruction exception than the current value being emitted.

Change-Id: I234cd70ce04f21311959c1061ae24992438105f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/605155
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
8 months agocmd/compile: improve unneeded zeroing removal
Keith Randall [Tue, 13 Aug 2024 16:01:05 +0000 (09:01 -0700)]
cmd/compile: improve unneeded zeroing removal

After newobject, we don't need to write zeroes to initialize the
object.  It has already been zeroed by the allocator.

This is already handled in most cases, but because we run builtin
decomposition after the opt pass, we don't handle cases where the zero
of a compound builtin is being written. Improve the zero detector to
handle those cases.

Fixes #68845

Change-Id: If3dde2e304a05e5a6a6723565191d5444b334bcc
Reviewed-on: https://go-review.googlesource.com/c/go/+/605255
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
8 months agonet/http/httputil: close res body in test
guoguangwu [Mon, 15 Jul 2024 01:31:15 +0000 (01:31 +0000)]
net/http/httputil: close res body in test

Change-Id: Ic57c93a8d8413fe4985bc430255b6db90e11b70c
GitHub-Last-Rev: 25db6644c6cd3ae532796b18f8978f84a51376af
GitHub-Pull-Request: golang/go#68397
Reviewed-on: https://go-review.googlesource.com/c/go/+/597936
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
8 months agocrypto/tls: fix typo in quicError
Jaeho Nam [Wed, 7 Aug 2024 06:14:11 +0000 (06:14 +0000)]
crypto/tls: fix typo in quicError

Change-Id: I2c07592c3b896bc86e349de7c032929b9979349c
GitHub-Last-Rev: 0fe8b90e09b971821f9b0c0a528ed61895d3d110
GitHub-Pull-Request: golang/go#68757
Reviewed-on: https://go-review.googlesource.com/c/go/+/603517
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
8 months agoslices: add examples for iterator-related functions
jiahua wang [Wed, 7 Aug 2024 06:43:14 +0000 (14:43 +0800)]
slices: add examples for iterator-related functions

Change-Id: I13e878579b51638c2c07ad3ea99be7276177875c
Reviewed-on: https://go-review.googlesource.com/c/go/+/603735
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agocmd/compile/internal/ssa: enable testcases TestDebugLinesPushback and TestDebugLinesC...
limeidan [Tue, 12 Mar 2024 11:55:39 +0000 (19:55 +0800)]
cmd/compile/internal/ssa: enable testcases TestDebugLinesPushback and TestDebugLinesConvert on loong64

Change-Id: Id5c12c9edf278f2419900ebbfb0b7f388bafc9b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/604177
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>

8 months agocrypto/tls: add support for additional alpn flags to bogo_shim_test
Clide Stefani [Tue, 25 Jun 2024 19:52:32 +0000 (15:52 -0400)]
crypto/tls: add support for additional alpn flags to bogo_shim_test

The existing implementation of bogo_shim_test does not support tests
that use the -expect-advertised-alpn flag or the -select-alpn flag. This
change allows bogo_shim_test to receive and enforce these flags.

Support for these flags is added in the same change because these flags are set together.

Updates #51434

Change-Id: Ia37f9e7403d4a43e6da68c16039a4bcb56ebd032
Reviewed-on: https://go-review.googlesource.com/c/go/+/595655
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Russell Webb <russell.webb@protonmail.com>
Reviewed-by: Clide Stefani <cstefani.sites@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
8 months agolog/slog: implement encoding.TextAppender for Level and LevelVar
apocelipes [Tue, 13 Aug 2024 13:47:47 +0000 (13:47 +0000)]
log/slog: implement encoding.TextAppender for Level and LevelVar

For #62384

Change-Id: I10df580ef966e497ff8da4efde6dd6ce1ccb17b4
GitHub-Last-Rev: 5ad8e2e0473ff509b48e525f6c7328f6281766a3
GitHub-Pull-Request: golang/go#68855
Reviewed-on: https://go-review.googlesource.com/c/go/+/605056
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agoruntime/cgo: create C pthreads in detached state
Ian Lance Taylor [Tue, 13 Aug 2024 18:25:31 +0000 (11:25 -0700)]
runtime/cgo: create C pthreads in detached state

Rather than explicitly calling pthread_detach.

Fixes #68850

Change-Id: I7b4042283f9feb5383bffd40fae6db6d23217f97
Reviewed-on: https://go-review.googlesource.com/c/go/+/605257
Commit-Queue: 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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
8 months agocmd/link, runtime: support library mode on wasip1
Cherry Mui [Thu, 8 Aug 2024 22:45:18 +0000 (18:45 -0400)]
cmd/link, runtime: support library mode on wasip1

This CL adds support of "library", i.e. c-shared, build mode on
wasip1. When -buildmode=c-shared is set, it builds a Wasm module
that is intended to be used as a library, instead of an executable.
It does not have the _start function. Instead, it has an
_initialize function, which initializes the runtime, but not call
the main function.

This is similar to the c-shared build mode on other platforms. One
difference is that unlike cgo callbacks, where Ms are created on-
demand, on Wasm we have only one M, so we just keep the M (and the
G) for callbacks.

For #65199.

Change-Id: Ieb21da96b25c1a9f3989d945cddc964c26f9085b
Reviewed-on: https://go-review.googlesource.com/c/go/+/604316
Reviewed-by: Achille Roussel <achille.roussel@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
8 months agocmd/compile/internal/types2: change inference error message
Tim King [Mon, 5 Aug 2024 19:57:33 +0000 (12:57 -0700)]
cmd/compile/internal/types2: change inference error message

Changes the type inference error message so that the position is
proceeded by a space. cmd/go rewrites the output of gc to replace
absolute paths at the beginning of lines and those proceeded by a
space or a tab to relative paths.

Updates testdir to do the same post processing on the output
of tests as cmd/go.

Fixes #68292

Change-Id: Ie109b51143e68f6e7ab4cd19064110db0e609a7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/603097
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agonet/http: rename server receiver for consistency
wineandchord [Mon, 12 Aug 2024 20:52:05 +0000 (20:52 +0000)]
net/http: rename server receiver for consistency

"receiver name `srv` should be consistent with the previous receiver name
`s` for Server" according to go-lint.

Change-Id: I3071ae30b7c1375999e5a599a0eee7b88494f17e
GitHub-Last-Rev: 093c7679b1919f364ed542904203d22ed2048313
GitHub-Pull-Request: golang/go#65787
Reviewed-on: https://go-review.googlesource.com/c/go/+/565175
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
8 months agotest: add test case for wasmexport parameter types
Cherry Mui [Mon, 12 Aug 2024 20:01:55 +0000 (16:01 -0400)]
test: add test case for wasmexport parameter types

For #65199.

Change-Id: Iecd11281706201a655b51583a08318b5ffd8ab04
Reviewed-on: https://go-review.googlesource.com/c/go/+/604975
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
8 months agocmd/compile: add additional arm64 bit field rules
khr@golang.org [Sun, 4 Aug 2024 12:41:38 +0000 (05:41 -0700)]
cmd/compile: add additional arm64 bit field rules

Get rid of TODO in prove pass.
We currently avoid marking shifts of constants as bounded, where
bounded means we don't have to worry about <0 or >=bitwidth shifts.
We do this because it causes different rule applications during lowering
which cause some codegen tests to fail.

Add some new rules which ensure that we get the right final instruction
sequence regardless of the ordering. Then we can remove this special case.

Change-Id: I4e962d4f09992b42ab47e123de5ded3b8b8fb205
Reviewed-on: https://go-review.googlesource.com/c/go/+/602935
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
8 months agocmd/go: stamp the version for binaries built with go build
Sam Thanawalla [Mon, 15 Jul 2024 14:37:52 +0000 (14:37 +0000)]
cmd/go: stamp the version for binaries built with go build

This CL will set the binary version using local tag information if
present.

For #50603

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: I58bed345c7eea20e51a7b24ff6e943d9d1ed240d
Reviewed-on: https://go-review.googlesource.com/c/go/+/596035
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Karam Moore <bigjimhilljameel@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>