]> Cypherpunks repositories - gostls13.git/log
gostls13.git
7 months agogo/types, types2: factor type checking of basic literals and generate go/types code
Robert Griesemer [Thu, 5 Sep 2024 01:06:50 +0000 (18:06 -0700)]
go/types, types2: factor type checking of basic literals and generate go/types code

Move the code for type checking of basic literals into literals.go.

In go/types, the respective code is now generated from the types2 source.

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

7 months agogo/types: factor out opPos computation
Robert Griesemer [Thu, 5 Sep 2024 00:46:28 +0000 (17:46 -0700)]
go/types: factor out opPos computation

Adjust Checker.overflow call sites to match types2
where possible.

Change-Id: Iaa0d423f2ebf642428c745c4ac4f712e4136dffb
Reviewed-on: https://go-review.googlesource.com/c/go/+/610956
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Tim King <taking@google.com>
7 months agogo/types, types2: factor type checking of func literals and generate go/types code
Robert Griesemer [Thu, 5 Sep 2024 00:15:57 +0000 (17:15 -0700)]
go/types, types2: factor type checking of func literals and generate go/types code

Move the code for type checking of function literals into
literals.go.

In go/types, the respective code is now generated from the types2 source.

Change-Id: Ic81ab3c0d3c66d99bc0f2e21d66bf9a896ef9375
Reviewed-on: https://go-review.googlesource.com/c/go/+/610996
Reviewed-by: Tim King <taking@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
7 months agogo/types, types2: factor out endPos call
Robert Griesemer [Thu, 5 Sep 2024 00:19:14 +0000 (17:19 -0700)]
go/types, types2: factor out endPos call

Preparation for generation of function literal type checking code
from types2 source.

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

7 months agogo/types: generate literals.go from corresponding types2 source
Robert Griesemer [Wed, 4 Sep 2024 23:37:45 +0000 (16:37 -0700)]
go/types: generate literals.go from corresponding types2 source

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

7 months agogo/types, types2: factor out isdddArray and inNode helper functions
Robert Griesemer [Wed, 4 Sep 2024 23:42:56 +0000 (16:42 -0700)]
go/types, types2: factor out isdddArray and inNode helper functions

Preparation for generation of go/types/literals.go from types2 sources.

Change-Id: I9af23fbe1e448976394ddd7b348188c2595d8afe
Reviewed-on: https://go-review.googlesource.com/c/go/+/610557
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
7 months agogo/types, types2: factor out code for type checking composite literals
Robert Griesemer [Wed, 4 Sep 2024 23:01:32 +0000 (16:01 -0700)]
go/types, types2: factor out code for type checking composite literals

Move code into separate function in separate file.
Replace "goto Error" statements with "x.mode = invalid; return".
No other semantic changes.

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

7 months agocmd/compile/internal/syntax: handle parentheses around constraints consistently
Robert Griesemer [Wed, 4 Sep 2024 20:20:36 +0000 (13:20 -0700)]
cmd/compile/internal/syntax: handle parentheses around constraints consistently

Generally, the parser strips (i.e., does not record in the syntax tree)
unnecessary parentheses. Specifically, given a type parameter list of
the form

        [P (C),]

it records it as

        [P C]

and then no comma is required when printing. However it did only strip
one level of parentheses, and

        [P ((C)),]

made it through, causing a panic when printing. Somewhat related,
the printer stripped parentheses around constraints as well.

This CL implements a more consistent behavior:

1) The parser strips all parentheses around constraints. For testing
   purposes, a local flag (keep_parens) can be set to retain the
   parentheses.

2) The printer code now correctly intruces a comma if parentheses
   are present (e.g., when testing with keep_parens). This case does
   not occur in normal operation.

3) The printer does not strip parentheses around constraints since
   the parser does it already.

For #69206.

Change-Id: I974a800265625e8daf9477faa9ee4dd74dbd17ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/610758
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
7 months agocmd/compile: use slices.SortStableFunc
Cuong Manh Le [Wed, 4 Sep 2024 18:21:40 +0000 (01:21 +0700)]
cmd/compile: use slices.SortStableFunc

Now that we're bootstrapping from a toolchain that has the slices
package.

Updates #64751

Change-Id: I876ec6d261466344faf33f8c5cda229dd1e4185f
Reviewed-on: https://go-review.googlesource.com/c/go/+/610602
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 months agocmd/compile: use slices.{Sort,SortFunc}
Cuong Manh Le [Wed, 4 Sep 2024 18:13:30 +0000 (01:13 +0700)]
cmd/compile: use slices.{Sort,SortFunc}

Now that we're bootstrapping from a toolchain that has the slices
package.

Updates #64751

Change-Id: I2e63d95577d058670d3dc75bd45d6e050c6f0e25
Reviewed-on: https://go-review.googlesource.com/c/go/+/610601
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 months agocmd/cgo: use slices.Index
Tobias Klauser [Wed, 4 Sep 2024 11:31:19 +0000 (13:31 +0200)]
cmd/cgo: use slices.Index

Now that Go 1.22.6 is the minimum bootstrap toolchain (cf. CL 606156),
the slices package (introduced in Go 1.21) can be used in packages built
using the bootstrap toolchain.

For #64751

Change-Id: Ife0daa37c0982d9ec1afab07b9d40a1dfee9b7d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/610575
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
7 months agogo/printer: do not treat comments inside a ast.Decl as godoc
Mateusz Poliwczak [Wed, 4 Sep 2024 07:05:17 +0000 (07:05 +0000)]
go/printer: do not treat comments inside a ast.Decl as godoc

This change makes sure that we do not format comments
as doc comments inside of a declaration and makes the
go doc formatter idempotent:

Previously:

// test comment
//go:directive2
// test comment
func main() {
}

was formatted to:

// test comment
//go:directive2
// test comment
func main() {
}

after another formatting, it got formatted with doc rules into:

// test comment
// test comment
//
//go:directive2
func main() {
}

With this change it gets directly to the correct form (last one).

Change-Id: Id7d8f03e43474357cd714e0672e886652c3fce86
GitHub-Last-Rev: 9833b87536c29f8be0e74c232936c5e6c5a9b78b
GitHub-Pull-Request: golang/go#69134
Reviewed-on: https://go-review.googlesource.com/c/go/+/609077
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

7 months agocmd/go/internal: use t.TempDir in tests
Kir Kolyshkin [Wed, 4 Sep 2024 21:51:44 +0000 (14:51 -0700)]
cmd/go/internal: use t.TempDir in tests

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

7 months agogo/build/constraint: add parsing limits
Roland Shoemaker [Thu, 20 Jun 2024 17:45:30 +0000 (10:45 -0700)]
go/build/constraint: add parsing limits

Limit the size of build constraints that we will parse. This prevents a
number of stack exhaustions that can be hit when parsing overly complex
constraints. The imposed limits are unlikely to ever be hit in real
world usage.

Fixes #69141
Fixes CVE-2024-34158

Change-Id: I38b614bf04caa36eefc6a4350d848588c4cef3c4
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/1540
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/611240
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

7 months agoencoding/gob: cover missed cases when checking ignore depth
Roland Shoemaker [Fri, 3 May 2024 13:21:39 +0000 (09:21 -0400)]
encoding/gob: cover missed cases when checking ignore depth

This change makes sure that we are properly checking the ignored field
recursion depth in decIgnoreOpFor consistently. This prevents stack
exhaustion when attempting to decode a message that contains an
extremely deeply nested struct which is ignored.

Thanks to Md Sakib Anwar of The Ohio State University (anwar.40@osu.edu)
for reporting this issue.

Fixes #69139
Fixes CVE-2024-34156

Change-Id: Iacce06be95a5892b3064f1c40fcba2e2567862d6
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/1440
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/611239
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

7 months agogo/parser: track depth in nested element lists
Roland Shoemaker [Mon, 10 Jun 2024 22:34:12 +0000 (15:34 -0700)]
go/parser: track depth in nested element lists

Prevents stack exhaustion with extremely deeply nested literal values,
i.e. field values in structs.

Fixes #69138
Fixes CVE-2024-34155

Change-Id: I2e8e33b44105cc169d7ed1ae83fb56df0c10f1ee
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/1520
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/611238
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

7 months agotypes2, go/types: use slices.SortFunc
Cuong Manh Le [Wed, 4 Sep 2024 18:18:10 +0000 (01:18 +0700)]
types2, go/types: use slices.SortFunc

Now that we're bootstrapping from a toolchain that has the slices
package.

Updates #64751

Change-Id: I3227e55f87e033dae63a2d1712b7f9373fe49731
Reviewed-on: https://go-review.googlesource.com/c/go/+/610603
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
7 months agoruntime: use regabi for riscv64 cputicks
Meng Zhuo [Mon, 2 Sep 2024 09:36:12 +0000 (17:36 +0800)]
runtime: use regabi for riscv64 cputicks

goos: linux
goarch: riscv64
pkg: runtime
cpu: Spacemit(R) X60
                     │ select.old.log │           select.new.log           │
                     │     sec/op     │   sec/op     vs base               │
SelectUncontended         490.5n ± 0%   486.8n ± 0%  -0.77% (p=0.000 n=10)
SelectSyncContended       2.754µ ± 0%   2.726µ ± 0%  -1.02% (p=0.000 n=10)
SelectAsyncContended      488.2n ± 0%   484.2n ± 0%  -0.84% (p=0.000 n=10)
SelectNonblock            112.2n ± 0%   111.5n ± 0%  -0.58% (p=0.000 n=10)
SelectProdCons            1.420µ ± 0%   1.417µ ± 0%       ~ (p=0.069 n=10)
GoroutineSelect           10.79m ± 3%   10.74m ± 3%       ~ (p=0.529 n=10)
geomean                   3.228µ        3.208µ       -0.63%

Change-Id: Idb519ef8b2872284dca6dbf1cf94c3fff65bfd37
Reviewed-on: https://go-review.googlesource.com/c/go/+/610095
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
7 months agocmd/internal/obj/loong64: add support for instructions ANDN and ORN
Xiaolin Zhao [Wed, 4 Sep 2024 08:19:22 +0000 (16:19 +0800)]
cmd/internal/obj/loong64: add support for instructions ANDN and ORN

Go asm syntax:
ANDN/ORN RK, RJ, RD
    or  ANDN/ORN RK, RD

Equivalent platform assembler syntax:
andn/orn rd, rj, rk
    or  andn/orn rd, rd, rk

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

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

7 months agoruntime: optimize the function memclrNoHeapPointers on loong64
Xiaolin Zhao [Mon, 3 Jun 2024 07:49:23 +0000 (15:49 +0800)]
runtime: optimize the function memclrNoHeapPointers on loong64

The relevant performance improved by 54.61%.

benchmark:
goos: linux
goarch: loong64
pkg: runtime
cpu: Loongson-3A6000 @ 2500.00MHz
                        │     old      │                 new                 │
                        │    sec/op    │   sec/op     vs base                │
Memclr/5                   4.803n ± 0%   2.801n ± 0%  -41.68% (p=0.000 n=20)
Memclr/16                  4.803n ± 0%   3.202n ± 0%  -33.33% (p=0.000 n=20)
Memclr/64                  9.605n ± 0%   5.061n ± 1%  -47.30% (p=0.000 n=20)
Memclr/256                 29.22n ± 0%   10.24n ± 0%  -64.96% (p=0.000 n=20)
Memclr/4096                413.4n ± 0%   106.9n ± 0%  -74.14% (p=0.000 n=20)
Memclr/65536               6.566µ ± 0%   1.673µ ± 0%  -74.52% (p=0.000 n=20)
Memclr/1M                 104.95µ ± 0%   52.51µ ± 0%  -49.97% (p=0.000 n=20)
Memclr/4M                  419.8µ ± 0%   209.9µ ± 0%  -49.99% (p=0.000 n=20)
Memclr/8M                  839.6µ ± 0%   419.9µ ± 0%  -49.98% (p=0.000 n=20)
Memclr/16M                1687.6µ ± 0%   845.3µ ± 0%  -49.91% (p=0.000 n=20)
Memclr/64M                 6.725m ± 0%   3.389m ± 0%  -49.61% (p=0.000 n=20)
MemclrUnaligned/0_5        6.003n ± 0%   4.581n ± 0%  -23.69% (p=0.000 n=20)
MemclrUnaligned/0_16       6.005n ± 0%   5.084n ± 0%  -15.33% (p=0.000 n=20)
MemclrUnaligned/0_64      10.810n ± 0%   6.229n ± 0%  -42.38% (p=0.000 n=20)
MemclrUnaligned/0_256      30.43n ± 0%   10.68n ± 0%  -64.90% (p=0.000 n=20)
MemclrUnaligned/0_4096     414.8n ± 0%   107.1n ± 0%  -74.18% (p=0.000 n=20)
MemclrUnaligned/0_65536    6.566µ ± 0%   1.700µ ± 0%  -74.11% (p=0.000 n=20)
MemclrUnaligned/1_5        6.003n ± 0%   4.582n ± 0%  -23.67% (p=0.000 n=20)
MemclrUnaligned/1_16      11.610n ± 0%   5.080n ± 0%  -56.24% (p=0.000 n=20)
MemclrUnaligned/1_64      16.810n ± 0%   7.370n ± 0%  -56.16% (p=0.000 n=20)
MemclrUnaligned/1_256      36.42n ± 0%   12.95n ± 0%  -64.44% (p=0.000 n=20)
MemclrUnaligned/1_4096     420.6n ± 0%   114.6n ± 0%  -72.75% (p=0.000 n=20)
MemclrUnaligned/1_65536    6.573µ ± 0%   1.708µ ± 0%  -74.01% (p=0.000 n=20)
MemclrUnaligned/4_5        6.003n ± 0%   4.582n ± 0%  -23.67% (p=0.000 n=20)
MemclrUnaligned/4_16      10.410n ± 0%   5.069n ± 0%  -51.30% (p=0.000 n=20)
MemclrUnaligned/4_64      15.610n ± 0%   7.372n ± 0%  -52.77% (p=0.000 n=20)
MemclrUnaligned/4_256      35.22n ± 0%   12.95n ± 0%  -63.23% (p=0.000 n=20)
MemclrUnaligned/4_4096     419.4n ± 0%   114.6n ± 0%  -72.68% (p=0.000 n=20)
MemclrUnaligned/4_65536    6.571µ ± 0%   1.708µ ± 0%  -74.01% (p=0.000 n=20)
MemclrUnaligned/7_5        6.003n ± 0%   4.581n ± 0%  -23.69% (p=0.000 n=20)
MemclrUnaligned/7_16       8.855n ± 0%   5.079n ± 0%  -42.65% (p=0.000 n=20)
MemclrUnaligned/7_64      14.010n ± 0%   7.370n ± 0%  -47.39% (p=0.000 n=20)
MemclrUnaligned/7_256      33.62n ± 0%   12.95n ± 0%  -61.48% (p=0.000 n=20)
MemclrUnaligned/7_4096     417.8n ± 0%   114.7n ± 0%  -72.56% (p=0.000 n=20)
MemclrUnaligned/7_65536    6.570µ ± 0%   1.708µ ± 0%  -74.00% (p=0.000 n=20)
MemclrUnaligned/0_1M      104.96µ ± 0%   52.51µ ± 0%  -49.97% (p=0.000 n=20)
MemclrUnaligned/0_4M       419.8µ ± 0%   209.9µ ± 0%  -49.99% (p=0.000 n=20)
MemclrUnaligned/0_8M       839.5µ ± 0%   419.8µ ± 0%  -49.99% (p=0.000 n=20)
MemclrUnaligned/0_16M     1687.9µ ± 0%   844.9µ ± 0%  -49.94% (p=0.000 n=20)
MemclrUnaligned/0_64M      6.725m ± 0%   3.382m ± 0%  -49.72% (p=0.000 n=20)
MemclrUnaligned/1_1M      104.97µ ± 0%   52.51µ ± 0%  -49.97% (p=0.000 n=20)
MemclrUnaligned/1_4M       419.8µ ± 0%   210.0µ ± 0%  -49.97% (p=0.000 n=20)
MemclrUnaligned/1_8M       839.5µ ± 0%   419.8µ ± 0%  -50.00% (p=0.000 n=20)
MemclrUnaligned/1_16M     1687.6µ ± 0%   844.2µ ± 0%  -49.97% (p=0.000 n=20)
MemclrUnaligned/1_64M      6.724m ± 0%   3.367m ± 0%  -49.93% (p=0.000 n=20)
MemclrUnaligned/4_1M      104.97µ ± 0%   52.51µ ± 0%  -49.97% (p=0.000 n=20)
MemclrUnaligned/4_4M       419.8µ ± 0%   210.0µ ± 0%  -49.97% (p=0.000 n=20)
MemclrUnaligned/4_8M       839.5µ ± 0%   419.8µ ± 0%  -50.00% (p=0.000 n=20)
MemclrUnaligned/4_16M     1687.5µ ± 0%   844.4µ ± 0%  -49.96% (p=0.000 n=20)
MemclrUnaligned/4_64M      6.725m ± 0%   3.366m ± 0%  -49.95% (p=0.000 n=20)
MemclrUnaligned/7_1M      104.97µ ± 0%   52.51µ ± 0%  -49.97% (p=0.000 n=20)
MemclrUnaligned/7_4M       419.8µ ± 0%   210.0µ ± 0%  -49.97% (p=0.000 n=20)
MemclrUnaligned/7_8M       839.5µ ± 0%   419.8µ ± 0%  -50.00% (p=0.000 n=20)
MemclrUnaligned/7_16M     1687.9µ ± 0%   844.3µ ± 0%  -49.98% (p=0.000 n=20)
MemclrUnaligned/7_64M      6.724m ± 0%   3.362m ± 0%  -50.00% (p=0.000 n=20)
geomean                    4.659µ        2.114µ       -54.61%

Change-Id: If0174e4cd8be5e17ad146698508a966158fe83e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/589539
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
7 months agocrypto/sha256: implement sha256block in hardware on loong64
Xiaolin Zhao [Tue, 4 Jun 2024 01:40:14 +0000 (09:40 +0800)]
crypto/sha256: implement sha256block in hardware on loong64

goos: linux
goarch: loong64
pkg: crypto/sha256
cpu: Loongson-3A6000 @ 2500.00MHz
                  │  bench.old  │              bench.new              │
                  │   sec/op    │   sec/op     vs base                │
Hash8Bytes/New      674.0n ± 0%   433.3n ± 0%  -35.71% (p=0.000 n=20)
Hash8Bytes/Sum224   695.3n ± 0%   445.8n ± 0%  -35.88% (p=0.000 n=20)
Hash8Bytes/Sum256   676.0n ± 0%   475.5n ± 0%  -29.66% (p=0.000 n=20)
Hash1K/New          8.982µ ± 0%   4.963µ ± 0%  -44.74% (p=0.000 n=20)
Hash1K/Sum224       8.999µ ± 0%   4.975µ ± 0%  -44.72% (p=0.000 n=20)
Hash1K/Sum256       8.979µ ± 0%   5.005µ ± 0%  -44.26% (p=0.000 n=20)
Hash8K/New          66.97µ ± 0%   36.78µ ± 0%  -45.08% (p=0.000 n=20)
Hash8K/Sum224       66.99µ ± 0%   36.79µ ± 0%  -45.09% (p=0.000 n=20)
Hash8K/Sum256       66.97µ ± 0%   36.82µ ± 0%  -45.03% (p=0.000 n=20)
geomean             7.431µ        4.357µ       -41.37%

                  │  bench.old   │              bench.new               │
                  │     B/s      │     B/s       vs base                │
Hash8Bytes/New      11.32Mi ± 0%   17.60Mi ± 0%  +55.52% (p=0.000 n=20)
Hash8Bytes/Sum224   10.98Mi ± 0%   17.11Mi ± 0%  +55.86% (p=0.000 n=20)
Hash8Bytes/Sum256   11.28Mi ± 0%   16.04Mi ± 0%  +42.18% (p=0.000 n=20)
Hash1K/New          108.7Mi ± 0%   196.8Mi ± 0%  +80.98% (p=0.000 n=20)
Hash1K/Sum224       108.5Mi ± 0%   196.3Mi ± 0%  +80.89% (p=0.000 n=20)
Hash1K/Sum256       108.8Mi ± 0%   195.1Mi ± 0%  +79.42% (p=0.000 n=20)
Hash8K/New          116.7Mi ± 0%   212.4Mi ± 0%  +82.09% (p=0.000 n=20)
Hash8K/Sum224       116.6Mi ± 0%   212.4Mi ± 0%  +82.09% (p=0.000 n=20)
Hash8K/Sum256       116.7Mi ± 0%   212.2Mi ± 0%  +81.90% (p=0.000 n=20)
geomean             52.15Mi        88.95Mi       +70.55%

goos: linux
goarch: loong64
pkg: crypto/sha256
cpu: Loongson-3A5000 @ 2500.00MHz
                  │  bench.old   │              bench.new              │
                  │    sec/op    │   sec/op     vs base                │
Hash8Bytes/New       855.9n ± 0%   521.1n ± 0%  -39.12% (p=0.000 n=20)
Hash8Bytes/Sum224    875.2n ± 0%   532.7n ± 1%  -39.13% (p=0.000 n=20)
Hash8Bytes/Sum256    909.4n ± 0%   553.9n ± 0%  -39.09% (p=0.000 n=20)
Hash1K/New          11.304µ ± 0%   5.684µ ± 0%  -49.72% (p=0.000 n=20)
Hash1K/Sum224       11.323µ ± 0%   5.690µ ± 0%  -49.75% (p=0.000 n=20)
Hash1K/Sum256       11.341µ ± 0%   5.714µ ± 0%  -49.62% (p=0.000 n=20)
Hash8K/New           84.26µ ± 0%   41.97µ ± 0%  -50.19% (p=0.000 n=20)
Hash8K/Sum224        84.27µ ± 0%   41.99µ ± 0%  -50.18% (p=0.000 n=20)
Hash8K/Sum256        84.32µ ± 0%   42.01µ ± 0%  -50.18% (p=0.000 n=20)
geomean              9.434µ        5.041µ       -46.56%

                  │  bench.old   │               bench.new                │
                  │     B/s      │      B/s       vs base                 │
Hash8Bytes/New      8.917Mi ± 0%   14.639Mi ± 0%   +64.17% (p=0.000 n=20)
Hash8Bytes/Sum224   8.717Mi ± 0%   14.319Mi ± 1%   +64.28% (p=0.000 n=20)
Hash8Bytes/Sum256   8.392Mi ± 0%   13.771Mi ± 0%   +64.09% (p=0.000 n=20)
Hash1K/New          86.39Mi ± 0%   171.81Mi ± 0%   +98.89% (p=0.000 n=20)
Hash1K/Sum224       86.25Mi ± 0%   171.64Mi ± 0%   +99.00% (p=0.000 n=20)
Hash1K/Sum256       86.11Mi ± 0%   170.92Mi ± 0%   +98.49% (p=0.000 n=20)
Hash8K/New          92.72Mi ± 0%   186.13Mi ± 0%  +100.75% (p=0.000 n=20)
Hash8K/Sum224       92.71Mi ± 0%   186.07Mi ± 0%  +100.71% (p=0.000 n=20)
Hash8K/Sum256       92.65Mi ± 0%   185.99Mi ± 0%  +100.74% (p=0.000 n=20)
geomean             41.08Mi         76.87Mi        +87.12%

Change-Id: Ib41d19d136b8593339af94a822942c102238891b
Reviewed-on: https://go-review.googlesource.com/c/go/+/590155
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 months agocrypto/sha512: implement sha512block in hardware on loong64
Xiaolin Zhao [Tue, 4 Jun 2024 03:21:16 +0000 (11:21 +0800)]
crypto/sha512: implement sha512block in hardware on loong64

goos: linux
goarch: loong64
pkg: crypto/sha512
cpu: Loongson-3A6000 @ 2500.00MHz
                  │  bench.old   │              bench.new              │
                  │    sec/op    │   sec/op     vs base                │
Hash8Bytes/New       942.3n ± 0%   627.5n ± 0%  -33.41% (p=0.000 n=20)
Hash8Bytes/Sum384    951.3n ± 0%   661.1n ± 0%  -30.51% (p=0.000 n=20)
Hash8Bytes/Sum512   1032.0n ± 0%   631.9n ± 0%  -38.77% (p=0.000 n=20)
Hash1K/New           6.355µ ± 0%   3.285µ ± 0%  -48.31% (p=0.000 n=20)
Hash1K/Sum384        6.333µ ± 0%   3.320µ ± 0%  -47.58% (p=0.000 n=20)
Hash1K/Sum512        6.416µ ± 0%   3.293µ ± 0%  -48.68% (p=0.000 n=20)
Hash8K/New           43.91µ ± 0%   22.01µ ± 0%  -49.89% (p=0.000 n=20)
Hash8K/Sum384        43.77µ ± 0%   22.05µ ± 0%  -49.61% (p=0.000 n=20)
Hash8K/Sum512        43.87µ ± 0%   22.01µ ± 0%  -49.83% (p=0.000 n=20)
geomean              6.480µ        3.596µ       -44.50%

                  │  bench.old   │               bench.new               │
                  │     B/s      │      B/s       vs base                │
Hash8Bytes/New      8.097Mi ± 0%   12.159Mi ± 0%  +50.18% (p=0.000 n=20)
Hash8Bytes/Sum384   8.020Mi ± 0%   11.539Mi ± 0%  +43.88% (p=0.000 n=20)
Hash8Bytes/Sum512   7.391Mi ± 0%   12.074Mi ± 0%  +63.35% (p=0.000 n=20)
Hash1K/New          153.7Mi ± 0%    297.2Mi ± 0%  +93.43% (p=0.000 n=20)
Hash1K/Sum384       154.2Mi ± 0%    294.1Mi ± 0%  +90.74% (p=0.000 n=20)
Hash1K/Sum512       152.2Mi ± 0%    296.6Mi ± 0%  +94.84% (p=0.000 n=20)
Hash8K/New          177.9Mi ± 0%    355.0Mi ± 0%  +99.55% (p=0.000 n=20)
Hash8K/Sum384       178.5Mi ± 0%    354.3Mi ± 0%  +98.46% (p=0.000 n=20)
Hash8K/Sum512       178.1Mi ± 0%    355.0Mi ± 0%  +99.34% (p=0.000 n=20)
geomean             59.81Mi         107.8Mi       +80.19%

goos: linux
goarch: loong64
pkg: crypto/sha512
cpu: Loongson-3A5000 @ 2500.00MHz
                  │  bench.old   │              bench.new              │
                  │    sec/op    │   sec/op     vs base                │
Hash8Bytes/New      1224.0n ± 0%   730.1n ± 0%  -40.36% (p=0.000 n=20)
Hash8Bytes/Sum384   1265.0n ± 0%   763.2n ± 0%  -39.67% (p=0.000 n=20)
Hash8Bytes/Sum512   1257.0n ± 0%   753.5n ± 0%  -40.06% (p=0.000 n=20)
Hash1K/New           8.218µ ± 0%   3.785µ ± 0%  -53.94% (p=0.000 n=20)
Hash1K/Sum384        8.248µ ± 0%   3.813µ ± 0%  -53.77% (p=0.000 n=20)
Hash1K/Sum512        8.235µ ± 0%   3.807µ ± 0%  -53.77% (p=0.000 n=20)
Hash8K/New           56.83µ ± 0%   25.37µ ± 0%  -55.35% (p=0.000 n=20)
Hash8K/Sum384        56.85µ ± 0%   25.39µ ± 0%  -55.34% (p=0.000 n=20)
Hash8K/Sum512        56.84µ ± 0%   25.38µ ± 0%  -55.36% (p=0.000 n=20)
geomean              8.360µ        4.165µ       -50.18%

                  │  bench.old   │               bench.new                │
                  │     B/s      │      B/s       vs base                 │
Hash8Bytes/New      6.232Mi ± 0%   10.452Mi ± 0%   +67.71% (p=0.000 n=20)
Hash8Bytes/Sum384   6.027Mi ± 0%    9.995Mi ± 0%   +65.82% (p=0.000 n=20)
Hash8Bytes/Sum512   6.065Mi ± 0%   10.123Mi ± 0%   +66.90% (p=0.000 n=20)
Hash1K/New          118.8Mi ± 0%    258.0Mi ± 0%  +117.12% (p=0.000 n=20)
Hash1K/Sum384       118.4Mi ± 0%    256.1Mi ± 0%  +116.29% (p=0.000 n=20)
Hash1K/Sum512       118.6Mi ± 0%    256.5Mi ± 0%  +116.30% (p=0.000 n=20)
Hash8K/New          137.5Mi ± 0%    307.9Mi ± 0%  +123.96% (p=0.000 n=20)
Hash8K/Sum384       137.4Mi ± 0%    307.8Mi ± 0%  +123.93% (p=0.000 n=20)
Hash8K/Sum512       137.4Mi ± 0%    307.9Mi ± 0%  +124.01% (p=0.000 n=20)
geomean             46.35Mi         93.05Mi       +100.76%

Change-Id: I0d764df16872598b8d2fd92d7253cf3fdbfdfdf2
Reviewed-on: https://go-review.googlesource.com/c/go/+/590156
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
7 months agoos: don't fail TestGetwdDeepWithPWDSet if TMPDIR has a symlink
Ian Lance Taylor [Wed, 4 Sep 2024 22:57:51 +0000 (15:57 -0700)]
os: don't fail TestGetwdDeepWithPWDSet if TMPDIR has a symlink

When testing with PWD set, it's possible for the stat of PWD to fail
with ENAMETOOLONG, and for syscall.Getwd to fail for the same reason.
If PWD contains symlinks, the fallback code won't know about them.
If Getwd returns the same result as PWD with resolved symlinks,
the test should not fail.

Change-Id: I39587ddb826d4e18339e185aad0cdd60167b1079
Reviewed-on: https://go-review.googlesource.com/c/go/+/610759
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tim King <taking@google.com>
7 months agocmd/link/internal/ld: rm os.Getwd from elf_test
Kir Kolyshkin [Wed, 4 Sep 2024 03:00:56 +0000 (20:00 -0700)]
cmd/link/internal/ld: rm os.Getwd from elf_test

When specifying the package to build, a relative path is sufficient.

Change-Id: I1ae08065b5cd77ec25be42dc1e664720a07baa62
Reviewed-on: https://go-review.googlesource.com/c/go/+/610039
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
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 months agocmd/link/internal/ld: rm os.Getwd from dwarf_test
Kir Kolyshkin [Wed, 4 Sep 2024 02:46:46 +0000 (19:46 -0700)]
cmd/link/internal/ld: rm os.Getwd from dwarf_test

Calls to os.Getwd were needed to set the cwd for go build to an absolute
path. Since CL 401340 os/exec takes care of setting PWD to a
filepath.Abs(cmd.Dir), so it looks like an absolute path is not
really required.

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

7 months agovendor/golang.org/x/tools: update to v0.24.1-0.20240904143311-70f56264139c
Alan Donovan [Wed, 4 Sep 2024 16:24:55 +0000 (12:24 -0400)]
vendor/golang.org/x/tools: update to v0.24.1-0.20240904143311-70f56264139c

Among other things, this should fix a regression in printf
whereby materialized aliases caused "any" and "interface{}"
in printf signatures not to be recognized as identical.

It also updates ureader.go used by vendored x/tools during
some tests, including cmd/internal/moddeps.TestAllDependencies.
This test uses golang.org/x/tools/cmd/bundle which uses x/reader.

Fixes #68796

Change-Id: I9f0711e66a5c4daaffe695c515aea3b8fb3d01e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/610736
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 months agocrypto/internal/nistec: Avo port of p256_asm_amd64.s
Garrett Bodley [Sun, 21 Jul 2024 00:23:05 +0000 (20:23 -0400)]
crypto/internal/nistec: Avo port of p256_asm_amd64.s

This implementation utilizes the same registers found in the reference
implementation, aiming to produce a minimal semantic diff between the
Avo-generated output and the original hand-written assembly.

To verify the Avo implementation, the reference and Avo-generated
assembly files are fed to `go tool asm`, capturing the debug output into
corresponding temp files. The debug output contains supplementary
metadata (line numbers, instruction offsets, and source file references)
that must be removed in order to obtain a semantic diff of the two
files. This is accomplished via a small utility script written in awk.

The reference assembly file does not specify a frame size for a number
of the defined assembly functions. Avo automatically infers the frame
size when generating the TEXT directive, leading to a diff on those
lines.

Commands used to verify Avo output:

GOROOT=$(go env GOROOT)
ASM_PATH="src/crypto/internal/nistec/p256_asm_amd64.s"
REFERENCE="54fe0fd43fcf8609666c16ae6d15ed92873b1564"

go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
  <(git cat-file -p "$REFERENCE:$ASM_PATH") \
  > /tmp/reference.s

go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
  "$ASM_PATH" \
  > /tmp/avo.s

normalize(){
  awk '{
    $1=$2=$3="";
    print substr($0,4)
  }'
}

diff <(normalize < /tmp/reference.s) <(normalize < /tmp/avo.s)

1c1
< TEXT <unlinkable>.p256OrdLittleToBig(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.p256OrdLittleToBig(SB), NOSPLIT, $0-16
3c3
< TEXT <unlinkable>.p256OrdBigToLittle(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.p256OrdBigToLittle(SB), NOSPLIT, $0-16
5c5
< TEXT <unlinkable>.p256LittleToBig(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.p256LittleToBig(SB), NOSPLIT, $0-16
7c7
< TEXT <unlinkable>.p256BigToLittle(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.p256BigToLittle(SB), NOSPLIT, $0-16
23c23
< TEXT <unlinkable>.p256MovCond(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.p256MovCond(SB), NOSPLIT, $0-32
74c74
< TEXT <unlinkable>.p256NegCond(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.p256NegCond(SB), NOSPLIT, $0-16
99c99
< TEXT <unlinkable>.p256Sqr(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.p256Sqr(SB), NOSPLIT, $0-24
234c234
< TEXT <unlinkable>.p256Mul(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.p256Mul(SB), NOSPLIT, $0-24
401c401
< TEXT <unlinkable>.p256FromMont(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.p256FromMont(SB), NOSPLIT, $0-16
465c465
< TEXT <unlinkable>.p256Select(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.p256Select(SB), NOSPLIT, $0-24
513c513
< TEXT <unlinkable>.p256SelectAffine(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.p256SelectAffine(SB), NOSPLIT, $0-24
566c566
< TEXT <unlinkable>.p256OrdMul(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.p256OrdMul(SB), NOSPLIT, $0-24
806c806
< TEXT <unlinkable>.p256OrdSqr(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.p256OrdSqr(SB), NOSPLIT, $0-24

Change-Id: I610b097c573b9d9018f0e26bc2afde5edb3f954b
Reviewed-on: https://go-review.googlesource.com/c/go/+/599875
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: Roland Shoemaker <roland@golang.org>
7 months agocrypto/aes: Avo port of asm_amd64.s
Garrett Bodley [Tue, 23 Jul 2024 03:39:44 +0000 (23:39 -0400)]
crypto/aes: Avo port of asm_amd64.s

This implementation utilizes the same registers found in the reference
implementation, aiming to produce a minimal semantic diff between the
Avo-generated output and the original hand-written assembly.

To verify the Avo implementation, the reference and Avo-generated
assembly files are fed to `go tool asm`, capturing the debug output into
corresponding temp files. The debug output contains supplementary
metadata (line numbers, instruction offsets, and source file references)
that must be removed in order to obtain a semantic diff of the two
files. This is accomplished via a small utility script written in awk.

The reference assembly file does not specify a frame size for some of
the defined assembly functions. Avo automatically infers the frame size
when generating TEXT directives, leading to a diff on those lines.

Commands used to verify Avo output:

GOROOT=$(go env GOROOT)
ASM_PATH="src/crypto/aes/asm_amd64.s"
REFERENCE="54fe0fd43fcf8609666c16ae6d15ed92873b1564"

go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
  <(git cat-file -p "$REFERENCE:$ASM_PATH") \
  > /tmp/reference.s

go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
  "$ASM_PATH" \
  > /tmp/avo.s

normalize(){
  awk '{
    $1=$2=$3="";
    print substr($0,4)
  }'
}

diff <(normalize < /tmp/reference.s) <(normalize < /tmp/avo.s)

1c1
< TEXT <unlinkable>.encryptBlockAsm(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.encryptBlockAsm(SB), NOSPLIT, $0-32
45c45
< TEXT <unlinkable>.decryptBlockAsm(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.decryptBlockAsm(SB), NOSPLIT, $0-32
89c89
< TEXT <unlinkable>.expandKeyAsm(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.expandKeyAsm(SB), NOSPLIT, $0-32

Change-Id: If647584df4137146d355f91ac0f6a8285d07c932
Reviewed-on: https://go-review.googlesource.com/c/go/+/600375
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
7 months agocrypto/aes: Avo port of gcm_amd64.s
Garrett Bodley [Sat, 27 Jul 2024 03:17:02 +0000 (23:17 -0400)]
crypto/aes: Avo port of gcm_amd64.s

This implementation utilizes the same registers found in the reference
implementation, aiming to produce a minimal semantic diff between the
Avo-generated output and the original hand-written assembly.

To verify the Avo implementation, the reference and Avo-generated
assembly files are fed to `go tool asm`, capturing the debug output into
corresponding temp files. The debug output contains supplementary
metadata (line numbers, instruction offsets, and source file references)
that must be removed in order to obtain a semantic diff of the two
files. This is accomplished via a small utility script written in awk.

The reference assembly file does not specify a frame size for some of
the defined assembly functions. Avo automatically infers the frame size
when generating TEXT directives, leading to a diff on those lines. Some
metadata not included in the reference assembly has also been added,
which leads to a diff in the lines where that parameter symbol is
referenced.

Commands used to verify Avo output:

GOROOT=$(go env GOROOT)
ASM_PATH="src/crypto/aes/gcm_amd64.s"
REFERENCE="54fe0fd43fcf8609666c16ae6d15ed92873b1564"

go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
  <(git cat-file -p "$REFERENCE:$ASM_PATH") \
  > /tmp/reference.s

go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
  "$ASM_PATH" \
  > /tmp/avo.s

normalize(){
  awk '{
    $1=$2=$3="";
    print substr($0,4)
  }'
}

diff <(normalize < /tmp/reference.s) <(normalize < /tmp/avo.s)

1c1
< TEXT <unlinkable>.gcmAesFinish(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.gcmAesFinish(SB), NOSPLIT, $0-40
44c44
< TEXT <unlinkable>.gcmAesInit(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.gcmAesInit(SB), NOSPLIT, $0-32
131c131
< TEXT <unlinkable>.gcmAesData(SB), NOSPLIT, $0
---
> TEXT <unlinkable>.gcmAesData(SB), NOSPLIT, $0-40
325c325
< MOVQ dst+8(FP), DX
---
> MOVQ dst_base+8(FP), DX
1207c1207
< MOVQ dst+8(FP), SI
---
> MOVQ dst_base+8(FP), SI

Change-Id: Iad8f8c6ea5d50ac093c8535adc9d23fbf2612fc2
Reviewed-on: https://go-review.googlesource.com/c/go/+/601462
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
7 months agocrypto/md5: Avo port of md5block_amd64.s
Garrett Bodley [Sun, 21 Jul 2024 05:00:56 +0000 (01:00 -0400)]
crypto/md5: Avo port of md5block_amd64.s

This implementation utilizes the same registers found in the reference
implementation, aiming to produce a minimal semantic diff between the
Avo-generated output and the original hand-written assembly.

To verify the Avo implementation, the reference and Avo-generated
assembly files are fed to `go tool asm`, capturing the debug output into
corresponding temp files. The debug output contains supplementary
metadata (line numbers, instruction offsets, and source file references)
that must be removed in order to obtain a semantic diff of the two
files. This is accomplished via a small utility script written in awk.

Metadata not found in the reference assembly file has been added to one
parameter symbol, resulting in a single line diff.

Commands used to verify Avo output:

GOROOT=$(go env GOROOT)
ASM_PATH="src/crypto/md5/md5block_amd64.s"
REFERENCE="54fe0fd43fcf8609666c16ae6d15ed92873b1564"

go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
  <(git cat-file -p "$REFERENCE:$ASM_PATH") \
  > /tmp/reference.s

go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
  "$ASM_PATH" \
  > /tmp/avo.s

normalize(){
  awk '{
    $1=$2=$3="";
    print substr($0,4)
  }'
}

diff <(normalize < /tmp/reference.s) <(normalize < /tmp/avo.s)

3c3
< MOVQ p+8(FP), SI
---
> MOVQ p_base+8(FP), SI

Change-Id: Ifecc84fd0f5a39a88350e6eaffb45ed3fdacf2fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/599935
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>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
7 months agocrypto/sha512: Avo port of sha512block_amd64.s
Garrett Bodley [Thu, 18 Jul 2024 00:00:53 +0000 (20:00 -0400)]
crypto/sha512: Avo port of sha512block_amd64.s

This implementation utilizes the same registers found in the reference
implementation, aiming to produce a minimal semantic diff between the
Avo-generated output and the original hand-written assembly.

To verify the Avo implementation, the reference and Avo-generated
assembly files are fed to `go tool asm`, capturing the debug output into
corresponding temp files. The debug output contains supplementary
metadata (line numbers, instruction offsets, and source file references)
that must be removed in order to obtain a semantic diff of the two
files. This is accomplished via a small utility script written in awk.

Commands used to verify Avo output:

GOROOT=$(go env GOROOT)
ASM_PATH="src/crypto/sha512/sha512block_amd64.s"
REFERENCE="54fe0fd43fcf8609666c16ae6d15ed92873b1564"

go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
  <(git cat-file -p "$REFERENCE:$ASM_PATH") \
  > /tmp/reference.s

go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
  "$ASM_PATH" \
  > /tmp/avo.s

normalize(){
  awk '{
    $1=$2=$3="";
    print substr($0,4)
  }'
}

diff <(normalize < /tmp/reference.s) <(normalize < /tmp/avo.s)

Change-Id: I172f0cb97252635c657efe82d1b547e6b6f40ebb
Reviewed-on: https://go-review.googlesource.com/c/go/+/598958
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 months agocrypto/sha1: Avo port of sha1block_amd64.s
Garrett Bodley [Wed, 17 Jul 2024 02:44:17 +0000 (22:44 -0400)]
crypto/sha1: Avo port of sha1block_amd64.s

This implementation utilizes the same registers found in the reference
implementation, aiming to produce a minimal semantic diff between the
Avo-generated output and the original hand-written assembly.

To verify the Avo implementation, the reference and Avo-generated
assembly files are fed to `go tool asm`, capturing the debug output into
corresponding temp files. The debug output contains supplementary
metadata (line numbers, instruction offsets, and source file references)
that must be removed in order to obtain a semantic diff of the two
files. This is accomplished via a small utility script written in awk.

Commands used to verify Avo output:

GOROOT=$(go env GOROOT)
ASM_PATH="src/crypto/sha1/sha1block_amd64.s"
REFERENCE="54fe0fd43fcf8609666c16ae6d15ed92873b1564"

go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
  <(git cat-file -p "$REFERENCE:$ASM_PATH") \
  > /tmp/reference.s

go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
  "$ASM_PATH" \
  > /tmp/avo.s

normalize(){
  awk '{
    $1=$2=$3="";
    print substr($0,4)
  }'
}

diff <(normalize < /tmp/reference.s) <(normalize < /tmp/avo.s)

1273c1273
< MOVQ $K_XMM_AR<>(SB), R8
---
> LEAQ K_XMM_AR<>(SB), R8

Change-Id: I39168fadb01baa9a96bc2b432fc94b492d036ce4
Reviewed-on: https://go-review.googlesource.com/c/go/+/598795
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: Roland Shoemaker <roland@golang.org>
7 months agocrypto/sha256: Avo port of sha256block_amd64.s
Garrett Bodley [Fri, 28 Jun 2024 04:46:32 +0000 (00:46 -0400)]
crypto/sha256: Avo port of sha256block_amd64.s

This implementation utilizes the same registers found in the reference
implementation, aiming to produce a minimal semantic diff between the
Avo-generated output and the original hand-written assembly.

To verify the Avo implementation, the reference and Avo-generated
assembly files are fed to `go tool asm`, capturing the debug output into
corresponding temp files. The debug output contains supplementary
metadata (line numbers, instruction offsets, and source file references)
that must be removed in order to obtain a semantic diff of the two
files. This is accomplished via a small utility script written in awk.

Commands used to verify Avo output:

GOROOT=$(go env GOROOT)
ASM_PATH="src/crypto/sha256/sha256block_amd64.s"
REFERENCE="54fe0fd43fcf8609666c16ae6d15ed92873b1564"

go tool asm -o /dev/null -I "$GOROOT"/src/runtime -debug \
  <(git cat-file -p "$REFERENCE:$ASM_PATH") \
  > /tmp/reference.s

go tool asm -o /dev/null -I $GOROOT/src/runtime -debug \
  "$ASM_PATH" \
  > /tmp/avo.s

normalize(){
  awk '{
    $1=$2=$3="";
    print substr($0,4)
  }'
}

diff <(normalize < /tmp/reference.s) <(normalize < /tmp/avo.s)

3513c3513
< MOVQ $K256<>(SB), BP
---
> LEAQ K256<>(SB), BP
4572c4572
< MOVQ $K256<>(SB), BP
---
> LEAQ K256<>(SB), BP

Change-Id: I637c01d746ca775b8a09f874f7925ffc3b4965ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/595559
Reviewed-by: Russell Webb <russell.webb@protonmail.com>
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: Dmitri Shuralyov <dmitshur@google.com>
7 months agocmd/compile: remove NameSet.Sorted
Cuong Manh Le [Wed, 4 Sep 2024 17:38:06 +0000 (00:38 +0700)]
cmd/compile: remove NameSet.Sorted

The only usage of it was removed in CL 517617

Change-Id: If1898b7cde4f8c7ab906a2c27a01125415b463c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/610600
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 months agocmd/compile/internal/liveness: use slices.Reverse
Cuong Manh Le [Wed, 4 Sep 2024 16:57:41 +0000 (23:57 +0700)]
cmd/compile/internal/liveness: use slices.Reverse

Now that we're bootstrapping from a toolchain that has the slices
package.

Updates #64751

Change-Id: Id50d76de05e353ef06d64b47ad6400b2b7572205
Reviewed-on: https://go-review.googlesource.com/c/go/+/610775
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
7 months agocrypto/internal/boring: disable LFS64 interfaces
Roland Shoemaker [Sat, 31 Aug 2024 04:11:09 +0000 (21:11 -0700)]
crypto/internal/boring: disable LFS64 interfaces

Comment out the definition in the libcrypto I/O code which enables
the LFS64 interfaces. We don't use any of the I/O bits and pieces, and
it's outside of the FIPS module, and it fixes some breakage in certain
scenarios.

Change-Id: Ie6597813726f94e23780b77d907cc1b9ccef36f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/609976
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Russ Cox <rsc@golang.org>
7 months agocmd/link/internal/ld: simplify gobuildTestdata
Kir Kolyshkin [Wed, 4 Sep 2024 02:32:40 +0000 (19:32 -0700)]
cmd/link/internal/ld: simplify gobuildTestdata

Drop the second argument, which is is always a one-time temporary
directory, thus it can be created right here.

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

7 months agogo/parser: convert *ast.CallExpr into *ast.ParenExpr in extractName
Mateusz Poliwczak [Wed, 4 Sep 2024 16:11:06 +0000 (16:11 +0000)]
go/parser: convert *ast.CallExpr into *ast.ParenExpr in extractName

We are loosing a bit of the AST information, i believe we should
convert *ast.CallExpr into *ast.ParenExpr.

See https://github.com/golang/go/issues/69206#issuecomment-2324592744

Change-Id: I2d9ad8a3dead664a4fa9ac324e8d8a955a4d97c8
GitHub-Last-Rev: e5db56d5cafdc9a8b0ffdfe4524632fd3b6cbb12
GitHub-Pull-Request: golang/go#69209
Reviewed-on: https://go-review.googlesource.com/c/go/+/610078
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
7 months agocmd: remove notsha256 package
Cuong Manh Le [Wed, 4 Sep 2024 11:32:07 +0000 (18:32 +0700)]
cmd: remove notsha256 package

All of its usages were removed in CL 610596.

Updates #51940
Updates #64751

Change-Id: I72a0ea4bd44a2f671e032bffa1facf84822a90f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/610599
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
7 months agocmd: use 16 bytes hash when possible
Cuong Manh Le [Wed, 4 Sep 2024 11:45:17 +0000 (18:45 +0700)]
cmd: use 16 bytes hash when possible

CL 402595 changes all usages of 16 bytes hash to 32 bytes hash by using
notsha256.

However, since CL 454836, notsha256 is not necessary anymore, so this CL
reverts those changes to 16 bytes hash using cmd/internal/hash package.

Updates #51940
Updates #64751

Change-Id: Ic015468ca4a49d0c3b1fb9fdbed93fddef3c838f
Reviewed-on: https://go-review.googlesource.com/c/go/+/610598
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: 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>

7 months agocmd: use 20 bytes hash when possible
Cuong Manh Le [Wed, 4 Sep 2024 11:39:52 +0000 (18:39 +0700)]
cmd: use 20 bytes hash when possible

CL 402595 changes all usages of 20 bytes hash to 32 bytes hash by using
notsha256.

However, since CL 454836, notsha256 is not necessary anymore, so this CL
reverts those changes to 20 bytes hash using cmd/internal/hash package.

Updates #51940
Updates #64751

Change-Id: Icb08d5a0d8032a3c4d050ff7b2298d31c483b88b
Reviewed-on: https://go-review.googlesource.com/c/go/+/610597
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
7 months agocmd: do not use notsha256
Cuong Manh Le [Wed, 4 Sep 2024 11:30:35 +0000 (18:30 +0700)]
cmd: do not use notsha256

CL 402595 used notsha256 to prevent the compiler from depending on
cgo-based implementations of sha1 and sha256.

However, since CL 454836, cmd is built with CGO_ENABLED=0, which
will disable boringcrypto. Thus all usages of notsha256 is not necessary
anymore.

Updates #51940
Updates #64751

Change-Id: I503090f7a2efb5723e8a79523b143dc7cdb4edd0
Reviewed-on: https://go-review.googlesource.com/c/go/+/610596
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
7 months agocmd/internal: add hash package
Cuong Manh Le [Wed, 4 Sep 2024 11:08:30 +0000 (18:08 +0700)]
cmd/internal: add hash package

To be used in compiler toolchain instead of notsha256.

Change-Id: Iceeacb6df7dfa7111ec98f070eba8e27a4ddbe8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/610595
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
7 months agoall: fix printf(var) mistakes detected by latest printf checker
Alan Donovan [Wed, 4 Sep 2024 17:14:17 +0000 (13:14 -0400)]
all: fix printf(var) mistakes detected by latest printf checker

These will cause build failures once we vendor x/tools.

In once case I renamed a function err to errf to indicate
that it is printf-like.

Updates golang/go#68796

Change-Id: I04d57b34ee5362f530554b7e8b817f70a9088d12
Reviewed-on: https://go-review.googlesource.com/c/go/+/610739
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>

7 months agounique: don't retain uncloned input as key
Michael Anthony Knyszek [Wed, 4 Sep 2024 16:46:33 +0000 (16:46 +0000)]
unique: don't retain uncloned input as key

Currently the unique package tries to clone strings that get stored in
its internal map to avoid retaining large strings.

However, this falls over entirely due to the fact that the original
string is *still* stored in the map as a key. Whoops. Fix this by
storing the cloned value in the map instead.

This change also adds a test which fails without this change.

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

7 months agointernal/weak: shade pointer in weak-to-strong conversion
Michael Anthony Knyszek [Wed, 4 Sep 2024 03:08:26 +0000 (03:08 +0000)]
internal/weak: shade pointer in weak-to-strong conversion

There's a bug in the weak-to-strong conversion in that creating the
*only* strong pointer to some weakly-held object during the mark phase
may result in that object not being properly marked.

The exact mechanism for this is that the new strong pointer will always
point to a white object (because it was only weakly referenced up until
this point) and it can then be stored in a blackened stack, hiding it
from the garbage collector.

This "hide a white pointer in the stack" problem is pretty much exactly
what the Yuasa part of the hybrid write barrier is trying to catch, so
we need to do the same thing the write barrier would do: shade the
pointer.

Added a test and confirmed that it fails with high probability if the
pointer shading is missing.

Fixes #69210.

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

7 months agoruntime: size maps.Clone destination bucket array safely
Keith Randall [Thu, 29 Aug 2024 22:08:33 +0000 (15:08 -0700)]
runtime: size maps.Clone destination bucket array safely

In rare situations, like during same-sized grows, the source map for
maps.Clone may be overloaded (has more than 6.5 entries per
bucket). This causes the runtime to allocate a larger bucket array for
the destination map than for the source map. The maps.Clone code
walks off the end of the source array if it is smaller than the
destination array.

This is a pretty simple fix, ensuring that the destination bucket
array is never longer than the source bucket array. Maybe a better fix
is to make the Clone code handle shorter source arrays correctly, but
this fix is deliberately simple to reduce the risk of backporting this
fix.

Fixes #69110

Change-Id: I824c93d1db690999f25a3c43b2816fc28ace7509
Reviewed-on: https://go-review.googlesource.com/c/go/+/609757
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
7 months agocmd/internal/obj: drop NOFRAME TODO
Michael Pratt [Wed, 4 Sep 2024 14:34:40 +0000 (10:34 -0400)]
cmd/internal/obj: drop NOFRAME TODO

NOFRAME is long since implemented beyond ppc64x.

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

7 months agocrypto/cipher: update documentation for aead Open
komuw [Wed, 28 Aug 2024 14:12:31 +0000 (14:12 +0000)]
crypto/cipher: update documentation for aead Open

The remaining capacity of dst should not overlap ciphertext.
The previous wording was probably a copy paste mistake from aead Seal.

Change-Id: Iaa28073f9ea90cbe2032c0c1149a78feab6c9239
GitHub-Last-Rev: fb54bc84c471648eb9d4c56492a8ff6d7db69b2b
GitHub-Pull-Request: golang/go#69108
Reviewed-on: https://go-review.googlesource.com/c/go/+/609075
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

7 months agomath: add large exact float rounding tests
Meng Zhuo [Wed, 24 Jul 2024 06:49:18 +0000 (14:49 +0800)]
math: add large exact float rounding tests

This CL adds trunc,ceil,floor tests for large exact float.

Change-Id: Ib7ffec1d2d50d2ac955398a3dd0fd06d494fcf4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/601095
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
7 months agogo/printer: do not panic on *ast.ParenExpr in combinesWithName
Mateusz Poliwczak [Mon, 2 Sep 2024 12:37:51 +0000 (12:37 +0000)]
go/printer: do not panic on *ast.ParenExpr in combinesWithName

Fixes #69206

Change-Id: I1b5a664c22d5739e2c6748d562591f57345b536e
GitHub-Last-Rev: 1798e2c65b3c2c0c1ef674b000dce2636c834783
GitHub-Pull-Request: golang/go#69208
Reviewed-on: https://go-review.googlesource.com/c/go/+/610115
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
7 months agoencoding/xml: allow ]]> in attribute values
Demi Marie Obenour [Tue, 3 Sep 2024 01:33:29 +0000 (01:33 +0000)]
encoding/xml: allow ]]> in attribute values

This is permitted by the XML specification.

Fixes #68387

Change-Id: Ic4ab5520a08a5a997f1c3d13c6d5f80c0521e45c
GitHub-Last-Rev: 6d2ac307bbd0ba7d50830ad8b879c00cc3a7242b
GitHub-Pull-Request: golang/go#69197
Reviewed-on: https://go-review.googlesource.com/c/go/+/610056
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
7 months agoruntime: update comment for golinkname
Wei Fu [Mon, 2 Sep 2024 02:40:39 +0000 (10:40 +0800)]
runtime: update comment for golinkname

containerd deleted unsafe, golinkname usage from whole project in
the https://github.com/containerd/containerd/pull/10611. This patch is
to delete contained name in the comment.

Change-Id: Ide55ad9c65b3b622650a0b5813a7817306e87d3f
Reviewed-on: https://go-review.googlesource.com/c/go/+/609996
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
7 months agoos/user: User.GroupIds shouldn't error on users with no groups
qmuntal [Mon, 19 Aug 2024 13:14:23 +0000 (15:14 +0200)]
os/user: User.GroupIds shouldn't error on users with no groups

On Windows, the User.GroupIds currently errors out if the user has no
groups. This is incorrect, as the user may not be a member of any groups
as demonstrated by the new TestGroupIdsTestUser test.

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-arm64
Change-Id: I436aa6214f2b98ef98dfb6064caec3d682b3f3d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/606675
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
7 months agoos: treat Getwd result of ENOMEM the same as ENAMETOOLONG
Ian Lance Taylor [Tue, 3 Sep 2024 22:13:01 +0000 (15:13 -0700)]
os: treat Getwd result of ENOMEM the same as ENAMETOOLONG

We can see ENOMEM on FreeBSD.

Also don't fail the test if we get an EPERM error when reading
all the way up the tree; on Android we get that, perhaps because
the root directory is unreadable.

Also accept an EFAULT from a stat of a long name on Dragonfly,
which we see on the builders.

Change-Id: If37e6bf414b7b568c9a06130f71e79af153bfb75
Reviewed-on: https://go-review.googlesource.com/c/go/+/610415
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
7 months agoall: use t.Chdir in tests
Kir Kolyshkin [Fri, 8 Sep 2023 00:21:16 +0000 (17:21 -0700)]
all: use t.Chdir in tests

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

7 months agocrypto/internal/bigmod: provide assembly addMulVVW* for loong64
Xiaolin Zhao [Wed, 19 Jun 2024 07:09:21 +0000 (15:09 +0800)]
crypto/internal/bigmod: provide assembly addMulVVW* for loong64

goos: linux
goarch: loong64
pkg: crypto/internal/bigmod
cpu: Loongson-3A6000 @ 2500.00MHz
               │  bench.old   │              bench.new              │
               │    sec/op    │   sec/op     vs base                │
ModAdd            159.5n ± 0%   159.8n ± 0%   +0.19% (p=0.000 n=20)
ModSub            161.5n ± 0%   161.7n ± 0%   +0.12% (p=0.038 n=20)
MontgomeryRepr    4.126µ ± 0%   2.932µ ± 0%  -28.94% (p=0.000 n=20)
MontgomeryMul     4.144µ ± 0%   2.930µ ± 0%  -29.30% (p=0.000 n=20)
ModMul            8.331µ ± 0%   5.956µ ± 0%  -28.51% (p=0.000 n=20)
ExpBig            11.65m ± 0%   11.64m ± 0%   -0.04% (p=0.000 n=20)
Exp              11.015m ± 0%   7.860m ± 0%  -28.65% (p=0.000 n=20)
geomean           17.34µ        14.28µ       -17.64%

goos: linux
goarch: loong64
pkg: crypto/internal/bigmod
cpu: Loongson-3A5000 @ 2500.00MHz
               │  bench.old   │              bench.new              │
               │    sec/op    │   sec/op     vs base                │
ModAdd            211.3n ± 0%   213.9n ± 0%   +1.23% (p=0.000 n=20)
ModSub            210.6n ± 0%   207.2n ± 0%   -1.61% (p=0.000 n=20)
MontgomeryRepr    5.442µ ± 0%   3.825µ ± 0%  -29.71% (p=0.000 n=20)
MontgomeryMul     5.379µ ± 0%   4.011µ ± 0%  -25.43% (p=0.000 n=20)
ModMul           10.868µ ± 0%   7.859µ ± 0%  -27.69% (p=0.000 n=20)
ExpBig            14.64m ± 0%   14.63m ± 0%   -0.06% (p=0.035 n=20)
Exp               14.39m ± 0%   10.38m ± 0%  -27.86% (p=0.000 n=20)
geomean           22.57µ        18.74µ       -16.96%

Change-Id: Id6ddc9552494e2a26e1a123f38e22d18bb78fdad
Reviewed-on: https://go-review.googlesource.com/c/go/+/593595
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
8 months agocmd: use built-in clear for maps instead of range+delete
Keith Randall [Tue, 3 Sep 2024 20:53:37 +0000 (13:53 -0700)]
cmd: use built-in clear for maps instead of range+delete

Now that we're bootstrapping from a toolchain that has the clear builtin.

Update #64751

Change-Id: Ia86d96c253c9f7c66131cd02048a493047569641
Reviewed-on: https://go-review.googlesource.com/c/go/+/610237
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
8 months agocmd: use built-in min/max instead of bespoke versions
Keith Randall [Tue, 3 Sep 2024 20:29:42 +0000 (13:29 -0700)]
cmd: use built-in min/max instead of bespoke versions

Now that we're bootstrapping from a toolchain that has min/max builtins.

Update #64751

Change-Id: I63eedf3cca00f56f62ca092949cb2dc61db03361
Reviewed-on: https://go-review.googlesource.com/c/go/+/610355
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@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 months agocmd/compile: compute Negation's limits from argument's limits
Jorropo [Thu, 15 Aug 2024 02:54:46 +0000 (04:54 +0200)]
cmd/compile: compute Negation's limits from argument's limits

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

8 months agocmd/compile: compute Complement's limits from argument's limits
Jorropo [Wed, 14 Aug 2024 20:28:00 +0000 (22:28 +0200)]
cmd/compile: compute Complement's limits from argument's limits

I was not sure this was correct so I exhaustively checked all possibilities:
https://go.dev/play/p/hjmCLm4Iagz
https://go.dev/play/p/R9RuRGKwCbN

Change-Id: I85f053df825a4d77f978de42f8a1fcaf4b881def
Reviewed-on: https://go-review.googlesource.com/c/go/+/605696
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
8 months agocmd/compile: compute Trunc's limits from argument's limits
Jorropo [Wed, 14 Aug 2024 19:25:08 +0000 (21:25 +0200)]
cmd/compile: compute Trunc's limits from argument's limits

Change-Id: I419faa781db085b98ea25008ca127d0317fb34e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/605695
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
8 months agocmd/compile: propagate unsigned limits for Div and Mod if arguments are positive
Jorropo [Tue, 13 Aug 2024 16:40:44 +0000 (18:40 +0200)]
cmd/compile: propagate unsigned limits for Div and Mod if arguments are positive

I didn't implemented negative limits since prove is most useful for BCE which
should never be negative in the first place.

Change-Id: I302ee462cdc20bd4edff0618f7e49ff66fc2a007
Reviewed-on: https://go-review.googlesource.com/c/go/+/605136
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>
Reviewed-by: Cherry Mui <cherryyz@google.com>
8 months agocmd: replace many sort.Interface with slices.Sort and SortFunc
Zxilly [Tue, 3 Sep 2024 17:46:10 +0000 (17:46 +0000)]
cmd: replace many sort.Interface with slices.Sort and SortFunc

with slices there's no need to implement sort.Interface

Change-Id: I59167e78881cb1df89a71e33d738d6aeca7adb71
GitHub-Last-Rev: 507ba84453f7305b6b2bf6317292111c00c93ffe
GitHub-Pull-Request: golang/go#68724
Reviewed-on: https://go-review.googlesource.com/c/go/+/602895
Reviewed-by: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
8 months agoall: omit unnecessary 0 in slice expression
nlwkobe30 [Fri, 30 Aug 2024 19:05:07 +0000 (19:05 +0000)]
all: omit unnecessary 0 in slice expression

All changes are related to the code, except for the comments in src/regexp/syntax/parse.go and src/slices/slices.go.

Change-Id: I73c5d3c54099749b62210aa7f3182c5eb84bb6a6
GitHub-Last-Rev: 794aa9b0539811d00e1cd42be1e8d9fe9afe0281
GitHub-Pull-Request: golang/go#69170
Reviewed-on: https://go-review.googlesource.com/c/go/+/609678
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

8 months agounicode: improve SimpleFold performance by 2x for non-foldable code points
Charlie Vieth [Sat, 3 Dec 2022 03:53:26 +0000 (22:53 -0500)]
unicode: improve SimpleFold performance by 2x for non-foldable code points

Change SimpleFold to search the CaseRanges table only once when no
folding is specified for the rune (previously up to two searches could
be performed). This improves performance by 2x for runes that have no
folds or are already upper case. As a side effect this improves the
performance of To by roughly ~15%

goos: darwin
goarch: arm64
pkg: unicode
cpu: Apple M1 Max
                     │ base.10.txt  │             new.10.txt              │
                     │    sec/op    │   sec/op     vs base                │
ToUpper-10             11.860n ± 1%   9.731n ± 1%  -17.95% (p=0.000 n=10)
ToLower-10              12.31n ± 1%   10.34n ± 1%  -16.00% (p=0.000 n=10)
SimpleFold/Upper-10     19.16n ± 0%   15.98n ± 1%  -16.64% (p=0.000 n=10)
SimpleFold/Lower-10     32.41n ± 1%   17.09n ± 1%  -47.27% (p=0.000 n=10)
SimpleFold/Fold-10      8.884n ± 4%   8.856n ± 8%        ~ (p=0.700 n=10)
SimpleFold/NoFold-10    30.87n ± 0%   15.49n ± 3%  -49.84% (p=0.000 n=10)
geomean                 17.09n        12.47n       -26.99%

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

8 months agoos: treat Getwd result of EINVAL/ERANGE the same as ENAMETOOLONG
Ian Lance Taylor [Tue, 3 Sep 2024 18:28:42 +0000 (11:28 -0700)]
os: treat Getwd result of EINVAL/ERANGE the same as ENAMETOOLONG

At least Darwin and OpenBSD seem to return EINVAL if the resulting
name would be too long. Solaris seems to return ERANGE.

Fixes #69233
Fixes #69234

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

8 months agoos: improve TestExecutable
Kir Kolyshkin [Fri, 30 Aug 2024 06:37:08 +0000 (23:37 -0700)]
os: improve TestExecutable

Instead of running all tests and relying on an init function, let's
embed the child code into the test case and only run one specific test.

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

8 months agosyscall: use t.TempDir in tests
Kir Kolyshkin [Fri, 30 Aug 2024 06:22:21 +0000 (23:22 -0700)]
syscall: use t.TempDir in tests

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

8 months agosyscall: use testenv.Executable
Kir Kolyshkin [Fri, 30 Aug 2024 05:24:30 +0000 (22:24 -0700)]
syscall: use testenv.Executable

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

8 months agomath,os,os/*: use testenv.Executable
Kir Kolyshkin [Fri, 30 Aug 2024 02:51:22 +0000 (19:51 -0700)]
math,os,os/*: use testenv.Executable

As some callers don't have a testing context, modify testenv.Executable
to accept nil (similar to how testenv.GOROOT works).

Change-Id: I39112a7869933785a26b5cb6520055b3cc42b847
Reviewed-on: https://go-review.googlesource.com/c/go/+/609835
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
8 months agointernal/testenv: add missing t.Helper calls
Kir Kolyshkin [Fri, 30 Aug 2024 01:23:25 +0000 (18:23 -0700)]
internal/testenv: add missing t.Helper calls

...and move a few so they won't be called when not needed.

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

8 months agointernal/testenv: use sync.OnceValues for hasSymlink
Kir Kolyshkin [Fri, 30 Aug 2024 07:23:50 +0000 (00:23 -0700)]
internal/testenv: use sync.OnceValues for hasSymlink

On some platforms (android, wasip1) this function is called many
times which probably results in some slowdown, especially for wasip1.

Wrap it into sync.OnceValues.

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

8 months agotesting: use testenv.Executable
Kir Kolyshkin [Fri, 30 Aug 2024 02:06:57 +0000 (19:06 -0700)]
testing: use testenv.Executable

Note that this changes some nuances of how the tests work:
 - some tests had a fallback to using os.Args[0], which is removed;
 - some tests skipped (rather than failed) the test upon getting an
   error from os.Executable.

I think these changes are not practically relevant.

Change-Id: I0655add6d959a8b7e3359f94c38203aa06e8f490
Reviewed-on: https://go-review.googlesource.com/c/go/+/609303
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
8 months agocmd: use testenv.Executable helper
Kir Kolyshkin [Fri, 30 Aug 2024 02:00:00 +0000 (19:00 -0700)]
cmd: use testenv.Executable helper

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

8 months agointernal/testenv: add Executable
Kir Kolyshkin [Fri, 30 Aug 2024 01:51:10 +0000 (18:51 -0700)]
internal/testenv: add Executable

Tests commonly use code to get os.Executable value, and some cache the
resulting value.

To reduce code duplication, add a helper that does just that.

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

8 months agotesting: skip TestChdir/relative when on Windows when GOROOT and TMPDIR are on differ...
qiulaidongfeng [Sun, 1 Sep 2024 00:55:35 +0000 (00:55 +0000)]
testing: skip TestChdir/relative when on Windows when GOROOT and TMPDIR are on different drives

Fixes #69159

Change-Id: I0bbcf7075bdcf7a277a5053bcb543563a3074784
GitHub-Last-Rev: 86052a9ce32a871d6ad62f772f22852b2c6139a6
GitHub-Pull-Request: golang/go#69160
Reviewed-on: https://go-review.googlesource.com/c/go/+/609304
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

8 months agocmd/compile: compute Divu's limits from argument's limits
Jorropo [Tue, 13 Aug 2024 16:27:38 +0000 (18:27 +0200)]
cmd/compile: compute Divu's limits from argument's limits

Change-Id: Id522bde5bba627d9cdc8c3d8e907bdc168e5b13c
Reviewed-on: https://go-review.googlesource.com/c/go/+/605157
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
8 months agocmd/compile: compute Modu's maximum limits from argument's limits
Jorropo [Tue, 13 Aug 2024 15:17:06 +0000 (17:17 +0200)]
cmd/compile: compute Modu's maximum limits from argument's limits

addLocalFacts loop already ft.update which sets up limits correctly, but doing this in flowLimit help us since other values might depend on this limit.

Updates #68857

We could improve this further:
- remove mod alltogheter when we can prove a < b.
- we could do more adhoc computation in flowLimit to set umax and umin tighter

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

8 months agocmd/compile: compute OR's maximum limits from argument's limits
Jorropo [Fri, 9 Aug 2024 14:35:46 +0000 (16:35 +0200)]
cmd/compile: compute OR's maximum limits from argument's limits

Change-Id: I6902c405cab7bd573f6a721a6ca7c783713ea39a
Reviewed-on: https://go-review.googlesource.com/c/go/+/604456
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
8 months agocmd/compile: compute XOR's limits from argument's limits
Jorropo [Fri, 9 Aug 2024 13:45:39 +0000 (15:45 +0200)]
cmd/compile: compute XOR's limits from argument's limits

This help to optimize code like this:

  func f(buckets *[512]bucket, v value) {
    a, b := v.computeSomething()
    // assume a and b are proved < 512
    b := &buckets[a ^ b] // pick a random bucket
    b.store(v)
  }

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

8 months agocmd/compile: remove outdated comment in prove.go
Jorropo [Fri, 9 Aug 2024 13:22:28 +0000 (15:22 +0200)]
cmd/compile: remove outdated comment in prove.go

See the cases above all of theses are implemented (except XOR which has a blank case with comments).

Change-Id: I9e2994490dac89e86ba70c1abeb1af1cbcf032e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/604416
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
8 months agocmd/compile: compute bits.TrailingZeros*'s limits from argument's limits
Jorropo [Wed, 7 Aug 2024 20:16:00 +0000 (22:16 +0200)]
cmd/compile: compute bits.TrailingZeros*'s limits from argument's limits

y := bits.TrailingZeros(x)
if y > bits.Len(x.umax)-1 {
 then must always be true 1 << y > x.umax which is impossible
}

Change-Id: Iab4fce1c2ef828bee3a8a4a977cbadb5f9333136
Reviewed-on: https://go-review.googlesource.com/c/go/+/603996
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
8 months agocmd/compile: do constant folding for BitLen*
Jorropo [Wed, 7 Aug 2024 19:40:43 +0000 (21:40 +0200)]
cmd/compile: do constant folding for BitLen*

Change-Id: I56c27d606b55ea882f4db264fd4735b0cccdf7c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/604015
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
8 months agocmd/compile: compute bits.Len*'s limits from argument's limits
Jorropo [Wed, 7 Aug 2024 18:20:21 +0000 (20:20 +0200)]
cmd/compile: compute bits.Len*'s limits from argument's limits

Change-Id: Ie3c7e5eaba6a9a29389018625c4b784d07c6f173
Reviewed-on: https://go-review.googlesource.com/c/go/+/603537
Reviewed-by: David Chase <drchase@google.com>
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>

8 months agogo/ast: remove unused code
qiulaidongfeng [Fri, 30 Aug 2024 01:13:44 +0000 (01:13 +0000)]
go/ast: remove unused code

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

8 months agoos: Getwd: fallback to slow method on ENAMETOOLONG
Kir Kolyshkin [Tue, 27 Aug 2024 06:04:40 +0000 (23:04 -0700)]
os: Getwd: fallback to slow method on ENAMETOOLONG

As of CL 257637, all currently supported platforms have syscall.Getwd
implemented, so the code which deduces wd by traversing up to root
directory is never used and thus can be removed.

Or, as it was suggested by Ian Lance Taylor in CL 607436 review
comments, it can be reused when syscall.Getwd returns ENAMETOOLONG
(which usually happens than the current working dir is longer than
syscall.PathMax).

Let's do that. The only caveat is, such a long path returned from Getwd
couldn't be used for any file-related operations (they will probably
fail with ENAMETOOLONG).

While at it:
 - make the stat(".") code conditional, slightly improving the
   performance on Unix when $PWD is not set;
 - reuse variables dir and err;
 - use openDirNolog instead of openFileNolog to obtain a dirfd;
 - ensure the errors returned are wrapped;
 - document the new functionality;
 - add test cases (which fail before this change).

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

8 months agoencoding/json: add embedded structs to the UnmarshalTypeError's Field
j2gg0s [Tue, 27 Aug 2024 14:35:59 +0000 (14:35 +0000)]
encoding/json: add embedded structs to the UnmarshalTypeError's Field

Including embedded struct inforamtion in error message.

Fixes #68941

Change-Id: I6a6f7d506104839a9a7cf1a2c3003272f5534a79
GitHub-Last-Rev: 717f680acafd3f6509c0495f9092e028be502750
GitHub-Pull-Request: golang/go#68966
Reviewed-on: https://go-review.googlesource.com/c/go/+/606956
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
8 months agointernal/poll: check return value instead of errno for copy_file_range(2)
Andy Pan [Thu, 29 Aug 2024 05:01:12 +0000 (13:01 +0800)]
internal/poll: check return value instead of errno for copy_file_range(2)

There is one special case of (0, nil) indicating EOF where the updates
of zero to remain and written are redundant.

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

8 months agoos: update the linux minimal version and fix a typo for zero-copy
Andy Pan [Thu, 29 Aug 2024 04:58:35 +0000 (12:58 +0800)]
os: update the linux minimal version and fix a typo for zero-copy

Change-Id: Ia6a2768be0e044112831c278d88ff31ba3caa9f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/609298
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
8 months agocmd/cgo: parallelize loadDefines calls
Michael Podtserkovskii [Thu, 18 Apr 2024 11:28:13 +0000 (12:28 +0100)]
cmd/cgo: parallelize loadDefines calls

```
export CC="zig cc -target x86_64-linux"
hyperfine '../pkg/tool/darwin_arm64/cgo -objdir /tmp net/cgo_linux.go net/cgo_resnew.go net/cgo_socknew.go net/cgo_unix_cgo.go net/cgo_unix_cgo_res.go'
```

**Before**
```
  Time (mean ± sig):      1.293 s ±  0.017 s    [User: 0.472 s, System: 0.451 s]
  Range (min ... max):    1.263 s ...  1.316 s    10 runs

```

**After**
```
  Time (mean ±sig):     986.5 ms ±  22.6 ms    [User: 487.0 ms, System: 519.5 ms]
  Range (min ... max):   950.7 ms ... 1022.2 ms    10 runs

```

The version after changes is 25% faster for 5 input files (std "net" package).
I also tried to make CC artifictially slower (wrapper with sleep 0.2) and it showes same 25% performance increase.

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

8 months agonet: enable multipath TCP by default for listeners
Aperence [Wed, 28 Aug 2024 17:45:58 +0000 (17:45 +0000)]
net: enable multipath TCP by default for listeners

A previous change [1] was introduced to enable MPTCP by default
for both the clients and servers, based on the discussions [2] in
golang#56539, where MPTCP would be an opt-in for a release or
two, and then would become an opt-out.

This change was not accepted at the time because the support for
a few socket options was missing [3]. Now that this support has been
added [4] and backported to stable versions not to block MPTCP
deployment with Go, it sounds like a good time to reconsider the use
of MPTCP by default.

Instead of enabling MPTCP on both ends by default, as a first step,
it seems safer to change the default behaviour only for the server
side (Listeners). On the server side, the impact is minimal: when
clients don't request to use MPTCP, server applications will create
"plain" TCP sockets within the kernel when connections are accepted,
making the performance impact minimal. This should also ease
experiments where MPTCP is enabled by default on the client side
(Dialer).

The changes in this patch consist of a duplication of the mptcpStatus
enumeration to have both a mptcpStatusDial and a mptcpStatusListen,
where MPTCP is enabled by default in mptcpStatusListen, but disabled
by default in mptcpStatusDial. It is still possible to turn MPTCP support
on and off by using GODEBUG=multipathtcp=1.

[1] https://go-review.googlesource.com/c/go/+/563575
[2] https://go.dev/issue/56539#issuecomment-1309294637
[3] https://github.com/multipath-tcp/mptcp_net-next/issues/383
[4] https://github.com/torvalds/linux/commit/bd11dc4fb969ec148e50cd87f88a78246dbc4d0b
[5] https://www.mptcp.dev/faq.html#why--when-should-mptcp-be-enabled-by-default

Updates #56539

Change-Id: I1ca0d6aaf74d3bda5468af135e29cdb405d3fd00
GitHub-Last-Rev: 5f9f29bfc13ad4ea6bfd1e0fc95a91bd824f4048
GitHub-Pull-Request: golang/go#69016
Reviewed-on: https://go-review.googlesource.com/c/go/+/607715
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Matthieu Baerts <matttbe@kernel.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>

8 months agocontext: document that WithValue returns a derived context
Ian Lance Taylor [Sun, 18 Aug 2024 00:53:19 +0000 (17:53 -0700)]
context: document that WithValue returns a derived context

Also replace "copy of parent" with "derived context" in doc comments.

Fixes #68923

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

8 months agoimage: use Rectangle{} instead of ZR
tomocy [Thu, 29 Aug 2024 12:47:40 +0000 (12:47 +0000)]
image: use Rectangle{} instead of ZR

ZR is deprecated,
so replace it with the literal Rectangle to represent the zero value.

Change-Id: I68c0ffec808eaed1e8c352bf364d295c0041594e
GitHub-Last-Rev: 850472888d3d0f5e68feb9ec09f0b544fe1f9446
GitHub-Pull-Request: golang/go#69136
Reviewed-on: https://go-review.googlesource.com/c/go/+/609516
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Nigel Tao <nigeltao@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
8 months agoos: dup pidfd if caller sets PidFD manually
Wei Fu [Thu, 22 Aug 2024 08:22:53 +0000 (16:22 +0800)]
os: dup pidfd if caller sets PidFD manually

Fixes #68984
Change-Id: I16d25777cb38a337cd4204a8147eaf866c3df9e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/607695
Reviewed-by: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

8 months agodoc: fix wording of GODEBUG history item from CL 606055
Paschalis T [Fri, 30 Aug 2024 20:24:40 +0000 (23:24 +0300)]
doc: fix wording of GODEBUG history item from CL 606055

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

8 months agocmd/dist: do not rewrite "any" -> "interface{}"
Cuong Manh Le [Fri, 30 Aug 2024 17:26:37 +0000 (00:26 +0700)]
cmd/dist: do not rewrite "any" -> "interface{}"

Since go1.22, generic can now be used when building bootstrap toolchain.

Updates #54265
Updates #64751

Change-Id: I93209fc23c92114d37ef36787ea2b520de3ed89d
Reviewed-on: https://go-review.googlesource.com/c/go/+/609915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
8 months agosyscall: honor prlimit set by a different process
Ian Lance Taylor [Wed, 21 Aug 2024 20:43:42 +0000 (13:43 -0700)]
syscall: honor prlimit set by a different process

On Linux one process can call prlimit to change the resource limit
of another process. With this change we treat that as though the
current process called prlimit (or setrlimit) to set its own limit.
The cost is one additional getrlimit system call per fork/exec,
for cases in which the rlimit Cur and Max values differ at startup.

This revealed a bug: the setrlimit (not Setrlimit) function should not
change the cached rlimit. That means that it must call prlimit1, not prlimit.

Fixes #66797

Change-Id: I46bfd06e09ab7273fe8dd9b5b744dffdf31d828b
Reviewed-on: https://go-review.googlesource.com/c/go/+/607516
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Aleksa Sarai <cyphar@cyphar.com>
Reviewed-by: Kirill Kolyshkin <kolyshkin@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

8 months agoencoding/base32, encoding/base64: document Decode to short buffer
Ian Lance Taylor [Thu, 22 Aug 2024 20:47:13 +0000 (13:47 -0700)]
encoding/base32, encoding/base64: document Decode to short buffer

Document that if one of the Decode methods in these packages is given
a short buffer, it panics.

Fixes #69024

Change-Id: I1c0e4c74274965c1cfa0422cc8f86af4fefb1d00
Reviewed-on: https://go-review.googlesource.com/c/go/+/607499
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
8 months agosyscall: always use prlimit for getrlimit/setrlimit on Linux
Ian Lance Taylor [Wed, 28 Aug 2024 23:20:44 +0000 (16:20 -0700)]
syscall: always use prlimit for getrlimit/setrlimit on Linux

Linux added the prlimit system call in version 2.6.36.
As our minimum Linux kernel version is now 3.2,
simplify the various getrlimit/setlrimit implementations
to just always use prlimit.

For #67001

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