]> Cypherpunks repositories - gostls13.git/log
gostls13.git
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>

8 months agospec: clarify prose for embedded struct fields
Robert Griesemer [Fri, 9 Aug 2024 04:03:13 +0000 (21:03 -0700)]
spec: clarify prose for embedded struct fields

The spec says that an embedded field must be specified
as a type name (or a pointer to a type name). This is
explicit in the prose and the FieldDecl syntax.

However, the prose on promoted methods required a named
type (originally the term used for a "defined type").
Before the introduction of alias types, type names could
only refer to named/defined types, so the prose was ok.

With the introduction of alias types in Go 1.9, we
distinguished between defined types (i.e., types given
a name through a type declaration) and type aliases
(types given an alternative name), and retired the notion
of a named type since any type with a name (alias type
and defined type) could be considered a "named type".

To make things worse, with Go 1.18 we re-introduced the
notion of a named type which now includes predeclared
types, defined types, type parameters (and with that
type aliases denoting named types).

In the process some of the wording on method promotion
didn't get updated correctly. At attempt to fix this
was made with CL 406054, but while that CL's description
correctly explained the intent, the CL changed the prose
from "defined type" to "named type" (which had the new
meaning after Go 1.18), and thus did not fix the issue.

This CL fixes that fix by using the term "type name".
This makes the prose consistent for embedded types and
in turn clarifies that methods of embedded alias types
(defined or not) can be promoted, consistent with the
implementation.

While at it, also document that the type of an embedded
field cannot be a type parameter. This restriction has
been in place since the introduction of type parameters
with Go 1.18 and is enforced by the compiler.

Fixes #66540.
For #41687.

Change-Id: If9e6a03d7b84d24a3e6a5ceda1d46bda99bdf1f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/603958
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Axel Wagner <axel.wagner.hh@googlemail.com>
8 months agoos: employ sendfile(2) for file-to-file copying on SunOS when needed
Andy Pan [Tue, 6 Aug 2024 13:22:57 +0000 (21:22 +0800)]
os: employ sendfile(2) for file-to-file copying on SunOS when needed

Change-Id: Ia46de6c62707db9ef193fe1a2aabb18585f1dd48
Reviewed-on: https://go-review.googlesource.com/c/go/+/603098
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
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@google.com>

8 months agogo/types, types2: only use fileVersion if 1.21 or greater
Michael Matloob [Wed, 7 Aug 2024 17:09:18 +0000 (13:09 -0400)]
go/types, types2: only use fileVersion if 1.21 or greater

Only honor //go:build language version downgrades if the version
specified is 1.21 or greater. Before 1.21 the version in //go:build
lines didn't have the meaning of setting the file's language version.

This fixes an issue that was appearing in GOPATH builds: Go 1.23 started
providing -lang versions to the compiler in GOPATH mode (among other
places) which it wasn't doing before.

For example, take a go file with a //go:build line specifying go1.10.
If that file used a 1.18 feature, that use would compile fine with a Go
1.22 toolchain. But, before this change, it would produce an error when
compiling with the 1.23 toolchain because it set the language version to
1.20 and disallowed the 1.18 feature. This breaks backwards
compatibility: when the build tag was added, it did not have the meaning
of restricting the language version.

Fixes #68658

Change-Id: I4ac2b45a981cd019183d52ba324ba8f0fed93a8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/603895
Reviewed-by: Robert Griesemer <gri@google.com>
Commit-Queue: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Matloob <matloob@golang.org>

8 months agocmd/cgo: clarify that strings and slices may contain C pointers
Ian Lance Taylor [Sat, 10 Aug 2024 23:31:28 +0000 (16:31 -0700)]
cmd/cgo: clarify that strings and slices may contain C pointers

Fixes #68832

Change-Id: I74b6aad9a18953c263cbbe795268017a72261f7f
Reviewed-on: https://go-review.googlesource.com/c/go/+/604715
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>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Commit-Queue: Ian Lance Taylor <iant@google.com>

8 months agocmd/compile: clean up some unused code in prove pass
Keith Randall [Wed, 7 Aug 2024 21:25:31 +0000 (14:25 -0700)]
cmd/compile: clean up some unused code in prove pass

Change-Id: Ib695064c5a77a3f86d1d2a74f96823e65199b8e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/603956
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
8 months agoruntime: make the wasm crash function abort
Cherry Mui [Fri, 9 Aug 2024 16:50:24 +0000 (12:50 -0400)]
runtime: make the wasm crash function abort

Currently the crash function on Wasm is implemented as a nil
pointer dereference, which turns into a sigpanic, which turns into
"panic during runtime execution" as we're already in runtime when
crash is called. Instead, just abort, which crashes hard and
terminates the Wasm module execution, and the execution engine
often dumps a stack trace.

Change-Id: I3c57f8ff7a0c0015e4abcd7bf262bf9001624b85
Reviewed-on: https://go-review.googlesource.com/c/go/+/604515
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/internal/obj/wasm: handle stack unwinding in wasmexport
Cherry Mui [Wed, 7 Aug 2024 15:52:39 +0000 (11:52 -0400)]
cmd/internal/obj/wasm: handle stack unwinding in wasmexport

CL 603055 added basic support of wasmexport. This CL follows it
and adds stack unwinding handling. If the wasmexport Go function
returns normally, we directly return to the host. If the Go
function unwinds the stack (e.g. goroutine switch, stack growth),
we need to run a PC loop to call functions on the new stack,
similar to wasm_pc_f_loop. One difference is that when the
wasmexport function returns normally, we need to exit the loop and
return to the host.

Now a wasmimport function can call back into the Go via wasmexport.
During the callback the stack could have moved. The wasmimport
code needs to read a new SP after the host function returns,
instead of assuming the SP doesn't change.

For #65199.

Change-Id: I62c1cde1c46f7eb72625892dea41e8137b361891
Reviewed-on: https://go-review.googlesource.com/c/go/+/603836
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Achille Roussel <achille.roussel@gmail.com>
8 months agocrypto/tls: align FIPS-only mode with BoringSSL policy
Filippo Valsorda [Thu, 14 Dec 2023 21:13:29 +0000 (22:13 +0100)]
crypto/tls: align FIPS-only mode with BoringSSL policy

This enables TLS 1.3, disables P-521, and disables non-ECDHE suites.

Reapplies CL 549975.

Updates #64717
Updates #62372

Change-Id: I6c608704638d59a063a657fbd4eb1126027112dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/603376
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
8 months agocrypto/internal/boring: upgrade module to fips-20220613 / certificate 4735
Filippo Valsorda [Tue, 6 Aug 2024 11:49:42 +0000 (13:49 +0200)]
crypto/internal/boring: upgrade module to fips-20220613 / certificate 4735

Reapplies CL 549695 now that the certificate was issued.

Updates #64717
Updates #62372

Change-Id: Ie37abed5c5aceac435d92397ed626dfeefabe5ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/603375
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 months agoRevert "os/user: speed up Current on Windows"
Quim Muntal [Fri, 9 Aug 2024 18:17:57 +0000 (18:17 +0000)]
Revert "os/user: speed up Current on Windows"

This reverts CL 597255.

Reason for revert: Broke windows/arm64

Fixes #68822.
Updates #68312.

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

8 months agosyscall,misc/wasm: fix path expansion on non-unix platforms
Zxilly [Fri, 9 Aug 2024 17:43:11 +0000 (17:43 +0000)]
syscall,misc/wasm: fix path expansion on non-unix platforms

When running a go binary compiled to wasm using node.js on a Windows platform,
the absolute path passed in is also incorrectly forced to expand.

For example:

E:\Project\CS_Project\gsv\testdata\result.gob.gz

will results to

open C:\Users\zxilly\AppData\Local\wasm-exec\go1.23rc1\E:\Project\CS_Project\gsv\testdata\result.gob.gz: No such file or directory

C:\Users\zxilly\AppData\Local\wasm-exec\go1.23rc1 is the place of
wasm_exec_node.js

Fixes: #68820
Change-Id: Ic30c6242302f8915ac1b8ea9f24546935cbb791e
GitHub-Last-Rev: f35ff1a2eef86c3b6431bb2be75448c3ac553f1b
GitHub-Pull-Request: golang/go#68255
Reviewed-on: https://go-review.googlesource.com/c/go/+/595797
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>

8 months agoruntime: add direct benchmark of mutex contention
Rhys Hiltner [Fri, 2 Aug 2024 22:31:22 +0000 (15:31 -0700)]
runtime: add direct benchmark of mutex contention

Measure throughput of a single mutex with all threads contending. Do not
attempt to measure fairness/starvation.

The ChanContended benchmark works somewhat well for this (interacting
with the mutex is a large contributor to its results), but it's better
to be clear about what we're attempting to measure.

For #68578

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

8 months agoruntime: make function comments match function names
cuishuang [Thu, 8 Aug 2024 03:05:23 +0000 (11:05 +0800)]
runtime: make function comments match function names

Change-Id: I5dc9864fbb6f1745be0f7076ac72debd039c8f3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/604178
Reviewed-by: shuang cui <imcusg@gmail.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 months agocmd/compile: in prove pass, check for unsat before adding local facts
Keith Randall [Fri, 9 Aug 2024 20:11:03 +0000 (13:11 -0700)]
cmd/compile: in prove pass, check for unsat before adding local facts

Local facts can get us to unsatisfiable because there is an
unconditional panic in the block. That shouldn't declare the whole
block as unreachable, because we do still need to enter it to get
that panic.

Fixes #68816

Change-Id: I9220edb46089690702d2eb61d112815c7ac91f16
Reviewed-on: https://go-review.googlesource.com/c/go/+/604118
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Keith Randall <khr@golang.org>

8 months agocmd/compile: fix off-by-one error in prove pass
Keith Randall [Fri, 9 Aug 2024 17:59:43 +0000 (10:59 -0700)]
cmd/compile: fix off-by-one error in prove pass

I think I introduced #68809 when rewriting the prove pass, by
introducing an off-by-one error here:
https://go-review.googlesource.com/c/go/+/599096/5/src/cmd/compile/internal/ssa/prove.go
lines 872-874.
The min++ is already handled in one of the two following cases with
the (r&eq==0) condition. Move the min++ to just the other case.

Fixes #68809

Change-Id: Iffae99e29219c94aaf584cd7ae247289fa604a00
Reviewed-on: https://go-review.googlesource.com/c/go/+/604100
Reviewed-by: Keith Randall <khr@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: add basic wasmexport support
Cherry Mui [Sat, 3 Aug 2024 18:20:58 +0000 (14:20 -0400)]
cmd/compile: add basic wasmexport support

This CL adds a compiler directive go:wasmexport, which applies to
a Go function and makes it an exported function of the Wasm module
being built, so it can be called directly from the host. As
proposed in #65199, parameter and result types are limited to
32-bit and 64-bit integers and floats, and there can be at most
one result.

As the Go and Wasm calling conventions are different, for a
wasmexport function we generate a wrapper function does the ABI
conversion at compile time.

Currently this CL only adds basic support. In particular,
- it only supports executable mode, i.e. the Go wasm module calls
  into the host via wasmimport, which then calls back to Go via
  wasmexport. Library (c-shared) mode is not implemented yet.
- only supports wasip1, not js.
- if the exported function unwinds stacks (goroutine switch, stack
growth, etc.), it probably doesn't work.

TODO: support stack unwinding, c-shared mode, js.

For #65199.

Change-Id: Id1777c2d44f7d51942c1caed3173c0a82f120cc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/603055
Reviewed-by: Than McIntosh <thanm@golang.org>
Reviewed-by: Randy Reddig <randy.reddig@fastly.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agocmd/go/internal/test: add 'tests' vet check to 'go test' suite
Alan Donovan [Tue, 6 Aug 2024 20:56:56 +0000 (20:56 +0000)]
cmd/go/internal/test: add 'tests' vet check to 'go test' suite

(Second attempt at CL 529816 (f1d6050), reverted in
CL 571695 (1304d98) due to broken longtest builder.)

The tests analyser reports structural problems in test
declarations. Presumably most of these would be caught by
go test itself, which compiles and runs (some subset of) the
tests, but Benchmark and Fuzz functions are executed less
frequently and may benefit more from static checks.

A number of tests of "go vet" needed to be updated, either
to avoid mistakes caught by the analyzer, or to suppress
the analyzer when the mistakes were intended.

Also, reflect the change in go test help message.

+ release note

Fixes golang/go#44251

Change-Id: I1c311086815fe55a66cce001eaab9b41e27d1144
Reviewed-on: https://go-review.googlesource.com/c/go/+/603476
Auto-Submit: Alan Donovan <adonovan@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 agoplugin: include a warning about race detector compatability in docs
Ezra Newman [Fri, 9 Aug 2024 16:17:49 +0000 (16:17 +0000)]
plugin: include a warning about race detector compatability in docs

As described in #24245, the race detector isn't able to find some race conditions in plugins.
This commit adds a warning about this to the plugins documentation.

Updates #24245

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

8 months agocrypto/tls: expose extensions presented by client to GetCertificate
Bobby Powers [Sun, 26 Feb 2023 00:24:54 +0000 (16:24 -0800)]
crypto/tls: expose extensions presented by client to GetCertificate

This enables JA3 and JA4 TLS fingerprinting to be implemented from
the GetCertificate callback, similar to what BoringSSL provides with
its SSL_CTX_set_dos_protection_cb hook.

fixes #32936

Change-Id: Idb54ebcb43075582fcef0ac6438727f494543424
Reviewed-on: https://go-review.googlesource.com/c/go/+/471396
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agoLICENSE: update per Google Legal
Russ Cox [Fri, 9 Aug 2024 14:28:39 +0000 (10:28 -0400)]
LICENSE: update per Google Legal

Very minor tweaks:
 - Remove (c) pseudosymbol.
 - Remove "All Rights Reserved."
 - Change "Google Inc." (no longer exists) to "Google LLC".

[git-generate]
echo '
,s/\(c\) //
,s/ All rights reserved.//
,s/Google Inc./Google LLC/
w
q
' | sam -d LICENSE

Change-Id: I243c86499bdaf8f8e73d8833e1ed8ccab4083c63
Reviewed-on: https://go-review.googlesource.com/c/go/+/604475
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@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
8 months agotypes2: move RangeKeyVal func into compilersupport.go
Robert Griesemer [Thu, 8 Aug 2024 20:54:56 +0000 (13:54 -0700)]
types2: move RangeKeyVal func into compilersupport.go

This function only exists in types2.

Change-Id: If0a8b6aaf496142cefdf088bd5656536f4ed101c
Reviewed-on: https://go-review.googlesource.com/c/go/+/604276
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>
Auto-Submit: Robert Griesemer <gri@google.com>

8 months agoos/user: speed up Current on Windows
qmuntal [Thu, 1 Aug 2024 14:26:32 +0000 (16:26 +0200)]
os/user: speed up Current on Windows

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
Change-Id: I893c5fcca6969050d73a20ed34770846becd5f5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/597255
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agocmd/link: add support for trampoline insertation on loong64
limeidan [Wed, 1 Nov 2023 09:25:20 +0000 (17:25 +0800)]
cmd/link: add support for trampoline insertation on loong64

Change-Id: I58c861d8403a77c1f3b55207d46076ba76eb1d45
Reviewed-on: https://go-review.googlesource.com/c/go/+/540755
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
8 months agoos: fix Chtimes test flakes
Kir Kolyshkin [Thu, 8 Aug 2024 20:11:14 +0000 (13:11 -0700)]
os: fix Chtimes test flakes

It appears that some builders (notably, linux-arm) have some additional
security software installed, which apparently reads the files created by
tests. As a result, test file atime is changed, making the test fail
like these:

=== RUN   TestChtimesOmit
    ...
    os_test.go:1475: atime mismatch, got: "2024-07-30 18:42:03.450932494 +0000 UTC", want: "2024-07-30 18:42:02.450932494 +0000 UTC"

=== RUN   TestChtimes
    ...
    os_test.go:1539: AccessTime didn't go backwards; was=2024-07-31 20:45:53.390326147 +0000 UTC, after=2024-07-31 20:45:53.394326118 +0000 UTC

According to inode(7), atime is changed when more than 0 bytes are read
from the file. So, one possible solution to these flakes is to make the
test files empty, so no one can read more than 0 bytes from them.

Fixes #68687
Fixes #68663

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

8 months agofmt: remove ineffective else branch in test
Oleksandr Redko [Wed, 7 Aug 2024 17:14:30 +0000 (20:14 +0300)]
fmt: remove ineffective else branch in test

Change-Id: I8e47266e8b3fb2f2ae07455b317de58dfcdd8016
Reviewed-on: https://go-review.googlesource.com/c/go/+/603536
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agoos/user: support calling Current on impersonated threads
qmuntal [Thu, 1 Aug 2024 14:26:00 +0000 (16:26 +0200)]
os/user: support calling Current on impersonated threads

The syscall.OpenCurrentProcessToken call in user.Current fails
when called from an impersonated thread, as the process token is
normally in that case.

This change ensures that the current thread is not impersonated
when calling OpenCurrentProcessToken, and then restores the
impersonation state, if any.

Fixes #68647

Change-Id: I3197535dd8355d21029a42f7aa3936d8fb021202
Reviewed-on: https://go-review.googlesource.com/c/go/+/602415
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agonet/url: implement encoding.BinaryAppender for URL
apocelipes [Wed, 7 Aug 2024 23:35:23 +0000 (23:35 +0000)]
net/url: implement encoding.BinaryAppender for URL

For #62384

Change-Id: I61529efe3a59b13606479b74af6cbff61c9efb6e
GitHub-Last-Rev: f188b91978711c55aa2daf2c72277990d25bc328
GitHub-Pull-Request: golang/go#68763
Reviewed-on: https://go-review.googlesource.com/c/go/+/603815
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

8 months agohash: mention encoding.BinaryAppender in Hash docs
Mateusz Poliwczak [Wed, 7 Aug 2024 09:20:30 +0000 (09:20 +0000)]
hash: mention encoding.BinaryAppender in Hash docs

For #62384

Change-Id: I4eeb83a4708544777815eacd6a5b6d293580c5e5
GitHub-Last-Rev: 6fdb6db4811a7b19742fec556fd5a1d5002b4e5e
GitHub-Pull-Request: golang/go#68758
Reviewed-on: https://go-review.googlesource.com/c/go/+/603405
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@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 ago.github: update language change proposal template
Branden J Brown [Wed, 7 Aug 2024 18:35:59 +0000 (13:35 -0500)]
.github: update language change proposal template

The language change proposal review process has been adjusted slightly.
Update the corresponding issue template to reflect the changes.

For #65660.

Change-Id: Ic6d3526ab4a7fa09433914fd0b1525eea3a832a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/603955
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
8 months agocmd/compile: fix loong64 MINF → FMINF name and friends
Jorropo [Wed, 7 Aug 2024 19:25:41 +0000 (21:25 +0200)]
cmd/compile: fix loong64 MINF → FMINF name and friends

CL 580283 left cmd/compile/internal/ssa/_gen/ in a state where `go run *.go` would always fails ! :'(

Change-Id: I0b3aea9b3f6275cb17c552898c5034e15f0107d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/603995
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
8 months agocmd: update golang.org/x/telemetry to 38c23d2
Michael Matloob [Wed, 7 Aug 2024 19:06:20 +0000 (15:06 -0400)]
cmd: update golang.org/x/telemetry to 38c23d2

Commands run:
    go get golang.org/x/telemetry@38c23d2
    go mod tidy
    go mod vendor

This also pulls in golang.org/x/sync@v0.8.0 as a module requirement, but
no changes need to be vendored from that module.

Change-Id: I2238388b6dc2a4a29a53e7b8ddea29eb677a97b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/603898
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
8 months agocmd: update golang.org/x/mod to v0.20.0
Michael Matloob [Wed, 7 Aug 2024 19:04:05 +0000 (15:04 -0400)]
cmd: update golang.org/x/mod to v0.20.0

Commands run:
    go get golang.org/x/mod@v0.20.0
    go mod tidy
    go mod vendor

This is being done in preparation for vendoring in the latest commit of
golang.org/x/telemetry.

Change-Id: I67de7c23c4949cde63826c9d791f7b67698491d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/603897
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Matloob <matloob@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
8 months agoall: update golang.org/x/sys to v0.23.0
Michael Matloob [Wed, 7 Aug 2024 19:00:53 +0000 (15:00 -0400)]
all: update golang.org/x/sys to v0.23.0

Commands run (in both src and src/cmd):
    go get golang.org/x/sys@v0.23.0
    go mod tidy
    go mod vendor

This is in preparation for vendoring an updated x/telemetry it has a
requirement on x/sys v0.23.0.

Change-Id: If52d077bafa04a3f656a28800c2591a47e434db4
Reviewed-on: https://go-review.googlesource.com/c/go/+/603896
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Michael Matloob <matloob@golang.org>

8 months agointernal/poll,syscall: drop the fallback for accept4 on linux/arm
Andy Pan [Fri, 24 May 2024 01:21:30 +0000 (09:21 +0800)]
internal/poll,syscall: drop the fallback for accept4 on linux/arm

For #67001

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

8 months agoos: employ sendfile(2) for file-to-file copying on Linux when needed
Andy Pan [Tue, 6 Aug 2024 08:36:45 +0000 (16:36 +0800)]
os: employ sendfile(2) for file-to-file copying on Linux when needed

Go utilizes copy_file_range(2) for file-to-file copying only on kernel 5.3+,
but even on 5.3+ this system call can still go wrong for some reason (check
out the comment inside poll.CopyFileRange).

Before Linux 2.6.33, out_fd must refer to a socket, but since Linux 2.6.33
it can be any file. Thus, we can employ sendfile(2) for copy between files
when copy_file_range(2) fails to handle the copy, that way we can still
benefit from the zero-copy technique on kernel <5.3 and wherever
copy_file_range(2) is available but broken.

Change-Id: I3922218c95ad34ee649ccdf3ccfbd1ce692bebcc
Reviewed-on: https://go-review.googlesource.com/c/go/+/603295
Reviewed-by: David Chase <drchase@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>
8 months agohash: implement the encoding.BinaryAppender interface
apocelipes [Tue, 6 Aug 2024 21:58:38 +0000 (21:58 +0000)]
hash: implement the encoding.BinaryAppender interface

For #62384

Change-Id: Ia6de028741e43449bcf54ba73ec9b0cad4d4e88a
GitHub-Last-Rev: 192f389d463d372a338dca82827a871888a53bb0
GitHub-Pull-Request: golang/go#68738
Reviewed-on: https://go-review.googlesource.com/c/go/+/603255
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: David Chase <drchase@google.com>
8 months agobytes,strings: use a more universal Cyrillic word
Oleksandr Redko [Tue, 6 Aug 2024 17:16:42 +0000 (20:16 +0300)]
bytes,strings: use a more universal Cyrillic word

The word "брат" (brother) is the same across Slavic languages that
use the Cyrillic script, such as Bulgarian, Macedonian, Russian,
Ukrainian, and others.

Change-Id: I5155e6bb16a02dec5d93a01b79f9570f43f09444
Reviewed-on: https://go-review.googlesource.com/c/go/+/603535
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: David Chase <drchase@google.com>
8 months agocmd/compile: rip out constant handling in poset data structure
khr@golang.org [Fri, 19 Jul 2024 21:54:54 +0000 (14:54 -0700)]
cmd/compile: rip out constant handling in poset data structure

The prove pass now tracks possible constant values explicitly, so
the poset data structure no longer has to. This simplifies a bunch of
the special cases in poset.

Change-Id: I0efff65269bc5d53c6d18e4760b0375cfb2ae8b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/599795
Reviewed-by: David Chase <drchase@google.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: simplify prove pass
khr@golang.org [Fri, 12 Jul 2024 02:38:33 +0000 (19:38 -0700)]
cmd/compile: simplify prove pass

We don't need noLimit checks in a bunch of places.
Also simplify folding of provable constant results.

At this point in the CL stack, compilebench reports no performance
changes. The only thing of note is that binaries got a bit smaller.

name                      old text-bytes    new text-bytes    delta
HelloSize                       960kB ± 0%        952kB ± 0%  -0.83%  (p=0.000 n=10+10)
CmdGoSize                      12.3MB ± 0%       12.1MB ± 0%  -1.53%  (p=0.000 n=10+10)

Change-Id: Id4be75eec0f8c93f2f3b93a8521ce2278ee2ee2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/599197
Reviewed-by: David Chase <drchase@google.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: simplify jump table case in prove pass
khr@golang.org [Thu, 11 Jul 2024 19:36:32 +0000 (12:36 -0700)]
cmd/compile: simplify jump table case in prove pass

Change-Id: I01e0c4953667594b84daaa38082fad1175343861
Reviewed-on: https://go-review.googlesource.com/c/go/+/599196
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/compile: reorganize prove pass domain relation table
khr@golang.org [Thu, 11 Jul 2024 19:10:10 +0000 (12:10 -0700)]
cmd/compile: reorganize prove pass domain relation table

Move some code from when we learn that we take a branch, to when
we learn that a boolean is true or false. It is more consistent
this way (and may lead to a few more cases where we can derive
useful relations).

Change-Id: Iea7b2d6740e10c9c71c4b1546881f501da81cd21
Reviewed-on: https://go-review.googlesource.com/c/go/+/599098
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/compile: handle boolean and pointer relations
khr@golang.org [Sun, 7 Jul 2024 21:58:47 +0000 (14:58 -0700)]
cmd/compile: handle boolean and pointer relations

The constant lattice for these types is pretty simple.
We no longer need the old-style facts table, as the ordering
table now has all that information.

Change-Id: If0e118c27a4de8e9bfd727b78942185c2eb50c4b
Reviewed-on: https://go-review.googlesource.com/c/go/+/599097
Reviewed-by: David Chase <drchase@google.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: propagate constant ranges through multiplies and shifts
khr@golang.org [Thu, 27 Jun 2024 22:53:24 +0000 (15:53 -0700)]
cmd/compile: propagate constant ranges through multiplies and shifts

Fixes #40704
Fixes #66826

Change-Id: Ia9c356e29b2ed6f2e3bc6e5eb9304cd4dccb4263
Reviewed-on: https://go-review.googlesource.com/c/go/+/599256
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
8 months agocmd/compile: rewrite the constant parts of the prove pass
khr@golang.org [Sat, 15 Jun 2024 05:29:09 +0000 (22:29 -0700)]
cmd/compile: rewrite the constant parts of the prove pass

Handles a lot more cases where constant ranges can eliminate
various (mostly bounds failure) paths.

Fixes #66826
Fixes #66692
Fixes #48213
Update #57959

TODO: remove constant logic from poset code, no longer needed.

Change-Id: Id196436fcd8a0c84c7d59c04f93bd92e26a0fd7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/599096
Reviewed-by: David Chase <drchase@google.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: move limit fact table in prove pass to dense encoding
khr@golang.org [Sat, 18 May 2024 15:01:27 +0000 (08:01 -0700)]
cmd/compile: move limit fact table in prove pass to dense encoding

Here begins a pretty major rewrite of the prove pass. The fundamental
observation is that although keeping facts about relations between
two SSA values could use O(n^2) space, keeping facts about relations
between an SSA value and constants needs only O(n) space. We can just
keep track of min/max for every SSA value at little cost.

Redo the limit table to just keep track of limits for all SSA values.
Use just a slice instead of a map. It may use more space (but still
just O(n) space), but accesses are a lot faster. And with the cache
in the compiler, that space will be reused quickly.

This is part of my planning to add lots more constant limits in the
prove pass.

Change-Id: Ie36819fad5631a8b79c3630fe0e819521796551a
Reviewed-on: https://go-review.googlesource.com/c/go/+/599255
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/compile, math: make math.{Abs,Copysign} intrinsics on loong64
Xiaolin Zhao [Mon, 1 Apr 2024 09:13:42 +0000 (17:13 +0800)]
cmd/compile, math: make math.{Abs,Copysign} intrinsics on loong64

goos: linux
goarch: loong64
pkg: math
cpu: Loongson-3A6000 @ 2500.00MHz
         │  old.bench   │              new.bench               │
         │    sec/op    │    sec/op     vs base                │
Copysign   1.9710n ± 0%   0.8006n ± 0%  -59.38% (p=0.000 n=10)
Abs        1.8745n ± 0%   0.8006n ± 0%  -57.29% (p=0.000 n=10)
geomean     1.922n        0.8006n       -58.35%

goos: linux
goarch: loong64
pkg: math
cpu: Loongson-3A5000 @ 2500.00MHz
         │  old.bench   │              new.bench               │
         │    sec/op    │    sec/op     vs base                │
Copysign   2.4020n ± 0%   0.9006n ± 0%  -62.51% (p=0.000 n=10)
Abs        2.4020n ± 0%   0.8005n ± 0%  -66.67% (p=0.000 n=10)
geomean     2.402n        0.8491n       -64.65%

Updates #59120.

Change-Id: Ic409e1f4d15ad15cb3568a5aaa100046e9302842
Reviewed-on: https://go-review.googlesource.com/c/go/+/580280
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
8 months agocmd/compile, math: improve implementation of math.{Max,Min} on loong64
Xiaolin Zhao [Wed, 10 Apr 2024 03:48:11 +0000 (11:48 +0800)]
cmd/compile, math: improve implementation of math.{Max,Min} on loong64

Make math.{Min,Max} intrinsics and implement math.{archMax,archMin}
in hardware.

goos: linux
goarch: loong64
pkg: math
cpu: Loongson-3A6000 @ 2500.00MHz
         │  old.bench   │              new.bench              │
         │    sec/op    │   sec/op     vs base                │
Max         7.606n ± 0%   3.087n ± 0%  -59.41% (p=0.000 n=20)
Min         7.205n ± 0%   2.904n ± 0%  -59.69% (p=0.000 n=20)
MinFloat   37.220n ± 0%   4.802n ± 0%  -87.10% (p=0.000 n=20)
MaxFloat   33.620n ± 0%   4.802n ± 0%  -85.72% (p=0.000 n=20)
geomean     16.18n        3.792n       -76.57%

goos: linux
goarch: loong64
pkg: runtime
cpu: Loongson-3A5000 @ 2500.00MHz
         │  old.bench   │              new.bench              │
         │    sec/op    │   sec/op     vs base                │
Max        10.010n ± 0%   7.196n ± 0%  -28.11% (p=0.000 n=20)
Min         8.806n ± 0%   7.155n ± 0%  -18.75% (p=0.000 n=20)
MinFloat   60.010n ± 0%   7.976n ± 0%  -86.71% (p=0.000 n=20)
MaxFloat   56.410n ± 0%   7.980n ± 0%  -85.85% (p=0.000 n=20)
geomean     23.37n        7.566n       -67.63%

Updates #59120.

Change-Id: I6815d20bc304af3cbf5d6ca8fe0ca1c2ddebea2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/580283
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
8 months agoruntime: add padding to Linux kernel structures sigcontext on loong64
Guoqi Chen [Fri, 7 Jun 2024 01:36:53 +0000 (09:36 +0800)]
runtime: add padding to Linux kernel structures sigcontext on loong64

On linux/loong64, the sc_extcontext member in the sigcontext structure is
required to be 16-byte aligned [1], although sc_extcontext is not currently
used anywhere, it still needs to be padded to the specified alignment.

[1] https://github.com/torvalds/linux/blob/master/arch/loongarch/include/uapi/asm/sigcontext.h

Change-Id: I98d30e921730314835c9469a6f28e186c9808e34
Reviewed-on: https://go-review.googlesource.com/c/go/+/591855
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
8 months agogo/types, types2: avoid spurious "undefined" errors" for invalid identifiers
Robert Griesemer [Thu, 1 Aug 2024 18:16:27 +0000 (11:16 -0700)]
go/types, types2: avoid spurious "undefined" errors" for invalid identifiers

The syntax parser complains about invalid identifiers.
Don't report a typechecker error when such an identifier
cannot be found in the current scope.

For now add a local test for types2 only because the
go/parser behaves differently than the syntax parser
which leads to slightly different error positions.

Fixes #68183.

Change-Id: Idbfe62fafcd704886069182744ec5e6b37ffc4e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/602476
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
8 months agocmd/go/internal/load: make check for path in import error more robust
Michael Matloob [Tue, 6 Aug 2024 16:42:34 +0000 (12:42 -0400)]
cmd/go/internal/load: make check for path in import error more robust

When producing an ImportPathError from ImportErrorf, we check to see
whether the error string contains the path for the error. The issue is
that we were checking for the exact path string when sometimes the
string is quoted when the error is constructed, and the escaping in the
quote may not match the path string. Check for both the path string, and
the quoted path string.

Fixes #68737

Change-Id: I01bf4e495056e929570bc11bc1f2000ce6d2802b
Reviewed-on: https://go-review.googlesource.com/c/go/+/603475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
8 months agoos: remove non-constant format string in t.Errorf call
Tim King [Tue, 6 Aug 2024 17:06:39 +0000 (10:06 -0700)]
os: remove non-constant format string in t.Errorf call

Fixes #68744

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

8 months agocmd/internal/objabi, cmd/link/internal: add new relocations used in internal linking
limeidan [Wed, 10 Jan 2024 02:49:52 +0000 (10:49 +0800)]
cmd/internal/objabi, cmd/link/internal: add new relocations used in internal linking

Change-Id: I1b7c258f0ea3b847a92ccd6644b653e11e7a5ef0
Reviewed-on: https://go-review.googlesource.com/c/go/+/555115
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>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
8 months agocmd/internal/obj: minor refactor of wasmimport code
Cherry Mui [Mon, 5 Aug 2024 17:40:18 +0000 (13:40 -0400)]
cmd/internal/obj: minor refactor of wasmimport code

This CL does some minor refactoring of the code handling
wasmimport.
- Put the WasmImport aux reading and writing code together for
  symmetry.
- Define WasmFuncType, embedded in WasmImport. WasmFuncType could
  also be used (later) for wasmexport.
- Move code generation code to a separate function. The containing
  function is already pretty large.
- Simplify linker code a little bit. The loader convention is to
  return the 0 Sym for nonexistent symbol, instead of a separate
  boolean.

No change in generated code. Passes toolstash -cmp
(GOARCH=wasm GOOS=wasip1 go build -toolexec "toolstash -cmp" -a std cmd).

Change-Id: Idc2514f84a08621333841ae4034b81130e0ce411
Reviewed-on: https://go-review.googlesource.com/c/go/+/603135
Reviewed-by: Than McIntosh <thanm@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
8 months agomaps: add examples for All, Keys, Values, Insert, and Collect functions
aimuz [Mon, 5 Aug 2024 03:14:45 +0000 (03:14 +0000)]
maps: add examples for All, Keys, Values, Insert, and Collect functions

Change-Id: I4ee61bea9997b822aa1ec2cc3d01b4db5f101e4c
GitHub-Last-Rev: d88282a92ec86721356696108898e06924ec89c9
GitHub-Pull-Request: golang/go#68696
Reviewed-on: https://go-review.googlesource.com/c/go/+/602315
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@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/internal/boring: use internal/byteorder
Mateusz Poliwczak [Sat, 3 Aug 2024 07:51:45 +0000 (07:51 +0000)]
crypto/internal/boring: use internal/byteorder

Change-Id: I882dd4160fb24b1d605af28bca01227716dac717
GitHub-Last-Rev: c631b19068aa95dcebed29a9a68cda5644a973b8
GitHub-Pull-Request: golang/go#68697
Reviewed-on: https://go-review.googlesource.com/c/go/+/602179
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Zxilly Chou <zxilly@outlook.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agointernal/bytealg: optimize Equal for arm64 target
Vasily Leonenko [Tue, 23 Jul 2024 20:23:33 +0000 (23:23 +0300)]
internal/bytealg: optimize Equal for arm64 target

Remove redundant intermediate jump in runtime.memequal
Remove redundant a.ptr==b.ptr check in runtime.memequal_varlen
Add 16-bytes alignment before some labels in runtime.memequal

goos: linux
goarch: arm64
pkg: bytes
                                │ ./master.log │              ./opt.log              │
                                │    sec/op    │    sec/op     vs base               │
Equal/0-4                         0.8342n ± 0%   0.5254n ± 3%  -37.01% (p=0.000 n=8)
Equal/same/1-4                     2.720n ± 0%    2.720n ± 2%        ~ (p=0.779 n=8)
Equal/same/6-4                     2.720n ± 5%    2.720n ± 2%        ~ (p=0.908 n=8)
Equal/same/9-4                     2.722n ± 2%    2.721n ± 2%        ~ (p=0.779 n=8)
Equal/same/15-4                    2.719n ± 0%    2.719n ± 0%        ~ (p=0.641 n=8)
Equal/same/16-4                    2.721n ± 2%    2.719n ± 0%   -0.07% (p=0.014 n=8)
Equal/same/20-4                    2.720n ± 0%    2.721n ± 2%        ~ (p=0.236 n=8)
Equal/same/32-4                    2.720n ± 1%    2.720n ± 0%        ~ (p=0.396 n=8)
Equal/same/4K-4                    2.719n ± 0%    2.720n ± 0%        ~ (p=0.663 n=8)
Equal/same/4M-4                    2.721n ± 0%    2.720n ± 0%        ~ (p=0.075 n=8)
Equal/same/64M-4                   2.720n ± 0%    2.720n ± 2%        ~ (p=0.806 n=8)
Equal/1-4                          6.671n ± 0%    5.449n ± 0%  -18.33% (p=0.000 n=8)
Equal/6-4                          8.761n ± 2%    7.508n ± 0%  -14.30% (p=0.000 n=8)
Equal/9-4                          8.343n ± 0%    7.091n ± 0%  -15.01% (p=0.000 n=8)
Equal/15-4                         8.339n ± 2%    7.090n ± 0%  -14.98% (p=0.000 n=8)
Equal/16-4                         9.173n ± 0%    7.925n ± 2%  -13.61% (p=0.000 n=8)
Equal/20-4                         11.26n ± 0%    10.01n ± 0%  -11.10% (p=0.000 n=8)
Equal/32-4                        10.425n ± 0%    9.176n ± 0%  -11.98% (p=0.000 n=8)
Equal/4K-4                         192.9n ± 0%    192.7n ± 0%   -0.10% (p=0.044 n=8)
Equal/4M-4                         191.3µ ± 0%    191.3µ ± 0%        ~ (p=0.798 n=8)
Equal/64M-4                        3.066m ± 2%    3.065m ± 0%        ~ (p=0.083 n=8)
EqualBothUnaligned/64_0-4          7.506n ± 2%    7.090n ± 2%   -5.55% (p=0.000 n=8)
EqualBothUnaligned/64_1-4          7.850n ± 1%    7.423n ± 0%   -5.43% (p=0.000 n=8)
EqualBothUnaligned/64_4-4          7.505n ± 0%    7.088n ± 0%   -5.56% (p=0.000 n=8)
EqualBothUnaligned/64_7-4          7.840n ± 0%    7.413n ± 0%   -5.44% (p=0.000 n=8)
EqualBothUnaligned/4096_0-4        193.0n ± 4%    190.9n ± 0%   -1.09% (p=0.004 n=8)
EqualBothUnaligned/4096_1-4        223.9n ± 0%    223.1n ± 0%   -0.36% (p=0.000 n=8)
EqualBothUnaligned/4096_4-4        191.9n ± 2%    191.5n ± 0%   -0.21% (p=0.004 n=8)
EqualBothUnaligned/4096_7-4        223.8n ± 0%    223.1n ± 1%        ~ (p=0.098 n=8)
EqualBothUnaligned/4194304_0-4     191.8µ ± 0%    191.8µ ± 0%        ~ (p=0.504 n=8)
EqualBothUnaligned/4194304_1-4     225.4µ ± 2%    225.5µ ± 0%        ~ (p=0.065 n=8)
EqualBothUnaligned/4194304_4-4     192.6µ ± 0%    192.7µ ± 2%   +0.06% (p=0.041 n=8)
EqualBothUnaligned/4194304_7-4     225.4µ ± 0%    225.5µ ± 0%   +0.05% (p=0.050 n=8)
EqualBothUnaligned/67108864_0-4    3.069m ± 0%    3.069m ± 0%        ~ (p=0.314 n=8)
EqualBothUnaligned/67108864_1-4    3.589m ± 0%    3.588m ± 0%        ~ (p=0.959 n=8)
EqualBothUnaligned/67108864_4-4    3.083m ± 0%    3.083m ± 2%        ~ (p=0.505 n=8)
EqualBothUnaligned/67108864_7-4    3.588m ± 0%    3.588m ± 0%        ~ (p=1.000 n=8)
geomean                            199.9n         190.5n        -4.70%

Change-Id: Ib8d0d4006dd39162a600ac98a5f44a0f05136ed3
Reviewed-on: https://go-review.googlesource.com/c/go/+/601135
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Keith Randall <khr@google.com>
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>

8 months agotest: add test that caused gofrontend to crash
Ian Lance Taylor [Mon, 5 Aug 2024 18:54:51 +0000 (11:54 -0700)]
test: add test that caused gofrontend to crash

Apparently people don't tend to pass untyped constant expressions
to panic.

For #68734

Change-Id: I6fff8137a0f001391de9e61860b67026a9db08c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/603096
Reviewed-by: David Chase <drchase@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>
Commit-Queue: Ian Lance Taylor <iant@google.com>

8 months agobytes, strings: replace reflect.DeepEqual and custom eq with slices.Equal in tests
aimuz [Mon, 5 Aug 2024 03:00:42 +0000 (03:00 +0000)]
bytes, strings: replace reflect.DeepEqual and custom eq with slices.Equal in tests

Change-Id: I016672af79d49a00ddc2d0449cdaac61e98b4ba0
GitHub-Last-Rev: 38d15d9a03e5bd29e4b25f1d767e40cf7165a7a6
GitHub-Pull-Request: golang/go#68730
Reviewed-on: https://go-review.googlesource.com/c/go/+/602698
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
8 months agocmd/internal/testdir: fix failure when GOAMD64=v3 is specified in goenv file
khr@golang.org [Mon, 22 Jul 2024 20:27:09 +0000 (13:27 -0700)]
cmd/internal/testdir: fix failure when GOAMD64=v3 is specified in goenv file

Fixes #68548

Add GOENV=off, GOFLAGS= to the build of the stdlib, so that it matches
what runcmd does. This ensures that the runtime and the test are built
with the same flags. As opposed to before this CL, where flags were used
in the stdlib build but not the runcmd build.

(Part of the problem here is that cmd/internal/testdir/testdir_test.go
plays fast and loose with the build cache to make the tests run faster.
Maybe some of that fast-and-loose mechanism can be removed now that we
have a better build cache? I'm not sure.)

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

9 months agocmd/internal/obj/loong64: add FLDX,FSTX,LDX.STX instructions support
Guoqi Chen [Thu, 23 May 2024 05:43:20 +0000 (13:43 +0800)]
cmd/internal/obj/loong64: add FLDX,FSTX,LDX.STX instructions support

The LDX.{B,BU,H,HU,W,WU,D},STX.{B,H,W,D}, FLDX.{S,D}, FSTX.{S,D} instruction
on Loong64 implements memory access operations using register offset

Go asm syntax:
MOV{B,BU,H,HU,W,WU,V} (RJ)(RK), RD
MOV{B,H,W,V} RD, (RJ)(RK)
MOV{F,D} (RJ)(RK), FD
MOV{F,D} FD, (RJ)(RK)

Equivalent platform assembler syntax:
        ldx.{b,bu,h,hu,w,wu,d} rd, rj, rk
        stx.{b,h,w,d} rd, rj, rk
        fldx.{s,d} fd, rj, rk
        fstx.{s,d} fd, rj, rk

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

Change-Id: Ic7d13bf45dab8342f034b6469465e6337a087144
Reviewed-on: https://go-review.googlesource.com/c/go/+/588215
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>

9 months agocmd/internal/obj/loong64: add support for instructions FTINT{RM/RP/RZ/RNE}.{W/L}...
Xiaolin Zhao [Thu, 6 Jun 2024 06:25:38 +0000 (14:25 +0800)]
cmd/internal/obj/loong64: add support for instructions FTINT{RM/RP/RZ/RNE}.{W/L}.{S/D}

These instructions convert floating-point numbers to fixed-point numbers
with the specified rounding pattern.

Go asm syntax:
            FTINT{RM/RP/RZ/RNE}{W/V}{F/D} FJ, FD

Equivalent platform assembler syntax:
            ftint{rm/rp/rz/rne}.{w/l}.{s/d} fd, fj

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

Change-Id: I6d650d1b48b10296d01a98fadf9d806206f9b96e
Reviewed-on: https://go-review.googlesource.com/c/go/+/590995
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
9 months agocmd/internal/obj/loong64: add support for instructions FFINT.{S/D}.{W/L} and FTINT...
Xiaolin Zhao [Thu, 6 Jun 2024 08:06:39 +0000 (16:06 +0800)]
cmd/internal/obj/loong64: add support for instructions FFINT.{S/D}.{W/L} and FTINT.{W/L}.{S/D}

Go asm syntax:
FFINT{F/D}{W/V} FJ, FD
FTINT{W/V}{F/D} FJ, FD

Equivalent platform assembler syntax:
ffint.{s/d}.{w/l} fd, fj
ftint.{w/l}.{s/d} fd, fj

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

Change-Id: Ie7646c5d49645c63b274b34b66539f10370f4930
Reviewed-on: https://go-review.googlesource.com/c/go/+/590996
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

9 months agocmd/internal/obj/loong64: add support for instructions FCOPYSIGN.{S/D} and FCLASS...
Xiaolin Zhao [Wed, 5 Jun 2024 02:52:08 +0000 (10:52 +0800)]
cmd/internal/obj/loong64: add support for instructions FCOPYSIGN.{S/D} and FCLASS.{S/D}

Go asm syntax:
FCOPYSG{F/D} FK, FJ, FD
FCLASSF{F/D} FJ, FD

Equivalent platform assembler syntax:
fcopysign.{s/d} fd, fj, fk
fclass.{s/d} fd, fj

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

Change-Id: Ied34b71c9d0b34456ac5782a59d29d2d0229e326
Reviewed-on: https://go-review.googlesource.com/c/go/+/590675
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

9 months agotime: restore support for large negative days in Date
Ian Lance Taylor [Fri, 2 Aug 2024 18:33:34 +0000 (11:33 -0700)]
time: restore support for large negative days in Date

CL 586257 converted days to uint32 which is usually fine but fails for
negative days close to cycle boundaries.

Fixes #68718

Change-Id: I8dc5b8fe0c7c1921beb204da1913b9a1ab39280d
Reviewed-on: https://go-review.googlesource.com/c/go/+/602815
Reviewed-by: Rob Pike <r@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

9 months agoarchive/zip,cmd/compile: simplify the split function
apocelipes [Fri, 2 Aug 2024 11:33:30 +0000 (11:33 +0000)]
archive/zip,cmd/compile: simplify the split function

Use strings to simplify the code.

This is a follow-up for the CL 586715.

Change-Id: I9e5470ec271e8af1ad4ddbb5f01f43a8a4879557
GitHub-Last-Rev: b95d6179781053ea8ec9fc8ad2e18607fd35c5bb
GitHub-Pull-Request: golang/go#68713
Reviewed-on: https://go-review.googlesource.com/c/go/+/602697
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
9 months agomime: add available godoc link
pgxiaolianzi [Fri, 2 Aug 2024 14:50:23 +0000 (14:50 +0000)]
mime: add available godoc link

Change-Id: Ic5454758c87e9f84a829aed8a72b5ad977878585
GitHub-Last-Rev: 2eb8ced71286a3bc3b53b35c809164b07ef28a16
GitHub-Pull-Request: golang/go#68605
Reviewed-on: https://go-review.googlesource.com/c/go/+/601295
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

9 months agoruntime: benchmark mutex handoffs
Rhys Hiltner [Wed, 31 Jul 2024 20:45:53 +0000 (13:45 -0700)]
runtime: benchmark mutex handoffs

The speed of handing off a mutex to a waiting thread is sensitive to the
configuration of the spinning section of lock2. Measure that latency
directly, to complement our existing benchmarks of mutex throughput.

For #68578

Change-Id: I7637684bcff62eb05cc008491f095f653d13af4b
Reviewed-on: https://go-review.googlesource.com/c/go/+/602176
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Rhys Hiltner <rhys.hiltner@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

9 months agocrypto/tls: fix testHandshake close flakes
Filippo Valsorda [Thu, 1 Aug 2024 21:41:13 +0000 (23:41 +0200)]
crypto/tls: fix testHandshake close flakes

The flakes were introduced by me in CL 586655. It's unclear why only
FreeBSD seems affected, maybe other TCP stacks handle sending on a
half-closed connection differently, or aren't as quick to propagate the
RST over localhost.

Fixes #68155

Change-Id: I32a1b474a7d6531dbab93910c23568b867629e8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/602615
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

9 months agoos: clarify Rename docs for renaming to a directory
Ian Lance Taylor [Thu, 1 Aug 2024 03:35:47 +0000 (20:35 -0700)]
os: clarify Rename docs for renaming to a directory

Fixes #68690

Change-Id: Iebc27d5f385d787e568550a863f59f16c7a79fd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/602178
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Rob Pike <r@golang.org>
9 months agocmd/compile,runtime: disable swissmap fast variants
Michael Pratt [Mon, 22 Apr 2024 18:17:35 +0000 (14:17 -0400)]
cmd/compile,runtime: disable swissmap fast variants

Temporary measure to reduce the required MVP code.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: I44dc8acd0dc8280c6beb40451998e84bc85c238a
Reviewed-on: https://go-review.googlesource.com/c/go/+/580915
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
9 months agoall: split old and swiss map abi and compiler integration
Michael Pratt [Fri, 19 Apr 2024 17:52:31 +0000 (13:52 -0400)]
all: split old and swiss map abi and compiler integration

The two map implementations are still identical, but now the compiler
targets the appropriate ABI depending on GOEXPERIMENT.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-linux-amd64-longtest-swissmap
Change-Id: I8438f64f044ba9de30ddbf2b8ceb9b4edd2d5614
Reviewed-on: https://go-review.googlesource.com/c/go/+/580779
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>

9 months agoall: create swissmap experiment and fork files
Michael Pratt [Fri, 19 Apr 2024 15:46:54 +0000 (11:46 -0400)]
all: create swissmap experiment and fork files

The _swiss.go files are identical to the originals (except build tag).
Later CLs will change them.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: I9943e2d6f1cfa227ffbf27c9ddc9ce853695d225
Reviewed-on: https://go-review.googlesource.com/c/go/+/580778
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
Commit-Queue: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
9 months agocrypto/internal/cryptotest: add tests for the cipher.Stream interface
Manuel Sabin [Thu, 27 Jun 2024 19:06:55 +0000 (15:06 -0400)]
crypto/internal/cryptotest: add tests for the cipher.Stream interface

This CL creates tests for the cipher.Stream interface in the new
cryptotest package.  This set of tests is called from the tests of
implementations of the Stream interface e.g. ctr_test.go, ofb_test.go,
rc4_test.go, etc.

Updates #25309

Change-Id: I57204ef9f4c0ec09b94e88466deb03c6715e411d
Reviewed-on: https://go-review.googlesource.com/c/go/+/595564
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Russell Webb <russell.webb@protonmail.com>
9 months agocmd/internal/obj/loong64: adjust the order of class names
limeidan [Fri, 12 Jan 2024 02:46:57 +0000 (10:46 +0800)]
cmd/internal/obj/loong64: adjust the order of class names

Change-Id: I0ff9a4f7b4758f44eaedfd821ad80a86b58e55a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/565625
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>