]> Cypherpunks repositories - gostls13.git/log
gostls13.git
7 weeks agocmd/link, runtime, debug/gosym: move pclntab magic to internal/abi
Ian Lance Taylor [Thu, 13 Nov 2025 21:01:14 +0000 (13:01 -0800)]
cmd/link, runtime, debug/gosym: move pclntab magic to internal/abi

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

7 weeks agocmd/link: put runtime.findfunctab in the .gopclntab section
Ian Lance Taylor [Tue, 11 Nov 2025 23:53:24 +0000 (15:53 -0800)]
cmd/link: put runtime.findfunctab in the .gopclntab section

There is a test for this in CL 721461 later in this series.

For #76038

Change-Id: I15f9a8d0d5bd9424702a9ca7febb2fa76035aaf8
Reviewed-on: https://go-review.googlesource.com/c/go/+/719743
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agocmd/link: put funcdata symbols in .gopclntab section
Ian Lance Taylor [Tue, 11 Nov 2025 00:08:48 +0000 (16:08 -0800)]
cmd/link: put funcdata symbols in .gopclntab section

There is a test for this in CL 721460 later in this series.

For #76038

Change-Id: Icd7a52cbabde5162139dbc4b2c61306c0c748545
Reviewed-on: https://go-review.googlesource.com/c/go/+/719440
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agocmd/link: build shstrtab from ELF sections
Ian Lance Taylor [Fri, 7 Nov 2025 20:25:03 +0000 (12:25 -0800)]
cmd/link: build shstrtab from ELF sections

Since before Go 1 the Go linker has handled ELF by first building the
ELF section string table, and then pointing ELF section headers to it.
This duplicates code as sections are effectively created twice,
once with the name and then again with the full section header.
The code duplication also means that it's easy to create unnecessary
section names; for example, every internally linked Go program
currently contains the string ".go.fuzzcntrs" although most do not
have a section by that name.

This CL changes the linker to simply build the section string table
after all the sections are known.

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

7 weeks agocmd/link: use shdr as a slice rather than counting in elfhdr.Shnum
Ian Lance Taylor [Fri, 7 Nov 2025 19:20:15 +0000 (11:20 -0800)]
cmd/link: use shdr as a slice rather than counting in elfhdr.Shnum

Change-Id: I293e50e3a6ab19fb927099e106095d6aa1241b9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/718820
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agocmd/link: sort allocated ELF section headers by address
Ian Lance Taylor [Fri, 7 Nov 2025 03:52:54 +0000 (19:52 -0800)]
cmd/link: sort allocated ELF section headers by address

For an executable, emit the allocated section headers in address order,
so that section headers are easier for humans to read.

Change-Id: Ib5efb4734101e4a1f6b09d0e045ed643c79c7c0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/718620
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
Reviewed-by: David Chase <drchase@google.com>
7 weeks agocmd/compile: introduce alias analysis and automatically free non-aliased memory after...
thepudds [Tue, 25 Nov 2025 14:57:50 +0000 (09:57 -0500)]
cmd/compile: introduce alias analysis and automatically free non-aliased memory after growslice

This CL is part of a set of CLs that attempt to reduce how much work the
GC must do. See the design in https://go.dev/design/74299-runtime-freegc

This CL updates the compiler to examine append calls to prove
whether or not the slice is aliased.

If proven unaliased, the compiler automatically inserts a call to a new
runtime function introduced with this CL, runtime.growsliceNoAlias,
which frees the old backing memory immediately after slice growth is
complete and the old storage is logically dead.

Two append benchmarks below show promising results, executing up to
~2x faster and up to factor of ~3 memory reduction with this CL.

The approach works with multiple append calls for the same slice,
including inside loops, and the final slice memory can be escaping,
such as in a classic pattern of returning a slice from a function
after the slice is built. (The final slice memory is never freed with
this CL, though we have other work that tackles that.)

An example target for this CL is we automatically free the
intermediate memory for the appends in the loop in this function:

    func f1(input []int) []int {
        var s []int
        for _, x := range input {
            s = append(s, g(x))   // s cannot be aliased here
            if h(x) {
                s = append(s, x)  // s cannot be aliased here
            }
        }
        return s                  // slice escapes at end
    }

In this case, the compiler and the runtime collaborate so that
the heap allocated backing memory for s is automatically freed after
a successful grow. (For the first grow, there is nothing to free,
but for the second and subsequent growths, the old heap memory is
freed automatically.)

The new runtime.growsliceNoAlias is primarily implemented
by calling runtime.freegc, which we introduced in CL 673695.

The high-level approach here is we step through the IR starting
from a slice declaration and look for any operations that either
alias the slice or might do so, and treat any IR construct we
don't specifically handle as a potential alias (and therefore
conservatively fall back to treating the slice as aliased when
encountering something not understood).

For loops, some additional care is required. We arrange the analysis
so that an alias in the body of a loop causes all the appends in that
same loop body to be marked aliased, even if the aliasing occurs after
the append in the IR:

    func f2() {
        var s []int
        for i := range 10 {
                s = append(s, i)  // aliased due to next line
                alias = s
        }
    }

For nested loops, we analyse the nesting appropriately so that
for example this append is still proven as non-aliased in the
inner loop even though it aliased for the outer loop:

    func f3() {
        for range 10 {
            var s []int
            for i := range 10 {
                s = append(s, i)  // append using non-aliased slice
            }
            alias = s
        }
    }

A good starting point is the beginning of the test/escape_alias.go file,
which starts with ~10 introductory examples with brief comments that
attempt to illustrate the high-level approach.

For more details, see the new .../internal/escape/alias.go file,
especially the (*aliasAnalysis).analyze method.

In the first benchmark, an append in a loop builds up a slice from
nothing, where the slice elements are each 64 bytes. In the table below,
'count' is the number of appends. With 1 append, there is no opportunity
for this CL to free memory. Once there are 2 appends, the growth from
1 element to 2 elements means the compiler-inserted growsliceNoAlias
frees the 1-element array, and we see a ~33% reduction in memory use
and a small reported speed improvement.

As the number of appends increases for example to 5, we are at
a ~20% speed improvement and ~45% memory reduction, and so on until
we reach ~40% faster and ~50% less memory allocated at the end of
the table.

There can be variation in the reported numbers based on -randlayout, so
this table is for 30 different values of -randlayout with a total
n=150. (Even so, there is still some variation, so we probably should
not read too much into small changes.) This is with GOAMD64=v3 on
a VM that gcc reports is cascadelake.

goos: linux
goarch: amd64
pkg: runtime
cpu: Intel(R) Xeon(R) CPU @ 2.80GHz
                         │ old-1bb1f2bf0c │        freegc-8ba7421-ps16 │
                         │     sec/op     │   sec/op     vs base       │
Append64Bytes/count=1-4       31.09n ± 2%   31.69n ± 1%   +1.95% (n=150)
Append64Bytes/count=2-4       73.31n ± 1%   70.27n ± 0%   -4.15% (n=150)
Append64Bytes/count=3-4       142.7n ± 1%   124.6n ± 1%  -12.68% (n=150)
Append64Bytes/count=4-4       149.6n ± 1%   127.7n ± 0%  -14.64% (n=150)
Append64Bytes/count=5-4       277.1n ± 1%   213.6n ± 0%  -22.90% (n=150)
Append64Bytes/count=6-4       280.7n ± 1%   216.5n ± 1%  -22.87% (n=150)
Append64Bytes/count=10-4      544.3n ± 1%   386.6n ± 0%  -28.97% (n=150)
Append64Bytes/count=20-4     1058.5n ± 1%   715.6n ± 1%  -32.39% (n=150)
Append64Bytes/count=50-4      2.121µ ± 1%   1.404µ ± 1%  -33.83% (n=150)
Append64Bytes/count=100-4     4.152µ ± 1%   2.736µ ± 1%  -34.11% (n=150)
Append64Bytes/count=200-4     7.753µ ± 1%   4.882µ ± 1%  -37.03% (n=150)
Append64Bytes/count=400-4    15.163µ ± 2%   9.273µ ± 1%  -38.84% (n=150)
geomean                       601.8n        455.0n       -24.39%

                          │ old-1bb1f2bf0c │      freegc-8ba7421-ps16  │
                          │      B/op      │  B/op      vs base        │
Append64Bytes/count=1-4       64.00 ± 0%     64.00 ± 0%        ~ (n=150)
Append64Bytes/count=2-4       192.0 ± 0%     128.0 ± 0%  -33.33% (n=150)
Append64Bytes/count=3-4       448.0 ± 0%     256.0 ± 0%  -42.86% (n=150)
Append64Bytes/count=4-4       448.0 ± 0%     256.0 ± 0%  -42.86% (n=150)
Append64Bytes/count=5-4       960.0 ± 0%     512.0 ± 0%  -46.67% (n=150)
Append64Bytes/count=6-4       960.0 ± 0%     512.0 ± 0%  -46.67% (n=150)
Append64Bytes/count=10-4    1.938Ki ± 0%   1.000Ki ± 0%  -48.39% (n=150)
Append64Bytes/count=20-4    3.938Ki ± 0%   2.001Ki ± 0%  -49.18% (n=150)
Append64Bytes/count=50-4    7.938Ki ± 0%   4.005Ki ± 0%  -49.54% (n=150)
Append64Bytes/count=100-4  15.938Ki ± 0%   8.021Ki ± 0%  -49.67% (n=150)
Append64Bytes/count=200-4   31.94Ki ± 0%   16.08Ki ± 0%  -49.64% (n=150)
Append64Bytes/count=400-4   63.94Ki ± 0%   32.33Ki ± 0%  -49.44% (n=150)
geomean                     1.991Ki        1.124Ki       -43.54%

                          │ old-1bb1f2bf0c │     freegc-8ba7421-ps16   │
                          │   allocs/op    │ allocs/op   vs base       │
Append64Bytes/count=1-4         1.000 ± 0%   1.000 ± 0%        ~ (n=150)
Append64Bytes/count=2-4         2.000 ± 0%   1.000 ± 0%  -50.00% (n=150)
Append64Bytes/count=3-4         3.000 ± 0%   1.000 ± 0%  -66.67% (n=150)
Append64Bytes/count=4-4         3.000 ± 0%   1.000 ± 0%  -66.67% (n=150)
Append64Bytes/count=5-4         4.000 ± 0%   1.000 ± 0%  -75.00% (n=150)
Append64Bytes/count=6-4         4.000 ± 0%   1.000 ± 0%  -75.00% (n=150)
Append64Bytes/count=10-4        5.000 ± 0%   1.000 ± 0%  -80.00% (n=150)
Append64Bytes/count=20-4        6.000 ± 0%   1.000 ± 0%  -83.33% (n=150)
Append64Bytes/count=50-4        7.000 ± 0%   1.000 ± 0%  -85.71% (n=150)
Append64Bytes/count=100-4       8.000 ± 0%   1.000 ± 0%  -87.50% (n=150)
Append64Bytes/count=200-4       9.000 ± 0%   1.000 ± 0%  -88.89% (n=150)
Append64Bytes/count=400-4      10.000 ± 0%   1.000 ± 0%  -90.00% (n=150)
geomean                             4.331        1.000       -76.91%

The second benchmark is similar, but instead uses an 8-byte integer
for the slice element. The first 4 appends in the loop never call into
the runtime thanks to the excellent CL 664299 introduced by Keith in
Go 1.25 that allows some <= 32 byte dynamically-sized slices to be on
the stack, so this CL is neutral for <= 32 bytes. Once the 5th append
occurs at count=5, a grow happens via the runtime and heap allocates
as normal, but freegc does not yet have anything to free, so we see
a small ~1.4ns penalty reported there. But once the second growth
happens, the older heap memory is now automatically freed by freegc,
so we start to see some benefit in memory reductions and speed
improvements, starting at a tiny speed improvement (close to a wash,
or maybe noise) by the second growth before count=10, and building up to
~2x faster with ~68% fewer allocated bytes reported.

goos: linux
goarch: amd64
pkg: runtime
cpu: Intel(R) Xeon(R) CPU @ 2.80GHz
                       │ old-1bb1f2bf0c │        freegc-8ba7421-ps16        │
                       │     sec/op     │   sec/op     vs base              │
AppendInt/count=1-4         2.978n ± 0%   2.969n ± 0%   -0.30% (p=0.000 n=150)
AppendInt/count=4-4         4.292n ± 3%   4.163n ± 3%        ~ (p=0.528 n=150)
AppendInt/count=5-4         33.50n ± 0%   34.93n ± 0%   +4.25% (p=0.000 n=150)
AppendInt/count=10-4        76.21n ± 1%   75.67n ± 0%   -0.72% (p=0.000 n=150)
AppendInt/count=20-4        150.6n ± 1%   133.0n ± 0%  -11.65% (n=150)
AppendInt/count=50-4        284.1n ± 1%   225.6n ± 0%  -20.59% (n=150)
AppendInt/count=100-4       544.2n ± 1%   392.4n ± 1%  -27.89% (n=150)
AppendInt/count=200-4      1051.5n ± 1%   702.3n ± 0%  -33.21% (n=150)
AppendInt/count=400-4       2.041µ ± 1%   1.312µ ± 1%  -35.70% (n=150)
AppendInt/count=1000-4      5.224µ ± 2%   2.851µ ± 1%  -45.43% (n=150)
AppendInt/count=2000-4     11.770µ ± 1%   6.010µ ± 1%  -48.94% (n=150)
AppendInt/count=3000-4     17.747µ ± 2%   8.264µ ± 1%  -53.44% (n=150)
geomean                           331.8n        246.4n       -25.72%

                       │ old-1bb1f2bf0c │         freegc-8ba7421-ps16          │
                       │      B/op      │     B/op      vs base                │
AppendInt/count=1-4        0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=150)
AppendInt/count=4-4        0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=150)
AppendInt/count=5-4        64.00 ± 0%       64.00 ± 0%        ~ (p=1.000 n=150)
AppendInt/count=10-4       192.0 ± 0%       128.0 ± 0%  -33.33% (n=150)
AppendInt/count=20-4       448.0 ± 0%       256.0 ± 0%  -42.86% (n=150)
AppendInt/count=50-4       960.0 ± 0%       512.0 ± 0%  -46.67% (n=150)
AppendInt/count=100-4    1.938Ki ± 0%     1.000Ki ± 0%  -48.39% (n=150)
AppendInt/count=200-4    3.938Ki ± 0%     2.001Ki ± 0%  -49.18% (n=150)
AppendInt/count=400-4    7.938Ki ± 0%     4.005Ki ± 0%  -49.54% (n=150)
AppendInt/count=1000-4   24.56Ki ± 0%     10.05Ki ± 0%  -59.07% (n=150)
AppendInt/count=2000-4   58.56Ki ± 0%     20.31Ki ± 0%  -65.32% (n=150)
AppendInt/count=3000-4   85.19Ki ± 0%     27.30Ki ± 0%  -67.95% (n=150)
geomean                                     ²                 -42.81%

                       │ old-1bb1f2bf0c │        freegc-8ba7421-ps16         │
                       │   allocs/op    │ allocs/op   vs base                │
AppendInt/count=1-4        0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=150)
AppendInt/count=4-4        0.000 ± 0%     0.000 ± 0%        ~ (p=1.000 n=150)
AppendInt/count=5-4        1.000 ± 0%     1.000 ± 0%        ~ (p=1.000 n=150)
AppendInt/count=10-4       2.000 ± 0%     1.000 ± 0%  -50.00% (n=150)
AppendInt/count=20-4       3.000 ± 0%     1.000 ± 0%  -66.67% (n=150)
AppendInt/count=50-4       4.000 ± 0%     1.000 ± 0%  -75.00% (n=150)
AppendInt/count=100-4      5.000 ± 0%     1.000 ± 0%  -80.00% (n=150)
AppendInt/count=200-4      6.000 ± 0%     1.000 ± 0%  -83.33% (n=150)
AppendInt/count=400-4      7.000 ± 0%     1.000 ± 0%  -85.71% (n=150)
AppendInt/count=1000-4     9.000 ± 0%     1.000 ± 0%  -88.89% (n=150)
AppendInt/count=2000-4    11.000 ± 0%     1.000 ± 0%  -90.91% (n=150)
AppendInt/count=3000-4    12.000 ± 0%     1.000 ± 0%  -91.67% (n=150)
geomean                                     ²               -72.76%                 ²

Of course, these are just microbenchmarks, but likely indicate
there are some opportunities here.

The immediately following CL 712422 tackles inlining and is able to get
runtime.freegc working automatically with iterators such as used by
slices.Collect, which becomes able to automatically free the
intermediate memory from its repeated appends (which earlier
in this work required a temporary hand edit to the slices package).

For now, we only use the NoAlias version for element types without
pointers while waiting on additional runtime support in CL 698515.

Updates #74299

Change-Id: I1b9d286aa97c170dcc2e203ec0f8ca72d84e8221
Reviewed-on: https://go-review.googlesource.com/c/go/+/710015
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
7 weeks agocmd/link, cmd/internal/obj: fix a remote call failure issue
limeidan [Mon, 24 Nov 2025 09:28:42 +0000 (17:28 +0800)]
cmd/link, cmd/internal/obj: fix a remote call failure issue

When a function call exceeds the immediate value range of the instruction,
a trampoline is required to assist in the jump. Trampoline is only omitted
when plt is needed; otherwise, a check is required.

Change-Id: I7fe2e08d75f6f574475837b560e650bbd4215858
Reviewed-on: https://go-review.googlesource.com/c/go/+/724580
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
7 weeks agocmd/internal/obj/loong64: remove the incorrect unsigned instructions
Xiaolin Zhao [Fri, 21 Nov 2025 09:22:05 +0000 (17:22 +0800)]
cmd/internal/obj/loong64: remove the incorrect unsigned instructions

The loong64 ISA does not support the 32-bit unsigned arithmetic
instructions ADDU, SUBU and MULU.

Change-Id: Ifa67de9c59aa12d08844189ed23e6daad0cc11ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/722760
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
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>
7 weeks agogo/types, types2: remove InvalidTypeCycle from literals.go
Mark Freeman [Tue, 25 Nov 2025 18:56:18 +0000 (13:56 -0500)]
go/types, types2: remove InvalidTypeCycle from literals.go

Both CL 722161 and CL 724140 implement a more general solution to
detecting cycles involving values of a type on the object path.

The logic in literals.go was intended to be a stop-gap solution and
is no longer necessary.

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

7 weeks agogo/types, types2: remove setDefType and most def plumbing
Mark Freeman [Mon, 24 Nov 2025 19:34:39 +0000 (14:34 -0500)]
go/types, types2: remove setDefType and most def plumbing

CL 722161 replaced the setDefType mechanism with boundaries on composite
literals, removing the need to pass the def argument in all but 1 case.

The exception is interface types, which use def to populate the receiver
type for better error messages.

Change-Id: Ic78c91238588015153f0d22790be5872a01c5f63
Reviewed-on: https://go-review.googlesource.com/c/go/+/723920
Auto-Submit: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
7 weeks agogo/types, types2: replace setDefType with pending type check
Mark Freeman [Mon, 24 Nov 2025 22:04:49 +0000 (17:04 -0500)]
go/types, types2: replace setDefType with pending type check

Given a type definition of the form:

  type T RHS

The setDefType function would set T.fromRHS as soon as we knew its
top-level type. For instance, in:

  type S struct { ... }

S.fromRHS is set to a struct type before type-checking anything inside
the struct.

This permit access to the (incomplete) RHS type in a cyclic type
declaration. Accessing this information is fraught (as it's incomplete),
but was used for reporting certain types of cycles.

This CL replaces setDefType with a check that ensures no value of type
T is used before its RHS is set up.

This CL is strictly more complete than what setDefType achieved. For
instance, it enables correct reporting for the below cycles:

  type A [unsafe.Sizeof(A{})]int

  var v any = 42
  type B [v.(B)]int

  func f() C {
    return C{}
  }
  type C [unsafe.Sizeof(f())]int

Fixes #76383
Fixes #76384

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

7 weeks agocrypto,testing/cryptotest: ignore random io.Reader params, add SetGlobalRandom
Filippo Valsorda [Mon, 15 Sep 2025 16:58:04 +0000 (18:58 +0200)]
crypto,testing/cryptotest: ignore random io.Reader params, add SetGlobalRandom

First, we centralize all random bytes generation through drbg.Read. The
rest of the FIPS 140-3 module can't use external functions anyway, so
drbg.Read needs to have all the logic.

Then, make sure that the crypto/... tree uses drbg.Read (or the new
crypto/internal/rand.Reader wrapper) instead of crypto/rand, so it is
unaffected by applications setting crypto/rand.Reader.

Next, pass all unspecified random io.Reader parameters through the new
crypto/internal/rand.CustomReader, which just redirects to drbg.Read
unless GODEBUG=cryptocustomrand=1 is set. Move all the calls to
MaybeReadByte there, since it's only needed for these custom Readers.

Finally, add testing/cryptotest.SetGlobalRandom which sets
crypto/rand.Reader to a locked deterministic source and overrides
drbg.Read. This way SetGlobalRandom should affect all cryptographic
randomness in the standard library.

Fixes #70942

Co-authored-by: qiulaidongfeng <2645477756@qq.com>
Change-Id: I6a6a69641311d9fac318abcc6d79677f0e406100
Reviewed-on: https://go-review.googlesource.com/c/go/+/724480
Reviewed-by: Nicholas Husin <nsh@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agoruntime: update mkmalloc to make generated code look nicer
matloob [Wed, 26 Nov 2025 23:04:22 +0000 (18:04 -0500)]
runtime: update mkmalloc to make generated code look nicer

This cl adds a new operation that can remove an if statement or replace
it with its body if its condition is var or !var for some variable var
that's being replaced with a constant.

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

7 weeks agoruntime/secret: implement new secret package
Daniel Morsing [Thu, 25 Sep 2025 16:26:03 +0000 (17:26 +0100)]
runtime/secret: implement new secret package

Implement secret.Do.

- When secret.Do returns:
  - Clear stack that is used by the argument function.
  - Clear all the registers that might contain secrets.
- On stack growth in secret mode, clear the old stack.
- When objects are allocated in secret mode, mark them and then zero
  the marked objects immediately when they are freed.
- If the argument function panics, raise that panic as if it originated
  from secret.Do. This removes anything about the secret function
  from tracebacks.

For now, this is only implemented on linux for arm64 and amd64.

This is a rebased version of Keith Randalls initial implementation at
CL 600635. I have added arm64 support, signal handling, preemption
handling and dealt with vDSOs spilling into system stacks.

Fixes #21865

Change-Id: I6fbd5a233beeaceb160785e0c0199a5c94d8e520
Co-authored-by: Keith Randall <khr@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/704615
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agogo/build/constraint: use strings.Builder instead of for { str+=str }
Alan Donovan [Wed, 26 Nov 2025 22:53:04 +0000 (17:53 -0500)]
go/build/constraint: use strings.Builder instead of for { str+=str }

(This works around a bug in the stringsbuilder modernizer.)

For #76476

Change-Id: I1cb8715fd79c0363cb9c159686eaeb3482c93228
Reviewed-on: https://go-review.googlesource.com/c/go/+/724721
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
7 weeks agogo/types: relax NewSignatureType for append(slice, str...)
Alan Donovan [Mon, 21 Jul 2025 18:35:08 +0000 (14:35 -0400)]
go/types: relax NewSignatureType for append(slice, str...)

CL 688815 contained a partial fix for the reported bug, but
NewSignatureType continued to panic. This change relaxes it
to permit construction of the type "func([]byte, B) []byte"
where "type B []byte". We must do so because a client
may instantiate the type "func([]byte, T...)" where [T ~string|~[]byte]
at T=B, and may have no way to know that they are dealing
with this very special edge case of append.

Added a regression test of NewSignatureType, which I should
have done in the earlier CL.

Also, make typestring less pedantic and fragile.

Fixes #73871

Change-Id: I3d8f8609582149f9c9f8402a04ad516c2c63bbc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/689277
TryBot-Bypass: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
7 weeks agocrypto/tls: support crypto.MessageSigner private keys
Filippo Valsorda [Wed, 26 Nov 2025 20:11:35 +0000 (21:11 +0100)]
crypto/tls: support crypto.MessageSigner private keys

Fixes #75656

Change-Id: I6bc71c80973765ef995d17b1450ea2026a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/724820
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
7 weeks agocmd/compile: fix bloop get name logic
Junyang Shao [Tue, 25 Nov 2025 01:37:13 +0000 (01:37 +0000)]
cmd/compile: fix bloop get name logic

This CL change getNameFrom impl to pattern match addressible patterns.

Change-Id: If1faa22a3a012d501e911d8468a5702b348abf16
Reviewed-on: https://go-review.googlesource.com/c/go/+/724180
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
7 weeks agocmd/go: remove experiment checks for compile -c
matloob [Wed, 26 Nov 2025 15:30:34 +0000 (10:30 -0500)]
cmd/go: remove experiment checks for compile -c

There's a comment that we should test that compile -c is compatible with
the fieldtrack and preemptibleloops experiments and then remove the
check disabling -c when those experiments are enabled.

I tested this and the tests pass with fieldtrack (with the exception of one go command test that makes the assumption that fieldtrack is off), and the preemptibleloops experiment is already broken without this experiment.

Also remove the check for the value of the GO19CONCURRENTCOMPILATION
environment variable. The compiler concurrency can be limited by setting
GOMAXPROCS.

Change-Id: I0c02745de463ea572673648061185cd76a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/724680
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agodoc/next: document broken freebsd/riscv64 port
Dmitri Shuralyov [Wed, 26 Nov 2025 21:12:53 +0000 (16:12 -0500)]
doc/next: document broken freebsd/riscv64 port

Also update comment in cmd/dist's broken map to point to the top-level
umbrella issue.

For #76475.
For #75005.

Change-Id: I43b8384af4264dc5d72ceea8d05730b9db81123a
Reviewed-on: https://go-review.googlesource.com/c/go/+/724860
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>

7 weeks agocmd/compile, runtime: guard X15 zeroing with GOEXPERIMENT=simd
Cherry Mui [Wed, 26 Nov 2025 15:56:15 +0000 (10:56 -0500)]
cmd/compile, runtime: guard X15 zeroing with GOEXPERIMENT=simd

If simd experiment is not enabled, the compiler doesn't use the
AVX part of the register. So only zero it with the SSE instruction.

Change-Id: Ia3bdf34a9ed273128db2ee0f4f5db6f7cc76a975
Reviewed-on: https://go-review.googlesource.com/c/go/+/724720
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
7 weeks agocrypto/fips140: add WithoutEnforcement
Daniel Morsing [Mon, 24 Nov 2025 13:08:10 +0000 (13:08 +0000)]
crypto/fips140: add WithoutEnforcement

WithoutEnforcement lets programs running under GODEBUG=fips140=only
selectively opt out of strict enforcement. This is especially helpful
for non-critical uses of cryptography routines like SHA-1 for content
addressable storage backends (E.g. git).

Fixes #74630

Change-Id: Iabba1f5eb63498db98047aca45e09c5dccf2fbdf
Reviewed-on: https://go-review.googlesource.com/c/go/+/723720
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
7 weeks agocrypto/x509: add ExtKeyUsage.OID method
Roland Shoemaker [Wed, 26 Nov 2025 17:21:13 +0000 (09:21 -0800)]
crypto/x509: add ExtKeyUsage.OID method

And OIDFromASN1OID for converting between asn1.ObjectIdentifier and OID.

Fixes #75325

Change-Id: I3b84dce54346d88aab731ffe30d0fef07b014f04
Reviewed-on: https://go-review.googlesource.com/c/go/+/724761
Reviewed-by: Neal Patel <nealpatel@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Commit-Queue: Neal Patel <nealpatel@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agocmd/go: limit total compile -c backend concurrency using a pool
Michael Matloob [Mon, 24 Nov 2025 23:33:30 +0000 (18:33 -0500)]
cmd/go: limit total compile -c backend concurrency using a pool

Previously we limited the value we passed in to compile -c (which set
the number of SSA compile goroutines that run at one time) to 4. This CL
allows the -c value to go up to GOMAXPROCS, while limiting the total
number of backend SSA compile goroutines to still be less than the
previous worst case of 4*GOMAXPROCS (actually four times the value of
the -p flag, but the default is GOMAXPROCS). We do that by keeping a
pool of tokens to represent the total number of SSA compile goroutines
(with some buffer to allow us to run out of tokens and not exceed
4*GOMAXPROCS). Each time a compile requests a -c value, we'll hand out
half of the remaining tokens (with the number handed otu capped at
GOMAXPROCS) until we run out of tokens, in wich case we'll set -c to
one.

This leads to a speed up of 3-10% on the 16 core intel perf builder and
5-16% on the 88 core builder on the Sweet go-build benchmark.

Change-Id: Ib1ec843fee57f0fb8d36a507162317276a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/724142
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
7 weeks agocmd/compile: handle loops better during stack allocation of slices
Keith Randall [Thu, 20 Nov 2025 17:42:16 +0000 (09:42 -0800)]
cmd/compile: handle loops better during stack allocation of slices

Don't use the move2heap optimization if the move2heap is inside
a loop deeper than the declaration of the slice. We really only want
to do the move2heap operation once.

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

7 weeks agogo/types, types2: improve printing of []*operand lists (debugging support)
Robert Griesemer [Wed, 26 Nov 2025 00:26:25 +0000 (16:26 -0800)]
go/types, types2: improve printing of []*operand lists (debugging support)

Special-case an sprintf argument of []*operand type, similar to what
we do for other lists. As a result a list of operands is printed as
[a, b, c] rather than [a b c] (default formatting for slices).

(We could factor out this code into a generic function, but this is
a minimally intrusive change at this point.)

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

7 weeks agoruntime: merge all the linux 32 and 64 bits files into one for each
Jorropo [Thu, 23 Oct 2025 08:54:00 +0000 (10:54 +0200)]
runtime: merge all the linux 32 and 64 bits files into one for each

Change-Id: I57067c9724dad2fba518b900d6f6a049cc32099e
Reviewed-on: https://go-review.googlesource.com/c/go/+/714081
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
7 weeks agotesting: fix bloop doc
Junyang Shao [Wed, 26 Nov 2025 19:15:51 +0000 (19:15 +0000)]
testing: fix bloop doc

This CL deletes the compiler detail part from bloop documentation.

Change-Id: I73933707a593d4958e2300416d15e7213f001c3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/724800
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
7 weeks agoos,internal/syscall/windows: support O_* flags in Root.OpenFile
qmuntal [Wed, 26 Nov 2025 11:11:50 +0000 (12:11 +0100)]
os,internal/syscall/windows: support O_* flags in Root.OpenFile

These file flags are supported by os.OpenFile since CL 699415.

Closes #73676

Change-Id: Ib37102a565f538d394d2a94bd605d6c6004f3028
Reviewed-on: https://go-review.googlesource.com/c/go/+/724621
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agocmd/internal/obj/loong64: add {,x}vmadd series instructions support
Guoqi Chen [Mon, 24 Nov 2025 12:19:06 +0000 (20:19 +0800)]
cmd/internal/obj/loong64: add {,x}vmadd series instructions support

Go asm syntax:
  VMADD{B, H, W, V}                         V1, V2, V3
  VMSUB{B, H, W, V}                         V1, V2, V3
 XVMADD{B, H, W, V}                         X1, X2, X3
 XVMSUB{B, H, W, V}                         X1, X2, X3
 VMADDWEV{HB, WH, VW,QV}{,U}                V1, V2, V3
 VMADDWOD{HB, WH, VW,QV}{,U}                V1, V2, V3
XVMADDWEV{HB, WH, VW,QV}{,U}                X1, X2, X3
XVMADDWOD{HB, WH, VW,QV}{,U}                X1, X2, X3
 VMADDWEV{HBUB, WHUH, VWUW, QVUV}           V1, V2, V3
 VMADDWOD{HBUB, WHUH, VWUW, QVUV}           V1, V2, V3
XVMADDWEV{HBUB, WHUH, VWUW, QVUV}           X1, X2, X3
XVMADDWOD{HBUB, WHUH, VWUW, QVUV}           X1, X2, X3

Equivalent platform assembler syntax:
 vmadd.{b,h,w,d}                            v3, v2, v1
 vmsub.{b,h,w,d}                            v3, v2, v1
xvmadd.{b,h,w,d}                            x3, x2, x1
xvmsub.{b,h,w,d}                            x3, x2, x1
 vmaddwev.{h.b, w.h, d.w, q.d}{,u}          v3, v2, v1
 vmaddwod.{h.b, w.h, d.w, q.d}{,u}          v3, v2, v1
xvmaddwev.{h.b, w.h, d.w, q.d}{,u}          x3, x2, x1
xvmaddwod.{h.b, w.h, d.w, q.d}{,u}          x3, x2, x1
 vmaddwev.{h.bu.b, d.wu.w, d.wu.w, q.du.d}  v3, v2, v1
 vmaddwod.{h.bu.b, d.wu.w, d.wu.w, q.du.d}  v3, v2, v1
xvmaddwev.{h.bu.b, d.wu.w, d.wu.w, q.du.d}  x3, x2, x1
xvmaddwod.{h.bu.b, d.wu.w, d.wu.w, q.du.d}  x3, x2, x1

Change-Id: I2f4aae51045e1596d4744e525a1589586065cf8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/724200
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@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>

7 weeks agocmd/internal/obj/loong64: add aliases to 32-bit arithmetic instructions
Xiaolin Zhao [Tue, 18 Nov 2025 08:00:35 +0000 (16:00 +0800)]
cmd/internal/obj/loong64: add aliases to 32-bit arithmetic instructions

Both the MULW and MUL instructions point to the mul.w instruction
in the loong64 ISA. Previously, MULW was not encoded; now it is
encoded and used as an alias for MUL.
The same applies to the following instructions: ADD, SUB, DIV.
For consistency, we have added additional aliases for DIVU, REM and REMU.

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

7 weeks agocmd/compile: add tests bruteforcing limit complement
Jorropo [Wed, 26 Nov 2025 08:49:50 +0000 (09:49 +0100)]
cmd/compile: add tests bruteforcing limit complement

Change-Id: I9d8bd78a06738a8a242b6965382e61568e93dea7
Reviewed-on: https://go-review.googlesource.com/c/go/+/724620
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
7 weeks agoos,internal/poll: don't call IsNonblock for consoles and Stdin
qmuntal [Wed, 26 Nov 2025 09:25:16 +0000 (10:25 +0100)]
os,internal/poll: don't call IsNonblock for consoles and Stdin

windows.IsNonblock can block for synchronous handles that have an
outstanding I/O operation. Console handles are always synchronous, so
we should not call IsNonblock for them. Stdin is often a pipe, and
almost always a synchronous handle, so we should not call IsNonblock for
it either. This avoids potential deadlocks during os package
initialization, which calls NewFile(syscall.Stdin).

Fixes #75949
Updates #76391

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-amd64-race,gotip-windows-arm64
Change-Id: I1603932b0a99823019aa0cad960f94cee9996505
Reviewed-on: https://go-review.googlesource.com/c/go/+/724640
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agocrypto/internal/fips140/aes: optimize ctrBlocks8Asm on amd64
Boris Nagaev [Wed, 26 Nov 2025 08:26:49 +0000 (08:26 +0000)]
crypto/internal/fips140/aes: optimize ctrBlocks8Asm on amd64

Implement overflow-aware optimization in ctrBlocks8Asm: make a fast branch
in case when there is no overflow. One branch per 8 blocks is faster than
7 increments in general purpose registers and transfers from them to XMM.

Added AES-192 and AES-256 modes to the AES-CTR benchmark.

Added a correctness test in ctr_test.go for the overflow optimization.

This improves performance, especially in AES-128 mode.

goos: windows
goarch: amd64
pkg: crypto/cipher
cpu: AMD Ryzen 7 5800H with Radeon Graphics
 │     B/s      │     B/s       vs base
AESCTR/128/50-16   1.377Gi ± 0%   1.384Gi ± 0%   +0.51% (p=0.028 n=20)
AESCTR/128/1K-16   6.164Gi ± 0%   6.892Gi ± 1%  +11.81% (p=0.000 n=20)
AESCTR/128/8K-16   7.372Gi ± 0%   8.768Gi ± 1%  +18.95% (p=0.000 n=20)
AESCTR/192/50-16   1.289Gi ± 0%   1.279Gi ± 0%   -0.75% (p=0.001 n=20)
AESCTR/192/1K-16   5.734Gi ± 0%   6.011Gi ± 0%   +4.83% (p=0.000 n=20)
AESCTR/192/8K-16   6.889Gi ± 1%   7.437Gi ± 0%   +7.96% (p=0.000 n=20)
AESCTR/256/50-16   1.170Gi ± 0%   1.163Gi ± 0%   -0.54% (p=0.005 n=20)
AESCTR/256/1K-16   5.235Gi ± 0%   5.391Gi ± 0%   +2.98% (p=0.000 n=20)
AESCTR/256/8K-16   6.361Gi ± 0%   6.676Gi ± 0%   +4.94% (p=0.000 n=20)
geomean            3.681Gi        3.882Gi        +5.46%

The slight slowdown on 50-byte workloads is unrelated to this change,
because such workloads never use ctrBlocks8Asm.

Updates #76061

Change-Id: Idfd628ac8bb282d9c73c6adf048eb12274a41379
GitHub-Last-Rev: 5aadd39351806fbbf5201e07511aac05bdcb0529
GitHub-Pull-Request: golang/go#76059
Reviewed-on: https://go-review.googlesource.com/c/go/+/714361
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: AHMAD ابو وليد <mizommz@gmail.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>

7 weeks agocmd/compile: add tests bruteforcing limit negation and improve limit addition
Jorropo [Wed, 26 Nov 2025 08:27:45 +0000 (09:27 +0100)]
cmd/compile: add tests bruteforcing limit negation and improve limit addition

I had to improve addition to make the tests pass.

Change-Id: I4daba2ee0f24a0dbc3929bf9afadd2116e16efae
Reviewed-on: https://go-review.googlesource.com/c/go/+/724600
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
7 weeks agocmd/compile,internal/bytealg: add MemEq intrinsic for runtime.memequal
Alexander Musman [Sat, 5 Jul 2025 20:16:36 +0000 (23:16 +0300)]
cmd/compile,internal/bytealg: add MemEq intrinsic for runtime.memequal

Introduce a new MemEq SSA operation for runtime.memequal. The operation
is initially implemented for arm64. The change adds opt rules (following
existing rules for call to runtime.memequal), working with MemEq, and a
later op version LoweredMemEq which may be lowered differently for more
constant size cases in future (for other targets as well as for arm64).
The new MemEq SSA operation does not have memory result, allowing cse of
loads operations around it.

Code size difference (for arm64 linux):

Executable            Old .text  New .text     Change
-------------------------------------------------------
asm                     1970420    1969668     -0.04%
cgo                     1741220    1740212     -0.06%
compile                 8956756    8959428     +0.03%
cover                   1879332    1878772     -0.03%
link                    2574116    2572660     -0.06%
preprofile               867124     866820     -0.04%
vet                     2890404    2888596     -0.06%

Change-Id: I6ab507929b861884d17d5818cfbd152cf7879751
Reviewed-on: https://go-review.googlesource.com/c/go/+/686655
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>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
7 weeks agocmd/go: remove final references to modfetch.Fetcher_
Ian Alexander [Tue, 25 Nov 2025 01:24:51 +0000 (20:24 -0500)]
cmd/go: remove final references to modfetch.Fetcher_

This commit removes the final references to the global Fetcher_ variable from
the modfetch and modload packages.

This completes the removal of global state from the modfetch package.

Change-Id: Ibb5309acdc7d05f1a7591ddcf890b44b6cc4cb2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/724249
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agocmd/go/internal/toolchain: remove references to modfetch.Fetcher_
Ian Alexander [Mon, 24 Nov 2025 23:48:32 +0000 (18:48 -0500)]
cmd/go/internal/toolchain: remove references to modfetch.Fetcher_

This commit removes references to the global modfetch.Fetcher_
variable from the toolchain package.

Change-Id: Id366bec88e5904098b90371ec103f92d402174d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/724248
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agocmd/go/internal/modget: remove references to modfetch.Fetcher_
Ian Alexander [Mon, 24 Nov 2025 23:39:53 +0000 (18:39 -0500)]
cmd/go/internal/modget: remove references to modfetch.Fetcher_

This commit removes references to the global modfetch.Fetcher_
variable from the modget package.

Change-Id: I62dfcc0e9cf9722a6706bbdf7b6e561130ed82d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/724247
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
7 weeks agocmd/go/internal/load: remove references to modfetch.Fetcher_
Ian Alexander [Mon, 24 Nov 2025 23:38:13 +0000 (18:38 -0500)]
cmd/go/internal/load: remove references to modfetch.Fetcher_

This commit removes references to the global modfetch.Fetcher_
variable from the load package.

Change-Id: Ic579743079252afd4d2d12e5118de09d86340267
Reviewed-on: https://go-review.googlesource.com/c/go/+/724246
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
7 weeks agocmd/go/internal/modcmd: remove references to modfetch.Fetcher_
Ian Alexander [Mon, 24 Nov 2025 23:36:07 +0000 (18:36 -0500)]
cmd/go/internal/modcmd: remove references to modfetch.Fetcher_

This commit removes references to the global modfetch.Fetcher_
variable from the modcmd package.

Change-Id: Ie2966401d1f6964e21ddede65d39ff53fea6e867
Reviewed-on: https://go-review.googlesource.com/c/go/+/724245
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
7 weeks agocmd/compile: adjust start heap size
David Chase [Mon, 17 Nov 2025 18:53:58 +0000 (13:53 -0500)]
cmd/compile: adjust start heap size

TLDR
- not-huge increase to default starting heap boost,
- small improvement in build performance,
- remove concurrency dependence of starting heap,
- aligns RSS behavior with GOMEMLIMIT,
- adds a gcflags=-d=gcstart=N (N -> N MiB) flag for
  people who want to trade a lot of memory for a
  little build performance improvement.

This removes concurrency (-c flag) sensitivity and increases the
nominal default to 128MiB.

Refactored the startheap code into a separate file, to make it
easier to extract and reuse.

Added sensitivity to concurrency=1 and GOMEMLIMIT!="" (in addition
to existing GOGC!=""), those disable the default starting heap boost
because the compiler-invoker has indicated either a desire to control
the GC or a desire to run in minimum memory(or both).

Adds a -d flag gcstart=N (N is number of MiB) for
tinkering/experiments. This always enables the starting heap.
(`GOGC=XXX` and `-d=gcstart=YYY` will use `GOGC=XXX` after starting
heap size is achieved.)

Derated the "boost" obtained by a factor of .70 so that
`-d=gcstart=2000` yields the same RSS as `GOMEMLIMIT=2000MiB`

(Actually adjusts the boost with a high-low breakpoint.)

The parent, with concurrency sensitivity, provided 64MB of plain
boost.  Derating reduces the effects of boosting the starting heap
slightly.  The benchmark here shows that maintaining 64MB results in
a minor regression, while increasing it to 128MB produces a slight
improvement, and does not grow the RSS versus 64MB.

```
        │   parent    │                sh64                │               sh128                │              sh1024               │
        │   sec/op    │   sec/op     vs base               │   sec/op     vs base               │   sec/op    vs base               │
std       10.164 ± 1%   10.527 ± 1%  +3.57% (p=0.000 n=50)   10.084 ± 1%  -0.79% (p=0.000 n=50)   9.631 ± 1%  -5.24% (p=0.000 n=50)
compile    21.05 ± 1%    20.78 ± 0%  -1.28% (p=0.000 n=50)    20.74 ± 1%  -1.46% (p=0.000 n=50)   20.77 ± 0%  -1.32% (p=0.001 n=50)
ast        20.45 ± 1%    20.39 ± 1%       ~ (p=0.334 n=50)    20.44 ± 0%       ~ (p=0.818 n=50)   20.11 ± 1%  -1.65% (p=0.000 n=50)
geomean    16.35         16.46       +0.65%                   16.23       -0.76%                  15.90       -2.75%

        │   parent    │                sh64                │               sh128                │               sh1024               │
        │ user-sec/op │ user-sec/op  vs base               │ user-sec/op  vs base               │ user-sec/op  vs base               │
std        66.06 ± 0%    69.74 ± 0%  +5.56% (p=0.000 n=50)    64.68 ± 0%  -2.09% (p=0.000 n=50)    59.51 ± 0%  -9.91% (p=0.000 n=50)
compile    84.69 ± 1%    82.54 ± 0%  -2.53% (p=0.000 n=50)    82.63 ± 0%  -2.43% (p=0.000 n=50)    82.66 ± 1%  -2.40% (p=0.000 n=50)
ast        59.41 ± 0%    58.84 ± 1%  -0.95% (p=0.011 n=50)    59.48 ± 1%       ~ (p=0.341 n=50)    57.13 ± 1%  -3.83% (p=0.000 n=50)
geomean    69.27         69.71       +0.63%                   68.25       -1.47%                   65.50       -5.44%

        │   parent   │                sh64                │               sh128               │              sh1024               │
        │ sys-sec/op │ sys-sec/op   vs base               │ sys-sec/op  vs base               │ sys-sec/op  vs base               │
std       9.599 ± 1%   10.031 ± 1%  +4.50% (p=0.000 n=50)   9.513 ± 1%  -0.90% (p=0.014 n=50)   9.359 ± 1%  -2.50% (p=0.000 n=50)
compile   6.813 ± 1%    6.740 ± 1%  -1.08% (p=0.017 n=50)   6.716 ± 1%  -1.42% (p=0.006 n=50)   6.696 ± 1%  -1.72% (p=0.000 n=50)
ast       4.315 ± 1%    4.291 ± 1%       ~ (p=0.781 n=50)   4.296 ± 1%       ~ (p=0.792 n=50)   4.279 ± 2%       ~ (p=0.124 n=50)
geomean   6.559         6.620       +0.93%                  6.499       -0.92%                  6.449       -1.68%

        │     parent     │                 sh64                  │                 sh128                 │                 sh1024                  │
        │ peak-RSS-bytes │ peak-RSS-bytes  vs base               │ peak-RSS-bytes  vs base               │ peak-RSS-bytes  vs base                 │
std         257.1Mi ± 1%     257.2Mi ± 1%       ~ (p=0.754 n=50)     257.0Mi ± 0%       ~ (p=0.570 n=50)     605.6Mi ± 0%  +135.59% (p=0.000 n=50)
compile    1007.2Mi ± 1%    1004.3Mi ± 0%       ~ (p=0.064 n=50)    1007.4Mi ± 0%       ~ (p=0.348 n=50)    1009.4Mi ± 1%         ~ (p=0.598 n=50)
ast         1.848Gi ± 0%     1.842Gi ± 0%       ~ (p=0.079 n=50)     1.824Gi ± 0%  -1.25% (p=0.000 n=50)     1.856Gi ± 0%    +0.47% (p=0.000 n=50)
geomean     788.3Mi          786.8Mi       -0.19%                    785.0Mi       -0.41%                    1.027Gi        +33.37%
```

Updates #73044

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

7 weeks agointernal/trace: support event constructor for testing
Felix Geisendörfer [Wed, 2 Jul 2025 09:26:17 +0000 (11:26 +0200)]
internal/trace: support event constructor for testing

Implement the new APIs described in #74826.

Closes #74826

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

7 weeks agoruntime: panic if cleanup function closes over cleanup pointer
Ian Lance Taylor [Fri, 22 Aug 2025 20:47:42 +0000 (13:47 -0700)]
runtime: panic if cleanup function closes over cleanup pointer

This would catch problems like https://go.dev/cl/696295.

Benchmark effect with this CL plus CL 697535:

goos: linux
goarch: amd64
pkg: runtime
cpu: 12th Gen Intel(R) Core(TM) i7-1260P
                     │ /tmp/foo.1  │             /tmp/foo.2             │
                     │   sec/op    │   sec/op     vs base               │
AddCleanupAndStop-16   81.93n ± 1%   82.87n ± 1%  +1.14% (p=0.041 n=10)

For #75066

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

7 weeks agoruntime: panic on AddCleanup with self pointer
Ian Lance Taylor [Wed, 20 Aug 2025 00:00:29 +0000 (17:00 -0700)]
runtime: panic on AddCleanup with self pointer

For #75066

Change-Id: Ifd555586fb448e7510fed16372648bdd7ec0ab4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/697535
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
7 weeks agocmd/go/internal/modfetch: remove references to Fetcher_ in test file
Ian Alexander [Mon, 24 Nov 2025 23:30:50 +0000 (18:30 -0500)]
cmd/go/internal/modfetch: remove references to Fetcher_ in test file

This commit removes references to the global Fetcher_ variable from
the zip sum test file.

Change-Id: I622587f7809f4c6bcd4afbb35312912149b7a3ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/724244
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
7 weeks agocmd/go/internal/modload: replace references to modfetch.Fetcher_
Ian Alexander [Mon, 24 Nov 2025 17:19:55 +0000 (12:19 -0500)]
cmd/go/internal/modload: replace references to modfetch.Fetcher_

This commit replaces references of modfetch.Fetcher_ with
modload.State.Fetcher() in the modload package.  Note that the
constructor `NewState` still intentionally references the global
variable.  This will be refactored in a later commit.

Change-Id: Ia8cfb41a81b0e29043694bc0f0f33f5a2f4920c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/724243
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agocmd/go/internal/modcmd: inject modfetch.Fetcher_ into DownloadModule
Ian Alexander [Mon, 24 Nov 2025 21:53:11 +0000 (16:53 -0500)]
cmd/go/internal/modcmd: inject modfetch.Fetcher_ into DownloadModule

This commit continues the injection of the global Fetcher_ variable into
the various function calls that make use of it.  The purpose is to
prepare for the eventual removal of the global Fetcher_ variable and
eliminate global state within the modfetch package.

[git-generate]
cd src/cmd/go/internal/modcmd
rf '
 inject modfetch.Fetcher_ DownloadModule
'
cd ../modfetch
rf '
  add downloadZip:/f, err := tempFile.*/+0 _ = f \
    file, err := tempFile(ctx, filepath.Dir(zipfile), filepath.Base(zipfile), 0o666) \
    _ = file
'
rf '
  add downloadZip:/f.Close\(\)/+0 file.Close()
  rm downloadZip:/file.Close\(\)/-1
  add downloadZip:/os.Remove\(f.Name\(\)\)/+0 os.Remove(file.Name())
  rm downloadZip:/os.Remove\(file.Name\(\)\)/-1
'
sed -i '
  s/ f, err := tempFile(ctx, filepath.Dir(zipfile), filepath.Base(zipfile), 0o666)/file, err := tempFile(ctx, filepath.Dir(zipfile), filepath.Base(zipfile), 0o666)/
  s/err := repo.Zip(ctx, f, mod.Version)/err := repo.Zip(ctx, file, mod.Version)/
  s/if _, err := f.Seek(0, io.SeekStart); err != nil {/if _, err := file.Seek(0, io.SeekStart); err != nil {/
  s/if err := f.Truncate(0); err != nil {/if err := file.Truncate(0); err != nil {/
  s/fi, err := f.Stat()/fi, err := file.Stat()/
  s/z, err := zip.NewReader(f, fi.Size())/z, err := zip.NewReader(file, fi.Size())/
  s/for _, f := range z.File {/for _, zf := range z.File {/
  s/if !strings.HasPrefix(f.Name, prefix) {/if !strings.HasPrefix(zf.Name, prefix) {/
  s/return fmt.Errorf("zip for %s has unexpected file %s", prefix\[:len(prefix)-1\], f.Name)/return fmt.Errorf("zip for %s has unexpected file %s", prefix[:len(prefix)-1], zf.Name)/
  s/if err := f.Close(); err != nil {/if err := file.Close(); err != nil {/
  s/if err := hashZip(fetcher_, mod, f.Name(), ziphashfile); err != nil {/if err := hashZip(fetcher_, mod, file.Name(), ziphashfile); err != nil {/
  s/if err := os.Rename(f.Name(), zipfile); err != nil {/if err := os.Rename(file.Name(), zipfile); err != nil {/
' fetch.go
rf '
  rm downloadZip:/_ = file/-3 downloadZip:/_ = file/-2 downloadZip:/file, err := tempFile\(ctx, filepath.Dir\(zipfile\), filepath.Base\(zipfile\), 0o666\)/+1
'
rf '
  mv InfoFile.fetcher_ InfoFile.f
  mv InfoFile Fetcher.InfoFile
  mv GoModFile.fetcher_ GoModFile.f
  mv GoModFile Fetcher.GoModFile
  mv GoModSum.fetcher_ GoModSum.f
  mv GoModSum Fetcher.GoModSum
  mv Download.fetcher_ Download.f
  mv Download Fetcher.Download
  mv download.fetcher_ download.f
  mv download Fetcher.download
  mv DownloadZip.fetcher_ DownloadZip.f
  mv DownloadZip Fetcher.DownloadZip
  mv downloadZip.fetcher_ downloadZip.f
  mv downloadZip Fetcher.downloadZip
  mv checkMod.fetcher_ checkMod.f
  mv checkMod Fetcher.checkMod
  mv hashZip.fetcher_ hashZip.f
'

Change-Id: I1d2e09b8523f5ef2be04b91d858d98fb79c0a771
Reviewed-on: https://go-review.googlesource.com/c/go/+/724242
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
7 weeks agocmd/go/internal/modload: inject modfetch.Fetcher_ into commitRequirements
Ian Alexander [Mon, 24 Nov 2025 17:38:27 +0000 (12:38 -0500)]
cmd/go/internal/modload: inject modfetch.Fetcher_ into commitRequirements

This commit continues the injection of the global Fetcher_ variable into
the various function calls that make use of it.  The purpose is to
prepare for the eventual removal of the global Fetcher_ variable and
eliminate global state within the modfetch package.

[git-generate]
cd src/cmd/go/internal/modload
rf '
  inject modfetch.Fetcher_ commitRequirements
  mv readModGraph.fetcher_ readModGraph.f
'

cd ../modfetch
sed -i '
  s/for _, f := range fetcher_.workspaceGoSumFiles {/for _, fn := range fetcher_.workspaceGoSumFiles {/
  s/fetcher_.sumState.w\[f\] = make(map\[module.Version\]\[\]string)/fetcher_.sumState.w[fn] = make(map[module.Version][]string)/
  s/_, err := readGoSumFile(fetcher_.sumState.w\[f\], f)/_, err := readGoSumFile(fetcher_.sumState.w[fn], fn)/
' fetch.go
rf '
  mv GoMod.fetcher_ GoMod.f
  mv GoMod Fetcher.GoMod
  mv readDiskGoMod.fetcher_ readDiskGoMod.f
  mv readDiskGoMod Fetcher.readDiskGoMod
  mv initGoSum.fetcher_ initGoSum.f
  mv initGoSum Fetcher.initGoSum
  mv HaveSum.fetcher_ HaveSum.f
  mv checkGoMod.fetcher_ checkGoMod.f
  mv checkModSum.fetcher_ checkModSum.f
  mv WriteGoSum.fetcher_ WriteGoSum.f
  mv WriteGoSum Fetcher.WriteGoSum
  mv Lookup.fetcher_ Lookup.f
  mv Lookup Fetcher.Lookup
'

Change-Id: Ifbe7d6b90b93fd65a7443434035921e6b42dea1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/724241
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
7 weeks agocmd/go/internal/modfetch: inject Fetcher_ into TidyGoSum
Ian Alexander [Mon, 24 Nov 2025 15:53:31 +0000 (10:53 -0500)]
cmd/go/internal/modfetch: inject Fetcher_ into TidyGoSum

This commit begins the injection of the global Fetcher_ variable into
the various function calls that make use of it.  The purpose is to
prepare for the eventual removal of the global Fetcher_ variable and
eliminate global state.

[git-generate]
cd src/cmd/go/internal/modfetch
rf '
  inject Fetcher_ TidyGoSum
  mv haveModSumLocked.fetcher_ haveModSumLocked.f
  mv addModSumLocked.fetcher_ addModSumLocked.f
  mv tidyGoSum.fetcher_ tidyGoSum.f
  mv sumInWorkspaceModulesLocked.fetcher_ sumInWorkspaceModulesLocked.f
'

Change-Id: Iecf736f17d6e63c856355284d09b7982dc9e16b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/724240
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
7 weeks agocrypto/internal/fips140/aes/gcm: add more GCM nonce modes
Filippo Valsorda [Mon, 24 Nov 2025 12:35:15 +0000 (13:35 +0100)]
crypto/internal/fips140/aes/gcm: add more GCM nonce modes

First, this adds a GCM mode for QUIC, and a generic TLS 1.3/QUIC-like
XOR'd counter mode. QUIC constructs nonces exactly like TLS 1.3, but the
counter does not reset to zero on a key update, so the mask must be
provided explicitly (or we will panic well before running out of
counters because the wrong value is XOR'd out). See the analysis at
https://github.com/quic-go/quic-go/issues/5077#issuecomment-3570352683
for the details of QUIC and FIPS 140-3 compliance (including a
workaround for the key update issue).

Second, this coalesces all the compliance modes around two schemes:
fixed || counter, and fixed XOR counter. The former is used in TLS 1.2
and SSH, and the latter is used in TLS 1.3 and QUIC.

This would not be a backwards compatible change if these were public
APIs, but we only need different versions of the FIPS 140-3 module to be
source-compatible with the standard library, and the callers of these
NewGCMFor* functions only care that the return value implements
cipher.AEAD, at least for now.

This exposes no new public APIs, but lets us get started validating
these functions in v2.0.0 of the FIPS 140-3 module.

Updates #73110

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

7 weeks agocrypto/tls: add SecP256r1/SecP384r1MLKEM1024 hybrid post-quantum key exchanges
Filippo Valsorda [Wed, 19 Nov 2025 16:32:42 +0000 (17:32 +0100)]
crypto/tls: add SecP256r1/SecP384r1MLKEM1024 hybrid post-quantum key exchanges

Fixes #71206

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

7 weeks agocmd/internal/obj/loong64: add {,X}V{ADD,SUB}W{EV,OD}.{H.B,W.H,D.W,Q.D}{,U} instructio...
Guoqi Chen [Mon, 24 Nov 2025 04:56:15 +0000 (12:56 +0800)]
cmd/internal/obj/loong64: add {,X}V{ADD,SUB}W{EV,OD}.{H.B,W.H,D.W,Q.D}{,U} instructions support

Go asm syntax:
 VADDWEV{HB, WH, VW, QV}{,U}        V1, V2, V3
 VSUBWEV{HB, WH, VW, QV}{,U}        V1, V2, V3
 VADDWOD{HB, WH, VW, QV}{,U}        V1, V2, V3
 VSUBWOD{HB, WH, VW, QV}{,U}        V1, V2, V3
XVADDWEV{HB, WH, VW, QV}{,U}        X1, X2, X3
XVSUBWEV{HB, WH, VW, QV}{,U}        X1, X2, X3
XVADDWOD{HB, WH, VW, QV}{,U}        X1, X2, X3
XVSUBWOD{HB, WH, VW, QV}{,U}        X1, X2, X3

Equivalent platform assembler syntax:
 vaddwev.{h.b, w.h, d.w, q.d}{,u}   V3, V2, V1
 vsubwev.{h.b, w.h, d.w, q.d}{,u}   V3, V2, V1
 vaddwod.{h.b, w.h, d.w, q.d}{,u}   V3, V2, V1
 vsubwod.{h.b, w.h, d.w, q.d}{,u}   V3, V2, V1
xvaddwev.{h.b, w.h, d.w, q.d}{,u}   X3, X2, X1
xvsubwev.{h.b, w.h, d.w, q.d}{,u}   X3, X2, X1
xvaddwod.{h.b, w.h, d.w, q.d}{,u}   X3, X2, X1
xvsubwod.{h.b, w.h, d.w, q.d}{,u}   X3, X2, X1

Change-Id: I407dc65b32b89844fd303e265a99d8aafdf922ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/723620
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
7 weeks agocmd/go/internal/modfetch: move global goSum to Fetcher_
Ian Alexander [Thu, 20 Nov 2025 16:45:33 +0000 (11:45 -0500)]
cmd/go/internal/modfetch: move global goSum to Fetcher_

[git-generate]
cd src/cmd/go/internal/modfetch
rf '
  add Fetcher.sumState mu sync.Mutex
  ex {
      goSum.mu -> Fetcher_.mu
      goSum.m -> Fetcher_.sumState.m
      goSum.w -> Fetcher_.sumState.w
      goSum.status -> Fetcher_.sumState.status
      goSum.overwrite -> Fetcher_.sumState.overwrite
      goSum.enabled -> Fetcher_.sumState.enabled
      goSum.sumState -> Fetcher_.sumState
    }
    rm goSum
'

Change-Id: I3693905d5bed19f7bae60f5bc1ec5097354c9427
Reviewed-on: https://go-review.googlesource.com/c/go/+/722582
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
7 weeks agocmd/go: remove fips140 dependency on global Fetcher_
Ian Alexander [Tue, 18 Nov 2025 17:40:06 +0000 (12:40 -0500)]
cmd/go: remove fips140 dependency on global Fetcher_

This commit makes Unzip a method on the *Fetcher type, and updates
fips140 initialization to use a new Fetcher instance instead of the
global Fetcher_ variable.

Change-Id: Iea8d9ee4dd6e6a2be43520c144aaec6e75c9cd63
Reviewed-on: https://go-review.googlesource.com/c/go/+/722581
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
7 weeks agointernal/strconv: add testbase tests
Russ Cox [Tue, 11 Nov 2025 13:47:14 +0000 (05:47 -0800)]
internal/strconv: add testbase tests

Add ability to test against inputs chosen by from the stress
tests computed by Vern Paxson's testbase program.

Checked that 'go test -testbase' passes.

Change-Id: I81057e55df6cd369b40ce623a59884e6ead0ed76
Reviewed-on: https://go-review.googlesource.com/c/go/+/719620
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agointernal/strconv: delete ftoaryu
Russ Cox [Mon, 24 Nov 2025 19:03:34 +0000 (14:03 -0500)]
internal/strconv: delete ftoaryu

CL 700075 made this dead code.

Benchmarks below for CL 700075, testing Dragonbox vs the old Ryu being deleted.
The "Fixed" benchmarks are unchanged, which gives a sense of the noise level.

benchmark \ host                  linux-amd64       s7  linux-arm64    local  linux-386  s7:GOARCH=386  linux-arm
                                      vs base  vs base      vs base  vs base    vs base        vs base    vs base
AppendFloat/Decimal                    -2.68%   +2.76%       +4.99%   -7.44%    +11.93%        +10.51%    +21.84%
AppendFloat/Float                     -21.98%  -13.32%      -16.50%  -11.54%    -33.37%        -28.66%    -15.64%
AppendFloat/Exp                       -32.44%  -25.54%      -28.85%  -31.79%    -39.60%        -35.92%    -20.89%
AppendFloat/NegExp                    -33.31%  -25.91%      -28.90%  -31.29%    -41.17%        -35.52%    -21.32%
AppendFloat/LongExp                   -19.35%   -9.51%      -15.29%  -12.36%    -30.46%        -25.10%    -10.18%
AppendFloat/Big                       -24.40%  -15.84%      -22.56%  -24.05%    -43.23%        -36.28%    -26.45%
AppendFloat/BinaryExp                  -0.52%   -1.20%            ~        ~          ~         +0.96%     +1.94%
AppendFloat/32Integer                 -14.24%   -7.01%      -12.82%  -18.99%    -12.12%        -10.85%     -0.32%
AppendFloat/32ExactFraction           -34.53%  -28.47%      -34.50%  -30.50%    -43.75%        -38.73%    -25.44%
AppendFloat/32Point                   -25.83%  -18.54%      -23.52%  -21.26%    -36.74%        -33.11%    -20.72%
AppendFloat/32Exp                     -37.55%  -33.36%      -37.74%  -39.06%    -51.37%        -44.53%    -31.76%
AppendFloat/32NegExp                  -35.99%  -31.96%      -36.02%  -37.13%    -44.62%        -39.03%    -26.91%
AppendFloat/32Shortest                -23.25%  -18.02%      -21.41%  -23.07%    -35.56%        -32.89%    -20.13%
AppendFloat/32Fixed8Hard               +1.09%   -1.94%            ~        ~     -2.33%         -1.36%     -0.10%
AppendFloat/32Fixed9Hard               +1.45%   -2.10%       +0.10%        ~     -4.20%         -0.72%     +1.31%
AppendFloat/64Fixed1                   +0.45%        ~            ~   -1.66%     -3.74%         -2.13%          ~
AppendFloat/64Fixed2                   +0.32%   -0.92%       +0.53%   -1.75%     -2.69%              ~     -0.49%
AppendFloat/64Fixed2.5                 +0.38%   -0.38%            ~        ~     -5.14%         -1.15%     -0.97%
AppendFloat/64Fixed3                   +0.97%   -0.53%            ~   +0.23%     -3.57%         -4.04%     -0.27%
AppendFloat/64Fixed4                   +0.95%   -2.77%       +0.45%   -1.57%     -3.99%         -2.58%     -0.91%
AppendFloat/64Fixed5Hard               +0.52%   -1.22%            ~   -0.87%     -3.20%         -1.60%     +0.49%
AppendFloat/64Fixed12                  +1.15%   -0.62%            ~        ~     -3.37%         -1.43%     -0.72%
AppendFloat/64Fixed16                  +1.13%        ~       -0.21%   -0.59%     -3.65%              ~     +0.74%
AppendFloat/64Fixed12Hard              +0.78%   -1.26%            ~   -0.95%     -4.82%         -2.98%     +0.26%
AppendFloat/64Fixed17Hard                   ~        ~       -0.32%   -6.34%     -2.44%         -2.19%     +1.00%
AppendFloat/64Fixed18Hard                   ~        ~            ~        ~          ~              ~     +0.06%
AppendFloat/64FixedF1                  +0.44%        ~       +0.43%   -1.87%     -2.75%              ~     -1.24%
AppendFloat/64FixedF2                  +1.35%   -1.04%       +0.81%   +1.26%     -2.21%         -2.36%          ~
AppendFloat/64FixedF3                       ~   -1.14%       +0.39%   -1.58%     -3.46%              ~     -1.08%
AppendFloat/Slowpath64                -15.51%   -7.05%      -14.59%   -7.86%    -22.54%        -19.63%     -5.90%
AppendFloat/SlowpathDenormal64        -15.10%   -8.19%      -14.62%   -9.36%    -26.86%        -23.10%    -14.48%

host: linux-amd64
goos: linux
goarch: amd64
pkg: internal/strconv
cpu: Intel(R) Xeon(R) CPU @ 2.30GHz
                                     │ 3c26aef8fba  │             8a958b0d9c1             │
                                     │    sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-16                  63.37n ± 0%   61.67n ± 0%   -2.68% (p=0.000 n=20)
AppendFloat/Float-16                    92.83n ± 0%   72.43n ± 0%  -21.98% (p=0.000 n=20)
AppendFloat/Exp-16                      98.60n ± 0%   66.61n ± 0%  -32.44% (p=0.000 n=20)
AppendFloat/NegExp-16                  100.15n ± 0%   66.79n ± 0%  -33.31% (p=0.000 n=20)
AppendFloat/LongExp-16                 105.35n ± 0%   84.96n ± 0%  -19.35% (p=0.000 n=20)
AppendFloat/Big-16                     108.50n ± 0%   82.03n ± 0%  -24.40% (p=0.000 n=20)
AppendFloat/BinaryExp-16                47.27n ± 0%   47.03n ± 0%   -0.52% (p=0.000 n=20)
AppendFloat/32Integer-16                63.29n ± 0%   54.28n ± 0%  -14.24% (p=0.000 n=20)
AppendFloat/32ExactFraction-16          89.72n ± 0%   58.74n ± 0%  -34.53% (p=0.000 n=20)
AppendFloat/32Point-16                  87.32n ± 0%   64.77n ± 0%  -25.83% (p=0.000 n=20)
AppendFloat/32Exp-16                    94.89n ± 0%   59.26n ± 0%  -37.55% (p=0.000 n=20)
AppendFloat/32NegExp-16                 92.68n ± 0%   59.32n ± 0%  -35.99% (p=0.000 n=20)
AppendFloat/32Shortest-16               82.12n ± 0%   63.04n ± 0%  -23.25% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-16             57.76n ± 0%   58.38n ± 0%   +1.09% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-16             66.44n ± 0%   67.41n ± 0%   +1.45% (p=0.000 n=20)
AppendFloat/64Fixed1-16                 51.00n ± 0%   51.24n ± 0%   +0.45% (p=0.000 n=20)
AppendFloat/64Fixed2-16                 50.86n ± 0%   51.03n ± 0%   +0.32% (p=0.000 n=20)
AppendFloat/64Fixed2.5-16               49.31n ± 0%   49.49n ± 0%   +0.38% (p=0.000 n=20)
AppendFloat/64Fixed3-16                 51.98n ± 0%   52.48n ± 0%   +0.97% (p=0.000 n=20)
AppendFloat/64Fixed4-16                 50.05n ± 0%   50.52n ± 0%   +0.95% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-16             58.01n ± 0%   58.31n ± 0%   +0.52% (p=0.000 n=20)
AppendFloat/64Fixed12-16                82.81n ± 0%   83.77n ± 0%   +1.15% (p=0.000 n=20)
AppendFloat/64Fixed16-16                70.66n ± 0%   71.46n ± 0%   +1.13% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-16            68.25n ± 0%   68.79n ± 0%   +0.78% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-16            79.78n ± 0%   79.82n ± 0%        ~ (p=0.136 n=20)
AppendFloat/64Fixed18Hard-16            4.881µ ± 0%   4.876µ ± 0%        ~ (p=0.432 n=20)
AppendFloat/64FixedF1-16                68.74n ± 0%   69.04n ± 0%   +0.44% (p=0.000 n=20)
AppendFloat/64FixedF2-16                57.36n ± 0%   58.13n ± 0%   +1.35% (p=0.000 n=20)
AppendFloat/64FixedF3-16                52.59n ± 0%   52.77n ± 0%        ~ (p=0.001 n=20)
AppendFloat/Slowpath64-16               99.56n ± 0%   84.12n ± 0%  -15.51% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-16       97.35n ± 0%   82.65n ± 0%  -15.10% (p=0.000 n=20)
AppendFloat/ShorterIntervalCase32-16                  56.27n ± 0%
AppendFloat/ShorterIntervalCase64-16                  57.42n ± 0%
geomean                                 82.53n        71.80n       -11.68%

host: s7
cpu: AMD Ryzen 9 7950X 16-Core Processor
                                     │ 3c26aef8fba │             8a958b0d9c1             │
                                     │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-32                 22.30n ± 0%   22.91n ± 0%   +2.76% (p=0.000 n=20)
AppendFloat/Float-32                   34.54n ± 0%   29.94n ± 0%  -13.32% (p=0.000 n=20)
AppendFloat/Exp-32                     34.55n ± 0%   25.72n ± 0%  -25.54% (p=0.000 n=20)
AppendFloat/NegExp-32                  35.08n ± 0%   25.99n ± 1%  -25.91% (p=0.000 n=20)
AppendFloat/LongExp-32                 36.85n ± 0%   33.35n ± 1%   -9.51% (p=0.000 n=20)
AppendFloat/Big-32                     38.28n ± 0%   32.21n ± 1%  -15.84% (p=0.000 n=20)
AppendFloat/BinaryExp-32               17.52n ± 0%   17.30n ± 0%   -1.20% (p=0.000 n=20)
AppendFloat/32Integer-32               22.31n ± 0%   20.75n ± 0%   -7.01% (p=0.000 n=20)
AppendFloat/32ExactFraction-32         32.74n ± 1%   23.41n ± 1%  -28.47% (p=0.000 n=20)
AppendFloat/32Point-32                 32.88n ± 0%   26.79n ± 0%  -18.54% (p=0.000 n=20)
AppendFloat/32Exp-32                   34.10n ± 0%   22.72n ± 1%  -33.36% (p=0.000 n=20)
AppendFloat/32NegExp-32                33.17n ± 1%   22.57n ± 0%  -31.96% (p=0.000 n=20)
AppendFloat/32Shortest-32              29.85n ± 1%   24.47n ± 0%  -18.02% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-32            22.62n ± 1%   22.19n ± 1%   -1.94% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-32            25.75n ± 1%   25.21n ± 0%   -2.10% (p=0.000 n=20)
AppendFloat/64Fixed1-32                19.02n ± 1%   18.98n ± 0%        ~ (p=0.351 n=20)
AppendFloat/64Fixed2-32                18.94n ± 0%   18.76n ± 0%   -0.92% (p=0.000 n=20)
AppendFloat/64Fixed2.5-32              18.23n ± 0%   18.16n ± 0%   -0.38% (p=0.001 n=20)
AppendFloat/64Fixed3-32                19.79n ± 0%   19.68n ± 0%   -0.53% (p=0.000 n=20)
AppendFloat/64Fixed4-32                18.93n ± 0%   18.40n ± 1%   -2.77% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-32            21.81n ± 0%   21.54n ± 1%   -1.22% (p=0.000 n=20)
AppendFloat/64Fixed12-32               30.58n ± 1%   30.39n ± 0%   -0.62% (p=0.000 n=20)
AppendFloat/64Fixed16-32               26.98n ± 1%   26.80n ± 1%        ~ (p=0.010 n=20)
AppendFloat/64Fixed12Hard-32           26.20n ± 0%   25.86n ± 1%   -1.26% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-32           30.01n ± 1%   30.10n ± 1%        ~ (p=0.112 n=20)
AppendFloat/64Fixed18Hard-32           1.809µ ± 1%   1.806µ ± 0%        ~ (p=0.713 n=20)
AppendFloat/64FixedF1-32               26.78n ± 1%   26.59n ± 0%        ~ (p=0.005 n=20)
AppendFloat/64FixedF2-32               20.24n ± 1%   20.03n ± 0%   -1.04% (p=0.000 n=20)
AppendFloat/64FixedF3-32               18.88n ± 0%   18.67n ± 0%   -1.14% (p=0.000 n=20)
AppendFloat/Slowpath64-32              35.37n ± 0%   32.88n ± 1%   -7.05% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-32      35.17n ± 0%   32.29n ± 1%   -8.19% (p=0.000 n=20)
AppendFloat/ShorterIntervalCase32-32                 21.76n ± 0%
AppendFloat/ShorterIntervalCase64-32                 22.11n ± 0%
geomean                                30.34n        27.23n        -8.96%

host: linux-arm64
goarch: arm64
cpu: unknown
                                    │ 3c26aef8fba  │             8a958b0d9c1             │
                                    │    sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-8                  60.08n ± 0%   63.07n ± 0%   +4.99% (p=0.000 n=20)
AppendFloat/Float-8                    88.53n ± 0%   73.92n ± 0%  -16.50% (p=0.000 n=20)
AppendFloat/Exp-8                      93.07n ± 0%   66.22n ± 0%  -28.85% (p=0.000 n=20)
AppendFloat/NegExp-8                   93.35n ± 0%   66.38n ± 0%  -28.90% (p=0.000 n=20)
AppendFloat/LongExp-8                 100.15n ± 0%   84.84n ± 0%  -15.29% (p=0.000 n=20)
AppendFloat/Big-8                     103.80n ± 0%   80.38n ± 0%  -22.56% (p=0.000 n=20)
AppendFloat/BinaryExp-8                47.36n ± 0%   47.34n ± 0%        ~ (p=0.033 n=20)
AppendFloat/32Integer-8                60.28n ± 0%   52.55n ± 0%  -12.82% (p=0.000 n=20)
AppendFloat/32ExactFraction-8          86.11n ± 0%   56.40n ± 0%  -34.50% (p=0.000 n=20)
AppendFloat/32Point-8                  82.88n ± 0%   63.39n ± 0%  -23.52% (p=0.000 n=20)
AppendFloat/32Exp-8                    89.33n ± 0%   55.62n ± 0%  -37.74% (p=0.000 n=20)
AppendFloat/32NegExp-8                 87.48n ± 0%   55.97n ± 0%  -36.02% (p=0.000 n=20)
AppendFloat/32Shortest-8               76.31n ± 0%   59.97n ± 0%  -21.41% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-8             52.83n ± 0%   52.82n ± 0%        ~ (p=0.370 n=20)
AppendFloat/32Fixed9Hard-8             60.90n ± 0%   60.96n ± 0%   +0.10% (p=0.000 n=20)
AppendFloat/64Fixed1-8                 46.96n ± 0%   46.95n ± 0%        ~ (p=0.702 n=20)
AppendFloat/64Fixed2-8                 46.96n ± 0%   47.21n ± 0%   +0.53% (p=0.000 n=20)
AppendFloat/64Fixed2.5-8               44.24n ± 0%   44.29n ± 0%        ~ (p=0.006 n=20)
AppendFloat/64Fixed3-8                 47.73n ± 0%   47.78n ± 0%        ~ (p=0.020 n=20)
AppendFloat/64Fixed4-8                 44.40n ± 0%   44.60n ± 0%   +0.45% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-8             52.52n ± 0%   52.50n ± 0%        ~ (p=0.722 n=20)
AppendFloat/64Fixed12-8                78.57n ± 0%   78.56n ± 0%        ~ (p=0.222 n=20)
AppendFloat/64Fixed16-8                65.36n ± 0%   65.22n ± 0%   -0.21% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-8            62.04n ± 0%   61.97n ± 0%        ~ (p=0.004 n=20)
AppendFloat/64Fixed17Hard-8            74.30n ± 0%   74.06n ± 0%   -0.32% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-8            4.282µ ± 0%   4.284µ ± 0%        ~ (p=0.296 n=20)
AppendFloat/64FixedF1-8                66.05n ± 0%   66.33n ± 0%   +0.43% (p=0.000 n=20)
AppendFloat/64FixedF2-8                53.67n ± 0%   54.11n ± 0%   +0.81% (p=0.000 n=20)
AppendFloat/64FixedF3-8                47.41n ± 0%   47.59n ± 0%   +0.39% (p=0.000 n=20)
AppendFloat/Slowpath64-8               97.42n ± 0%   83.21n ± 0%  -14.59% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-8       94.74n ± 0%   80.88n ± 0%  -14.62% (p=0.000 n=20)
AppendFloat/ShorterIntervalCase32-8                  53.77n ± 0%
AppendFloat/ShorterIntervalCase64-8                  55.22n ± 0%
geomean                                77.14n        67.89n       -10.73%

host: local
goos: darwin
cpu: Apple M3 Pro
                                     │ 3c26aef8fba │             8a958b0d9c1             │
                                     │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-12                 21.09n ± 0%   19.52n ± 0%   -7.44% (p=0.000 n=20)
AppendFloat/Float-12                   32.36n ± 0%   28.63n ± 1%  -11.54% (p=0.000 n=20)
AppendFloat/Exp-12                     31.77n ± 0%   21.67n ± 0%  -31.79% (p=0.000 n=20)
AppendFloat/NegExp-12                  31.56n ± 1%   21.68n ± 0%  -31.29% (p=0.000 n=20)
AppendFloat/LongExp-12                 33.33n ± 0%   29.21n ± 0%  -12.36% (p=0.000 n=20)
AppendFloat/Big-12                     35.24n ± 1%   26.77n ± 0%  -24.05% (p=0.000 n=20)
AppendFloat/BinaryExp-12               18.88n ± 1%   19.38n ± 2%        ~ (p=0.031 n=20)
AppendFloat/32Integer-12               21.32n ± 1%   17.27n ± 0%  -18.99% (p=0.000 n=20)
AppendFloat/32ExactFraction-12         30.85n ± 1%   21.44n ± 0%  -30.50% (p=0.000 n=20)
AppendFloat/32Point-12                 31.02n ± 1%   24.42n ± 0%  -21.26% (p=0.000 n=20)
AppendFloat/32Exp-12                   31.55n ± 0%   19.23n ± 0%  -39.06% (p=0.000 n=20)
AppendFloat/32NegExp-12                30.32n ± 1%   19.06n ± 0%  -37.13% (p=0.000 n=20)
AppendFloat/32Shortest-12              26.68n ± 0%   20.52n ± 0%  -23.07% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-12            17.34n ± 1%   17.24n ± 0%        ~ (p=0.017 n=20)
AppendFloat/32Fixed9Hard-12            19.05n ± 1%   19.25n ± 1%        ~ (p=0.155 n=20)
AppendFloat/64Fixed1-12                15.66n ± 0%   15.40n ± 0%   -1.66% (p=0.000 n=20)
AppendFloat/64Fixed2-12                15.39n ± 0%   15.12n ± 0%   -1.75% (p=0.000 n=20)
AppendFloat/64Fixed2.5-12              15.14n ± 0%   15.14n ± 0%        ~ (p=0.645 n=20)
AppendFloat/64Fixed3-12                15.53n ± 0%   15.56n ± 0%   +0.23% (p=0.000 n=20)
AppendFloat/64Fixed4-12                15.28n ± 0%   15.04n ± 0%   -1.57% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-12            18.32n ± 0%   18.16n ± 0%   -0.87% (p=0.000 n=20)
AppendFloat/64Fixed12-12               25.51n ± 1%   25.48n ± 0%        ~ (p=0.256 n=20)
AppendFloat/64Fixed16-12               21.32n ± 0%   21.20n ± 0%   -0.59% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-12           21.11n ± 1%   20.91n ± 1%   -0.95% (p=0.001 n=20)
AppendFloat/64Fixed17Hard-12           26.89n ± 1%   25.18n ± 3%   -6.34% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-12           2.057µ ± 6%   2.065µ ± 1%        ~ (p=0.856 n=20)
AppendFloat/64FixedF1-12               24.65n ± 0%   24.19n ± 0%   -1.87% (p=0.000 n=20)
AppendFloat/64FixedF2-12               20.68n ± 0%   20.94n ± 0%   +1.26% (p=0.000 n=20)
AppendFloat/64FixedF3-12               16.44n ± 0%   16.18n ± 0%   -1.58% (p=0.000 n=20)
AppendFloat/Slowpath64-12              31.68n ± 0%   29.18n ± 0%   -7.86% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-12      29.92n ± 1%   27.12n ± 0%   -9.36% (p=0.000 n=20)
AppendFloat/ShorterIntervalCase32-12                 18.44n ± 1%
AppendFloat/ShorterIntervalCase64-12                 18.57n ± 0%
geomean                                26.90n        23.50n       -11.27%

host: linux-386
goos: linux
goarch: 386
cpu: Intel(R) Xeon(R) CPU @ 2.30GHz
                                     │ 3c26aef8fba │             8a958b0d9c1             │
                                     │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-16                 128.2n ± 0%   143.5n ± 0%  +11.93% (p=0.000 n=20)
AppendFloat/Float-16                   236.3n ± 0%   157.5n ± 0%  -33.37% (p=0.000 n=20)
AppendFloat/Exp-16                     245.3n ± 0%   148.2n ± 0%  -39.60% (p=0.000 n=20)
AppendFloat/NegExp-16                  251.2n ± 0%   147.8n ± 0%  -41.17% (p=0.000 n=20)
AppendFloat/LongExp-16                 253.2n ± 0%   176.0n ± 0%  -30.46% (p=0.000 n=20)
AppendFloat/Big-16                     278.6n ± 0%   158.1n ± 0%  -43.23% (p=0.000 n=20)
AppendFloat/BinaryExp-16               89.72n ± 0%   89.47n ± 0%        ~ (p=0.155 n=20)
AppendFloat/32Integer-16               127.1n ± 0%   111.7n ± 0%  -12.12% (p=0.000 n=20)
AppendFloat/32ExactFraction-16         206.9n ± 1%   116.3n ± 1%  -43.75% (p=0.000 n=20)
AppendFloat/32Point-16                 196.9n ± 0%   124.5n ± 1%  -36.74% (p=0.000 n=20)
AppendFloat/32Exp-16                   235.1n ± 1%   114.3n ± 0%  -51.37% (p=0.000 n=20)
AppendFloat/32NegExp-16                206.4n ± 0%   114.3n ± 1%  -44.62% (p=0.000 n=20)
AppendFloat/32Shortest-16              189.7n ± 0%   122.3n ± 0%  -35.56% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-16            137.2n ± 0%   134.0n ± 0%   -2.33% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-16            160.8n ± 0%   154.0n ± 0%   -4.20% (p=0.000 n=20)
AppendFloat/64Fixed1-16                140.2n ± 0%   135.0n ± 0%   -3.74% (p=0.000 n=20)
AppendFloat/64Fixed2-16                135.5n ± 0%   131.8n ± 0%   -2.69% (p=0.000 n=20)
AppendFloat/64Fixed2.5-16              133.3n ± 0%   126.5n ± 0%   -5.14% (p=0.000 n=20)
AppendFloat/64Fixed3-16                135.8n ± 0%   130.9n ± 0%   -3.57% (p=0.000 n=20)
AppendFloat/64Fixed4-16                127.9n ± 0%   122.8n ± 0%   -3.99% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-16            140.7n ± 0%   136.2n ± 0%   -3.20% (p=0.000 n=20)
AppendFloat/64Fixed12-16               166.1n ± 0%   160.5n ± 0%   -3.37% (p=0.000 n=20)
AppendFloat/64Fixed16-16               160.1n ± 0%   154.2n ± 0%   -3.65% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-16           156.6n ± 0%   149.0n ± 0%   -4.82% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-16           173.9n ± 1%   169.6n ± 0%   -2.44% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-16           10.59µ ± 1%   10.60µ ± 0%        ~ (p=0.664 n=20)
AppendFloat/64FixedF1-16               158.5n ± 0%   154.1n ± 0%   -2.75% (p=0.000 n=20)
AppendFloat/64FixedF2-16               147.1n ± 0%   143.8n ± 0%   -2.21% (p=0.000 n=20)
AppendFloat/64FixedF3-16               135.8n ± 0%   131.1n ± 0%   -3.46% (p=0.000 n=20)
AppendFloat/Slowpath64-16              244.9n ± 0%   189.7n ± 0%  -22.54% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-16      241.8n ± 0%   176.9n ± 0%  -26.86% (p=0.000 n=20)
AppendFloat/ShorterIntervalCase32-16                 114.9n ± 0%
AppendFloat/ShorterIntervalCase64-16                 130.6n ± 0%
geomean                                195.7n        157.4n       -18.30%

host: s7:GOARCH=386
cpu: AMD Ryzen 9 7950X 16-Core Processor
                                     │ 3c26aef8fba │             8a958b0d9c1             │
                                     │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-32                 42.76n ± 0%   47.25n ± 0%  +10.51% (p=0.000 n=20)
AppendFloat/Float-32                   71.44n ± 1%   50.97n ± 0%  -28.66% (p=0.000 n=20)
AppendFloat/Exp-32                     75.51n ± 0%   48.39n ± 1%  -35.92% (p=0.000 n=20)
AppendFloat/NegExp-32                  74.70n ± 0%   48.17n ± 1%  -35.52% (p=0.000 n=20)
AppendFloat/LongExp-32                 76.52n ± 0%   57.32n ± 1%  -25.10% (p=0.000 n=20)
AppendFloat/Big-32                     83.05n ± 0%   52.92n ± 1%  -36.28% (p=0.000 n=20)
AppendFloat/BinaryExp-32               31.92n ± 1%   32.22n ± 0%   +0.96% (p=0.000 n=20)
AppendFloat/32Integer-32               41.29n ± 1%   36.81n ± 0%  -10.85% (p=0.000 n=20)
AppendFloat/32ExactFraction-32         62.29n ± 1%   38.16n ± 0%  -38.73% (p=0.000 n=20)
AppendFloat/32Point-32                 60.45n ± 1%   40.44n ± 1%  -33.11% (p=0.000 n=20)
AppendFloat/32Exp-32                   69.32n ± 1%   38.45n ± 1%  -44.53% (p=0.000 n=20)
AppendFloat/32NegExp-32                63.39n ± 0%   38.64n ± 1%  -39.03% (p=0.000 n=20)
AppendFloat/32Shortest-32              58.90n ± 1%   39.53n ± 0%  -32.89% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-32            43.30n ± 0%   42.70n ± 1%   -1.36% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-32            49.96n ± 1%   49.60n ± 0%   -0.72% (p=0.000 n=20)
AppendFloat/64Fixed1-32                42.99n ± 1%   42.08n ± 0%   -2.13% (p=0.000 n=20)
AppendFloat/64Fixed2-32                41.58n ± 0%   41.42n ± 1%        ~ (p=0.077 n=20)
AppendFloat/64Fixed2.5-32              40.47n ± 1%   40.00n ± 1%   -1.15% (p=0.000 n=20)
AppendFloat/64Fixed3-32                43.43n ± 1%   41.67n ± 0%   -4.04% (p=0.000 n=20)
AppendFloat/64Fixed4-32                40.44n ± 0%   39.40n ± 0%   -2.58% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-32            43.41n ± 0%   42.72n ± 0%   -1.60% (p=0.000 n=20)
AppendFloat/64Fixed12-32               52.00n ± 0%   51.26n ± 0%   -1.43% (p=0.000 n=20)
AppendFloat/64Fixed16-32               50.62n ± 1%   50.55n ± 0%        ~ (p=0.234 n=20)
AppendFloat/64Fixed12Hard-32           49.36n ± 0%   47.89n ± 0%   -2.98% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-32           56.91n ± 0%   55.66n ± 1%   -2.19% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-32           3.983µ ± 0%   3.964µ ± 0%        ~ (p=0.014 n=20)
AppendFloat/64FixedF1-32               49.31n ± 1%   49.10n ± 1%        ~ (p=0.005 n=20)
AppendFloat/64FixedF2-32               45.06n ± 0%   44.00n ± 1%   -2.36% (p=0.000 n=20)
AppendFloat/64FixedF3-32               42.22n ± 0%   42.20n ± 1%        ~ (p=0.644 n=20)
AppendFloat/Slowpath64-32              75.77n ± 0%   60.89n ± 1%  -19.63% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-32      74.88n ± 1%   57.59n ± 1%  -23.10% (p=0.000 n=20)
AppendFloat/ShorterIntervalCase32-32                 37.66n ± 1%
AppendFloat/ShorterIntervalCase64-32                 42.49n ± 1%
geomean                                61.34n        51.27n       -15.08%

host: linux-arm
goarch: arm
cpu: ARMv8 Processor rev 1 (v8l)
                                    │ 3c26aef8fba │             8a958b0d9c1             │
                                    │   sec/op    │   sec/op     vs base                │
AppendFloat/Decimal-4                 110.8n ± 0%   135.0n ± 0%  +21.84% (p=0.000 n=20)
AppendFloat/Float-4                   172.0n ± 0%   145.1n ± 0%  -15.64% (p=0.000 n=20)
AppendFloat/Exp-4                     172.1n ± 0%   136.2n ± 0%  -20.89% (p=0.000 n=20)
AppendFloat/NegExp-4                  172.6n ± 0%   135.8n ± 0%  -21.32% (p=0.000 n=20)
AppendFloat/LongExp-4                 180.2n ± 0%   161.9n ± 0%  -10.18% (p=0.000 n=20)
AppendFloat/Big-4                     195.5n ± 0%   143.8n ± 0%  -26.45% (p=0.000 n=20)
AppendFloat/BinaryExp-4               84.75n ± 0%   86.40n ± 0%   +1.94% (p=0.000 n=20)
AppendFloat/32Integer-4               110.4n ± 0%   110.0n ± 0%   -0.32% (p=0.000 n=20)
AppendFloat/32ExactFraction-4         152.9n ± 0%   114.0n ± 0%  -25.44% (p=0.000 n=20)
AppendFloat/32Point-4                 151.5n ± 0%   120.1n ± 0%  -20.72% (p=0.000 n=20)
AppendFloat/32Exp-4                   163.1n ± 0%   111.3n ± 0%  -31.76% (p=0.000 n=20)
AppendFloat/32NegExp-4                152.0n ± 0%   111.1n ± 0%  -26.91% (p=0.000 n=20)
AppendFloat/32Shortest-4              145.8n ± 0%   116.5n ± 0%  -20.13% (p=0.000 n=20)
AppendFloat/32Fixed8Hard-4            104.1n ± 0%   104.0n ± 0%   -0.10% (p=0.000 n=20)
AppendFloat/32Fixed9Hard-4            114.2n ± 0%   115.7n ± 0%   +1.31% (p=0.000 n=20)
AppendFloat/64Fixed1-4                97.35n ± 0%   97.31n ± 0%        ~ (p=0.357 n=20)
AppendFloat/64Fixed2-4                95.74n ± 0%   95.28n ± 0%   -0.49% (p=0.000 n=20)
AppendFloat/64Fixed2.5-4              94.24n ± 0%   93.32n ± 0%   -0.97% (p=0.000 n=20)
AppendFloat/64Fixed3-4                95.56n ± 0%   95.30n ± 0%   -0.27% (p=0.000 n=20)
AppendFloat/64Fixed4-4                92.36n ± 0%   91.52n ± 0%   -0.91% (p=0.000 n=20)
AppendFloat/64Fixed5Hard-4            101.5n ± 0%   102.0n ± 0%   +0.49% (p=0.000 n=20)
AppendFloat/64Fixed12-4               125.5n ± 0%   124.6n ± 0%   -0.72% (p=0.000 n=20)
AppendFloat/64Fixed16-4               121.8n ± 0%   122.7n ± 0%   +0.74% (p=0.000 n=20)
AppendFloat/64Fixed12Hard-4           116.1n ± 0%   116.4n ± 0%   +0.26% (p=0.000 n=20)
AppendFloat/64Fixed17Hard-4           129.8n ± 0%   131.1n ± 0%   +1.00% (p=0.000 n=20)
AppendFloat/64Fixed18Hard-4           7.945µ ± 0%   7.950µ ± 0%   +0.06% (p=0.000 n=20)
AppendFloat/64FixedF1-4               112.8n ± 0%   111.4n ± 0%   -1.24% (p=0.000 n=20)
AppendFloat/64FixedF2-4               100.6n ± 0%   100.5n ± 0%        ~ (p=0.066 n=20)
AppendFloat/64FixedF3-4               96.45n ± 0%   95.41n ± 0%   -1.08% (p=0.000 n=20)
AppendFloat/Slowpath64-4              176.3n ± 0%   165.9n ± 0%   -5.90% (p=0.000 n=20)
AppendFloat/SlowpathDenormal64-4      178.2n ± 0%   152.4n ± 0%  -14.48% (p=0.000 n=20)
AppendFloat/ShorterIntervalCase32-4                 112.8n ± 0%
AppendFloat/ShorterIntervalCase64-4                 119.0n ± 0%
geomean                               144.6n        132.1n        -7.84%

Change-Id: I1eb3c7b8756ad6cf938bc9b81180e01fd8a4cd9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/723861
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>

7 weeks agocompress/flate: move big non-pointer arrays to end of compressor
Ian Lance Taylor [Mon, 29 Sep 2025 04:38:53 +0000 (21:38 -0700)]
compress/flate: move big non-pointer arrays to end of compressor

The compressor type is fairly large: 656616 bytes on amd64.
Before this patch, it had fields of slice and interface type
near the end of the struct. As those types always contain pointers,
the ptrBytes value in the type descriptor was quite large.
That forces the garbage collector to do extra work scanning for pointers,
and wastes a bit of executable space recording the gcmask for the type.

This patch moves the arrays to the end of the type,
fixing those minor issues.

Change-Id: I849a75a19cc61137c8797a1ea5a4c97e0f69b4db
Reviewed-on: https://go-review.googlesource.com/c/go/+/707596
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
7 weeks agocmd/internal/obj/riscv: document compressed instructions
Mark Ryan [Mon, 10 Nov 2025 09:07:51 +0000 (10:07 +0100)]
cmd/internal/obj/riscv: document compressed instructions

We update the RISC-V assembler documentation to describe how
the RISC-V compressed instruction set is implemented by the
assembler and how compressed instructions can be disabled.

Change-Id: Ic7b1cb1586e6906af78adb8ff5fa10f5fbfde292
Reviewed-on: https://go-review.googlesource.com/c/go/+/719221
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Auto-Submit: Joel Sing <joel@sing.id.au>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
7 weeks agopath: add more examples for path.Clean
Louis Nyffenegger [Sun, 6 Jul 2025 11:18:42 +0000 (11:18 +0000)]
path: add more examples for path.Clean

Clarify that the function path.Clean only normalises paths and does not
protect against directory-traversal attacks.

Change-Id: I66f1267ac15900ac0cb6011ace0c79aabaebc68b
GitHub-Last-Rev: d669e1edf6221e7c8e0a9aa7bf46493c8ea85ba0
GitHub-Pull-Request: golang/go#74397
Reviewed-on: https://go-review.googlesource.com/c/go/+/684376
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>

7 weeks agomaps: use strings.EqualFold in example
guoguangwu [Tue, 20 Feb 2024 06:13:08 +0000 (06:13 +0000)]
maps: use strings.EqualFold in example

Change-Id: I40a9684a9465e844ff1de46601edf23de7b637e3
GitHub-Last-Rev: 15ef023853d1f18160b290f32468f1ce0c38d12d
GitHub-Pull-Request: golang/go#65541
Reviewed-on: https://go-review.googlesource.com/c/go/+/561855
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agostrconv: replace Ryu ftoa with Dragonbox
Taichi Maeda [Thu, 20 Nov 2025 23:56:29 +0000 (23:56 +0000)]
strconv: replace Ryu ftoa with Dragonbox

Dragonbox is a faster ftoa algorithm that provides the same guarantees
as Ryu: round-trip conversion, shortest length, and correct rounding.
Dragonbox only supports shortest-precision conversion, so we continue to
use Ryu-printf for fixed precision.

The new implementation has been fuzz-tested against the current
Ryu implementation in addition to the existing test suite.
Benchmarks show at least ~15-20% performance improvement.

The following shows the relevant output from benchstat. Full benchmark
results and plots are available at:
https://github.com/taichimaeda/dragonbox-bench/

goos: darwin
goarch: arm64
pkg: strconv
cpu: Apple M1
                                    │   old.txt    │               new.txt                │
                                    │    sec/op    │    sec/op     vs base                │
FormatFloat/Decimal-8                 32.71n ± 14%   31.89n ± 12%        ~ (p=0.165 n=10)
FormatFloat/Float-8                   45.54n ±  1%   42.48n ±  0%   -6.70% (p=0.000 n=10)
FormatFloat/Exp-8                     50.06n ±  0%   32.27n ±  1%  -35.54% (p=0.000 n=10)
FormatFloat/NegExp-8                  47.15n ±  1%   31.33n ±  0%  -33.56% (p=0.000 n=10)
FormatFloat/LongExp-8                 46.15n ±  1%   43.66n ±  0%   -5.38% (p=0.000 n=10)
FormatFloat/Big-8                     50.02n ±  0%   39.36n ±  0%  -21.31% (p=0.000 n=10)
FormatFloat/BinaryExp-8               27.89n ±  0%   27.88n ±  1%        ~ (p=0.798 n=10)
FormatFloat/32Integer-8               31.41n ±  0%   23.00n ±  3%  -26.79% (p=0.000 n=10)
FormatFloat/32ExactFraction-8         44.93n ±  1%   29.91n ±  0%  -33.43% (p=0.000 n=10)
FormatFloat/32Point-8                 43.22n ±  1%   33.82n ±  0%  -21.74% (p=0.000 n=10)
FormatFloat/32Exp-8                   45.91n ±  0%   25.48n ±  0%  -44.50% (p=0.000 n=10)
FormatFloat/32NegExp-8                44.66n ±  0%   25.12n ±  0%  -43.76% (p=0.000 n=10)
FormatFloat/32Shortest-8              37.96n ±  0%   27.83n ±  1%  -26.68% (p=0.000 n=10)
FormatFloat/Slowpath64-8              47.74n ±  2%   45.85n ±  0%   -3.96% (p=0.000 n=10)
FormatFloat/SlowpathDenormal64-8      42.78n ±  1%   41.46n ±  0%   -3.07% (p=0.000 n=10)
FormatFloat/ShorterIntervalCase32-8                  25.49n ±  2%
FormatFloat/ShorterIntervalCase64-8                  27.72n ±  1%
geomean                               41.95n         31.89n        -22.11%

Fixes #74886

Co-authored-by: Junekey Jeon <j6jeon@ucsd.edu>
Change-Id: I923f7259c9cecd0896b2340a43d1041cc2ed7787
GitHub-Last-Rev: fd735db0b1e3fab5fbad4d8b75c8e29247069d94
GitHub-Pull-Request: golang/go#75195
Reviewed-on: https://go-review.googlesource.com/c/go/+/700075
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Bypass: Russ Cox <rsc@golang.org>

7 weeks agocrypto: fix dead links and correct SHA-512 algorithm comment
Neal Patel [Wed, 8 Oct 2025 18:13:56 +0000 (14:13 -0400)]
crypto: fix dead links and correct SHA-512 algorithm comment

Change-Id: I71d63b0b78a9fc4895574f6df465e22c9585e77c
Reviewed-on: https://go-review.googlesource.com/c/go/+/710196
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agocrypto/internal/fips140/sha512: interleave scheduling with rounds for 10.3% speed-up
Neal Patel [Tue, 14 Oct 2025 20:14:00 +0000 (16:14 -0400)]
crypto/internal/fips140/sha512: interleave scheduling with rounds for 10.3% speed-up

goos: linux
goarch: amd64
pkg: crypto/sha512
cpu: AMD EPYC 7B13
                    │   before    │               after                │
                    │   sec/op    │   sec/op     vs base               │
Hash8Bytes/New        486.7n ± 1%   440.3n ± 0%   -9.53% (p=0.001 n=7)
Hash8Bytes/New-2      487.3n ± 1%   442.6n ± 1%   -9.17% (p=0.001 n=7)
Hash8Bytes/New-4      488.0n ± 1%   442.3n ± 0%   -9.36% (p=0.001 n=7)
Hash8Bytes/Sum384     495.1n ± 0%   451.2n ± 1%   -8.87% (p=0.001 n=7)
Hash8Bytes/Sum384-2   495.0n ± 1%   450.8n ± 1%   -8.93% (p=0.001 n=7)
Hash8Bytes/Sum384-4   500.2n ± 2%   453.6n ± 2%   -9.32% (p=0.001 n=7)
Hash8Bytes/Sum512     497.3n ± 1%   452.1n ± 0%   -9.09% (p=0.001 n=7)
Hash8Bytes/Sum512-2   496.0n ± 1%   453.5n ± 0%   -8.57% (p=0.001 n=7)
Hash8Bytes/Sum512-4   498.5n ± 0%   452.3n ± 1%   -9.27% (p=0.001 n=7)
Hash1K/New            3.985µ ± 1%   3.543µ ± 1%  -11.09% (p=0.001 n=7)
Hash1K/New-2          4.004µ ± 2%   3.558µ ± 1%  -11.14% (p=0.001 n=7)
Hash1K/New-4          3.997µ ± 0%   3.563µ ± 1%  -10.86% (p=0.001 n=7)
Hash1K/Sum384         3.996µ ± 1%   3.560µ ± 1%  -10.91% (p=0.001 n=7)
Hash1K/Sum384-2       4.011µ ± 1%   3.576µ ± 1%  -10.85% (p=0.001 n=7)
Hash1K/Sum384-4       4.004µ ± 0%   3.564µ ± 0%  -10.99% (p=0.001 n=7)
Hash1K/Sum512         3.998µ ± 1%   3.555µ ± 1%  -11.08% (p=0.001 n=7)
Hash1K/Sum512-2       3.996µ ± 0%   3.560µ ± 1%  -10.91% (p=0.001 n=7)
Hash1K/Sum512-4       4.004µ ± 1%   3.573µ ± 1%  -10.76% (p=0.001 n=7)
Hash8K/New            28.34µ ± 1%   25.29µ ± 1%  -10.77% (p=0.001 n=7)
Hash8K/New-2          28.45µ ± 1%   25.48µ ± 1%  -10.44% (p=0.001 n=7)
Hash8K/New-4          28.42µ ± 1%   25.37µ ± 1%  -10.71% (p=0.001 n=7)
Hash8K/Sum384         28.38µ ± 0%   25.18µ ± 0%  -11.28% (p=0.001 n=7)
Hash8K/Sum384-2       28.50µ ± 1%   25.35µ ± 1%  -11.07% (p=0.001 n=7)
Hash8K/Sum384-4       28.51µ ± 1%   25.35µ ± 0%  -11.07% (p=0.001 n=7)
Hash8K/Sum512         28.34µ ± 1%   25.23µ ± 0%  -10.96% (p=0.001 n=7)
Hash8K/Sum512-2       28.33µ ± 1%   25.23µ ± 1%  -10.95% (p=0.001 n=7)
Hash8K/Sum512-4       28.48µ ± 1%   25.31µ ± 1%  -11.13% (p=0.001 n=7)
geomean               3.828µ        3.433µ       -10.34%

                    │    before    │                after                │
                    │     B/s      │     B/s       vs base               │
Hash8Bytes/New        15.68Mi ± 1%   17.33Mi ± 0%  +10.52% (p=0.001 n=7)
Hash8Bytes/New-2      15.66Mi ± 1%   17.23Mi ± 1%  +10.05% (p=0.001 n=7)
Hash8Bytes/New-4      15.63Mi ± 0%   17.25Mi ± 0%  +10.37% (p=0.001 n=7)
Hash8Bytes/Sum384     15.41Mi ± 0%   16.91Mi ± 1%   +9.72% (p=0.001 n=7)
Hash8Bytes/Sum384-2   15.41Mi ± 1%   16.93Mi ± 1%   +9.84% (p=0.001 n=7)
Hash8Bytes/Sum384-4   15.25Mi ± 2%   16.82Mi ± 2%  +10.32% (p=0.001 n=7)
Hash8Bytes/Sum512     15.34Mi ± 1%   16.87Mi ± 0%   +9.94% (p=0.001 n=7)
Hash8Bytes/Sum512-2   15.38Mi ± 1%   16.82Mi ± 0%   +9.36% (p=0.001 n=7)
Hash8Bytes/Sum512-4   15.31Mi ± 0%   16.87Mi ± 1%  +10.22% (p=0.001 n=7)
Hash1K/New            245.0Mi ± 1%   275.6Mi ± 1%  +12.47% (p=0.001 n=7)
Hash1K/New-2          243.9Mi ± 2%   274.5Mi ± 1%  +12.55% (p=0.001 n=7)
Hash1K/New-4          244.3Mi ± 0%   274.1Mi ± 1%  +12.21% (p=0.001 n=7)
Hash1K/Sum384         244.4Mi ± 0%   274.3Mi ± 1%  +12.24% (p=0.001 n=7)
Hash1K/Sum384-2       243.5Mi ± 1%   273.1Mi ± 1%  +12.16% (p=0.001 n=7)
Hash1K/Sum384-4       243.9Mi ± 0%   274.0Mi ± 0%  +12.35% (p=0.001 n=7)
Hash1K/Sum512         244.3Mi ± 1%   274.7Mi ± 1%  +12.46% (p=0.001 n=7)
Hash1K/Sum512-2       244.4Mi ± 0%   274.3Mi ± 1%  +12.25% (p=0.001 n=7)
Hash1K/Sum512-4       243.9Mi ± 1%   273.3Mi ± 1%  +12.08% (p=0.001 n=7)
Hash8K/New            275.7Mi ± 1%   309.0Mi ± 1%  +12.07% (p=0.001 n=7)
Hash8K/New-2          274.6Mi ± 1%   306.6Mi ± 1%  +11.67% (p=0.001 n=7)
Hash8K/New-4          274.9Mi ± 1%   307.9Mi ± 1%  +11.99% (p=0.001 n=7)
Hash8K/Sum384         275.3Mi ± 0%   310.3Mi ± 0%  +12.71% (p=0.001 n=7)
Hash8K/Sum384-2       274.1Mi ± 1%   308.2Mi ± 1%  +12.45% (p=0.001 n=7)
Hash8K/Sum384-4       274.1Mi ± 1%   308.2Mi ± 0%  +12.44% (p=0.001 n=7)
Hash8K/Sum512         275.7Mi ± 1%   309.6Mi ± 0%  +12.31% (p=0.001 n=7)
Hash8K/Sum512-2       275.8Mi ± 1%   309.7Mi ± 1%  +12.29% (p=0.001 n=7)
Hash8K/Sum512-4       274.3Mi ± 1%   308.7Mi ± 1%  +12.52% (p=0.001 n=7)
geomean               101.2Mi        112.9Mi       +11.53%

                    │    before    │               after                │
                    │     B/op     │    B/op     vs base                │
Hash8Bytes/New        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/New-2      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/New-4      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum384     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum384-2   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum384-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum512     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum512-2   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum512-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum384         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum384-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum384-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum512         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum512-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum512-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum384         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum384-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum384-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum512         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum512-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum512-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
geomean                          ²               +0.00%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                    │    before    │               after                │
                    │  allocs/op   │ allocs/op   vs base                │
Hash8Bytes/New        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/New-2      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/New-4      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum384     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum384-2   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum384-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum512     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum512-2   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum512-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum384         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum384-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum384-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum512         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum512-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum512-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum384         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum384-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum384-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum512         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum512-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum512-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
geomean                          ²               +0.00%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

Change-Id: I3791244b3f69e093203f6aa46dc59428afcb9223
Reviewed-on: https://go-review.googlesource.com/c/go/+/711844
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
7 weeks agocrypto/internal/fips140/sha256: interleave scheduling and rounds for 11.2% speed-up
Neal Patel [Tue, 14 Oct 2025 19:31:44 +0000 (15:31 -0400)]
crypto/internal/fips140/sha256: interleave scheduling and rounds for 11.2% speed-up

goos: linux
goarch: amd64
pkg: crypto/sha256
cpu: AMD EPYC 7B13
                    │   before    │               after                │
                    │   sec/op    │   sec/op     vs base               │
Hash8Bytes/New        384.4n ± 2%   347.2n ± 0%   -9.68% (p=0.001 n=7)
Hash8Bytes/New-2      386.3n ± 2%   348.3n ± 1%   -9.84% (p=0.001 n=7)
Hash8Bytes/New-4      386.7n ± 1%   347.9n ± 1%  -10.03% (p=0.001 n=7)
Hash8Bytes/Sum224     406.9n ± 2%   358.8n ± 3%  -11.82% (p=0.001 n=7)
Hash8Bytes/Sum224-2   404.1n ± 1%   359.8n ± 1%  -10.96% (p=0.001 n=7)
Hash8Bytes/Sum224-4   409.5n ± 1%   360.9n ± 1%  -11.87% (p=0.001 n=7)
Hash8Bytes/Sum256     401.3n ± 1%   352.4n ± 0%  -12.19% (p=0.001 n=7)
Hash8Bytes/Sum256-2   402.0n ± 1%   354.2n ± 1%  -11.89% (p=0.001 n=7)
Hash8Bytes/Sum256-4   403.7n ± 1%   353.5n ± 1%  -12.43% (p=0.001 n=7)
Hash1K/New            5.836µ ± 1%   5.180µ ± 2%  -11.24% (p=0.001 n=7)
Hash1K/New-2          5.855µ ± 1%   5.177µ ± 5%  -11.58% (p=0.001 n=7)
Hash1K/New-4          5.878µ ± 0%   5.215µ ± 3%  -11.28% (p=0.001 n=7)
Hash1K/Sum224         5.860µ ± 1%   5.225µ ± 1%  -10.84% (p=0.001 n=7)
Hash1K/Sum224-2       5.852µ ± 1%   5.198µ ± 1%  -11.18% (p=0.001 n=7)
Hash1K/Sum224-4       5.867µ ± 1%   5.226µ ± 4%  -10.93% (p=0.001 n=7)
Hash1K/Sum256         5.851µ ± 0%   5.246µ ± 1%  -10.34% (p=0.001 n=7)
Hash1K/Sum256-2       5.863µ ± 1%   5.237µ ± 2%  -10.68% (p=0.001 n=7)
Hash1K/Sum256-4       5.873µ ± 1%   5.191µ ± 1%  -11.61% (p=0.001 n=7)
Hash8K/New            44.06µ ± 0%   38.93µ ± 1%  -11.63% (p=0.001 n=7)
Hash8K/New-2          44.23µ ± 0%   39.14µ ± 1%  -11.50% (p=0.001 n=7)
Hash8K/New-4          44.25µ ± 1%   39.04µ ± 1%  -11.77% (p=0.001 n=7)
Hash8K/Sum224         43.98µ ± 1%   40.47µ ± 2%   -7.98% (p=0.001 n=7)
Hash8K/Sum224-2       44.31µ ± 1%   39.54µ ± 3%  -10.76% (p=0.001 n=7)
Hash8K/Sum224-4       44.45µ ± 1%   39.04µ ± 2%  -12.16% (p=0.001 n=7)
Hash8K/Sum256         43.95µ ± 0%   39.23µ ± 0%  -10.75% (p=0.001 n=7)
Hash8K/Sum256-2       44.19µ ± 1%   39.39µ ± 2%  -10.87% (p=0.001 n=7)
Hash8K/Sum256-4       44.19µ ± 1%   39.27µ ± 1%  -11.13% (p=0.001 n=7)
Hash256K/New          1.397m ± 1%   1.238m ± 1%  -11.39% (p=0.001 n=7)
Hash256K/New-2        1.404m ± 1%   1.242m ± 1%  -11.53% (p=0.001 n=7)
Hash256K/New-4        1.402m ± 1%   1.243m ± 1%  -11.31% (p=0.001 n=7)
Hash256K/Sum224       1.398m ± 0%   1.237m ± 1%  -11.48% (p=0.001 n=7)
Hash256K/Sum224-2     1.402m ± 1%   1.239m ± 1%  -11.59% (p=0.001 n=7)
Hash256K/Sum224-4     1.409m ± 1%   1.245m ± 1%  -11.61% (p=0.001 n=7)
Hash256K/Sum256       1.402m ± 1%   1.242m ± 1%  -11.38% (p=0.001 n=7)
Hash256K/Sum256-2     1.397m ± 1%   1.240m ± 1%  -11.22% (p=0.001 n=7)
Hash256K/Sum256-4     1.404m ± 1%   1.250m ± 1%  -10.97% (p=0.001 n=7)
Hash1M/New            5.584m ± 2%   4.944m ± 1%  -11.46% (p=0.001 n=7)
Hash1M/New-2          5.609m ± 1%   4.974m ± 1%  -11.33% (p=0.001 n=7)
Hash1M/New-4          5.625m ± 2%   4.984m ± 2%  -11.40% (p=0.001 n=7)
Hash1M/Sum224         5.578m ± 0%   4.949m ± 0%  -11.28% (p=0.001 n=7)
Hash1M/Sum224-2       5.603m ± 1%   4.985m ± 1%  -11.02% (p=0.001 n=7)
Hash1M/Sum224-4       5.619m ± 1%   4.976m ± 1%  -11.44% (p=0.001 n=7)
Hash1M/Sum256         5.589m ± 1%   4.940m ± 0%  -11.61% (p=0.001 n=7)
Hash1M/Sum256-2       5.581m ± 1%   4.981m ± 1%  -10.75% (p=0.001 n=7)
Hash1M/Sum256-4       5.618m ± 3%   4.966m ± 1%  -11.59% (p=0.001 n=7)
geomean               60.48µ        53.71µ       -11.19%

                    │    before    │                after                │
                    │     B/s      │     B/s       vs base               │
Hash8Bytes/New        19.85Mi ± 2%   21.97Mi ± 0%  +10.72% (p=0.001 n=7)
Hash8Bytes/New-2      19.75Mi ± 2%   21.91Mi ± 1%  +10.91% (p=0.001 n=7)
Hash8Bytes/New-4      19.73Mi ± 1%   21.93Mi ± 1%  +11.16% (p=0.001 n=7)
Hash8Bytes/Sum224     18.75Mi ± 2%   21.27Mi ± 3%  +13.43% (p=0.001 n=7)
Hash8Bytes/Sum224-2   18.88Mi ± 1%   21.20Mi ± 1%  +12.27% (p=0.001 n=7)
Hash8Bytes/Sum224-4   18.63Mi ± 1%   21.14Mi ± 1%  +13.46% (p=0.001 n=7)
Hash8Bytes/Sum256     19.01Mi ± 1%   21.65Mi ± 0%  +13.90% (p=0.001 n=7)
Hash8Bytes/Sum256-2   18.98Mi ± 1%   21.54Mi ± 1%  +13.52% (p=0.001 n=7)
Hash8Bytes/Sum256-4   18.90Mi ± 1%   21.58Mi ± 1%  +14.18% (p=0.001 n=7)
Hash1K/New            167.4Mi ± 1%   188.5Mi ± 2%  +12.65% (p=0.001 n=7)
Hash1K/New-2          166.8Mi ± 1%   188.6Mi ± 5%  +13.11% (p=0.001 n=7)
Hash1K/New-4          166.1Mi ± 0%   187.3Mi ± 3%  +12.71% (p=0.001 n=7)
Hash1K/Sum224         166.7Mi ± 1%   186.9Mi ± 1%  +12.14% (p=0.001 n=7)
Hash1K/Sum224-2       166.9Mi ± 1%   187.9Mi ± 1%  +12.59% (p=0.001 n=7)
Hash1K/Sum224-4       166.5Mi ± 1%   186.9Mi ± 4%  +12.27% (p=0.001 n=7)
Hash1K/Sum256         166.9Mi ± 0%   186.1Mi ± 1%  +11.51% (p=0.001 n=7)
Hash1K/Sum256-2       166.6Mi ± 1%   186.5Mi ± 2%  +11.94% (p=0.001 n=7)
Hash1K/Sum256-4       166.3Mi ± 1%   188.1Mi ± 1%  +13.15% (p=0.001 n=7)
Hash8K/New            177.3Mi ± 0%   200.7Mi ± 1%  +13.17% (p=0.001 n=7)
Hash8K/New-2          176.6Mi ± 0%   199.6Mi ± 1%  +13.00% (p=0.001 n=7)
Hash8K/New-4          176.6Mi ± 1%   200.1Mi ± 1%  +13.34% (p=0.001 n=7)
Hash8K/Sum224         177.6Mi ± 1%   193.0Mi ± 2%   +8.67% (p=0.001 n=7)
Hash8K/Sum224-2       176.3Mi ± 1%   197.6Mi ± 3%  +12.06% (p=0.001 n=7)
Hash8K/Sum224-4       175.8Mi ± 1%   200.1Mi ± 2%  +13.84% (p=0.001 n=7)
Hash8K/Sum256         177.8Mi ± 0%   199.2Mi ± 0%  +12.04% (p=0.001 n=7)
Hash8K/Sum256-2       176.8Mi ± 1%   198.4Mi ± 2%  +12.20% (p=0.001 n=7)
Hash8K/Sum256-4       176.8Mi ± 1%   198.9Mi ± 1%  +12.52% (p=0.001 n=7)
Hash256K/New          179.0Mi ± 1%   202.0Mi ± 1%  +12.86% (p=0.001 n=7)
Hash256K/New-2        178.1Mi ± 1%   201.3Mi ± 1%  +13.03% (p=0.001 n=7)
Hash256K/New-4        178.4Mi ± 1%   201.1Mi ± 1%  +12.76% (p=0.001 n=7)
Hash256K/Sum224       178.8Mi ± 0%   202.0Mi ± 1%  +12.97% (p=0.001 n=7)
Hash256K/Sum224-2     178.3Mi ± 1%   201.7Mi ± 1%  +13.11% (p=0.001 n=7)
Hash256K/Sum224-4     177.5Mi ± 1%   200.8Mi ± 1%  +13.13% (p=0.001 n=7)
Hash256K/Sum256       178.3Mi ± 1%   201.2Mi ± 1%  +12.83% (p=0.001 n=7)
Hash256K/Sum256-2     179.0Mi ± 1%   201.6Mi ± 1%  +12.64% (p=0.001 n=7)
Hash256K/Sum256-4     178.0Mi ± 1%   200.0Mi ± 1%  +12.33% (p=0.001 n=7)
Hash1M/New            179.1Mi ± 2%   202.3Mi ± 1%  +12.94% (p=0.001 n=7)
Hash1M/New-2          178.3Mi ± 1%   201.1Mi ± 1%  +12.78% (p=0.001 n=7)
Hash1M/New-4          177.8Mi ± 2%   200.6Mi ± 2%  +12.87% (p=0.001 n=7)
Hash1M/Sum224         179.3Mi ± 0%   202.1Mi ± 0%  +12.71% (p=0.001 n=7)
Hash1M/Sum224-2       178.5Mi ± 1%   200.6Mi ± 1%  +12.39% (p=0.001 n=7)
Hash1M/Sum224-4       178.0Mi ± 1%   201.0Mi ± 1%  +12.92% (p=0.001 n=7)
Hash1M/Sum256         178.9Mi ± 1%   202.4Mi ± 0%  +13.13% (p=0.001 n=7)
Hash1M/Sum256-2       179.2Mi ± 1%   200.8Mi ± 1%  +12.04% (p=0.001 n=7)
Hash1M/Sum256-4       178.0Mi ± 3%   201.3Mi ± 1%  +13.12% (p=0.001 n=7)
geomean               112.5Mi        126.6Mi       +12.60%

                    │    before    │               after                │
                    │     B/op     │    B/op     vs base                │
Hash8Bytes/New        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/New-2      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/New-4      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum224     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum224-2   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum224-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum256     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum256-2   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum256-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum224         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum224-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum224-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum256         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum256-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum256-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum224         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum224-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum224-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum256         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum256-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum256-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/New          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/New-2        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/New-4        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum224       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum224-2     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum224-4     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum256       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum256-2     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum256-4     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum224         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum224-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum224-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum256         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum256-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum256-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
geomean                          ²               +0.00%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                    │    before    │               after                │
                    │  allocs/op   │ allocs/op   vs base                │
Hash8Bytes/New        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/New-2      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/New-4      0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum224     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum224-2   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum224-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum256     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum256-2   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8Bytes/Sum256-4   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum224         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum224-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum224-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum256         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum256-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1K/Sum256-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum224         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum224-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum224-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum256         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum256-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash8K/Sum256-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/New          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/New-2        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/New-4        0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum224       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum224-2     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum224-4     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum256       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum256-2     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash256K/Sum256-4     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/New            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/New-2          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/New-4          0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum224         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum224-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum224-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum256         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum256-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
Hash1M/Sum256-4       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=7) ¹
geomean                          ²               +0.00%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

Change-Id: I705f024221690532b2e891ab8e508d07eefe295b
Reviewed-on: https://go-review.googlesource.com/c/go/+/711843
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agointernal/runtime/cgroup: allow more tests to run on all OSes
胡玮文 [Fri, 21 Nov 2025 15:26:50 +0000 (23:26 +0800)]
internal/runtime/cgroup: allow more tests to run on all OSes

Move non-Linux specific part out of _linux.go. The parsing code itself
doesn't depend anything Linux specific, even if it the format is Linux
specific.

This should benefit developers working on non-Linux OSes.

Change-Id: I1692978d583c3dd9a57ff269c97e8fca53a7a057
Reviewed-on: https://go-review.googlesource.com/c/go/+/723240
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Carrillo Rodriguez <carrillorodriguez672@gmail.com>
7 weeks agocrypto/internal/fips140/bigmod: vector implementation of addMulVVWx on s390x
kmvijay [Thu, 30 Oct 2025 14:50:14 +0000 (14:50 +0000)]
crypto/internal/fips140/bigmod: vector implementation of addMulVVWx on s390x

addMulVVWx assembly routine is used to multiply bignum multiplicand with a 64-bit multiplier.
The new implementation for s390x architecture uses an algorithm based on vector instructions,
with a significant performance improvement.

Note: z13 is the minimum architecture for Go, which already has VX support.

The performance improvement is as below:

goos: linux
goarch: s390x
pkg: crypto/internal/fips140/bigmod
                  Orig.txt       Vector_Patch.txt
                   sec/op             sec/op          vs base
ModAdd          164.1n ± 0%   159.7n ± 0%      -2.7% (p=0.000 n=10)
ModSub          152.3n ± 1%   147.3n ± 0%      -3.25 (p=0.000 n=10)
MontgomeryRepr  4.806µ ± 3% 1.829µ ± 0%    -61.94% (p=0.000 n=10)
MontgomeryMul   4.812µ ± 5% 1.834µ ± 0%    -61.90% (p=0.000 n=10)
ModMul          9.646µ ± 3% 3.698µ ± 0%    -61.67% (p=0.000 n=10)
ExpBig          11.28m ± 0%   11.28m ± 0%      +0.04 (p=0.035 n=10)
Exp             12.284m ± 5%  5.004m ± 1%    -59.26  (p=0.000 n=10)
geomean         18.61µ        10.74µ         -42.2

Change-Id: I679944c9dac9f43f1626b018f72efa6da0d2442d
Cq-Include-Trybots: luci.golang.try:gotip-linux-s390x
Reviewed-on: https://go-review.googlesource.com/c/go/+/716480
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Srinivas Pokala <Pokala.Srinivas@ibm.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agonet/url: fix example of Values.Encode
José Joaquín Atria [Mon, 24 Nov 2025 19:52:22 +0000 (19:52 +0000)]
net/url: fix example of Values.Encode

Calling url.Values.Encode generates a query string with the
values sorted by key. However, in the example in the documentation
this behaviour is not reflected. This change corrects this.

Change-Id: Id95a5d79b57dc20c3bff1f0c6975c76dcd8412b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/723960
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>

7 weeks agocrypto/sha3: reduce cSHAKE allocations
Tom Thorogood [Sun, 15 Dec 2024 01:38:43 +0000 (12:08 +1030)]
crypto/sha3: reduce cSHAKE allocations

Consider a hypothetical SumCSHAKE256 function:

func SumCSHAKE256(N, S, data []byte, length int) []byte {
out := make([]byte, 64)
return sumCSHAKE256(out, N, S, data, length)
}

func sumCSHAKE256(out, N, S, data []byte, length int) []byte {
if len(out) < length {
out = make([]byte, length)
} else {
out = out[:length]
}
h := sha3.NewCSHAKE256(N, S)
h.Write(data)
h.Read(out)
return out
}

Currently this has 4 allocations:
- one for out (unless stack allocated),
- one for the SHAKE result of crypto/internal/fips140/sha3.newCShake,
- one for the initBlock allocation in crypto/internal/fips140/sha3.newCShake,
- one for the result of crypto/internal/fips140/sha3.bytepad.

We eliminate the SHAKE allocation by outlining the SHAKE allocation in
crypto/internal/fips140/sha3.NewCSHAKE128 and NewCSHAKE256. As
crypto/sha3.NewCSHAKE128 and NewCSHAKE256 immediately de-reference this
result, this allocation is eliminated.

We eliminate the bytepad allocation by instead writing the various
values directly with SHAKE.Write. Values passed to Write don't escape
and, with the exception of data (which is initBlock), all our Writes are
of fixed size allocations. We can't simply modify bytepad to return a
fixed size byte-slice as the length of data is not constant nor does it
have a reasonable upper bound.

We're stuck with the initBlock allocation because of the API (Reset and
the various marshallers), but we still net a substantial improvement.

benchstat output using the following benchmark:

        func BenchmarkSumCSHAKE256(b *testing.B) {
                N := []byte("N")
                S := []byte("S")
                data := []byte("testdata")

                b.SetBytes(64)

                for b.Loop() {
                        SumCSHAKE256(N, S, data, 64)
                }
        }

name             old time/op    new time/op    delta
SumCSHAKE256-12    1.09µs ±20%    0.79µs ± 1%  -27.41%  (p=0.000 n=10+9)

name             old speed      new speed      delta
SumCSHAKE256-12  59.8MB/s ±18%  81.0MB/s ± 1%  +35.33%  (p=0.000 n=10+9)

name             old alloc/op   new alloc/op   delta
SumCSHAKE256-12      536B ± 0%       88B ± 0%  -83.58%  (p=0.000 n=10+10)

name             old allocs/op  new allocs/op  delta
SumCSHAKE256-12      4.00 ± 0%      2.00 ± 0%  -50.00%  (p=0.000 n=10+10)

Updates #69982

Change-Id: If426ea8127c58f5ef062cf74712ec70fd26a7372
Reviewed-on: https://go-review.googlesource.com/c/go/+/636255
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
7 weeks agocrypto/hpke: expose crypto/internal/hpke
Filippo Valsorda [Sat, 22 Nov 2025 22:03:14 +0000 (23:03 +0100)]
crypto/hpke: expose crypto/internal/hpke

Fixes #75300

Change-Id: I6a83e0d040dba3366819d2afff704f886a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/723560
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
7 weeks agocrypto/ecdsa: clean up ECDSA parsing and serialization paths
Filippo Valsorda [Mon, 24 Nov 2025 19:46:14 +0000 (20:46 +0100)]
crypto/ecdsa: clean up ECDSA parsing and serialization paths

Check for invalid encodings and keys more systematically in
ParseRawPrivateKey/PrivateKey.Bytes,
ParseUncompressedPublicKey/PublicKey.Bytes, and
fips140/ecdsa.NewPrivateKey/NewPublicKey.

Also, use these functions throughout the codebase.

This should not change any observable behavior, because there were
multiple layers of checks and every path would hit at least one.

Change-Id: I6a6a46566c95de871a5a37996835a0e51495f1d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/724000
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agoreflect: add iterator equivalents for NumField, NumIn, NumOut and NumMethod
Quentin Quaadgras [Wed, 19 Nov 2025 21:18:39 +0000 (21:18 +0000)]
reflect: add iterator equivalents for NumField, NumIn, NumOut and NumMethod

The new methods are Type.Fields, Type.Methods, Type.Ins, Type.Outs,
Value.Fields and Value.Methods.

These methods have been introduced into the reflect package (as well
as tests) replacing three-clause for loops where possible.

Fixes #66631

Change-Id: Iab346e52c0eadd7817afae96d9ef73a35db65fd2
GitHub-Last-Rev: 8768ef71b9fd74536094cb1072c7075dc732cd5c
GitHub-Pull-Request: golang/go#75646
Reviewed-on: https://go-review.googlesource.com/c/go/+/707356
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>

7 weeks agocrypto/x509: sub-quadratic name constraint checking
Roland Shoemaker [Fri, 26 Sep 2025 02:13:23 +0000 (19:13 -0700)]
crypto/x509: sub-quadratic name constraint checking

Previously, we implemented ~quadratic name constraint checking, wherein
we would check every SAN against every respective constraint in the
chain. This is the technique _basically everyone_ implements, because
it's easy, but it requires also capping the total number of constraint
checking operations to prevent denial of service.

Instead, this change implements a log-linear checking technique, as
originally described by davidben@google.com with some minor
modifications. The comment at the top of crypto/x509/constraints.go
describes this technique in detail.

This technique is faster than the existing quadratic approach in all but
one specific case, where there are a large number of constraints but
only a single name, since our previous algorithm resolves to linear in
that case.

Change-Id: Icb761f5f9898c04e266c0d0c2b07ab2637f03418
Reviewed-on: https://go-review.googlesource.com/c/go/+/711421
Reviewed-by: Nicholas Husin <nsh@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
7 weeks agocrypto/x509: cleanup name constraint tests
Roland Shoemaker [Thu, 20 Nov 2025 21:32:48 +0000 (13:32 -0800)]
crypto/x509: cleanup name constraint tests

Make TestConstraintCases a bit clearer by adding actual subtest names,
mostly taken from the old comments. Also add a handful of extra test
cases.

Change-Id: Ie759d1ea85a353aeacab267bb6e175a90f20702c
Reviewed-on: https://go-review.googlesource.com/c/go/+/722481
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
7 weeks agocrypto/rsa: add EncryptOAEPWithOptions
Andrey Pshenkin [Fri, 12 Sep 2025 17:43:13 +0000 (18:43 +0100)]
crypto/rsa: add EncryptOAEPWithOptions

Co-authored-by: Filippo Valsorda <filippo@golang.org>
Change-Id: I78968794d609a7b343e5affc141d8ba96a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/722260
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
7 weeks agointernal/poll: replace t.Sub(time.Now()) with time.Until in test
guoguangwu [Mon, 18 Mar 2024 07:34:04 +0000 (07:34 +0000)]
internal/poll: replace t.Sub(time.Now()) with time.Until in test

Change-Id: Ia383d4d322008901cd1e57b05fb522db44076fa2
GitHub-Last-Rev: 5c7cbeb7371c6afa47c280e164087e45ca89f3d2
GitHub-Pull-Request: golang/go#66375
Reviewed-on: https://go-review.googlesource.com/c/go/+/572178
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>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Sean Liao <sean@liao.dev>
7 weeks agocrypto/tls: expose HelloRetryRequest state
Daniel McCarney [Mon, 3 Nov 2025 19:47:42 +0000 (14:47 -0500)]
crypto/tls: expose HelloRetryRequest state

This commit adds fields to the ClientHelloInfo and ConnectionState
structures to represent hello retry request state information.

ClientHelloInfo gains a new HelloRetryRequest bool field that indicates
if the client hello was sent in response to a TLS 1.3 hello retry
request message previously emitted by the server.

ConnectionState gains a new HelloRetryRequest bool field that indicates
(depending on the connection role) whether the client received a TLS 1.3
hello retry request message from the server, or whether the server sent
such a message to a client.

Fixes #74425

Change-Id: Ic1a5290b8a4ba1568da1d2c2cf9f148150955fa5
Reviewed-on: https://go-review.googlesource.com/c/go/+/717440
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Daniel McCarney <daniel@binaryparadox.net>

7 weeks agodoc: pre-announce removal of 1.23 and earlier crypto GODEBUGs
Sean Liao [Fri, 21 Nov 2025 22:11:41 +0000 (22:11 +0000)]
doc: pre-announce removal of 1.23 and earlier crypto GODEBUGs

For #75316

Change-Id: Ife391b8c3e7fd2fec0e53b296d47b4756a787001
Reviewed-on: https://go-review.googlesource.com/c/go/+/723100
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agocrypto/fips140: add Version
Sean Liao [Fri, 21 Nov 2025 22:27:36 +0000 (22:27 +0000)]
crypto/fips140: add Version

Fixes #75301

Change-Id: If953b4382499570d5437491036f91cbe4fec7c01
Reviewed-on: https://go-review.googlesource.com/c/go/+/723101
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
7 weeks agocmd/go/internal/modfetch: rename State to Fetcher
Ian Alexander [Mon, 17 Nov 2025 21:38:22 +0000 (16:38 -0500)]
cmd/go/internal/modfetch: rename State to Fetcher

This change renames the type State to Fetcher to better reflect its
purpose.  The global variable ModuleFetchState is also renamed to
Fetcher_, which will continue to be gradually eliminated as with all
global state in the modfetch package.

[git-generate]
cd src/cmd/go/internal/modfetch
rf '
  mv State Fetcher
  mv ModuleFetchState Fetcher_
  mv NewState NewFetcher

  mv Fetcher.GoSumFile GoSumFile
  mv GoSumFile.s GoSumFile.f
  mv GoSumFile Fetcher.GoSumFile

  mv Fetcher.SetGoSumFile SetGoSumFile
  mv SetGoSumFile.s SetGoSumFile.f
  mv SetGoSumFile Fetcher.SetGoSumFile

  mv Fetcher.AddWorkspaceGoSumFile AddWorkspaceGoSumFile
  mv AddWorkspaceGoSumFile.s AddWorkspaceGoSumFile.f
  mv AddWorkspaceGoSumFile Fetcher.AddWorkspaceGoSumFile
'
rf '
  add NewFetcher:+0 f := new(Fetcher) \
  f.lookupCache = new(par.Cache[lookupCacheKey, Repo]) \
  f.downloadCache = new(par.ErrCache[module.Version, string]) \
  return f
'
rf 'rm NewFetcher:+5,8'
cd ../modload
rf '
  mv State.modfetchState State.fetcher
'

Change-Id: I7cb6c945ea0f1d2119e1615064f041e88c81c689
Reviewed-on: https://go-review.googlesource.com/c/go/+/721740
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
7 weeks agocmd/go/internal/modload: make State.modfetchState a pointer
Ian Alexander [Sun, 16 Nov 2025 04:08:02 +0000 (23:08 -0500)]
cmd/go/internal/modload: make State.modfetchState a pointer

This change aligns modfetch.State with modload.State by using pointer
parameters and receivers.

[git-generate]
cd src/cmd/go/internal/modload
sed -i '
  s/oldState/old/
  s/old := State{/old = \&State{/
  s/func (s \*State) setState(new State) State {/func (s *State) setState(new *State) (old *State) {/
  s/setState(State{})/setState(NewState())/
' init.go
cd ../modfetch
sed -i '
  s/oldState = State{/oldState = \&State{/
  s/func SetState(newState State) (oldState State) {/func SetState(newState *State) (oldState *State) {/
  s/SetState(State{})/SetState(NewState())/
' fetch.go
cd ../modload
sed -i '
  s/old.modfetchState = modfetch.SetState(new.modfetchState)/_ = modfetch.SetState(\&new.modfetchState)/
' init.go
rf '
  #
  # Prepare to swap the existing modfetchState field for a pointer type
  #
  mv State.modfetchState State.modfetchState_
  add State:/modfetchState_/+0 modfetchState *modfetch.State
  #
  # Update State.setState to set & restore additional values
  #
  add State.setState:/s\.requirements,/+0 workFilePath: s.workFilePath,
  add State.setState:/s\.workFilePath,/+0 modfetchState: s.modfetchState,
  #
  # Swap the existing modfetchState field for a pointer type
  #
  add init.go:/.* = modfetch.SetState\(.*\)/-0 s.modfetchState = new.modfetchState
  add init.go:/.* = modfetch.SetState\(.*\)/-0 old.modfetchState = modfetch.SetState(s.modfetchState) // TODO(jitsu): remove after completing global state elimination
  rm init.go:/_ = modfetch.SetState\(.*\)/
  rm State.modfetchState_
'
sed -i '
  s/return &State{}/s := new(State)\ns.modfetchState = modfetch.NewState()\nreturn s/
' init.go
go fmt

Change-Id: I0602ecf976fd3ee93844e77989291d729ad71595
Reviewed-on: https://go-review.googlesource.com/c/go/+/720900
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
7 weeks agocmd/go: add setters for critical State fields
Ian Alexander [Sun, 16 Nov 2025 00:19:10 +0000 (19:19 -0500)]
cmd/go: add setters for critical State fields

This commit unexports critical State fields and provides setter
methods to update their values.

[git-generate]
cd src/cmd/go/internal/modfetch
rf '
  add fetch.go:490 var jitsu int = 0 // rf marker
  mv State.GoSumFile State.GoSumFile_
  mv State.WorkspaceGoSumFiles State.WorkspaceGoSumFiles_
  add jitsu \
    func (s *State) GoSumFile() string { \
      return ""
    } \
    \
    func (s *State) SetGoSumFile(str string) { \
    } \
    \
    func (s *State) AddWorkspaceGoSumFile(file string) { \
        s.WorkspaceGoSumFiles_ = append(s.WorkspaceGoSumFiles_, file) \
    }
    \

  ex {
    var s *State
    var x string
    s.GoSumFile_ = x -> s.SetGoSumFile(x)
  }

  rm jitsu
'

cd ../modload
sed -i '
  s/modfetch.ModuleFetchState.WorkspaceGoSumFiles_ = append(modfetch.ModuleFetchState.WorkspaceGoSumFiles_, sumFile)/modfetch.ModuleFetchState.AddWorkspaceGoSumFile(sumFile)/
' init.go

for dir in modcmd modload ; do
 cd ../${dir}
 rf '
   ex {
     import "cmd/go/internal/modfetch"
     var s *modfetch.State
     var x string
     s.GoSumFile_ = x -> s.SetGoSumFile(x)
   }
 '
done

cd ../modfetch
rf '
 mv State.GoSumFile_ State.goSumFile
 mv State.WorkspaceGoSumFiles_ State.workspaceGoSumFiles
 add State.GoSumFile: return s.goSumFile
 rm State.GoSumFile://+1
 add State.SetGoSumFile: s.goSumFile = str
'

Change-Id: Iff694aad7ad1cc62d2096c210dbaa3cce2b4061d
Reviewed-on: https://go-review.googlesource.com/c/go/+/720840
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agoruntime: add GODEBUG=tracebacklabels=1 to include pprof labels in tracebacks
David Finkel [Fri, 23 May 2025 20:04:08 +0000 (16:04 -0400)]
runtime: add GODEBUG=tracebacklabels=1 to include pprof labels in tracebacks

Copy LabelSet to an internal package as label.Set, and include (escaped)
labels within goroutine stack dumps.

Labels are added to the goroutine header as quoted key:value pairs, so
the line may get long if there are a lot of labels.

To handle escaping, we add a printescaped function to the
runtime and hook it up to the print function in the compiler with a new
runtime.quoted type that's a sibling to runtime.hex. (in fact, we
leverage some of the machinery from printhex to generate escape
sequences).

The escaping can be improved for printable runes outside basic ASCII
(particularly for languages using non-latin stripts). Additionally,
invalid UTF-8 can be improved.

So we can experiment with the output format make this opt-in via a
a new tracebacklabels GODEBUG var.

Updates #23458
Updates #76349

Change-Id: I08e78a40c55839a809236fff593ef2090c13c036
Reviewed-on: https://go-review.googlesource.com/c/go/+/694119
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
7 weeks agonet/http: add Transport.NewClientConn
Damien Neil [Tue, 18 Nov 2025 22:15:05 +0000 (14:15 -0800)]
net/http: add Transport.NewClientConn

For #75772

Change-Id: Iad7607b40636bab1faf8653455e92e9700309003
Reviewed-on: https://go-review.googlesource.com/c/go/+/722223
Reviewed-by: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agoall: update to x/net@bff14c52567061031b9761881907c39e24792736
Damien Neil [Mon, 24 Nov 2025 19:32:38 +0000 (11:32 -0800)]
all: update to x/net@bff14c52567061031b9761881907c39e24792736

This brings in CL 722200 which adds necessary HTTP/2 support for
net/http.Transport.NewClientConn.

For #75772

Change-Id: I5489232401096982ed21002f293dd0f87fe2fba6
Reviewed-on: https://go-review.googlesource.com/c/go/+/723901
Reviewed-by: Nicholas Husin <nsh@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
7 weeks agocontext: don't return the wrong error when Cause races cancellation
Damien Neil [Fri, 6 Jun 2025 22:38:28 +0000 (15:38 -0700)]
context: don't return the wrong error when Cause races cancellation

Check to see if a context is canceled at all
before checking for the cancellaion cause.
If we can't find a cause, use the original error.

Avoids a data race where we look for a cause,
find none (because the context is not canceled),
the context is canceled,
and we then return ctx.Err() (even though there is now a cause).

Fixes #73390

Change-Id: I97f44aef25c6b02871d987970abfb4c215c5c80e
Reviewed-on: https://go-review.googlesource.com/c/go/+/679835
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 weeks agocrypto/x509: add ExtKeyUsage.String and KeyUsage.String methods
Filippo Valsorda [Sat, 22 Nov 2025 15:26:24 +0000 (16:26 +0100)]
crypto/x509: add ExtKeyUsage.String and KeyUsage.String methods

Fixes #56866

Change-Id: Icc8f067820f5d74e0d5073bce160429e6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/723360
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Roland Shoemaker <roland@golang.org>
7 weeks agocrypto/internal/fips140test: add ML-DSA coverage
Daniel McCarney [Fri, 7 Nov 2025 16:36:05 +0000 (11:36 -0500)]
crypto/internal/fips140test: add ML-DSA coverage

This commit integrates ML-DSA ACVP test coverage, describing the
capabilities of the crypto/internal/fips140/mldsa package and
adding the required command handlers to our ACVP module wrapper.

Change-Id: I2aee6f169752a6c6fec3a68591dde33e4f308081
Reviewed-on: https://go-review.googlesource.com/c/go/+/719703
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
7 weeks agocmd/compile: add cases for StringLen to prove
David Chase [Mon, 24 Nov 2025 20:00:11 +0000 (15:00 -0500)]
cmd/compile: add cases for StringLen to prove

Tricky index-offset logic had been added for slices,
but not for strings.  This fixes that, and also adds
tests for same behavior in string/slice cases, and adds
a new test for code in prove that had been added but not
explicitly tested.

Fixes #76270.

Change-Id: Ibd92b89e944d86b7f30b4486a9008e6f1ac6af7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/723980
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
7 weeks agocmd/go/internal/auth: fix typo
Jes Cok [Fri, 21 Nov 2025 15:59:20 +0000 (15:59 +0000)]
cmd/go/internal/auth: fix typo

Change-Id: Ic113d59144aa2d37c8988559fbc086f5c29c0b69
GitHub-Last-Rev: e2623be0a00464d9be845da53fb1a67520fc1716
GitHub-Pull-Request: golang/go#76397
Reviewed-on: https://go-review.googlesource.com/c/go/+/722861
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agoruntime: use m.profStack in traceStack
Michael Anthony Knyszek [Wed, 19 Nov 2025 23:42:06 +0000 (23:42 +0000)]
runtime: use m.profStack in traceStack

Turns out we spend a few percent of the trace event writing path in just
zero-initializing the stack space for pcBuf. We don't need zero
initialization, since we're going to write over whatever we actually
use. Use m.profStack instead, which is already sized correctly.

A side-effect of this change is that trace stacks now obey the GODEBUG
profstackdepth where they previously ignored it. The name clearly
doesn't match, but this is a positive: there's no reason the maximum
stack depth shouldn't apply to every diagnostic.

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

7 weeks agoruntime: don't write unique string to trace if it's length zero
Michael Anthony Knyszek [Wed, 19 Nov 2025 03:51:20 +0000 (03:51 +0000)]
runtime: don't write unique string to trace if it's length zero

While we're here, document that ID 0 is implicitly assigned to an empty
set of data for both stacks and strings.

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

7 weeks agoall: REVERSE MERGE dev.simd (7d65463) into master
Cherry Mui [Mon, 24 Nov 2025 21:02:01 +0000 (16:02 -0500)]
all: REVERSE MERGE dev.simd (7d65463) into master

This commit is a REVERSE MERGE.
It merges dev.simd back into its parent branch, master.
The development of simd will continue on (only) dev.simd,
and it will be merged to the master branch when necessary.

Merge List:

+ 2025-11-24 7d65463a54 [dev.simd] all: merge master (e704b09) into dev.simd
+ 2025-11-24 afd1721fc5 [dev.simd] all: merge master (02d1f3a) into dev.simd
+ 2025-11-24 a9914886da [dev.simd] internal/buildcfg: don't enable SIMD experiment by default
+ 2025-11-24 61a5a6b016 [dev.simd] simd: add goexperiment tag to generate.go
+ 2025-11-24 f045ed4110 [dev.simd] go/doc/comment: don't include experimental packages in std list
+ 2025-11-24 220d73cc44 [dev.simd] all: merge master (8dd5b13) into dev.simd
+ 2025-11-24 0c69e77343 Revert "[dev.simd] internal/runtime/gc: add simd package based greentea kernels"
+ 2025-11-21 da92168ec8 [dev.simd] internal/runtime/gc: add simd package based greentea kernels
+ 2025-11-21 3fdd183aef [dev.simd] cmd/compile, simd: update conversion API names
+ 2025-11-21 d3a0321dba [dev.simd] cmd/compile: fix incorrect mapping of SHA256MSG2128
+ 2025-11-20 74ebdd28d1 [dev.simd] simd, cmd/compile: add more element types for Select128FromPair
+ 2025-11-20 4d26d66a49 [dev.simd] simd: fix signatures for PermuteConstant* methods
+ 2025-11-20 e3d4645693 [dev.simd] all: merge master (ca37d24) into dev.simd
+ 2025-11-20 95b4ad525f [dev.simd] simd: reorganize internal tests so that simd does not import testing
+ 2025-11-18 3fe246ae0f [dev.simd] simd: make 'go generate' generate everything
+ 2025-11-18 cf45adf140 [dev.simd] simd: move template code generator into _gen
+ 2025-11-18 19b4a30899 [dev.simd] simd/_gen/simdgen: remove outdated asm.yaml.toy
+ 2025-11-18 9461db5c59 [dev.simd] simd: fix comment in file generator
+ 2025-11-18 4004ff3523 [dev.simd] simd: remove FlattenedTranspose from exports
+ 2025-11-18 896f293a25 [dev.simd] cmd/compile, simd: change DotProductQuadruple and add peepholes
+ 2025-11-18 be9c50c6a0 [dev.simd] cmd/compile, simd: change SHA ops names and types
+ 2025-11-17 0978935a99 [dev.simd] cmd/compile, simd: change AES op names and add missing size
+ 2025-11-17 95871e4a00 [dev.simd] cmd/compile, simd: add VPALIGNR
+ 2025-11-17 934dbcea1a [dev.simd] simd: update CPU feature APIs
+ 2025-11-17 e4d9484220 [dev.simd] cmd/compile: fix unstable output
+ 2025-11-13 d7a0c45642 [dev.simd] all: merge master (57362e9) into dev.simd
+ 2025-11-11 86b4fe31d9 [dev.simd] cmd/compile: add masked merging ops and optimizations
+ 2025-11-10 771a1dc216 [dev.simd] cmd/compile: add peepholes for all masked ops and bug fixes
+ 2025-11-10 972732b245 [dev.simd] simd, cmd/compile: remove move from API
+ 2025-11-10 bf77323efa [dev.simd] simd: put unexported methods to another file
+ 2025-11-04 fe040658b2 [dev.simd] simd/_gen: fix sorting ops slices
+ 2025-10-29 e452f4ac7d [dev.simd] cmd/compile: enhance inlining for closure-of-SIMD
+ 2025-10-27 ca1264ac50 [dev.simd] test: add some trickier cases to ternary-boolean simd test
+ 2025-10-24 f6b4711095 [dev.simd] cmd/compile, simd: add rewrite to convert logical expression trees into TERNLOG instructions
+ 2025-10-24 cf7c1a4cbb [dev.simd] cmd/compile, simd: add SHA features
+ 2025-10-24 2b8eded4f4 [dev.simd] simd/_gen: parse SHA features from XED
+ 2025-10-24 c75965b666 [dev.simd] simd: added String() method to SIMD vectors.
+ 2025-10-22 d03634f807 [dev.simd] cmd/compile, simd: add definitions for VPTERNLOG[DQ]
+ 2025-10-20 20b3339542 [dev.simd] simd: add AES feature check
+ 2025-10-14 fc3bc49337 [dev.simd] simd: clean up mask load comments
+ 2025-10-14 416332dba2 [dev.simd] cmd/compile, simd: update DotProd to DotProduct
+ 2025-10-14 647c790143 [dev.simd] cmd/compile: peephole simd mask load/stores from bits
+ 2025-10-14 2e71cf1a2a [dev.simd] cmd/compile, simd: remove mask load and stores
+ 2025-10-13 c4fbf3b4cf [dev.simd] simd/_gen: add mem peephole with feat mismatches
+ 2025-10-13 ba72ee0f30 [dev.simd] cmd/compile: more support for cpufeatures
+ 2025-10-09 be57d94c4c [dev.simd] simd: add emulated Not method
+ 2025-10-07 d2270bccbd [dev.simd] cmd/compile: track which CPU features are in scope
+ 2025-10-03 48756abd3a [dev.simd] cmd/compile: inliner tweaks to favor simd-handling functions
+ 2025-10-03 fb1749a3fe [dev.simd] all: merge master (adce7f1) into dev.simd
+ 2025-09-30 703a5fbaad [dev.simd] cmd/compile, simd: add AES instructions
+ 2025-09-29 1c961c2fb2 [dev.simd] simd: use new data movement instructions to do "fast" transposes
+ 2025-09-26 fe4af1c067 [dev.simd] simd: repair broken comments in generated ops_amd64.go
+ 2025-09-26 ea3b2ecd28 [dev.simd] cmd/compile, simd: add 64-bit select-from-pair methods
+ 2025-09-26 25c36b95d1 [dev.simd] simd, cmd/compile: add 128 bit select-from-pair
+ 2025-09-26 f0e281e693 [dev.simd] cmd/compile: don't require single use for SIMD load/store folding
+ 2025-09-26 b4d1e018a8 [dev.simd] cmd/compile: remove unnecessary code from early simd prototype
+ 2025-09-26 578777bf7c [dev.simd] cmd/compile: make condtion of CanSSA smarter for SIMD fields
+ 2025-09-26 c28b2a0ca1 [dev.simd] simd: generalize select-float32-from-pair
+ 2025-09-25 a693ae1e9a [dev.simd] all: merge master (d70ad4e) into dev.simd
+ 2025-09-25 5a78e1a4a1 [dev.simd] simd, cmd/compile: mark simd vectors uncomparable
+ 2025-09-23 bf00f5dfd6 [dev.simd] simd, cmd/compile: added simd methods for VSHUFP[DS]
+ 2025-09-23 8e60feeb41 [dev.simd] cmd/compile: improve slicemask removal
+ 2025-09-23 2b50ffe172 [dev.simd] cmd/compile: remove stores to unread parameters
+ 2025-09-23 2d8cb80d7c [dev.simd] all: merge master (9b2d39b) into dev.simd
+ 2025-09-22 63a09d6d3d [dev.simd] cmd/compile: fix SIMD const rematerialization condition
+ 2025-09-20 2ca96d218d [dev.simd] cmd/compile: enhance prove to infer bounds in slice len/cap calculations
+ 2025-09-19 c0f031fcc3 [dev.simd] cmd/compile: spill the correct SIMD register for morestack
+ 2025-09-19 58fa1d023e [dev.simd] cmd/compile: enhance the chunked indexing case to include reslicing
+ 2025-09-18 7ae0eb2e80 [dev.simd] cmd/compile: remove Add32x4 generic op
+ 2025-09-18 31b664d40b [dev.simd] cmd/compile: widen index for simd intrinsics jumptable
+ 2025-09-18 e34ad6de42 [dev.simd] cmd/compile: optimize VPTEST for 2-operand cases
+ 2025-09-18 f1e3651c33 [dev.simd] cmd/compile, simd: add VPTEST
+ 2025-09-18 d9751166a6 [dev.simd] cmd/compile: handle rematerialized op for incompatible reg constraint
+ 2025-09-18 4eb5c6e07b [dev.simd] cmd/compile, simd/_gen: add rewrite for const load ops
+ 2025-09-18 443b7aeddb [dev.simd] cmd/compile, simd/_gen: make rewrite rules consistent on CPU Features
+ 2025-09-16 bdd30e25ca [dev.simd] all: merge master (ca0e035) into dev.simd
+ 2025-09-16 0e590a505d [dev.simd] cmd/compile: use the right type for spill slot
+ 2025-09-15 dabe2bb4fb [dev.simd] cmd/compile: fix holes in mask peepholes
+ 2025-09-12 3ec0b25ab7 [dev.simd] cmd/compile, simd/_gen/simdgen: add const load mops
+ 2025-09-12 1e5631d4e0 [dev.simd] cmd/compile: peephole simd load
+ 2025-09-11 48f366d826 [dev.simd] cmd/compile: add memop peephole rules
+ 2025-09-11 9a349f8e72 [dev.simd] all: merge master (cf5e993) into dev.simd
+ 2025-09-11 5a0446d449 [dev.simd] simd/_gen/simdgen, cmd/compile: add memory op machine ops
+ 2025-09-08 c39b2fdd1e [dev.simd] cmd/compile, simd: add VPLZCNT[DQ]
+ 2025-09-07 832c1f76dc [dev.simd] cmd/compile: enhance prove to deal with double-offset IsInBounds checks
+ 2025-09-06 0b323350a5 [dev.simd] simd/_gen/simdgen: merge memory ops
+ 2025-09-06 f42c9261d3 [dev.simd] simd/_gen/simdgen: parse memory operands
+ 2025-09-05 356c48d8e9 [dev.simd] cmd/compile, simd: add ClearAVXUpperBits
+ 2025-09-03 7c8b9115bc [dev.simd] all: merge master (4c4cefc) into dev.simd
+ 2025-09-02 9125351583 [dev.simd] internal/cpu: report AVX1 and 2 as supported on macOS 15 Rosetta 2
+ 2025-09-02 b509516b2e [dev.simd] simd, cmd/compile: add Interleave{Hi,Lo} (VPUNPCK*)
+ 2025-09-02 6890aa2e20 [dev.simd] cmd/compile: add instructions and rewrites for scalar-> vector moves
+ 2025-08-24 5ebe2d05d5 [dev.simd] simd: correct SumAbsDiff documentation
+ 2025-08-22 a5137ec92a [dev.simd] cmd/compile: sample peephole optimization for SIMD broadcast
+ 2025-08-22 83714616aa [dev.simd] cmd/compile: remove VPADDD4
+ 2025-08-22 4a3ea146ae [dev.simd] cmd/compile: correct register mask of some AVX512 ops
+ 2025-08-22 8d874834f1 [dev.simd] cmd/compile: use X15 for zero value in AVX context
+ 2025-08-22 4c311aa38f [dev.simd] cmd/compile: ensure the whole X15 register is zeroed
+ 2025-08-22 baea0c700b [dev.simd] cmd/compile, simd: complete AVX2? u?int shuffles
+ 2025-08-22 fa1e78c9ad [dev.simd] cmd/compile, simd: make Permute 128-bit use AVX VPSHUFB
+ 2025-08-22 bc217d4170 [dev.simd] cmd/compile, simd: add packed saturated u?int conversions
+ 2025-08-22 4fa23b0d29 [dev.simd] cmd/compile, simd: add saturated u?int conversions
+ 2025-08-21 3f6bab5791 [dev.simd] simd: move tests to a subdirectory to declutter "simd"
+ 2025-08-21 aea0a5e8d7 [dev.simd] simd/_gen/unify: improve envSet doc comment
+ 2025-08-21 7fdb1da6b0 [dev.simd] cmd/compile, simd: complete truncating u?int conversions.
+ 2025-08-21 f4c41d9922 [dev.simd] cmd/compile, simd: complete u?int widening conversions
+ 2025-08-21 6af8881adb [dev.simd] simd: reorganize cvt rules
+ 2025-08-21 58cfc2a5f6 [dev.simd] cmd/compile, simd: add VPSADBW
+ 2025-08-21 f7c6fa709e [dev.simd] simd/_gen/unify: fix some missing environments
+ 2025-08-20 7c84e984e6 [dev.simd] cmd/compile: rewrite to elide Slicemask from len==c>0 slicing
+ 2025-08-20 cf31b15635 [dev.simd] simd, cmd/compile: added .Masked() peephole opt for many operations.
+ 2025-08-20 1334285862 [dev.simd] simd: template field name cleanup in genfiles
+ 2025-08-20 af6475df73 [dev.simd] simd: add testing hooks for size-changing conversions
+ 2025-08-20 ede64cf0d8 [dev.simd] simd, cmd/compile: sample peephole optimization for .Masked()
+ 2025-08-20 103b6e39ca [dev.simd] all: merge master (9de69f6) into dev.simd
+ 2025-08-20 728ac3e050 [dev.simd] simd: tweaks to improve test disassembly
+ 2025-08-20 4fce49b86c [dev.simd] simd, cmd/compile: add widening unsigned converts 8->16->32
+ 2025-08-19 0f660d675f [dev.simd] simd: make OpMasked machine ops only
+ 2025-08-19 a034826e26 [dev.simd] simd, cmd/compile: implement ToMask, unexport asMask.
+ 2025-08-18 8ccd6c2034 [dev.simd] simd, cmd/compile: mark BLEND instructions as not-zero-mask
+ 2025-08-18 9a934d5080 [dev.simd] cmd/compile, simd: added methods for "float" GetElem
+ 2025-08-15 7380213a4e [dev.simd] cmd/compile: make move/load/store dependent only on reg and width
+ 2025-08-15 908e3e8166 [dev.simd] cmd/compile: make (most) move/load/store lowering use reg and width only
+ 2025-08-14 9783f86bc8 [dev.simd] cmd/compile: accounts rematerialize ops's output reginfo
+ 2025-08-14 a4ad41708d [dev.simd] all: merge master (924fe98) into dev.simd
+ 2025-08-13 8b90d48d8c [dev.simd] simd/_gen/simdgen: rewrite etetest.sh
+ 2025-08-13 b7c8698549 [dev.simd] simd/_gen: migrate simdgen from x/arch
+ 2025-08-13 257c1356ec [dev.simd] go/types: exclude simd/_gen module from TestStdlib
+ 2025-08-13 858a8d2276 [dev.simd] simd: reorganize/rename generated emulation files
+ 2025-08-13 2080415aa2 [dev.simd] simd: add emulations for missing AVX2 comparisons
+ 2025-08-13 ddb689c7bb [dev.simd] simd, cmd/compile: generated code for Broadcast
+ 2025-08-13 e001300cf2 [dev.simd] cmd/compile: fix LoadReg so it is aware of register target
+ 2025-08-13 d5dea86993 [dev.simd] cmd/compile: fix isIntrinsic for methods; fix fp <-> gp moves
+ 2025-08-13 08ab8e24a3 [dev.simd] cmd/compile: generated code from 'fix generated rules for shifts'
+ 2025-08-11 702ee2d51e [dev.simd] cmd/compile, simd: update generated files
+ 2025-08-11 e33eb1a7a5 [dev.simd] cmd/compile, simd: update generated files
+ 2025-08-11 667add4f1c [dev.simd] cmd/compile, simd: update generated files
+ 2025-08-11 1755c2909d [dev.simd] cmd/compile, simd: update generated files
+ 2025-08-11 2fd49d8f30 [dev.simd] simd: imm doc improve
+ 2025-08-11 ce0e803ab9 [dev.simd] cmd/compile: keep track of multiple rule file names in ssa/_gen
+ 2025-08-11 38b76bf2a3 [dev.simd] cmd/compile, simd: jump table for imm ops
+ 2025-08-08 94d72355f6 [dev.simd] simd: add emulations for bitwise ops and for mask/merge methods
+ 2025-08-07 8eb5f6020e [dev.simd] cmd/compile, simd: API interface fixes
+ 2025-08-07 b226bcc4a9 [dev.simd] cmd/compile, simd: add value conversion ToBits for mask
+ 2025-08-06 5b0ef7fcdc [dev.simd] cmd/compile, simd: add Expand
+ 2025-08-06 d3cf582f8a [dev.simd] cmd/compile, simd: (Set|Get)(Lo|Hi)
+ 2025-08-05 7ca34599ec [dev.simd] simd, cmd/compile: generated files to add 'blend' and 'blendMasked'
+ 2025-08-05 82d056ddd7 [dev.simd] cmd/compile: add ShiftAll immediate variant
+ 2025-08-04 775fb52745 [dev.simd] all: merge master (7a1679d) into dev.simd
+ 2025-08-04 6b9b59e144 [dev.simd] simd, cmd/compile: rename some methods
+ 2025-08-04 d375b95357 [dev.simd] simd: move lots of slice functions and methods to generated code
+ 2025-08-04 3f92aa1eca [dev.simd] cmd/compile, simd: make bitwise logic ops available to all u?int vectors
+ 2025-08-04 c2d775d401 [dev.simd] cmd/compile, simd: change PairDotProdAccumulate to AddDotProd
+ 2025-08-04 2c25f3e846 [dev.simd] cmd/compile, simd: change Shift*AndFillUpperFrom to Shift*Concat
+ 2025-08-01 c25e5c86b2 [dev.simd] cmd/compile: generated code for K-mask-register slice load/stores
+ 2025-08-01 1ac5f3533f [dev.simd] cmd/compile: opcodes and rules and code generation to enable AVX512 masked loads/stores
+ 2025-08-01 f39711a03d [dev.simd] cmd/compile: test for int-to-mask conversion
+ 2025-08-01 08bec02907 [dev.simd] cmd/compile: add register-to-mask moves, other simd glue
+ 2025-08-01 09ff25e350 [dev.simd] simd: add tests for simd conversions to Int32/Uint32.
+ 2025-08-01 a24ffe3379 [dev.simd] simd: modify test generation to make it more flexible
+ 2025-08-01 ec5c20ba5a [dev.simd] cmd/compile: generated simd code to add some conversions
+ 2025-08-01 e62e377ed6 [dev.simd] cmd/compile, simd: generated code from repaired simdgen sort
+ 2025-08-01 761894d4a5 [dev.simd] simd: add partial slice load/store for 32/64-bits on AVX2
+ 2025-08-01 acc1492b7d [dev.simd] cmd/compile: Generated code for AVX2 SIMD masked load/store
+ 2025-08-01 a0b87a7478 [dev.simd] cmd/compile: changes for AVX2 SIMD masked load/store
+ 2025-08-01 88568519b4 [dev.simd] simd: move test generation into Go repo
+ 2025-07-31 6f7a1164e7 [dev.simd] cmd/compile, simd: support store to bits for mask
+ 2025-07-21 41054cdb1c [dev.simd] simd, internal/cpu: support more AVX CPU Feature checks
+ 2025-07-21 957f06c410 [dev.simd] cmd/compile, simd: support load from bits for mask
+ 2025-07-21 f0e9dc0975 [dev.simd] cmd/compile: fix opLen(2|3)Imm8_2I intrinsic function
+ 2025-07-17 03a3887f31 [dev.simd] simd: clean up masked op doc
+ 2025-07-17 c61743e4f0 [dev.simd] cmd/compile, simd: reorder PairDotProdAccumulate
+ 2025-07-15 ef5f6cc921 [dev.simd] cmd/compile: adjust param order for AndNot
+ 2025-07-15 6d10680141 [dev.simd] cmd/compile, simd: add Compress
+ 2025-07-15 17baae72db [dev.simd] simd: default mask param's name to mask
+ 2025-07-15 01f7f57025 [dev.simd] cmd/compile, simd: add variable Permute
+ 2025-07-14 f5f42753ab [dev.simd] cmd/compile, simd: add VDPPS
+ 2025-07-14 08ffd66ab2 [dev.simd] simd: updates CPU Feature in doc
+ 2025-07-14 3f789721d6 [dev.simd] cmd/compile: mark SIMD types non-fat
+ 2025-07-11 b69622b83e [dev.simd] cmd/compile, simd: adjust Shift.* operations
+ 2025-07-11 4993a91ae1 [dev.simd] simd: change imm param name to constant
+ 2025-07-11 bbb6dccd84 [dev.simd] simd: fix documentations
+ 2025-07-11 1440ff7036 [dev.simd] cmd/compile: exclude simd vars from merge local
+ 2025-07-11 ccb43dcec7 [dev.simd] cmd/compile: add VZEROUPPER and VZEROALL inst
+ 2025-07-11 21596f2f75 [dev.simd] all: merge master (88cf0c5) into dev.simd
+ 2025-07-10 ab7f839280 [dev.simd] cmd/compile: fix maskreg/simdreg chaos
+ 2025-07-09 47b07a87a6 [dev.simd] cmd/compile, simd: fix Int64x2 Greater output type to mask
+ 2025-07-09 08cd62e9f5 [dev.simd] cmd/compile: remove X15 from register mask
+ 2025-07-09 9ea33ed538 [dev.simd] cmd/compile: output of simd generator, more ... rewrite rules
+ 2025-07-09 aab8b173a9 [dev.simd] cmd/compile, simd: Int64x2 Greater and Uint* Equal
+ 2025-07-09 8db7f41674 [dev.simd] cmd/compile: use upper registers for AVX512 simd ops
+ 2025-07-09 574854fd86 [dev.simd] runtime: save Z16-Z31 registers in async preempt
+ 2025-07-09 5429328b0c [dev.simd] cmd/compile: change register mask names for simd ops
+ 2025-07-09 029d7ec3e9 [dev.simd] cmd/compile, simd: rename Masked$OP to $(OP)Masked.
+ 2025-07-09 983e81ce57 [dev.simd] simd: rename stubs_amd64.go to ops_amd64.go
+ 2025-07-08 56ca67682b [dev.simd] cmd/compile, simd: remove FP bitwise logic operations.
+ 2025-07-08 0870ed04a3 [dev.simd] cmd/compile: make compares between NaNs all false.
+ 2025-07-08 24f2b8ae2e [dev.simd] simd: {Int,Uint}{8x{16,32},16x{8,16}} subvector loads/stores from slices.
+ 2025-07-08 2bb45cb8a5 [dev.simd] cmd/compile: minor tweak for race detector
+ 2025-07-07 43a61aef56 [dev.simd] cmd/compile: add EXTRACT[IF]128 instructions
+ 2025-07-07 292db9b676 [dev.simd] cmd/compile: add INSERT[IF]128 instructions
+ 2025-07-07 d8fa853b37 [dev.simd] cmd/compile: make regalloc simd aware on copy
+ 2025-07-07 dfd75f82d4 [dev.simd] cmd/compile: output of simdgen with invariant type order
+ 2025-07-04 72c39ef834 [dev.simd] cmd/compile: fix the "always panic" code to actually panic
+ 2025-07-01 1ee72a15a3 [dev.simd] internal/cpu: add GFNI feature check
+ 2025-06-30 0710cce6eb [dev.simd] runtime: remove write barrier in xRegRestore
+ 2025-06-30 59846af331 [dev.simd] cmd/compile, simd: cleanup operations and documentations
+ 2025-06-30 f849225b3b [dev.simd] all: merge master (740857f) into dev.simd
+ 2025-06-30 9eeb1e7a9a [dev.simd] runtime: save AVX2 and AVX-512 state on asynchronous preemption
+ 2025-06-30 426cf36b4d [dev.simd] runtime: save scalar registers off stack in amd64 async preemption
+ 2025-06-30 ead249a2e2 [dev.simd] cmd/compile: reorder operands for some simd operations
+ 2025-06-30 55665e1e37 [dev.simd] cmd/compile: undoes reorder transform in prior commit, changes names
+ 2025-06-26 10c9621936 [dev.simd] cmd/compile, simd: add galois field operations
+ 2025-06-26 e61ebfce56 [dev.simd] cmd/compile, simd: add shift operations
+ 2025-06-26 35b8cf7fed [dev.simd] cmd/compile: tweak sort order in generator
+ 2025-06-26 7fadfa9638 [dev.simd] cmd/compile: add simd VPEXTRA*
+ 2025-06-26 0d8cb89f5c [dev.simd] cmd/compile: support simd(imm,fp) returns gp
+ 2025-06-25 f4a7c124cc [dev.simd] all: merge master (f8ccda2) into dev.simd
+ 2025-06-25 4fda27c0cc [dev.simd] cmd/compile: glue codes for Shift and Rotate
+ 2025-06-24 61c1183342 [dev.simd] simd: add test wrappers
+ 2025-06-23 e32488003d [dev.simd] cmd/compile: make simd regmask naming more like existing conventions
+ 2025-06-23 1fa4bcfcda [dev.simd] simd, cmd/compile: generated code for VPINSR[BWDQ], and test
+ 2025-06-23 dd63b7aa0e [dev.simd] simd: add AVX512 aggregated check
+ 2025-06-23 0cdb2697d1 [dev.simd] simd: add tests for intrinsic used as a func value and via reflection
+ 2025-06-23 88c013d6ff [dev.simd] cmd/compile: generate function body for bodyless intrinsics
+ 2025-06-20 a8669c78f5 [dev.simd] sync: correct the type of runtime_StoreReluintptr
+ 2025-06-20 7c6ac35275 [dev.simd] cmd/compile: add simdFp1gp1fp1Imm8 helper to amd64 code generation
+ 2025-06-20 4150372a5d [dev.simd] cmd/compile: don't treat devel compiler as a released compiler
+ 2025-06-18 1b87d52549 [dev.simd] cmd/compile: add fp1gp1fp1 register mask for AMD64
+ 2025-06-18 1313521f75 [dev.simd] cmd/compile: remove fused mul/add/sub shapes.
+ 2025-06-17 1be5eb2686 [dev.simd] cmd/compile: fix signature error of PairDotProdAccumulate.
+ 2025-06-17 3a4d10bfca [dev.simd] cmd/compile: removed a map iteration from generator; tweaked type order
+ 2025-06-17 21d6573154 [dev.simd] cmd/compile: alphabetize SIMD intrinsics
+ 2025-06-16 ee1d9f3f85 [dev.simd] cmd/compile: reorder stubs
+ 2025-06-13 6c50c8b892 [dev.simd] cmd/compile: move simd helpers into compiler, out of generated code
+ 2025-06-13 7392dfd43e [dev.simd] cmd/compile: generated simd*ops files weren't up to date
+ 2025-06-13 00a8dacbe4 [dev.simd] cmd/compile: remove unused simd intrinsics "helpers"
+ 2025-06-13 b9a548775f cmd/compile: add up-to-date test for generated files
+ 2025-06-13 ca01eab9c7 [dev.simd] cmd/compile: add fused mul add sub ops
+ 2025-06-13 ded6e0ac71 [dev.simd] cmd/compile: add more dot products
+ 2025-06-13 3df41c856e [dev.simd] simd: update documentations
+ 2025-06-13 9ba7db36b5 [dev.simd] cmd/compile: add dot product ops
+ 2025-06-13 34a9cdef87 [dev.simd] cmd/compile: add round simd ops
+ 2025-06-13 5289e0f24e [dev.simd] cmd/compile: updates simd ordering and docs
+ 2025-06-13 c81cb05e3e [dev.simd] cmd/compile: add simdGen prog writer
+ 2025-06-13 9b9af3d638 [dev.simd] internal/cpu: add AVX-512-CD and DQ, and derived "basic AVX-512"
+ 2025-06-13 dfa6c74263 [dev.simd] runtime: eliminate global state in mkpreempt.go
+ 2025-06-10 b2e8ddba3c [dev.simd] all: merge master (773701a) into dev.simd
+ 2025-06-09 884f646966 [dev.simd] cmd/compile: add fp3m1fp1 shape to regalloc
+ 2025-06-09 6bc3505773 [dev.simd] cmd/compile: add fp3fp1 regsiter shape
+ 2025-06-05 2eaa5a0703 [dev.simd] simd: add functions+methods to load-from/store-to slices
+ 2025-06-05 8ecbd59ebb [dev.simd] cmd/compile: generated codes for amd64 SIMD
+ 2025-06-02 baa72c25f1 [dev.simd] all: merge master (711ff94) into dev.simd
+ 2025-05-30 0ff18a9cca [dev.simd] cmd/compile: disable intrinsics test for new simd stuff
+ 2025-05-30 7800f3813c [dev.simd] cmd/compile: flip sense of intrinsics test for SIMD
+ 2025-05-29 eba2430c16 [dev.simd] simd, cmd/compile, go build, go/doc: test tweaks
+ 2025-05-29 71c0e550cd [dev.simd] cmd/dist: disable API check on dev branch
+ 2025-05-29 62e1fccfb9 [dev.simd] internal: delete unused internal/simd directory
+ 2025-05-29 1161228bf1 [dev.simd] cmd/compile: add a fp1m1fp1 register shape to amd64
+ 2025-05-28 fdb067d946 [dev.simd] simd: initialize directory to make it suitable for testing SIMD
+ 2025-05-28 11d2b28bff [dev.simd] cmd/compile: add and fix k register supports
+ 2025-05-28 04b1030ae4 [dev.simd] cmd/compile: adapters for simd
+ 2025-05-27 2ef7106881 [dev.simd] internal/buildcfg: enable SIMD GOEXPERIMENT for amd64
+ 2025-05-22 4d2c71ebf9 [dev.simd] internal/goexperiment: add SIMD goexperiment
+ 2025-05-22 3ac5f2f962 [dev.simd] codereview.cfg: set up dev.simd branch

Change-Id: I60f2cd2ea055384a3788097738c6989630207871

7 weeks ago[dev.simd] all: merge master (e704b09) into dev.simd
Cherry Mui [Mon, 24 Nov 2025 20:48:06 +0000 (15:48 -0500)]
[dev.simd] all: merge master (e704b09) into dev.simd

Merge List:

+ 2025-11-24 e704b0993b go/types, types2: shorten object map assertion

Change-Id: Ie45f971d2872c6b7f8f62d61e4d307ccf52a6546

7 weeks agogo/types, types2: shorten object map assertion
Mark Freeman [Fri, 14 Nov 2025 20:04:28 +0000 (15:04 -0500)]
go/types, types2: shorten object map assertion

It's a fairly well-known invariant that each object must exist in the
object map and cannot be nil. This change just shortens a check of
that invariant.

Change-Id: Id15c158c3a9ad91cdc230fb0b84eb69b2451cbdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/722061
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Mark Freeman <markfreeman@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
7 weeks ago[dev.simd] all: merge master (02d1f3a) into dev.simd
Cherry Mui [Mon, 24 Nov 2025 20:29:27 +0000 (15:29 -0500)]
[dev.simd] all: merge master (02d1f3a) into dev.simd

Merge List:

+ 2025-11-24 02d1f3a06b runtime: respect GOTRACEBACK for user-triggered runtime panics
+ 2025-11-24 a593ca9d65 runtime/cgo: add support for `any` param and return type
+ 2025-11-24 89552911b3 cmd/compile, internal/buildcfg: enable regABI on s390x, and add s390x
+ 2025-11-24 2fe0ba8d52 internal/bytealg: port bytealg functions to reg ABI on s390x
+ 2025-11-24 4529c8fba6 runtime: port memmove, memclr to register ABI on s390x
+ 2025-11-24 58a48a3e3b internal/runtime/syscall: Syscall changes for s390x regabi
+ 2025-11-24 2a185fae7e reflect, runtime: add reflect support for regabi on s390x
+ 2025-11-24 e92d2964fa runtime: mark race functions on s390x as ABIInternal
+ 2025-11-24 41af98eb83 runtime: add runtime changes for register ABI on s390x
+ 2025-11-24 85e6080089 cmd/internal/obj: set morestack arg spilling and regabi prologue on s390x
+ 2025-11-24 24697419c5 cmd/compile: update s390x CALL* ops
+ 2025-11-24 81242d034c cmd/compile/internal/s390x: add initial spill support
+ 2025-11-24 73b6aa0fec cmd/compile/internal: add register ABI information for s390x
+ 2025-11-24 1036f6f485 internal/abi: define s390x ABI constants
+ 2025-11-24 2e5d12a277 cmd/compile: document register-based ABI for s390x

Change-Id: I57b4ae6f9b65d99958b9fe5974205770e18f7788

7 weeks agoruntime: respect GOTRACEBACK for user-triggered runtime panics
Joe Tsai [Thu, 13 Feb 2025 23:59:32 +0000 (15:59 -0800)]
runtime: respect GOTRACEBACK for user-triggered runtime panics

The documentation for GOTRACEBACK says that "single" is the default
where the stack trace for only a single routine is printed except
that it prints all stack traces if:

there is no current goroutine or
the failure is internal to the run-time.

In the runtime, there are two types of panics:
throwTypeUser and throwTypeRuntime.
The latter more clearly corresponds to a
"failure [that] is internal to the run-time",
while the former corresponds to a
problem trigger due to a user mistake.

Thus, a user-triggered panic (e.g., concurrent map access)
should not result in a dump of all stack traces.

Fixes #68019

Change-Id: I9b02f82535ddb9fd666f7158e2e4ee10f235646a
Reviewed-on: https://go-review.googlesource.com/c/go/+/649535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
7 weeks ago[dev.simd] internal/buildcfg: don't enable SIMD experiment by default
Cherry Mui [Mon, 24 Nov 2025 19:41:26 +0000 (14:41 -0500)]
[dev.simd] internal/buildcfg: don't enable SIMD experiment by default

Preparing for merge to the main branch. Will reenable on the
branch.

Change-Id: Iac77dfb90498cf6eb60f79930a53179f130b7508
Reviewed-on: https://go-review.googlesource.com/c/go/+/723940
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 weeks agoruntime/cgo: add support for `any` param and return type
Alexandre Daubois [Mon, 24 Nov 2025 08:14:18 +0000 (08:14 +0000)]
runtime/cgo: add support for `any` param and return type

When using `any` as param or return type of an exported
function, we currently have the error `unrecognized Go
type any`. `any` is an alias of `interface{}` which is
already supported.

This would avoid such change: https://github.com/php/frankenphp/pull/1976

Fixes #76340

Change-Id: I301838ff72e99ae78b035a8eff2405f6a145ed1a
GitHub-Last-Rev: 7dfbccfa582bbc6e79ed29677391b9ae81a9b5bd
GitHub-Pull-Request: golang/go#76325
Reviewed-on: https://go-review.googlesource.com/c/go/+/720960
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>