62911 Commits

Author SHA1 Message Date
Michael Anthony Knyszek
1b40dbce1a runtime: mark and scan small objects in whole spans [green tea]
Our current parallel mark algorithm suffers from frequent stalls on
memory since its access pattern is essentially random. Small objects
are the worst offenders, since each one forces pulling in at least one
full cache line to access even when the amount to be scanned is far
smaller than that. Each object also requires an independent access to
per-object metadata.

The purpose of this change is to improve garbage collector performance
by scanning small objects in batches to obtain better cache locality
than our current approach. The core idea behind this change is to defer
marking and scanning small objects, and then scan them in batches
localized to a span.

This change adds scanned bits to each small object (<=512 bytes) span in
addition to mark bits. The scanned bits indicate that the object has
been scanned. (One way to think of them is "grey" bits and "black" bits
in the tri-color mark-sweep abstraction.) Each of these spans is always
8 KiB and if they contain pointers, the pointer/scalar data is already
packed together at the end of the span, allowing us to further optimize
the mark algorithm for this specific case.

When the GC encounters a pointer, it first checks if it points into a
small object span. If so, it is first marked in the mark bits, and then
the object is queued on a work-stealing P-local queue. This object
represents the whole span, and we ensure that a span can only appear at
most once in any queue by maintaining an atomic ownership bit for each
span. Later, when the pointer is dequeued, we scan every object with a
set mark that doesn't have a corresponding scanned bit. If it turns out
that was the only object in the mark bits since the last time we scanned
the span, we scan just that object directly, essentially falling back to
the existing algorithm. noscan objects have no scan work, so they are
never queued.

Each span's mark and scanned bits are co-located together at the end of
the span. Since the span is always 8 KiB in size, it can be found with
simple pointer arithmetic. Next to the marks and scans we also store the
size class, eliminating the need to access the span's mspan altogether.

The work-stealing P-local queue is a new source of GC work. If this
queue gets full, half of it is dumped to a global linked list of spans
to scan. The regular scan queues are always prioritized over this queue
to allow time for darts to accumulate. Stealing work from other Ps is a
last resort.

This change also adds a new debug mode under GODEBUG=gctrace=2 that
dumps whole-span scanning statistics by size class on every GC cycle.

A future extension to this CL is to use SIMD-accelerated scanning
kernels for scanning spans with high mark bit density.

For #19112. (Deadlock averted in GOEXPERIMENT.)
For #73581.

Change-Id: I4bbb4e36f376950a53e61aaaae157ce842c341bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/658036
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-02 10:28:07 -07:00
Dmitri Shuralyov
f760e1fe49 cmd/api: skip 3 non-TestCheck tests in -check mode
TestIssue64958 takes a while, so it's not worth running both without
and with -check flag. The others are fast, but there's still no good
reason to run anything but TestCheck when the -check flag is on.

Change-Id: I13ebb90e3c863006f21441909b05364e1b316ed6
Reviewed-on: https://go-review.googlesource.com/c/go/+/668656
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2025-05-02 10:06:27 -07:00
Joel Sing
1cc624fd62 cmd/internal/obj/riscv: add support for vector permutation instructions
Add support for vector permutation instructions to the RISC-V assembler.
This includes integer scalar move, floating point scalar move, slide up
and slide down, register gather, compression and whole vector register
move instructions.

Change-Id: I1da9f393091504fd81714006355725b8b9ecadea
Reviewed-on: https://go-review.googlesource.com/c/go/+/646780
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
2025-05-02 04:24:52 -07:00
Joel Sing
936ecc3e24 cmd/internal/obj/riscv: add support for vector mask instructions
Add support for vector mask instructions to the RISC-V assembler.
These allow manipulation of vector masks and include mask register
logical instructions, population count and find-first bit set
instructions.

Change-Id: I3ab3aa0f918338aee9b37ac5a2b2fdc407875072
Reviewed-on: https://go-review.googlesource.com/c/go/+/646779
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-05-02 04:24:40 -07:00
Joel Sing
2e60916f6e cmd/internal/obj/riscv: add support for vector reduction instructions
Add support for vector reduction instructions to the RISC-V assembler,
including single-width integer reduction, widening integer reduction,
single-width floating-point reduction and widening floating-point
reduction.

Change-Id: I8f17bef11389f3a017e0430275023fc5d75936e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/646778
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-05-02 04:24:27 -07:00
Josh Rickmar
7785528c50 os: fix Root.Mkdir permission bits on OpenBSD
Pass missing mode bits in the mkdirat() syscall wrapper.

Fixes #73559

Change-Id: I54b1985bd77b1fe5d1a48acab9f2597f8c931854
GitHub-Last-Rev: 669c17361d86bc9065bb6b47a2d60aa86bcfa12d
GitHub-Pull-Request: golang/go#73565
Reviewed-on: https://go-review.googlesource.com/c/go/+/669375
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2025-05-01 16:36:58 -07:00
Alan Donovan
9921537a96 sync: WaitGroup.Go: document that f must not panic
Fixes #63796

Change-Id: Ib11d32574011e13aab3a0ad504f0d10009627503
Reviewed-on: https://go-review.googlesource.com/c/go/+/667695
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2025-05-01 12:34:03 -07:00
Keith Randall
12110c3f7e cmd/compile: improve multiplication strength reduction
Use an automatic algorithm to generate strength reduction code.
You give it all the linear combination (a*x+b*y) instructions in your
architecture, it figures out the rest.

Just amd64 and arm64 for now.

Fixes #67575

Change-Id: I35c69382bebb1d2abf4bb4e7c43fd8548c6c59a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/626998
Reviewed-by: Jakub Ciolek <jakub@ciolek.dev>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-01 09:33:31 -07:00
Joel Sing
4d10d4ad84 cmd/compile,internal/cpu,runtime: intrinsify math/bits.OnesCount on riscv64
For riscv64/rva22u64 and above, we can intrinsify math/bits.OnesCount
using the CPOP/CPOPW machine instructions. Since the native Go
implementation of OnesCount is relatively expensive, it is also
worth emitting a check for Zbb support when compiled for rva20u64.

On a Banana Pi F3, with GORISCV64=rva22u64:

              │     oc.1     │                oc.2                 │
              │    sec/op    │   sec/op     vs base                │
OnesCount-8     16.930n ± 0%   4.389n ± 0%  -74.08% (p=0.000 n=10)
OnesCount8-8     5.642n ± 0%   5.016n ± 0%  -11.10% (p=0.000 n=10)
OnesCount16-8    9.404n ± 0%   5.015n ± 0%  -46.67% (p=0.000 n=10)
OnesCount32-8   13.165n ± 0%   4.388n ± 0%  -66.67% (p=0.000 n=10)
OnesCount64-8   16.300n ± 0%   4.388n ± 0%  -73.08% (p=0.000 n=10)
geomean          11.40n        4.629n       -59.40%

On a Banana Pi F3, compiled with GORISCV64=rva20u64 and with Zbb
detection enabled:

              │     oc.3     │                oc.4                 │
              │    sec/op    │   sec/op     vs base                │
OnesCount-8     16.930n ± 0%   5.643n ± 0%  -66.67% (p=0.000 n=10)
OnesCount8-8     5.642n ± 0%   5.642n ± 0%        ~ (p=0.447 n=10)
OnesCount16-8   10.030n ± 0%   6.896n ± 0%  -31.25% (p=0.000 n=10)
OnesCount32-8   13.170n ± 0%   5.642n ± 0%  -57.16% (p=0.000 n=10)
OnesCount64-8   16.300n ± 0%   5.642n ± 0%  -65.39% (p=0.000 n=10)
geomean          11.55n        5.873n       -49.16%

On a Banana Pi F3, compiled with GORISCV64=rva20u64 but with Zbb
detection disabled:

              │    oc.3     │                oc.5                 │
              │   sec/op    │   sec/op     vs base                │
OnesCount-8     16.93n ± 0%   29.47n ± 0%  +74.07% (p=0.000 n=10)
OnesCount8-8    5.642n ± 0%   5.643n ± 0%        ~ (p=0.191 n=10)
OnesCount16-8   10.03n ± 0%   15.05n ± 0%  +50.05% (p=0.000 n=10)
OnesCount32-8   13.17n ± 0%   18.18n ± 0%  +38.04% (p=0.000 n=10)
OnesCount64-8   16.30n ± 0%   21.94n ± 0%  +34.60% (p=0.000 n=10)
geomean         11.55n        15.84n       +37.16%

For hardware without Zbb, this adds ~5ns overhead, while for hardware
with Zbb we achieve a performance gain up of up to 11ns. It is worth
noting that OnesCount8 is cheap enough that it is preferable to stick
with the generic version in this case.

Change-Id: Id657e40e0dd1b1ab8cc0fe0f8a68df4c9f2d7da5
Reviewed-on: https://go-review.googlesource.com/c/go/+/660856
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-01 05:57:41 -07:00
Joel Sing
90e8b8cdae cmd/compile: intrinsify math/bits.Bswap on riscv64
For riscv64/rva22u64 and above, we can intrinsify math/bits.Bswap
using the REV8 machine instruction.

On a StarFive VisionFive 2 with GORISCV64=rva22u64:

                 │     rb.1     │                rb.2                 │
                 │    sec/op    │   sec/op     vs base                │
ReverseBytes-4     18.790n ± 0%   4.026n ± 0%  -78.57% (p=0.000 n=10)
ReverseBytes16-4    6.710n ± 0%   5.368n ± 0%  -20.00% (p=0.000 n=10)
ReverseBytes32-4   13.420n ± 0%   5.368n ± 0%  -60.00% (p=0.000 n=10)
ReverseBytes64-4   17.450n ± 0%   4.026n ± 0%  -76.93% (p=0.000 n=10)
geomean             13.11n        4.649n       -64.54%

Change-Id: I26eee34270b1721f7304bb1cddb0fda129b20ece
Reviewed-on: https://go-review.googlesource.com/c/go/+/660855
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-05-01 05:57:13 -07:00
Joel Sing
6fc1e34100 internal/bytealg: deduplicate code between Count/CountString for riscv64
Change-Id: I22eb4e7444e5fe5f6767cc960895f3c6e2fa13cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/661615
Reviewed-by: 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: Carlos Amedee <carlos@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-05-01 05:56:26 -07:00
Joel Sing
5a342266e6 cmd/internal/obj/riscv: add support for vector floating-point instructions
Add support for vector floating-point instructions to the RISC-V
assembler. This includes single-width and widening addition and
subtraction, multiplication and division, fused multiply-addition,
comparison, min/max, sign-injection, classification and type
conversion instructions.

Change-Id: I8bceb1c5d7eead0561ba5407ace00805a6144f51
Reviewed-on: https://go-review.googlesource.com/c/go/+/646777
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
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>
2025-05-01 05:55:31 -07:00
Julian Zhu
6109185cf9 math/big: fix incorrect register allocation for mipsx/mips64x
According to the MIPS ABI, R26/R27 are reserved for OS kernel, and may be clobbered by it. They must not be used by user mode.

See Figure 3-18 of MIPS ELF ABI specification: https://refspecs.linuxfoundation.org/elf/mipsabi.pdf

Fixes #73472

Change-Id: Ifda692a803176bfaab2c70d6623636c5d135f42e
Reviewed-on: https://go-review.googlesource.com/c/go/+/667816
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-05-01 05:04:39 -07:00
Dmitri Shuralyov
b48e52b428 cmd/dist: move "devel" substring in git-inferred development version
Keep the property that the "devel" substring is always present in these
development versions of Go, but also gain the property that it's viable
to use functions in the go/version package such as Lang, Compare, and
get the expected results without needing to trim the "devel " prefix.

For #73369.
For #41116.
Fixes #73372.

Change-Id: Ieea4692e8c6cf0135e010f49f85300f6b038d6b1
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/668015
Reviewed-by: Funda Secgin <fundasecgin30@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-04-30 12:54:52 -07:00
Mark Ryan
12e5efd710 cmd/link: fix cgo on riscv64 when building with gcc-15
It's not currently possible to build cgo programs that are partially
compiled with gcc-15 on riscv64 using the internal linker. There are
two reasons for this.

1. When gcc-15 compiles _cgo_export.c, which contains no actual code,
   for a riscv64 target, it emits a label in the .text section called
   .Letext0. This label is referred to by another section, .debug_line,
   and an entry is generated in the symbol table for it. The Go linker
   panics when processing the .Letext0 symbol in _cgo_export.o, as it
   occurs in an empty section.
2. GCC-15 is generating additional debug symbols with the .LVUS
   prefix, e.g., .LVUS33, that need to be ignored.

We fix the issue by removing the check in
cmd/link/internal/loader/loader.go that panics if we encounter a
symbol in an empty section (the comments preceding this check suggest
it's safe to remove it) and by adding .LVUS to the list of symbol
prefixes to ignore.

Fixes #72840

Change-Id: I00658b6bdd01606dde1581b5bc2f42edfc37de82
Reviewed-on: https://go-review.googlesource.com/c/go/+/668276
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
2025-04-30 11:40:17 -07:00
Dmitri Shuralyov
214b208e24 cmd/go, cmd/internal/objabi: detect "devel" version by substring
These were the remaining instances in the main Go repo I found where a
Go version like "devel go1.25-9ce47e66e8 Wed Mar 26 03:48:50 2025 -0700"
is considered to be a development version rather than a release version,
but the version "go1.25-devel_9ce47e66e8 Wed Mar 26 03:48:50 2025 -0700"
is not.

Update this in preparation of the move of "devel" from front to middle.

For #73372.
For #73369.

Change-Id: If5442ecb0751c08b3a1b4d1148193e501700b956
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/668355
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-04-30 11:07:24 -07:00
qmuntal
3cebfb678b os: test overlapped pipes deadlines on Windows
NewFile recently added support for overlapped I/O on Windows,
which allows us to set deadlines on them, but the test coverage for
this new feature is not exhaustive.

Modify the existing pipe deadline tests to also exercise named
overlapped pipes.

Updates #19098.

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-race,gotip-windows-amd64-longtest,gotip-windows-arm64
Change-Id: I86d284d9fb054c24959045a922cf84feeda5b5f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/668095
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-04-30 08:49:12 -07:00
Jake Bailey
06751c455d syscall: cache Errno.Error() on Windows
Windows is unlike the other OSs and depends on a syscall for most
errors. This can be costly; cache the returned string for later reuse.

This helps test caching, since errors are written out as string to the
test ID, which are often PathErrors wrapping Errnos.

For now, only cache ERROR_FILE_NOT_FOUND and ERROR_PATH_NOT_FOUND.

goos: windows
goarch: amd64
pkg: syscall
cpu: Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
               │    old.txt    │               new.txt               │
               │    sec/op     │   sec/op     vs base                │
ErrnoString-20   1788.00n ± 1%   11.08n ± 1%  -99.38% (p=0.000 n=10)

               │  old.txt   │              new.txt               │
               │    B/op    │   B/op     vs base                 │
ErrnoString-20   48.00 ± 0%   0.00 ± 0%  -100.00% (p=0.000 n=10)

               │  old.txt   │               new.txt               │
               │ allocs/op  │ allocs/op   vs base                 │
ErrnoString-20   1.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=10)

For #72992

Change-Id: I9a0910fa6538772ffc64ef7670b44059a2c7d18c
Reviewed-on: https://go-review.googlesource.com/c/go/+/667495
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>
2025-04-30 08:41:56 -07:00
qmuntal
c966f1c0c0 net: support IPv6 addresses in ListenMulticastUDP on Windows
Fixes #63529.

Change-Id: Id9246af1a72beef3149af571f0891437bba2f4e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/668216
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2025-04-30 08:34:01 -07:00
Sean Liao
8270b858ee testing: use more doc links
Change-Id: Ide372735165b7510fd8d7588451a37fa743e59c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/668915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-04-30 08:21:07 -07:00
Jakub Ciolek
1e756dc5f7 cmd/compile: relax tighten register-pressure heuristic slightly
Sometimes a value has multiple args, but they are the same
dependency. Relax the regalloc heuristic for those.

No measurable compile-time regression according to compilebench,
maybe even a small improvement.

name    old time/op  new time/op  delta
StdCmd   14.4s ± 1%   14.4s ± 1%  -0.39%  (p=0.101 n=11+11)

compilecmp:

linux/amd64:

strconv
strconv.formatBits 1199 -> 1189  (-0.83%)
strconv.formatDecimal 637 -> 631  (-0.94%)

strconv [cmd/compile]
strconv.formatBits 1199 -> 1189  (-0.83%)
strconv.formatDecimal 637 -> 631  (-0.94%)

image
image.NewGray16 286 -> 275  (-3.85%)
image.NewAlpha16 286 -> 275  (-3.85%)

regexp/syntax
regexp/syntax.ranges.Less 150 -> 147  (-2.00%)
regexp/syntax.(*compiler).rune 774 -> 773  (-0.13%)
regexp/syntax.(*ranges).Swap 197 -> 180  (-8.63%)
regexp/syntax.ranges.Swap 146 -> 134  (-8.22%)
regexp/syntax.(*compiler).cap 440 -> 425  (-3.41%)
regexp/syntax.(*compiler).nop 310 -> 297  (-4.19%)
regexp/syntax.(*compiler).compile 5815 -> 5733  (-1.41%)
regexp/syntax.(*ranges).Less 211 -> 197  (-6.64%)

regexp/syntax [cmd/compile]
regexp/syntax.(*compiler).compile 5815 -> 5733  (-1.41%)
regexp/syntax.(*compiler).rune 774 -> 773  (-0.13%)
regexp/syntax.(*compiler).cap 440 -> 425  (-3.41%)
regexp/syntax.(*ranges).Less 211 -> 197  (-6.64%)
regexp/syntax.ranges.Swap 146 -> 134  (-8.22%)
regexp/syntax.(*ranges).Swap 197 -> 180  (-8.63%)
regexp/syntax.(*compiler).nop 310 -> 297  (-4.19%)
regexp/syntax.ranges.Less 150 -> 147  (-2.00%)

crypto/elliptic
crypto/elliptic.(*nistCurve[go.shape.*uint8]).pointFromAffine 1272 -> 1240  (-2.52%)

image/gif
image/gif.(*decoder).readColorTable 652 -> 646  (-0.92%)
image/gif.(*encoder).colorTablesMatch 350 -> 349  (-0.29%)

crypto/internal/cryptotest
crypto/internal/cryptotest.testCipher.func3 1289 -> 1286  (-0.23%)

internal/trace/internal/tracev1
internal/trace/internal/tracev1.(*parser).collectBatchesAndCPUSamples 1352 -> 1338  (-1.04%)

internal/fuzz
internal/fuzz.byteSliceDuplicateBytes 741 -> 718  (-3.10%)

cmd/compile/internal/types
cmd/compile/internal/types.CalcSize 3663 -> 3633  (-0.82%)

cmd/compile/internal/rttype
cmd/compile/internal/rttype.Init 2149 -> 2124  (-1.16%)

cmd/link/internal/loadmacho
cmd/link/internal/loadmacho.macholoadsym 1213 -> 1212  (-0.08%)

cmd/compile/internal/rangefunc
cmd/compile/internal/rangefunc.(*rewriter).checks 5207 -> 5175  (-0.61%)

net/http
net/http.(*http2SettingsFrame).Setting 155 -> 147  (-5.16%)

cmd/compile/internal/rttype [cmd/compile]
cmd/compile/internal/rttype.Init 2149 -> 2124  (-1.16%)

cmd/compile/internal/rangefunc [cmd/compile]
cmd/compile/internal/rangefunc.(*rewriter).checks 5207 -> 5175  (-0.61%)

cmd/link/internal/ld
cmd/link/internal/ld.pefips 3119 -> 3109  (-0.32%)

cmd/vendor/rsc.io/markdown
cmd/vendor/rsc.io/markdown.parseDash 593 -> 587  (-1.01%)

cmd/compile/internal/ssa
cmd/compile/internal/ssa.(*poset).setOrder 3442 -> 3416  (-0.76%)
cmd/compile/internal/ssa.rewriteValuegeneric_OpMul16 2054 -> 2022  (-1.56%)
cmd/compile/internal/ssa.rewriteValuegeneric_OpMul8 2054 -> 2022  (-1.56%)
inserted cmd/compile/internal/ssa.tighten.deferwrap5

cmd/compile/internal/ssa [cmd/compile]
cmd/compile/internal/ssa.rewriteValuegeneric_OpMul8 2054 -> 2022  (-1.56%)
cmd/compile/internal/ssa.rewriteValuegeneric_OpMul16 2054 -> 2022  (-1.56%)
cmd/compile/internal/ssa.tighten.deferwrap4 76 -> 67  (-11.84%)
cmd/compile/internal/ssa.tighten 6746 -> 5082  (-24.67%)
inserted cmd/compile/internal/ssa.tighten.deferwrap5

file                                             before   after    Δ       %
strconv.s                                        49029    49020    -9      -0.018%
strconv [cmd/compile].s                          49029    49020    -9      -0.018%
image.s                                          34963    34941    -22     -0.063%
regexp/syntax.s                                  83017    82860    -157    -0.189%
regexp/syntax [cmd/compile].s                    83017    82860    -157    -0.189%
crypto/elliptic.s                                26848    26816    -32     -0.119%
image/gif.s                                      22840    22833    -7      -0.031%
crypto/internal/cryptotest.s                     63834    63832    -2      -0.003%
internal/trace/internal/tracev1.s                52995    52981    -14     -0.026%
internal/trace.s                                 181396   181412   +16     +0.009%
internal/fuzz.s                                  85526    85503    -23     -0.027%
cmd/internal/obj/s390x.s                         121651   121683   +32     +0.026%
cmd/internal/obj/ppc64.s                         139867   139871   +4      +0.003%
cmd/compile/internal/types.s                     71425    71395    -30     -0.042%
cmd/internal/obj/ppc64 [cmd/compile].s           139952   139956   +4      +0.003%
cmd/internal/obj/s390x [cmd/compile].s           121753   121785   +32     +0.026%
cmd/compile/internal/rttype.s                    10418    10393    -25     -0.240%
cmd/link/internal/loadmacho.s                    23270    23272    +2      +0.009%
cmd/compile/internal/rangefunc.s                 35050    35018    -32     -0.091%
cmd/vendor/github.com/google/pprof/profile.s     148264   148273   +9      +0.006%
net/http.s                                       612895   612910   +15     +0.002%
cmd/compile/internal/rttype [cmd/compile].s      10397    10372    -25     -0.240%
cmd/compile/internal/rangefunc [cmd/compile].s   35681    35649    -32     -0.090%
net/http/cookiejar.s                             28758    28761    +3      +0.010%
cmd/compile/internal/reflectdata.s               86639    86644    +5      +0.006%
cmd/compile/internal/reflectdata [cmd/compile].s 89725    89730    +5      +0.006%
cmd/link/internal/ld.s                           649596   649633   +37     +0.006%
cmd/vendor/rsc.io/markdown.s                     116731   116757   +26     +0.022%
cmd/compile/internal/ssa.s                       3574185  3574642  +457    +0.013%
cmd/compile/internal/ssa [cmd/compile].s         3725364  3723715  -1649   -0.044%
cmd/compile/internal/ssagen.s                    415135   415155   +20     +0.005%
total                                            36475376 36473818 -1558   -0.004%

linux/arm64:

go/printer
go/printer.(*printer).expr1 7152 -> 7168  (+0.22%)

fmt [cmd/compile]
fmt.(*ss).advance 1712 -> 1696  (-0.93%)

crypto/x509
crypto/x509.marshalCertificatePolicies.func1.2.(*Builder).AddASN1ObjectIdentifier.1 changed

internal/fuzz
internal/fuzz.minimizeBytes changed

cmd/internal/obj/arm64
cmd/internal/obj/arm64.bitconEncode changed

math/big [cmd/compile]
math/big.(*Float).Int64 512 -> 528  (+3.12%)
math/big.NewInt changed
math/big.fmtE 720 -> 736  (+2.22%)
math/big.basicSqr changed

cmd/asm/internal/asm
cmd/asm/internal/asm.(*Parser).asmText 1424 -> 1440  (+1.12%)

go/constant [cmd/compile]
go/constant.UnaryOp changed
go/constant.BinaryOp changed

crypto/tls
crypto/tls.prf10 576 -> 560  (-2.78%)

cmd/internal/obj/arm64 [cmd/compile]
cmd/internal/obj/arm64.bitconEncode changed

cmd/vendor/golang.org/x/term
cmd/vendor/golang.org/x/term.(*Terminal).addKeyToLine changed

cmd/compile/internal/ir
cmd/compile/internal/ir.ConstOverflow changed

cmd/vendor/github.com/google/pprof/internal/graph
cmd/vendor/github.com/google/pprof/internal/graph.(*builder).addEdge changed

cmd/compile/internal/ir [cmd/compile]
cmd/compile/internal/ir.ConstOverflow changed

cmd/compile/internal/rttype
cmd/compile/internal/rttype.Init changed

cmd/compile/internal/rttype [cmd/compile]
cmd/compile/internal/rttype.Init changed

cmd/compile/internal/abi [cmd/compile]
cmd/compile/internal/abi.(*ABIParamAssignment).RegisterTypesAndOffsets 1344 -> 1328  (-1.19%)

cmd/vendor/golang.org/x/tools/go/types/typeutil
cmd/vendor/golang.org/x/tools/go/types/typeutil.hasher.hash changed

cmd/vendor/github.com/ianlancetaylor/demangle
cmd/vendor/github.com/ianlancetaylor/demangle.(*rustState).expandPunycode changed

net/http/cookiejar
net/http/cookiejar.adapt changed
net/http/cookiejar.encode changed

cmd/compile/internal/reflectdata
cmd/compile/internal/reflectdata.OldMapType changed

cmd/compile/internal/reflectdata [cmd/compile]
cmd/compile/internal/reflectdata.OldMapType changed

cmd/vendor/github.com/google/pprof/internal/report
cmd/vendor/github.com/google/pprof/internal/report.(*Report).newTrimmedGraph 2336 -> 2368  (+1.37%)

cmd/link/internal/ld
cmd/link/internal/ld.(*relocSymState).relocsym changed

cmd/vendor/rsc.io/markdown
cmd/vendor/rsc.io/markdown.parseDash changed
cmd/vendor/rsc.io/markdown.parseLinkRefDef changed

cmd/trace
main.(*stackMap).profile 912 -> 880  (-3.51%)

cmd/vendor/golang.org/x/tools/go/analysis/passes/tests
cmd/vendor/golang.org/x/tools/go/analysis/passes/tests.checkExampleOutput 832 -> 816  (-1.92%)

cmd/compile/internal/ssa
cmd/compile/internal/ssa.shouldElimIfElse changed
cmd/compile/internal/ssa.storeOrder changed
cmd/compile/internal/ssa.elimIfElse changed
cmd/compile/internal/ssa.tighten 3408 -> 3456  (+1.41%)

cmd/compile/internal/ssa [cmd/compile]
cmd/compile/internal/ssa.storeOrder changed
cmd/compile/internal/ssa.elimIfElse changed
cmd/compile/internal/ssa.shouldElimIfElse changed
cmd/compile/internal/ssa.tighten 4960 -> 4976  (+0.32%)
cmd/compile/internal/ssa.branchelim changed

file                                                     before   after    Δ       %
runtime.s                                                624064   624032   -32     -0.005%
runtime [cmd/compile].s                                  679456   679424   -32     -0.005%
strconv.s                                                48528    48560    +32     +0.066%
strconv [cmd/compile].s                                  48528    48560    +32     +0.066%
index/suffixarray.s                                      41808    41856    +48     +0.115%
fmt.s                                                    72272    72256    -16     -0.022%
math/big.s                                               152992   153024   +32     +0.021%
go/printer.s                                             77680    77696    +16     +0.021%
fmt [cmd/compile].s                                      81760    81744    -16     -0.020%
math/big [cmd/compile].s                                 153040   153072   +32     +0.021%
cmd/asm/internal/asm.s                                   57360    57376    +16     +0.028%
crypto/tls.s                                             354304   354288   -16     -0.005%
cmd/compile/internal/abi [cmd/compile].s                 22752    22736    -16     -0.070%
cmd/vendor/github.com/google/pprof/internal/report.s     67008    67040    +32     +0.048%
cmd/trace.s                                              215040   215008   -32     -0.015%
cmd/vendor/golang.org/x/tools/go/analysis/passes/tests.s 12544    12528    -16     -0.128%
cmd/compile/internal/ssa.s                               3209248  3209296  +48     +0.001%
cmd/compile/internal/ssa [cmd/compile].s                 3319152  3319168  +16     +0.000%
total                                                    33366288 33366416 +128    +0.000%

Change-Id: I8111792c9dd4f927b49a6d5dd90a3fdc3ec26277
Reviewed-on: https://go-review.googlesource.com/c/go/+/666836
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2025-04-29 07:38:24 -07:00
John Bampton
29595ffeca doc: fix grammar and spelling
Minor typo fixes in the docs

Change-Id: I56b5d0318936aecc7775fb5bc70534456707da49
GitHub-Last-Rev: b4d042f8a997aa0d3824d8f9350dd24090b21073
GitHub-Pull-Request: golang/go#73531
Reviewed-on: https://go-review.googlesource.com/c/go/+/668815
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2025-04-29 07:37:04 -07:00
Guoqi Chen
b386b62852 cmd/internal/obj/loong64: fix the error parameters when calling UnspillRegisterArgs
This bug was introduced in CL 648518.

Fixes #73518.

Change-Id: I4988dd0b636c6a6a48d2aa2e2ae868e43f69995a
Reviewed-on: https://go-review.googlesource.com/c/go/+/668475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-04-28 18:54:08 -07:00
John Bampton
760f22848d crypto/internal/hpke: rename Receipient to Recipient
receipient -> recipient

Change-Id: I9ed5937acf0f3808283e35221f8b4f41408eee7c
GitHub-Last-Rev: 0ed5ff7a46808d5311af3620b6577734a1e557f4
GitHub-Pull-Request: golang/go#73131
Reviewed-on: https://go-review.googlesource.com/c/go/+/662175
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
2025-04-28 18:49:45 -07:00
goto1134
c8b589e266 cmd/list: fix -retracted flag description
Change-Id: Ia1ab220485af2f38c3ddcd4c5d5bca1b195a33ed
GitHub-Last-Rev: fb9933427d852518c93efbc4f2c2e4d4ee9b9197
GitHub-Pull-Request: golang/go#59847
Reviewed-on: https://go-review.googlesource.com/c/go/+/489175
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-04-28 16:51:08 -07:00
Julien Cretel
f9ce1dddc2 mime: speed up ParseMediaType
Add benchmarks for ParseMediaType.

Eschew UTF-8 decoding and strings.IndexFunc where possible, and rely
on 128-bit bitmaps instead. Eliminate some bounds checks.

Some benchmark results (no changes to allocations):

goos: darwin
goarch: amd64
pkg: mime
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
                      │     old     │                 new                 │
                      │   sec/op    │   sec/op     vs base                │
ParseMediaType-8        71.75µ ± 0%   55.53µ ± 0%  -22.60% (p=0.000 n=20)
ParseMediaTypeBogus-8   5.330µ ± 0%   3.603µ ± 0%  -32.41% (p=0.000 n=20)
geomean                 19.56µ        14.14µ       -27.67%

Change-Id: I324c9990fe43581484916ecff61ca6c708467a89
GitHub-Last-Rev: e2293d64b3852722bef920169eaa44e7ded3111c
GitHub-Pull-Request: golang/go#73436
Reviewed-on: https://go-review.googlesource.com/c/go/+/666655
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sean Liao <sean@liao.dev>
2025-04-26 08:01:54 -07:00
Austin Clements
7a2689b152 sync: tidy WaitGroup documentation, add WaitGroup.Go example
This reframes the WaitGroup documentation with Go at its center and
Add/Done as more "advanced" features.

Updates #63796

Change-Id: I8101972626fdb00c6f7fb185b685227823d10db1
Reviewed-on: https://go-review.googlesource.com/c/go/+/662975
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-04-25 15:40:11 -07:00
David du Colombier
9f55e7bc21 runtime: don't read /dev/random on Plan 9
In CL 656755, the readRandom function was modified
to read an integer from /dev/random.

However, on Plan 9, /dev/random can only return
a few hundred bits a second.

The issue is that readRandom is called by randinit,
which is called at the creation of Go processes.

Consequently, it lead the Go programs to be very
slow on Plan 9.

This change reverts the change done in CL 656755
to make the readRandom function always returning 0
on Plan 9.

Change-Id: Ibe1bf7e4c8cbc82998e4f5e1331f5e29a047c4fc
Cq-Include-Trybots: luci.golang.try:gotip-plan9-arm

Reviewed-on: https://go-review.googlesource.com/c/go/+/663195
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Richard Miller <millerresearch@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-04-25 14:43:43 -07:00
Dmitri Shuralyov
eb55b985a1 cmd/dist: add "devel" substring check to isRelease computation
Non-release versions that are built from source without a VERSION file
specifying any particular version end up with a development version like
"devel go1.25-67e0681aef Thu Apr 24 12:17:27 2025 -0700". Right now
those versions are correctly determined to be non-release because they
don't have a "go" prefix, instead they have a "devel " prefix.

In preparation of being able to move the "devel" substring, add a check
that said substring isn't present anywhere, since it is certain not to
be included in any released Go version we publish at https://go.dev/dl/.

For #73372.

Change-Id: Ia3e0d03b5723d4034d6270c3a2224f8dfae380e9
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/667955
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-04-25 14:30:13 -07:00
Keith Randall
3f3782feed cmd/compile: allow all of the preamble to be preemptible
We currently make some parts of the preamble unpreemptible because
it confuses morestack. See comments in the code.

Instead, have morestack handle those weird cases so we can
remove unpreemptible marks from most places.

This CL makes user functions preemptible everywhere if they have no
write barriers (at least, on x86). In cmd/go the fraction of functions
that need preemptible markings drops from 82% to 36%. Makes the cmd/go
binary 0.3% smaller.

Update #35470

Change-Id: Ic83d5eabfd0f6d239a92e65684bcce7e67ff30bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/648518
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-04-25 12:21:48 -07:00
limeidan
dc1e255104 runtime, internal/fuzz: add comparison tracing for libFuzzer on loong64
Change-Id: I212330962453139fa353db29928786b64c9ff063
Reviewed-on: https://go-review.googlesource.com/c/go/+/667455
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-04-24 23:16:24 -07:00
Guoqi Chen
fb2c88147d cmd/internal/obj: add new assembly format for BFPT and BFPF on loong64
On loong64, BFPT and BFPF are mapped to the platform assembly as follows:

   Go asm syntax:
        BFPT   FCCx, offs21
        BFPF   FCCx, offs21
   Equivalent platform assembler syntax:
        bcnez  cj, offs21
        bceqz  cj, offs21

If the condition register is not specified, it defaults to FCC0.

Change-Id: I2cc3df62a9c55d4b5eb124789358983c6737319c
Reviewed-on: https://go-review.googlesource.com/c/go/+/667456
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
2025-04-24 18:28:42 -07:00
Julian Zhu
06f96a598e crypto/sha256: improve performance of riscv64 assembly
Simplified the implementation of Ch and Maj by reducing instructions, based on CL 605495 which made the same change for SHA-512.

goos: linux
goarch: riscv64
pkg: crypto/sha256
cpu: Spacemit(R) X60
                    │  oldsha256  │              newsha256              │
                    │   sec/op    │   sec/op     vs base                │
Hash8Bytes/New-8      2.303µ ± 0%   2.098µ ± 0%   -8.90% (p=0.000 n=10)
Hash8Bytes/Sum224-8   2.535µ ± 0%   2.329µ ± 0%   -8.13% (p=0.000 n=10)
Hash8Bytes/Sum256-8   2.558µ ± 0%   2.352µ ± 0%   -8.04% (p=0.000 n=10)
Hash1K/New-8          28.67µ ± 0%   25.21µ ± 0%  -12.06% (p=0.000 n=10)
Hash1K/Sum224-8       28.89µ ± 0%   25.43µ ± 0%  -11.99% (p=0.000 n=10)
Hash1K/Sum256-8       28.91µ ± 0%   25.43µ ± 0%  -12.04% (p=0.000 n=10)
Hash8K/New-8          218.0µ ± 1%   192.7µ ± 2%  -11.58% (p=0.000 n=10)
Hash8K/Sum224-8       218.0µ ± 1%   193.6µ ± 1%  -11.20% (p=0.000 n=10)
Hash8K/Sum256-8       219.1µ ± 1%   193.4µ ± 1%  -11.74% (p=0.000 n=10)
geomean               24.93µ        22.28µ       -10.65%

                    │  oldsha256   │              newsha256               │
                    │     B/s      │     B/s       vs base                │
Hash8Bytes/New-8      3.309Mi ± 0%   3.633Mi ± 0%   +9.80% (p=0.000 n=10)
Hash8Bytes/Sum224-8   3.009Mi ± 0%   3.271Mi ± 0%   +8.72% (p=0.000 n=10)
Hash8Bytes/Sum256-8   2.985Mi ± 0%   3.242Mi ± 0%   +8.63% (p=0.000 n=10)
Hash1K/New-8          34.06Mi ± 0%   38.73Mi ± 0%  +13.72% (p=0.000 n=10)
Hash1K/Sum224-8       33.80Mi ± 0%   38.40Mi ± 0%  +13.63% (p=0.000 n=10)
Hash1K/Sum256-8       33.78Mi ± 0%   38.40Mi ± 0%  +13.69% (p=0.000 n=10)
Hash8K/New-8          35.84Mi ± 1%   40.54Mi ± 2%  +13.10% (p=0.000 n=10)
Hash8K/Sum224-8       35.83Mi ± 1%   40.35Mi ± 1%  +12.61% (p=0.000 n=10)
Hash8K/Sum256-8       35.66Mi ± 1%   40.40Mi ± 1%  +13.29% (p=0.000 n=10)
geomean               15.54Mi        17.39Mi       +11.89%

Change-Id: I9aa692fcfd70634dc6c308db9b5d06bd82ac2302
Reviewed-on: https://go-review.googlesource.com/c/go/+/639495
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
2025-04-24 17:55:31 -07:00
Mateusz Poliwczak
42d3cdc909 sync/atomic: document that atomic types should not be copied
Change-Id: I3c557d02cd676a389b5c5ea70ed92c8959041e3b
GitHub-Last-Rev: 8732da19a64853834ca155cafc1d7b2967290c31
GitHub-Pull-Request: golang/go#63256
Reviewed-on: https://go-review.googlesource.com/c/go/+/531375
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Sean Liao <sean@liao.dev>
2025-04-24 16:10:59 -07:00
changwang ma
da64b60c7e runtime: fix typo in comment
Change-Id: I85f518e36c18f4f0eda8b167750b43cd8c48ecff
Reviewed-on: https://go-review.googlesource.com/c/go/+/622675
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-04-24 15:19:23 -07:00
Keith Randall
67e0681aef cmd/compile: put constant value on node inside parentheses
That's where the unified IR writer expects it.

Fixes #73476

Change-Id: Ic22bd8dee5be5991e6d126ae3f6eccb2acdc0b19
Reviewed-on: https://go-review.googlesource.com/c/go/+/667415
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-04-24 12:17:27 -07:00
Felix Geisendörfer
3672a09a48 runtime/debug: update SetCrashOutput example to not pass parent env vars
Fixes #73490

Change-Id: I500fa73f4215c7f490779f53c1c2c0d775f51a95
Reviewed-on: https://go-review.googlesource.com/c/go/+/667775
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-04-24 12:01:27 -07:00
Keith Randall
3452d80da3 cmd/compile: add cast in range loop final value computation
When replacing a loop where the iteration variable has a named type,
we need to compute the last iteration value as i = T(len(a)-1), not
just i = len(a)-1.

Fixes #73491

Change-Id: Ic1cc3bdf8571a40c10060f929a9db8a888de2b70
Reviewed-on: https://go-review.googlesource.com/c/go/+/667815
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2025-04-24 11:02:26 -07:00
Keith Randall
3009566a46 runtime: fix tag pointers on aix
Clean up tagged pointers a bit. I got the shifts wrong
for the weird aix case.

Change-Id: I21449fd5973f4651fd1103d3b8be9c2b9b93a490
Reviewed-on: https://go-review.googlesource.com/c/go/+/667715
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-04-24 10:09:19 -07:00
qmuntal
8a8f506516 os,internal/poll: disassociate handle from IOCP in File.Fd
Go 1.25 will gain support for overlapped IO on handles passed to
os.NewFile thanks to CL 662236. It was previously not possible to add
an overlapped handle to the Go runtime's IO completion port (IOCP),
and now happens on the first call the an IO method.

This means that there is code that relies on the fact that File.Fd
returns a handle that can always be associated with a custom IOCP.
That wouldn't be the case anymore, as a handle can only be associated
with one IOCP at a time and it must be explicitly disassociated.

To fix this breaking change, File.Fd will disassociate the handle
from the Go runtime IOCP before returning it. It is then not necessary
to defer the association until the first IO method is called, which
was recently added in CL 661955 to support this same use case, but
in a more complex and unreliable way.

Updates #19098.

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-race,gotip-windows-amd64-longtest,gotip-windows-arm64
Change-Id: Id8a7e04d35057047c61d1733bad5bf45494b2c28
Reviewed-on: https://go-review.googlesource.com/c/go/+/664455
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-04-24 06:51:09 -07:00
Keith Randall
c1fc209c41 runtime: use precise bounds of Go data/bss for race detector
We only want to call into the race detector for Go global variables.
By rounding up the region bounds, we can include some C globals.
Even worse, we can include only *part* of a C global, leading to
race{read,write}range calls which straddle the end of shadow memory.
That causes the race detector to barf.

Fix some off-by-one errors in the assembly comparisons. We want to
skip calling the race detector when addr == racedataend.

Fixes #73483

Change-Id: I436b0f588d6165b61f30cb7653016ba9b7cbf585
Reviewed-on: https://go-review.googlesource.com/c/go/+/667655
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2025-04-23 23:22:12 -07:00
Keith Randall
9d0320de25 runtime: align taggable pointers more so we can use low bits for tag
Currently we assume alignment to 8 bytes, so we can steal the low 3 bits.
This CL assumes alignment to 512 bytes, so we can steal the low 9 bits.

That's 6 extra bits!

Aligning to 512 bytes wastes a bit of space but it is not egregious.
Most of the objects that we make tagged pointers to are pretty big.

Update #49405

Change-Id: I66fc7784ac1be5f12f285de1d7851d5a6871fb75
Reviewed-on: https://go-review.googlesource.com/c/go/+/665815
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-04-23 21:44:50 -07:00
Alan Donovan
702f164ed1 cmd/vet: add hostport analyzer
+ test, release note

Fixes #28308

Change-Id: I190e2fe513eeb6b90b0398841f67bf52510b5f59
Reviewed-on: https://go-review.googlesource.com/c/go/+/667596
Auto-Submit: Alan Donovan <adonovan@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-04-23 19:09:44 -07:00
Alan Donovan
fca5832607 cmd/vendor: update x/tools and x/text
This CL updates x/tools to 68e94bd and x/text to v0.24.0,
updates the vendor tree, and re-runs the bundle step for net/http.

Updates golang/go#28308

Change-Id: I4184f77547f535270ddc8e2ce6542377e3046ffd
Reviewed-on: https://go-review.googlesource.com/c/go/+/667597
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2025-04-23 15:34:39 -07:00
Nevkontakte
71d9505998 crypto/tls: skip part of the test based on GOOS instead of GOARCH
This allows to skip the last part of the test under GopherJS as well as
WebAssembly, since GopherJS shares GOOS=js with wasm.

Change-Id: I41adad788043c1863b23eb2a6da9bc9aa2833092
GitHub-Last-Rev: d8d42a3b7ccb2bee6479306b6ac1a319443702ec
GitHub-Pull-Request: golang/go#51827
Reviewed-on: https://go-review.googlesource.com/c/go/+/394114
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-04-23 10:22:11 -07:00
Michael Anthony Knyszek
f1ebad19bd internal/goexperiment: add Green Tea GC goexperiment
Change-Id: Ia3ea5290842d8eddfafad4882f5874a2aff03e94
Reviewed-on: https://go-review.googlesource.com/c/go/+/645935
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-04-23 08:07:17 -07:00
Michael Anthony Knyszek
e90ba1d208 runtime: move some malloc constants to internal/runtime/gc
These constants are needed by some future generator programs.

Change-Id: I5dccd009cbb3b2f321523bc0d8eaeb4c82e5df81
Reviewed-on: https://go-review.googlesource.com/c/go/+/655276
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-04-23 08:06:33 -07:00
Michael Anthony Knyszek
528bafa049 runtime: move sizeclass defs to new package internal/runtime/gc
We will want to reference these definitions from new generator programs,
and this is a good opportunity to cleanup all these old C-style names.

Change-Id: Ifb06f0afc381e2697e7877f038eca786610c96de
Reviewed-on: https://go-review.googlesource.com/c/go/+/655275
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-04-23 08:00:33 -07:00
limeidan
ecdd429a3b runtime: optimize the function memequal using SIMD on loong64
goos: linux
goarch: loong64
pkg: bytes
cpu: Loongson-3A6000-HV @ 2500.00MHz
                              │      old      │                 new                  │
                              │    sec/op     │    sec/op     vs base                │
Equal/0                          0.4012n ± 0%   0.4003n ± 0%   -0.21% (p=0.000 n=10)
Equal/same/1                      2.555n ± 1%    2.419n ± 0%   -5.32% (p=0.000 n=10)
Equal/same/6                      2.574n ± 1%    2.425n ± 1%   -5.79% (p=0.000 n=10)
Equal/same/9                      2.578n ± 0%    2.419n ± 1%   -6.19% (p=0.000 n=10)
Equal/same/15                     2.565n ± 1%    2.417n ± 0%   -5.73% (p=0.000 n=10)
Equal/same/16                     2.576n ± 1%    2.414n ± 0%   -6.31% (p=0.000 n=10)
Equal/same/20                     2.573n ± 1%    2.416n ± 0%   -6.10% (p=0.000 n=10)
Equal/same/32                     2.559n ± 0%    2.411n ± 0%   -5.80% (p=0.000 n=10)
Equal/same/4K                     2.579n ± 1%    2.410n ± 0%   -6.53% (p=0.000 n=10)
Equal/same/4M                     2.571n ± 0%    2.411n ± 0%   -6.22% (p=0.000 n=10)
Equal/same/64M                    2.568n ± 1%    2.413n ± 0%   -6.05% (p=0.000 n=10)
Equal/1                           5.215n ± 0%    6.404n ± 0%  +22.80% (p=0.000 n=10)
Equal/6                          11.630n ± 0%    6.404n ± 0%  -44.94% (p=0.000 n=10)
Equal/9                          15.240n ± 0%    6.404n ± 0%  -57.98% (p=0.000 n=10)
Equal/15                         22.925n ± 0%    6.404n ± 0%  -72.07% (p=0.000 n=10)
Equal/16                         24.070n ± 0%    5.203n ± 0%  -78.38% (p=0.000 n=10)
Equal/20                         28.880n ± 0%    6.404n ± 0%  -77.83% (p=0.000 n=10)
Equal/32                         43.320n ± 0%    6.404n ± 0%  -85.22% (p=0.000 n=10)
Equal/4K                        4938.50n ± 0%    55.43n ± 0%  -98.88% (p=0.000 n=10)
Equal/4M                         5048.8µ ± 0%    202.0µ ± 0%  -96.00% (p=0.000 n=10)
Equal/64M                        80.819m ± 0%    4.539m ± 0%  -94.38% (p=0.000 n=10)
EqualBothUnaligned/64_0          79.830n ± 0%    4.803n ± 0%  -93.98% (p=0.000 n=10)
EqualBothUnaligned/64_1          79.830n ± 0%    4.803n ± 0%  -93.98% (p=0.000 n=10)
EqualBothUnaligned/64_4          79.830n ± 0%    4.803n ± 0%  -93.98% (p=0.000 n=10)
EqualBothUnaligned/64_7          79.830n ± 0%    4.803n ± 0%  -93.98% (p=0.000 n=10)
EqualBothUnaligned/4096_0       4937.00n ± 0%    65.64n ± 0%  -98.67% (p=0.000 n=10)
EqualBothUnaligned/4096_1       4937.00n ± 0%    78.85n ± 0%  -98.40% (p=0.000 n=10)
EqualBothUnaligned/4096_4       4937.00n ± 0%    78.87n ± 0%  -98.40% (p=0.000 n=10)
EqualBothUnaligned/4096_7       4937.00n ± 0%    78.87n ± 0%  -98.40% (p=0.000 n=10)
EqualBothUnaligned/4194304_0     5049.2µ ± 0%    204.2µ ± 0%  -95.96% (p=0.000 n=10)
EqualBothUnaligned/4194304_1     5049.2µ ± 0%    205.1µ ± 0%  -95.94% (p=0.000 n=10)
EqualBothUnaligned/4194304_4     5049.4µ ± 0%    205.1µ ± 0%  -95.94% (p=0.000 n=10)
EqualBothUnaligned/4194304_7     5049.2µ ± 0%    205.1µ ± 0%  -95.94% (p=0.000 n=10)
EqualBothUnaligned/67108864_0    80.796m ± 0%    3.863m ± 0%  -95.22% (p=0.000 n=10)
EqualBothUnaligned/67108864_1    80.801m ± 0%    3.706m ± 0%  -95.41% (p=0.000 n=10)
EqualBothUnaligned/67108864_4    80.799m ± 0%    3.706m ± 0%  -95.41% (p=0.000 n=10)
EqualBothUnaligned/67108864_7    80.781m ± 0%    3.706m ± 0%  -95.41% (p=0.000 n=10)
geomean                           1.040µ         149.6n       -85.63%

Change-Id: Id4c2bc0ca758337dd9759df83750c761814be488
Reviewed-on: https://go-review.googlesource.com/c/go/+/667255
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2025-04-23 01:29:52 -07:00
Xiaolin Zhao
93e4e26d5b runtime: fix typos in comments
Change-Id: Id169b68cc93bb6eb4cdca384efaaf971fcfa32b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/666316
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-04-22 18:37:58 -07:00