]> Cypherpunks repositories - gostls13.git/log
gostls13.git
6 months agoruntime: uphold goroutine profile invariants in coroswitch
Michael Anthony Knyszek [Wed, 23 Oct 2024 16:28:52 +0000 (16:28 +0000)]
runtime: uphold goroutine profile invariants in coroswitch

Goroutine profiles require checking in with the profiler before any
goroutine starts running. coroswitch is a place where a goroutine may
start running, but where we do not check in with the profiler, which
leads to crashes. Fix this by checking in with the profiler the same way
execute does.

Fixes #69998.

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

6 months agoruntime: fix ASAN poison calculation in mallocgc
Michael Anthony Knyszek [Thu, 24 Oct 2024 14:11:39 +0000 (14:11 +0000)]
runtime: fix ASAN poison calculation in mallocgc

A previous CL broke the ASAN poisoning calculation in mallocgc by not
taking into account a possible allocation header, so the beginning of
the following allocation could have been poisoned.

This mostly isn't a problem, actually, since the following slot would
usually just have an allocation header in it that programs shouldn't be
touching anyway, but if we're going a word-past-the-end at the end of a
span, we could be poisoning a valid heap allocation.

Change-Id: I76a4f59bcef01af513a1640c4c212c0eb6be85b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/622295
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>
6 months agocrypto/internal/cryptotest: skip hardware support check on non-Linux builders
Filippo Valsorda [Thu, 24 Oct 2024 09:18:40 +0000 (11:18 +0200)]
crypto/internal/cryptotest: skip hardware support check on non-Linux builders

Non-Linux builder hardware is more varied, and the important thing is
that we test on at least one builder.

Fixes #70014
Fixes #70013
Fixes #70012

Change-Id: I33c4483c8b2792f6a15d6532e8cbae98b2888ea5
Reviewed-on: https://go-review.googlesource.com/c/go/+/622096
Auto-Submit: 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: David Chase <drchase@google.com>
6 months agonet/http: limit 1xx based on size, do not limit when delivered
Damien Neil [Mon, 23 Sep 2024 18:43:19 +0000 (11:43 -0700)]
net/http: limit 1xx based on size, do not limit when delivered

Replace Transport's limit of 5 1xx responses with a limit based
on MaxResponseHeaderBytes: The total number of responses
(including 1xx reponses and the final response) must not exceed
this value.

When the user is reading 1xx responses using a Got1xxResponse
client trace hook, disable the limit: Each 1xx response is
individually limited by MaxResponseHeaderBytes, but there
is no limit on the total number of responses. The user is
responsible for imposing a limit if they want one.

For #65035

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

6 months agoruntime: support cgo index into pointer-to-array
Ian Lance Taylor [Thu, 24 Oct 2024 00:27:44 +0000 (17:27 -0700)]
runtime: support cgo index into pointer-to-array

We were missing a case for calling a C function with an index
into a pointer-to-array.

Fixes #70016

Change-Id: I9c74d629e58722813c1aaa0f0dc225a5a64d111b
Reviewed-on: https://go-review.googlesource.com/c/go/+/621576
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 months agocmd/internal/obj,cmd/asm: add vector registers to riscv64 assembler
Joel Sing [Thu, 27 Jun 2024 14:03:53 +0000 (00:03 +1000)]
cmd/internal/obj,cmd/asm: add vector registers to riscv64 assembler

This adds V0 through V31 as vector registers, which are available on CPUs
that support the V extension.

Change-Id: Ibffee3f9a2cf1d062638715b3744431d72d451ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/595404
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: 鹏程汪 <wangpengcheng.pp@bytedance.com>
6 months agocmd/internal/obj/riscv: add vector instruction encodings
Joel Sing [Sun, 16 Jun 2024 13:01:27 +0000 (23:01 +1000)]
cmd/internal/obj/riscv: add vector instruction encodings

Regenerate the riscv instruction encoding table with the V extension
enabled. Add constants and names for the resulting 375 instructions.

Change-Id: Icce688493aeb1e9880fb76a0618643f57e481273
Reviewed-on: https://go-review.googlesource.com/c/go/+/595403
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: 鹏程汪 <wangpengcheng.pp@bytedance.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
6 months agocmd/compile: fold MOV*nop and MOV*const on loong64
Xiaolin Zhao [Mon, 21 Oct 2024 09:19:48 +0000 (17:19 +0800)]
cmd/compile: fold MOV*nop and MOV*const on loong64

Change-Id: I4bb1082518fc08fc0a1cb66970746d5b4f13c934
Reviewed-on: https://go-review.googlesource.com/c/go/+/621356
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
6 months agocrypto/sha256,crypto/sha512: skip TestAllocations without optimizations
Filippo Valsorda [Wed, 23 Oct 2024 18:01:36 +0000 (20:01 +0200)]
crypto/sha256,crypto/sha512: skip TestAllocations without optimizations

Fixes #70004
Fixes #70005

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-noopt
Change-Id: I6766a722f124646262fa0d2a1ff245f8b93bc920
Reviewed-on: https://go-review.googlesource.com/c/go/+/622095
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agocmd/compile: inline constant sized memclrNoHeapPointers calls on loong64
Xiaolin Zhao [Fri, 11 Oct 2024 03:08:43 +0000 (11:08 +0800)]
cmd/compile: inline constant sized memclrNoHeapPointers calls on loong64

Tested that on loong64, the optimization effect is negative for
constant size cases greater than 512.
So only enable inlining for constant size cases less than 512.

goos: linux
goarch: loong64
pkg: runtime
cpu: Loongson-3A6000 @ 2500.00MHz
                      |  bench.old   |              bench.new               |
                      |    sec/op    |    sec/op     vs base                |
MemclrKnownSize1        2.4070n ± 0%   0.4004n ± 0%  -83.37% (p=0.000 n=20)
MemclrKnownSize2        2.1365n ± 0%   0.4004n ± 0%  -81.26% (p=0.000 n=20)
MemclrKnownSize4        2.4445n ± 0%   0.4004n ± 0%  -83.62% (p=0.000 n=20)
MemclrKnownSize8        2.4200n ± 0%   0.4004n ± 0%  -83.45% (p=0.000 n=20)
MemclrKnownSize16       2.8030n ± 0%   0.8007n ± 0%  -71.43% (p=0.000 n=20)
MemclrKnownSize32        2.803n ± 0%    1.602n ± 0%  -42.85% (p=0.000 n=20)
MemclrKnownSize64        3.250n ± 0%    2.402n ± 0%  -26.08% (p=0.000 n=20)
MemclrKnownSize112       6.006n ± 0%    2.819n ± 0%  -53.06% (p=0.000 n=20)
MemclrKnownSize128       6.006n ± 0%    3.240n ± 0%  -46.05% (p=0.000 n=20)
MemclrKnownSize192       6.807n ± 0%    5.205n ± 0%  -23.53% (p=0.000 n=20)
MemclrKnownSize248       7.608n ± 0%    6.301n ± 0%  -17.19% (p=0.000 n=20)
MemclrKnownSize256       7.608n ± 0%    6.707n ± 0%  -11.84% (p=0.000 n=20)
MemclrKnownSize512       13.61n ± 0%    13.61n ± 0%        ~ (p=0.374 n=20)
MemclrKnownSize1024      26.43n ± 0%    26.43n ± 0%        ~ (p=0.826 n=20)
MemclrKnownSize4096      103.3n ± 0%    103.3n ± 0%        ~ (p=1.000 n=20)
MemclrKnownSize512KiB    26.29µ ± 0%    26.29µ ± 0%   -0.00% (p=0.012 n=20)
geomean                  10.05n         5.006n       -50.18%

                      |  bench.old   |               bench.new                |
                      |     B/s      |      B/s       vs base                 |
MemclrKnownSize1        396.2Mi ± 0%   2381.9Mi ± 0%  +501.21% (p=0.000 n=20)
MemclrKnownSize2        892.8Mi ± 0%   4764.0Mi ± 0%  +433.59% (p=0.000 n=20)
MemclrKnownSize4        1.524Gi ± 0%    9.305Gi ± 0%  +510.56% (p=0.000 n=20)
MemclrKnownSize8        3.079Gi ± 0%   18.609Gi ± 0%  +504.42% (p=0.000 n=20)
MemclrKnownSize16       5.316Gi ± 0%   18.609Gi ± 0%  +250.05% (p=0.000 n=20)
MemclrKnownSize32       10.63Gi ± 0%    18.61Gi ± 0%   +75.00% (p=0.000 n=20)
MemclrKnownSize64       18.34Gi ± 0%    24.81Gi ± 0%   +35.27% (p=0.000 n=20)
MemclrKnownSize112      17.37Gi ± 0%    37.01Gi ± 0%  +113.08% (p=0.000 n=20)
MemclrKnownSize128      19.85Gi ± 0%    36.80Gi ± 0%   +85.39% (p=0.000 n=20)
MemclrKnownSize192      26.27Gi ± 0%    34.35Gi ± 0%   +30.77% (p=0.000 n=20)
MemclrKnownSize248      30.36Gi ± 0%    36.66Gi ± 0%   +20.75% (p=0.000 n=20)
MemclrKnownSize256      31.34Gi ± 0%    35.55Gi ± 0%   +13.43% (p=0.000 n=20)
MemclrKnownSize512      35.02Gi ± 0%    35.03Gi ± 0%    +0.00% (p=0.030 n=20)
MemclrKnownSize1024     36.09Gi ± 0%    36.09Gi ± 0%         ~ (p=0.101 n=20)
MemclrKnownSize4096     36.93Gi ± 0%    36.93Gi ± 0%    +0.00% (p=0.003 n=20)
MemclrKnownSize512KiB   18.57Gi ± 0%    18.57Gi ± 0%    +0.00% (p=0.041 n=20)
geomean                 10.13Gi         20.33Gi       +100.72%

Change-Id: I460a56f7ccc9f820ca2c1934c1c517b9614809ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/621355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Pratt <mpratt@google.com>
6 months agocmd/compile/internal: optimize condition branch implementation
limeidan [Thu, 18 Jul 2024 02:17:42 +0000 (10:17 +0800)]
cmd/compile/internal: optimize condition branch implementation

os: linux
goarch: loong64
pkg: test/bench/go1
cpu: Loongson-3A6000 @ 2500.00MHz
                      │     old      │                new                 │
                      │    sec/op    │   sec/op     vs base               │
BinaryTree17              7.521 ± 1%    7.551 ± 2%       ~ (p=0.190 n=10)
Fannkuch11                2.736 ± 0%    2.667 ± 0%  -2.51% (p=0.000 n=10)
FmtFprintfEmpty          34.42n ± 0%   35.22n ± 0%  +2.32% (p=0.000 n=10)
FmtFprintfString         61.24n ± 0%   56.84n ± 0%  -7.18% (p=0.000 n=10)
FmtFprintfInt            68.04n ± 0%   65.65n ± 0%  -3.51% (p=0.000 n=10)
FmtFprintfIntInt         111.9n ± 0%   106.0n ± 0%  -5.32% (p=0.000 n=10)
FmtFprintfPrefixedInt    131.4n ± 0%   122.5n ± 0%  -6.77% (p=0.000 n=10)
FmtFprintfFloat          241.1n ± 0%   235.1n ± 0%  -2.51% (p=0.000 n=10)
FmtManyArgs              553.7n ± 0%   518.9n ± 0%  -6.28% (p=0.000 n=10)
GobDecode                7.223m ± 1%   7.291m ± 1%  +0.94% (p=0.004 n=10)
GobEncode                6.741m ± 1%   6.622m ± 2%  -1.77% (p=0.011 n=10)
Gzip                     288.9m ± 0%   280.3m ± 0%  -3.00% (p=0.000 n=10)
Gunzip                   34.07m ± 0%   33.33m ± 0%  -2.18% (p=0.000 n=10)
HTTPClientServer         60.15µ ± 0%   60.63µ ± 0%  +0.80% (p=0.000 n=10)
JSONEncode              10.052m ± 1%   9.840m ± 0%  -2.12% (p=0.000 n=10)
JSONDecode               50.96m ± 0%   51.32m ± 0%  +0.70% (p=0.002 n=10)
Mandelbrot200            4.525m ± 0%   4.602m ± 0%  +1.69% (p=0.000 n=10)
GoParse                  5.018m ± 0%   4.996m ± 0%  -0.44% (p=0.000 n=10)
RegexpMatchEasy0_32      58.74n ± 0%   59.95n ± 0%  +2.06% (p=0.000 n=10)
RegexpMatchEasy0_1K      464.9n ± 0%   466.1n ± 0%  +0.26% (p=0.000 n=10)
RegexpMatchEasy1_32      64.88n ± 0%   59.64n ± 0%  -8.08% (p=0.000 n=10)
RegexpMatchEasy1_1K      557.2n ± 0%   564.4n ± 0%  +1.29% (p=0.000 n=10)
RegexpMatchMedium_32     879.3n ± 0%   912.8n ± 1%  +3.81% (p=0.000 n=10)
RegexpMatchMedium_1K     28.08µ ± 0%   28.70µ ± 0%  +2.20% (p=0.000 n=10)
RegexpMatchHard_32       1.456µ ± 0%   1.414µ ± 0%  -2.88% (p=0.000 n=10)
RegexpMatchHard_1K       43.81µ ± 0%   42.23µ ± 0%  -3.61% (p=0.000 n=10)
Revcomp                  472.4m ± 0%   474.5m ± 1%  +0.45% (p=0.000 n=10)
Template                 83.45m ± 0%   83.39m ± 0%       ~ (p=0.481 n=10)
TimeParse                291.3n ± 0%   283.8n ± 0%  -2.57% (p=0.000 n=10)
TimeFormat               322.8n ± 0%   313.1n ± 0%  -3.02% (p=0.000 n=10)
geomean                  54.32µ        53.45µ       -1.61%

Change-Id: If68fdd952ec6137c77e25ce8932358cac28da324
Reviewed-on: https://go-review.googlesource.com/c/go/+/620977
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
6 months agogo/types, types2: simplify cycle reporting code (minor cleanup)
Robert Griesemer [Wed, 23 Oct 2024 16:19:57 +0000 (09:19 -0700)]
go/types, types2: simplify cycle reporting code (minor cleanup)

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

6 months agointernal/poll: keep copying after successful Sendfile return on BSD
Damien Neil [Wed, 23 Oct 2024 23:01:08 +0000 (16:01 -0700)]
internal/poll: keep copying after successful Sendfile return on BSD

The BSD implementation of poll.SendFile incorrectly halted
copying after succesfully writing one full chunk of data.
Adjust the copy loop to match the Linux and Solaris
implementations.

In testing, empirically macOS appears to sometimes return
EAGAIN from sendfile after successfully copying a full
chunk. Add a check to all implementations to return nil
after successfully copying all data if the last sendfile
call returns EAGAIN.

For #70000

Change-Id: I57ba649491fc078c7330310b23e1cfd85135c8ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/622235
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agonet/http/pprof: include Symbol in Index
Sean Liao [Tue, 15 Oct 2024 23:47:44 +0000 (00:47 +0100)]
net/http/pprof: include Symbol in Index

Fixes #69897

Change-Id: I5887f34504b39018e16f269e087b43bc6a80964b
Reviewed-on: https://go-review.googlesource.com/c/go/+/620455
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>
6 months agodoc/next: document the minimum Linux kernel version for 1.24
Carlos Amedee [Wed, 23 Oct 2024 15:33:13 +0000 (11:33 -0400)]
doc/next: document the minimum Linux kernel version for 1.24

The minimum Linux kernel version for Go 1.24 is now set to 3.2.

Updates #67001
For #68545

Change-Id: I509f09c8ed7f3067af14066cf139008db0cb06ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/622015
Auto-Submit: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
6 months agoruntime: add the checkPtraceScope to skip certain tests
Shuo Wang [Wed, 23 Oct 2024 01:52:14 +0000 (01:52 +0000)]
runtime: add the checkPtraceScope to skip certain tests

When the kernel parameter ptrace_scope is set to 2 or 3,
certain test cases in runtime-gdb_test.go will fail.
We should skip these tests.

Fixes #69932

Change-Id: I685d1217f1521d7f8801680cf6b71d8e7a265188
GitHub-Last-Rev: 063759e04cfc5ea750ed1d381d8586134488a96b
GitHub-Pull-Request: golang/go#69933
Reviewed-on: https://go-review.googlesource.com/c/go/+/620857
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
6 months agosyscall: only remove write data access when O_APPEND is set on Windows
qmuntal [Wed, 16 Oct 2024 14:38:37 +0000 (16:38 +0200)]
syscall: only remove write data access when O_APPEND is set on Windows

There is no need to remove all write accesses when O_APPEND is set,
only the FILE_WRITE_DATA access. This will allow files opened with
O_APPEND and O_WRONLY to be have their attributes and ACLs modified.

Change-Id: I6fe3b25e87b141a9eb30805f395fec31242fd35d
Reviewed-on: https://go-review.googlesource.com/c/go/+/620615
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
6 months agocmd/link: fix flags order in linkerFlagSupported
Siddhartha Bagaria [Wed, 18 Sep 2024 22:05:40 +0000 (15:05 -0700)]
cmd/link: fix flags order in linkerFlagSupported

Flags from CGo directives should be placed before extldflags so that
extldflags get more preference. This is also the order followed by the
final link command.

Fixes #69350

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

6 months agohash/maphash: sync wyhash with runtime implementation
Cuong Manh Le [Tue, 22 Oct 2024 07:56:17 +0000 (14:56 +0700)]
hash/maphash: sync wyhash with runtime implementation

Fixes #69940

Change-Id: I40535d2647f9456d2196241bf7414b1e92b53c2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/621756
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>
Reviewed-by: Michael Pratt <mpratt@google.com>
6 months agocrypto/internal/fips/subtle: provide XORBytes
Filippo Valsorda [Mon, 30 Sep 2024 15:08:12 +0000 (17:08 +0200)]
crypto/internal/fips/subtle: provide XORBytes

This is needed from inside the module, and we generally don't want to
import the crypto tree from it.

For #69536

Change-Id: I69e91e4df89ecac0016c671ccd28e733a7131533
Reviewed-on: https://go-review.googlesource.com/c/go/+/616716
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
6 months agocrypto/hmac: move implementation to crypto/internal/fips
Filippo Valsorda [Sun, 29 Sep 2024 08:01:45 +0000 (10:01 +0200)]
crypto/hmac: move implementation to crypto/internal/fips

For #69536

Change-Id: I38508a8de4ac321554a2c12ac70bcf9e25fad1aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/616636
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
6 months agocrypto/sha256,crypto/sha512: move implementation to crypto/internal/fips
Filippo Valsorda [Thu, 19 Sep 2024 18:04:30 +0000 (20:04 +0200)]
crypto/sha256,crypto/sha512: move implementation to crypto/internal/fips

For #69536

Change-Id: I1efa916e6e9fcddeffa52bc3d23286e6465dae54
Reviewed-on: https://go-review.googlesource.com/c/go/+/615235
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
6 months agocrypto/sha256,crypto/sha512: test fallback implementations
Filippo Valsorda [Fri, 20 Sep 2024 16:06:54 +0000 (18:06 +0200)]
crypto/sha256,crypto/sha512: test fallback implementations

This will be required for #69536 but is also good hygiene and required
by go.dev/wiki/AssemblyPolicy.

> The code must be tested in our CI. This means there need to be
> builders that support the instructions, and if there are multiple (or
> fallback) paths they must be tested separately.

The new crypto/internal/impl registry lets us select alternative
implementations from both the same package and importers (such as
crypto/sha256 tests once we have crypto/internal/fips/sha256, or
crypto/hmac).

Updates #69592
Updates #69593

Change-Id: Ifea22a9fc9ccffcaf4924ff6bd08da7c9bd39e99
Cq-Include-Trybots: luci.golang.try:gotip-linux-arm64-longtest,gotip-linux-amd64-longtest,gotip-linux-ppc64le_power8,gotip-linux-ppc64_power8
Reviewed-on: https://go-review.googlesource.com/c/go/+/614656
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>

6 months agocrypto/sha256,crypto/sha512: make assembly structure consistent
Filippo Valsorda [Thu, 19 Sep 2024 18:04:30 +0000 (20:04 +0200)]
crypto/sha256,crypto/sha512: make assembly structure consistent

Ensure separate implementations are implemented in different functions
called from Go, and that they can be turned off from a GODEBUG.

This will be necessary to test implementations separately for #69536.

Change-Id: I3e081deb7abb01b0665265e39c72fd4037dd48b3
Cq-Include-Trybots: luci.golang.try:gotip-linux-arm64-longtest,gotip-linux-amd64-longtest,gotip-linux-ppc64le_power8,gotip-linux-ppc64_power8
Reviewed-on: https://go-review.googlesource.com/c/go/+/614495
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: 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: Michael Pratt <mpratt@google.com>
6 months agoencoding/json: clarify omitempty option for {array,slice,map,string}
Jes Cok [Tue, 22 Oct 2024 14:56:13 +0000 (14:56 +0000)]
encoding/json: clarify omitempty option for {array,slice,map,string}

This CL is inspired by:
https://github.com/golang/go/issues/29310#issuecomment-758768325

When I read omitempty option in encoding/xml package, I find it's
a bit different than encoding/json package.

I think it's more precise to say:
"any array, slice, map, or string of length zero."

Update #29310

Change-Id: Ia77167c3155411640224b349d4b34d0bb91ee11e
GitHub-Last-Rev: a4cf00dcc75067bd259bc600f288c9de4b5393cf
GitHub-Pull-Request: golang/go#69984
Reviewed-on: https://go-review.googlesource.com/c/go/+/621835
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Michael Pratt <mpratt@google.com>
6 months agocmd/asm: add support for LDREXB/STREXB
Mauri de Souza Meneguzzo [Mon, 21 Oct 2024 21:47:40 +0000 (21:47 +0000)]
cmd/asm: add support for LDREXB/STREXB

These are 8-bit ARM Load/Store atomics and are available starting from armv6k.

See https://developer.arm.com/documentation/dui0379/e/arm-and-thumb-instructions/strex

For #69735

Change-Id: I12623433c89070495c178208ee4758b3cdefd368
GitHub-Last-Rev: d6a797836af1dccdcc6e6554725546b386d01615
GitHub-Pull-Request: golang/go#69959
Cq-Include-Trybots: luci.golang.try:gotip-linux-arm
Reviewed-on: https://go-review.googlesource.com/c/go/+/621395
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agoos: use sync.OnceValue
apocelipes [Mon, 21 Oct 2024 15:28:25 +0000 (15:28 +0000)]
os: use sync.OnceValue

Simplify the code and reduce global variables.

Change-Id: Id322836e8b6b6c4434136b95700ed4070ba52300
GitHub-Last-Rev: 7c9d409855c682b6de1f338f69d9193a7887f9f0
GitHub-Pull-Request: golang/go#69962
Reviewed-on: https://go-review.googlesource.com/c/go/+/621456
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
6 months agocmd/compile: arithmetic optimization for shifts
Youlin Feng [Mon, 21 Oct 2024 09:22:00 +0000 (17:22 +0800)]
cmd/compile: arithmetic optimization for shifts

Fixes #69635

Change-Id: I4f8d7dafb34ccfb943c29f96c982278ab7edcd05
Reviewed-on: https://go-review.googlesource.com/c/go/+/621357
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
6 months agoruntime/debug: minor cleanups after CL 384154
Ian Lance Taylor [Wed, 23 Oct 2024 00:24:56 +0000 (17:24 -0700)]
runtime/debug: minor cleanups after CL 384154

Change some vars to consts, remove some unneeded string conversions.

Change-Id: Ib12eed11ef080c4b593c8369bb915117e7100045
Reviewed-on: https://go-review.googlesource.com/c/go/+/621838
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>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
6 months agoruntime/debug: document ParseBuildInfo and (*BuildInfo).String
Ian Lance Taylor [Wed, 23 Oct 2024 00:21:33 +0000 (17:21 -0700)]
runtime/debug: document ParseBuildInfo and (*BuildInfo).String

For #51026
Fixes #69971

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

6 months agogo/types, types2: qualify named types in error messages with type kind
Robert Griesemer [Tue, 22 Oct 2024 18:48:38 +0000 (11:48 -0700)]
go/types, types2: qualify named types in error messages with type kind

Change the description of an operand x that has a named type of sorts
by providing a description of the type structure (array, struct, slice,
pointer, etc).

For instance, given a (variable) operand x of a struct type T, the
operand is mentioned as (new):

        x (variable of struct type T)

instead of (old):

        x (variable of type T)

This approach is also used when a basic type is renamed, for instance
as in:

        x (value of uint type big.Word)

which makes it clear that big.Word is a uint.

This change is expected to produce more informative error messages.

Fixes #69955.

Change-Id: I544b0698f753a522c3b6e1800a492a94974fbab7
Reviewed-on: https://go-review.googlesource.com/c/go/+/621458
Reviewed-by: Alan Donovan <adonovan@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>

6 months agogo/types, types2: rename kindString to compositeKind and simplify function
Robert Griesemer [Tue, 22 Oct 2024 17:13:29 +0000 (10:13 -0700)]
go/types, types2: rename kindString to compositeKind and simplify function

Simplify functionality of compositeKind (formerly: kindString) by
giving it a smaller scope. Move it into operand.go for future use
in that file. Adjust existing uses.

Change-Id: I73d04a8c0be44d9604e56bd4c0289afdcdd32238
Reviewed-on: https://go-review.googlesource.com/c/go/+/621457
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
6 months agoruntime: fix typo in error message
changwang ma [Tue, 22 Oct 2024 18:04:20 +0000 (02:04 +0800)]
runtime: fix typo in error message

Change-Id: I27bf98e84545746d90948dd06c4a7bd70782c49d
Reviewed-on: https://go-review.googlesource.com/c/go/+/621895
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: Keith Randall <khr@google.com>
6 months agogo/types: improve recursive type error message
Max Neverov [Wed, 9 Oct 2024 00:00:28 +0000 (00:00 +0000)]
go/types: improve recursive type error message

This change improves error message for recursive types.
Currently, compilation of the [following program](https://go.dev/play/p/3ef84ObpzfG):

package main

type T1[T T2] struct{}
type T2[T T1] struct{}

returns an error:

./prog.go:3:6: invalid recursive type T1
./prog.go:3:6: T1 refers to
./prog.go:4:6: T2 refers to
./prog.go:3:6: T1

With the patch applied the error message looks like:

./prog.go:3:6: invalid recursive type T1
./prog.go:3:6: T1 refers to T2
./prog.go:4:6: T2 refers to T1

Change-Id: Ic07cdffcffb1483c672b241fede4e694269b5b79
GitHub-Last-Rev: cd042fdc384cf5591b3258ca80fdc002bb8c5e0d
GitHub-Pull-Request: golang/go#69574
Reviewed-on: https://go-review.googlesource.com/c/go/+/614084
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agogo/internal/typeparams: melt it down
Alan Donovan [Tue, 22 Oct 2024 17:58:53 +0000 (13:58 -0400)]
go/internal/typeparams: melt it down

This package is no longer needed now that typeparams
are unconditionally enabled.  Its declarations have been
moved into the go/{types,parser} packages.

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

6 months agocmd/compile: discount calls to closure variables
David Chase [Mon, 14 Oct 2024 17:28:28 +0000 (13:28 -0400)]
cmd/compile: discount calls to closure variables

This causes more inlining for rangefunc code.
The PAUTOHEAP case catches closure-passed-as-param
to function that returns a closure, that calls the
outer PPARAM.

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

6 months agocmd/compile: tweak inlining to favor PPARAM call sites
David Chase [Wed, 28 Aug 2024 14:34:54 +0000 (10:34 -0400)]
cmd/compile: tweak inlining to favor PPARAM call sites

If a function f being considered for inlining calls
one of its parameters, reduce the normal cost of that
call (57) to 17 to increase the chance that f will
be inlined and (with luck) that parameter will be
revealed as a constant function (which unblocks
escape analysis) or perhaps even be inlined.

The least-change value for that was still effective for
iter_test benchmarks was 32; however tests showed no
particular harm even when reduced as low as 7, and there
have been reports of other performance problems with
rangefunc overheads and so I picked a middling number
in hopes of warding off such reports.

Updates #69015

Change-Id: I2a525c1beffb9f88daa14caa8a622864b023675c
Reviewed-on: https://go-review.googlesource.com/c/go/+/609095
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
6 months agocmd/compile: use STP/LDP around morestack on arm64
Keith Randall [Mon, 21 Oct 2024 22:36:38 +0000 (15:36 -0700)]
cmd/compile: use STP/LDP around morestack on arm64

The spill/restore code around morestack is almost never exectued, so
we should make it as small as possible. Using 2-register loads/stores
makes sense here. Also, the offsets from SP are pretty small so the
offset almost always fits in the (smaller than a normal load/store)
offset field of the instruction.

Makes cmd/go 0.6% smaller.

Change-Id: I8845283c1b269a259498153924428f6173bda293
Reviewed-on: https://go-review.googlesource.com/c/go/+/621556
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agoruntime: Check LSE support on ARM64 at runtime init
Andrey Bokhanko [Tue, 3 Sep 2024 05:19:18 +0000 (08:19 +0300)]
runtime: Check LSE support on ARM64 at runtime init

Check presence of LSE support on ARM64 chip if we targeted it at compile time.

Related to #69124
Update #60905

Change-Id: I6fe244decbb4982548982e1f88376847721a33c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/610195
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Shu-Chun Weng <scw@google.com>
6 months agocmd/compile/internal/ssa: optimize if control flow rule of loong64
limeidan [Thu, 20 Jun 2024 09:22:43 +0000 (17:22 +0800)]
cmd/compile/internal/ssa: optimize if control flow rule of loong64

goos: linux
goarch: loong64
pkg: cmd/compile/internal/test
cpu: Loongson-3A6000 @ 2500.00MHz
                                 │     old     │                 new                 │
                                 │   sec/op    │   sec/op     vs base                │
Switch8Predictable                 2.908n ± 0%   2.702n ± 2%   -7.10% (p=0.000 n=10)
Switch8Unpredictable               13.29n ± 0%   12.45n ± 0%   -6.32% (p=0.000 n=10)
Switch32Predictable                3.069n ± 0%   3.137n ± 0%   +2.23% (p=0.000 n=10)
Switch32Unpredictable              15.11n ± 0%   13.21n ± 0%  -12.57% (p=0.000 n=10)
SwitchStringPredictable            5.165n ± 0%   4.447n ± 0%  -13.90% (p=0.000 n=10)
SwitchStringUnpredictable          18.26n ± 0%   16.86n ± 0%   -7.67% (p=0.000 n=10)
SwitchTypePredictable              3.961n ± 0%   3.405n ± 0%  -14.04% (p=0.000 n=10)
SwitchTypeUnpredictable            17.92n ± 0%   16.17n ± 0%   -9.77% (p=0.000 n=10)
SwitchInterfaceTypePredictable     8.463n ± 0%   8.492n ± 0%   +0.34% (p=0.001 n=10)
SwitchInterfaceTypeUnpredictable   23.70n ± 0%   22.48n ± 0%   -5.15% (p=0.000 n=10)
geomean                            8.672n        8.018n        -7.54%

Change-Id: Iefbf8e9e784905779f1ebc9fd6a9b7a28cf2f6f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/620815
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agocmd/compile/internal/ssa: optimize ANDconst rule of loong64
limeidan [Sat, 6 Jul 2024 09:19:06 +0000 (17:19 +0800)]
cmd/compile/internal/ssa: optimize ANDconst rule of loong64

Change-Id: I0e88f885ff17b4932c2f448dc3c577c0329a6658
Reviewed-on: https://go-review.googlesource.com/c/go/+/620976
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agocmd/compile/internal/ssa: optimize store-zero rules on loong64
limeidan [Fri, 18 Oct 2024 01:30:23 +0000 (09:30 +0800)]
cmd/compile/internal/ssa: optimize store-zero rules on loong64

Change-Id: I4c6ce7b77da05636895127de7bc687c59bd79787
Reviewed-on: https://go-review.googlesource.com/c/go/+/620975
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Pratt <mpratt@google.com>
6 months agogo/types,types2: avoid data race to object.color_ through dot imports
Rob Findley [Mon, 21 Oct 2024 18:14:24 +0000 (18:14 +0000)]
go/types,types2: avoid data race to object.color_ through dot imports

As described in issue #69912, type checking dot-imported identifiers can
result in a call to objDecl on an imported object, which leads to a data
race to the color_ field.

There are multiple potential fixes for this race. Opt for avoiding the
call to objDecl altogether, rather than setting color_ during import.
The color_ field is an internal property of objects that should only be
valid during the type checking of their package. We should not be
calling objDecl on imported objects.

Fixes #69912

Change-Id: I55eb652479715f2a7ac84104db2f448091c4e7ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/621637
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
6 months agocmd/link,runtime: DWARF/gdb support for swiss maps
Michael Pratt [Thu, 10 Oct 2024 17:52:26 +0000 (13:52 -0400)]
cmd/link,runtime: DWARF/gdb support for swiss maps

For #54766.

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

6 months agocmd/link: reduce Wasm initial memory size
Cherry Mui [Mon, 21 Oct 2024 17:09:58 +0000 (13:09 -0400)]
cmd/link: reduce Wasm initial memory size

Currently, for Wasm, the linker sets the initial memory size to
the size of global data plus 16 MB. The intention is that it
covers the global data and runtime initialization without growing
the linear memory. However, the code accounts only the data
"section", not the bss "section", therefore the extra 16 MB is
actually used to cover bss variables. Also, as seen on the
previous CL, the runtime actually didn't use the extra space,
which means the program can start without that space.

This CL corrects the global data size calculation, and reduces the
extra to 1 MB. Currently the runtime's allocation pattern at
startup is that it allocates a few pages for the page allocator's
metadata, the an 8 MB reservation for the first 4 MB size, 4 MB
aligned heap arena (it may be possible to reduce that, but we'll
leave that for later). Here we use 1 MB extra space to cover the
small allocations, but let the runtime allocate the heap arena, so
the linker code and the runtime's allocator are not tightly
coupled.

For #69018.

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

6 months agoruntime: (re)use unused linear memory on Wasm
Cherry Mui [Mon, 21 Oct 2024 17:01:56 +0000 (13:01 -0400)]
runtime: (re)use unused linear memory on Wasm

CL 476717 adopted the memory management mechanism on Plan 9 to
manage Wasm's linear memory. But the Plan 9 code uses global
variable bloc and blocMax to keep track of the runtime's and the
OS's sense of break, whereas the Wasm sbrk function doesn't use
those global variables, and directly goes to grow the linear
memory instead. This causes that if there is any unused portion at
the end of the linear memory, the runtime doesn't use it. This CL
fixes it, adopts the same mechanism as the Plan 9 code.

In particular, the runtime is not aware of any unused initial
memory at startup. Therefore, (most of) the extra initial memory
set by the linker are not actually used. This CL fixes this as
well.

For #69018.

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

6 months agoruntime,time: use atomic.Int32 for isSending
Michael Anthony Knyszek [Mon, 21 Oct 2024 17:34:22 +0000 (17:34 +0000)]
runtime,time: use atomic.Int32 for isSending

This change switches isSending to be an atomic.Int32 instead of an
atomic.Uint8. The Int32 version is managed as a counter, which is
something that we couldn't do with Uint8 without adding a new intrinsic
which may not be available on all architectures.

That is, instead of only being able to support 8 concurrent timer
firings on the same timer because we only have 8 independent bits to set
for each concurrent timer firing, we can now have 2^31-1 concurrent
timer firings before running into any issues. Like the fact that each
bit-set was matched with a clear, here we match increments with
decrements to indicate that we're in the "sending on a channel" critical
section in the timer code, so we can report the correct result back on
Stop or Reset.

We choose an Int32 instead of a Uint32 because it's easier to check for
obviously bad values (negative values are always bad) and 2^31-1
concurrent timer firings should be enough for anyone.

Previously, we avoided anything bigger than a Uint8 because we could
pack it into some padding in the runtime.timer struct. But it turns out
that the type that actually matters, runtime.timeTimer, is exactly 96
bytes in size. This means its in the next size class up in the 112 byte
size class because of an allocation header. We thus have some free space
to work with. This change increases the size of this struct from 96
bytes to 104 bytes.

(I'm not sure if runtime.timer is often allocated directly, but if it
is, we get lucky in the same way too. It's exactly 80 bytes in size,
which means its in the 96-byte size class, leaving us with some space to
work with.)

Fixes #69969.
Related to #69880 and #69312.

Change-Id: I9fd59cb6a69365c62971d1f225490a65c58f3e77
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/621616
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agotest: split non-regabi stack map test
Michael Pratt [Mon, 21 Oct 2024 16:58:22 +0000 (12:58 -0400)]
test: split non-regabi stack map test

CL 594596 already did this for regabi, but missed non-regabi.

Stack allocated swiss maps don't call rand32.

For #54766.

Change-Id: I312ea77532ecc6fa860adfea58ea00b01683ca69
Reviewed-on: https://go-review.googlesource.com/c/go/+/621615
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
6 months agohtml: use sync.OnceValues instead of var once sync.Once
1911860538 [Mon, 21 Oct 2024 16:27:03 +0000 (16:27 +0000)]
html: use sync.OnceValues instead of var once sync.Once

Simplify populateMaps with sync.OnceValues.

Change-Id: Id52e6e1623c621b8d51e11fecbe3f1fab1e74eb4
GitHub-Last-Rev: 3cf736ae299f14ece401d218d68c3c8870e0cf5a
GitHub-Pull-Request: golang/go#69946
Reviewed-on: https://go-review.googlesource.com/c/go/+/621255
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>

6 months agoruntime: remove linkname from memhash{32,64} functions
Alfonso Subiotto Marques [Mon, 3 Jun 2024 12:02:40 +0000 (12:02 +0000)]
runtime: remove linkname from memhash{32,64} functions

Remove linkname directives that are no longer necessary given
parquet-go/parquet-go#142 removes the dependency on the `memhash{32,64}`
functions.

This change also removes references to segmentio/parquet-go since that
repository was archived in favor of parquet-go/parquet-go.

Updates #67401

Change-Id: Ibafb0c41b39cdb86dac5531f62787fb5cb8d3f01
GitHub-Last-Rev: e14c4e4dfe1023df83339da73eb5dd632d52851b
GitHub-Pull-Request: golang/go#67784
Reviewed-on: https://go-review.googlesource.com/c/go/+/589795
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agocmd/link: fix TestTrampoline symbol name check on PPC64
Paul E. Murphy [Mon, 21 Oct 2024 14:40:44 +0000 (09:40 -0500)]
cmd/link: fix TestTrampoline symbol name check on PPC64

CL 603736 added a check looking for a specific trampoline symbol
name. PPC64 uses a slightly different name for the trampoline,
update the test to accept both.

Change-Id: I177dadb25d82bc3ffeb7530d7ab865482d907d34
Reviewed-on: https://go-review.googlesource.com/c/go/+/621455
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Paul Murphy <murp@ibm.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
6 months agodatabase/sql: rewrite Null[T].Value method, update doc for Null[T]
Jes Cok [Mon, 21 Oct 2024 04:42:51 +0000 (04:42 +0000)]
database/sql: rewrite Null[T].Value method, update doc for Null[T]

Update doc for Null[T] to clarify that T should be one of the types
accepted by driver.Value.

Modify the Value() method of Null[T]:
1) recognize T implementing driver.Valuer interface and invoke it.
2) use the DefaultParameterConverter to convert native types that
are not directly supported as driver.Value types.

Fixes #69728
Fixes #69837

Change-Id: Iba782c878b2bde168125f5390abf319b88424149
GitHub-Last-Rev: 3df182d23dd57bd04828c3e9bd0c5222d8bef152
GitHub-Pull-Request: golang/go#69938
Reviewed-on: https://go-review.googlesource.com/c/go/+/620858
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agocmd/compile: fix the typos in genericOps.go
Shuo Wang [Mon, 21 Oct 2024 06:29:38 +0000 (06:29 +0000)]
cmd/compile: fix the typos in genericOps.go

Change-Id: I7ff869e21e67cf6a193f7a92bf7b05f047ee005c
GitHub-Last-Rev: bf01f582492c95ff169eab89b688bfb938695c50
GitHub-Pull-Request: golang/go#69957
Reviewed-on: https://go-review.googlesource.com/c/go/+/620778
Reviewed-by: Michael Pratt <mpratt@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>

6 months agointernal/syscall/windows: set write access when O_TRUNC is used
qmuntal [Wed, 16 Oct 2024 14:33:03 +0000 (16:33 +0200)]
internal/syscall/windows: set write access when O_TRUNC is used

Whenn O_TRUNC is set, Opentat ends up calling syscall.Ftruncate, which
needs write access. Make sure write access is not removed when O_TRUNC
and O_APPEND are both set.

Updates #67002.

Change-Id: Iccc470b7be3c62144318d6a707057504f3b74c97
Reviewed-on: https://go-review.googlesource.com/c/go/+/620576
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agonet: document ctx argument to ListenConfig.Listen/ListenPacket
Ian Lance Taylor [Mon, 21 Oct 2024 00:39:31 +0000 (17:39 -0700)]
net: document ctx argument to ListenConfig.Listen/ListenPacket

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

6 months agocmd/link: on ELF, generate GNU build ID by default
Cherry Mui [Tue, 8 Oct 2024 21:59:29 +0000 (17:59 -0400)]
cmd/link: on ELF, generate GNU build ID by default

On ELF, default to "-B gobuildid", so it generates GNU build ID
based on Go buildid by default.

Updates #41004.
Fixes #63934.
Fixes #68652.

Change-Id: I5619dfaa4eeb6575c52922ae1de3430b46e31db6
Reviewed-on: https://go-review.googlesource.com/c/go/+/618601
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Than McIntosh <thanm@golang.org>
6 months agocmd/internal/buildid: skip over GNU build ID from buildid computation
Cherry Mui [Tue, 8 Oct 2024 21:46:22 +0000 (17:46 -0400)]
cmd/internal/buildid: skip over GNU build ID from buildid computation

This is similar to CL 618597, but for GNU build ID on ELF. This
makes it possible to enable "-B gobuildid" by default on ELF.

Updates #41004.
For #63934.

Change-Id: I4e663a27a2f7824bce994c783fe6d9ce8d1a395a
Reviewed-on: https://go-review.googlesource.com/c/go/+/618600
Reviewed-by: Than McIntosh <thanm@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocmd/link: apply -B UUID to external linking on Mach-O
Cherry Mui [Tue, 8 Oct 2024 17:17:47 +0000 (13:17 -0400)]
cmd/link: apply -B UUID to external linking on Mach-O

Currently, on Mach-O, the -B UUID setting is only applied in
internal linking mode, whereas in external linking mode the UUID
is always rewritten to a hash of Go build ID. This CL makes it
apply to external linking as well. This makes the behavior
consistent on both linkmodes, and also consistent with the -B
flag's behavior for GNU build ID on ELF.

Add tests.

Updates #68678.

Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64_14,gotip-darwin-arm64_13
Change-Id: I276a5930e231141440cdba16e8812df28ac4237b
Reviewed-on: https://go-review.googlesource.com/c/go/+/618599
Reviewed-by: Than McIntosh <thanm@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agocmd/link: on Mach-O, generate LC_UUID by default
Cherry Mui [Tue, 8 Oct 2024 16:46:01 +0000 (12:46 -0400)]
cmd/link: on Mach-O, generate LC_UUID by default

On Mach-O, default to "-B gobuildid", so it generates the UUID
based on Go buildid by default.

Fixes #68678.

Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64_14,gotip-darwin-arm64_13
Change-Id: I6c1a6bcafd8370a13174657e05d7d9620a8d4f12
Reviewed-on: https://go-review.googlesource.com/c/go/+/618598
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Than McIntosh <thanm@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocmd/internal/buildid: skip over Mach-O UUID from buildid computation
Cherry Mui [Tue, 8 Oct 2024 16:42:33 +0000 (12:42 -0400)]
cmd/internal/buildid: skip over Mach-O UUID from buildid computation

With the "-B gobuildid" linker option (which will be the default
on some platforms), the host build ID (GNU build ID, Mach-O UUID)
depends on the Go buildid. If the host build ID is included in the
Go buildid computation, it will lead to convergence problem for
the toolchain binaries. So ignore the host build ID in the buildid
computation.

This CL only handles Mach-O UUID. ELF GNU build ID will be handled
later.

For #68678.
For #63934.

Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64_14,gotip-darwin-arm64_13
Change-Id: Ie8ff20402a1c6083246d25dea391140c75be40d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/618597
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@golang.org>
6 months agocmd/internal/macho: new package for handling mach-o files in toolchain
Cherry Mui [Mon, 7 Oct 2024 15:20:15 +0000 (11:20 -0400)]
cmd/internal/macho: new package for handling mach-o files in toolchain

Currently the linker has some code handling and manipulating
Mach-O files. Specifically, it augments the debug/macho package
with file offset and length, so the content can be handled or
updated easily with the file.

Move this code to an internal package, so it can be used by other
part of the toolchain, e.g. buildid computation.

For #68678.

Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64_14,gotip-darwin-arm64_13
Change-Id: I2311af0a06441b7fd887ca5c6ed9e6fc44670a16
Reviewed-on: https://go-review.googlesource.com/c/go/+/618596
Reviewed-by: Than McIntosh <thanm@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocmd/link: generate Mach-O UUID when -B flag is specified
Cherry Mui [Mon, 7 Oct 2024 15:11:06 +0000 (11:11 -0400)]
cmd/link: generate Mach-O UUID when -B flag is specified

Currently, on Mach-O, the Go linker doesn't generate LC_UUID in
internal linking mode. This causes some macOS system tools unable
to track the binary, as well as in some cases the binary unable
to access local network on macOS 15.

This CL makes the linker start generate LC_UUID. Currently, the
UUID is generated if the -B flag is specified. And we'll make it
generate UUID by default in a later CL. The -B flag is currently
for generating GNU build ID on ELF, which is a similar concept to
Mach-O's UUID. Instead of introducing another flag, we just use
the same flag and the same setting. Specifically, "-B gobuildid"
will generate a UUID based on the Go build ID.

For #68678.

Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64_14,gotip-darwin-arm64_13
Change-Id: I90089a78ba144110bf06c1c6836daf2d737ff10a
Reviewed-on: https://go-review.googlesource.com/c/go/+/618595
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ingo Oeser <nightlyone@googlemail.com>
Reviewed-by: Than McIntosh <thanm@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agoruntime: execute publicationBarrier in noscan case for delayed zeroing
Michael Anthony Knyszek [Wed, 9 Oct 2024 17:38:49 +0000 (17:38 +0000)]
runtime: execute publicationBarrier in noscan case for delayed zeroing

This is a peace-of-mind change to make sure that delayed-zeroed memory
(in the large alloc case) is globally visible from the moment the
allocation is published back to the caller.

The way it's written right now is good enough for the garbage collector
(we already have a publication barrier for a nil span.largeType, so the
GC will ignore the noscan span) but this might matter for user code on
weak memory architectures.

Change-Id: I06ac9b95863074e5f09382629083b19bfa87fdb8
Reviewed-on: https://go-review.googlesource.com/c/go/+/619036
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
6 months agoruntime: specialize heapSetType
Michael Anthony Knyszek [Fri, 20 Sep 2024 20:56:40 +0000 (20:56 +0000)]
runtime: specialize heapSetType

Last CL we separated mallocgc into several specialized paths. Let's
split up heapSetType too. This will make the specialized heapSetType
functions inlineable and cut out some branches as well as a function
call.

Microbenchmark results at this point in the stack:

                   │ before.out  │            after-5.out             │
                   │   sec/op    │   sec/op     vs base               │
Malloc8-4            13.52n ± 3%   12.15n ± 2%  -10.13% (p=0.002 n=6)
Malloc16-4           21.49n ± 2%   18.32n ± 4%  -14.75% (p=0.002 n=6)
MallocTypeInfo8-4    27.12n ± 1%   18.64n ± 2%  -31.30% (p=0.002 n=6)
MallocTypeInfo16-4   28.71n ± 3%   21.63n ± 5%  -24.65% (p=0.002 n=6)
geomean              21.81n        17.31n       -20.64%

Change-Id: I5de9ac5089b9eb49bf563af2a74e6dc564420e05
Reviewed-on: https://go-review.googlesource.com/c/go/+/614795
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
6 months agoruntime: refactor mallocgc into several independent codepaths
Michael Anthony Knyszek [Wed, 18 Sep 2024 21:17:03 +0000 (21:17 +0000)]
runtime: refactor mallocgc into several independent codepaths

Right now mallocgc is a monster of a function. In real programs, we see
that a substantial amount of time in mallocgc is spent in mallocgc
itself. It's very branch-y, holds a lot of state, and handles quite a few
disparate cases, trying to merge them together.

This change breaks apart mallocgc into separate, leaner functions.
There's some duplication now, but there are a lot of branches that can
be pruned as a result.

There's definitely still more we can do here. heapSetType can be inlined
and broken down for each case, since its internals roughly map to each
case anyway (done in a follow-up CL). We can probably also do more with
the size class lookups, since we know more about the size of the object
in each case than before.

Below are the savings for the full stack up until now.

                    │ after-3.out │              after-4.out              │
                    │   sec/op    │     sec/op      vs base               │
Malloc8-4             13.32n ± 2%   12.17n ±  1%     -8.63% (p=0.002 n=6)
Malloc16-4            21.64n ± 3%   19.38n ± 10%    -10.47% (p=0.002 n=6)
MallocTypeInfo8-4     23.15n ± 2%   19.91n ±  2%    -14.00% (p=0.002 n=6)
MallocTypeInfo16-4    25.86n ± 4%   22.48n ±  5%    -13.11% (p=0.002 n=6)
MallocLargeStruct-4                 270.0n ±   ∞ ¹
geomean               20.38n        30.97n          -11.58%

Change-Id: I681029c0b442f9221c4429950626f06299a5cfe4
Reviewed-on: https://go-review.googlesource.com/c/go/+/614257
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
6 months agoruntime: break out the debug.malloc codepaths into functions
Michael Anthony Knyszek [Thu, 3 Oct 2024 18:33:49 +0000 (18:33 +0000)]
runtime: break out the debug.malloc codepaths into functions

This change breaks out the debug.malloc codepaths into dedicated
functions, both for making mallocgc easier to read, and to reduce the
function's size (currently all that code is inlined and really doesn't
need to be).

This is a microoptimization that on its own changes very little, but
together with other optimizations and a breaking up of the various
malloc paths will matter all together ("death by a thousand cuts").

Change-Id: I30b3ab4a1f349ba85b4a1b5b2c399abcdfe4844f
Reviewed-on: https://go-review.googlesource.com/c/go/+/617879
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agoruntime: move debug checks behind constant flag in mallocgc
Michael Anthony Knyszek [Thu, 3 Oct 2024 18:30:15 +0000 (18:30 +0000)]
runtime: move debug checks behind constant flag in mallocgc

These debug checks are very occasionally helpful, but they do cost real
time. The biggest issue seems to be the bloat of mallocgc due to the
"throw" paths. Overall, after some follow-ups, this change cuts about
1ns off of the mallocgc fast path.

This is a microoptimization that on its own changes very little, but
together with other optimizations and a breaking up of the various
malloc paths will matter all together ("death by a thousand cuts").

Change-Id: I07c4547ad724b9f94281320846677fb558957721
Reviewed-on: https://go-review.googlesource.com/c/go/+/617878
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
6 months agoruntime: rename shouldhelpgc to checkGCTrigger in mallocgc
Michael Anthony Knyszek [Thu, 3 Oct 2024 18:27:01 +0000 (18:27 +0000)]
runtime: rename shouldhelpgc to checkGCTrigger in mallocgc

shouldhelpgc is a very unhelpful name, because it has nothing to do with
assists and solely to do with GC triggering. Name it checkGCTrigger
instead, which is much clearer.

Change-Id: Id38debd424ddb397376c0cea6e74b3fe94002f71
Reviewed-on: https://go-review.googlesource.com/c/go/+/617877
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
6 months agoruntime: recompute assistG before and after malloc
Michael Anthony Knyszek [Thu, 3 Oct 2024 18:22:46 +0000 (18:22 +0000)]
runtime: recompute assistG before and after malloc

This change stops tracking assistG across malloc to reduce number of
slots the compiler must keep track of in mallocgc, which adds to
register pressure. It also makes the call to deductAssistCredit only
happen if the GC is running.

This is a microoptimization that on its own changes very little, but
together with other optimizations and a breaking up of the various
malloc paths will matter all together ("death by a thousand cuts").

Change-Id: I4cfac7f3e8e873ba66ff3b553072737a4707e2c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/617876
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

6 months agoruntime: use wb flag instead of gcphase for allocate-black check
Michael Anthony Knyszek [Thu, 3 Oct 2024 18:18:11 +0000 (18:18 +0000)]
runtime: use wb flag instead of gcphase for allocate-black check

This is an allocator microoptimization. There's no reason to check
gcphase in general, since it's mostly for debugging anyway.
writeBarrier.enabled is set in all the same cases here, and we force one
fewer cache line (probably) to be touched during malloc.

Conceptually, it also makes a bit more sense. The allocate-black policy
is partly informed by the write barrier design.

Change-Id: Ia5ff593d64c29cf7f4d1bced3204056566444a98
Reviewed-on: https://go-review.googlesource.com/c/go/+/617875
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
6 months agoruntime: simplify mem profile checking in mallocgc
Michael Anthony Knyszek [Wed, 25 Sep 2024 16:51:52 +0000 (16:51 +0000)]
runtime: simplify mem profile checking in mallocgc

Checking whether the current allocation needs to be profiled is
currently branch-y and weirdly a lot of code. The branches are
generally predictable, but it's a surprising number of instructions.
Part of the problem is that MemProfileRate is just a global that can be
set at any time, so we need to load it and check certain settings
explicitly. In an ideal world, we would just always subtract from
nextSample and have a single branch to take the slow path if we
subtract below zero.

If MemProfileRate were a function, we could trash all the nextSample
values intentionally in each mcache. This would be slow, but
MemProfileRate changes rarely while the malloc hot path is well, hot.
Unfortunate...

Although this ideal world is, AFAICT, impossible, we can still get
close. If we cache the value of MemProfileRate in each mcache, then we
can force malloc to take the slow path whenever MemProfileRate changes.
This does require two additional loads, but crucially, these loads are
independent of everything else in mallocgc. Furthermore, the branch
dependent on those loads is incredibly predictable in practice.

This CL on its own has little-to-no impact on mallocgc. But this
codepath is going to be duplicated in several places in the next CL, so
it'll pay to simplify it. Also, we're very much trying to remedy a
death-by-a-thousand-cuts situation, and malloc is currently still kind
of a monster -- it will not help if mallocgc isn't really streamlined
itself.

Lastly, there's a nice property now that all nextSample values get
immediately re-sampled when MemProfileRate changes.

Change-Id: I6443d0cf9bd7861595584442b675ac1be8ea3455
Reviewed-on: https://go-review.googlesource.com/c/go/+/615815
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
6 months agoencoding/xml: document that embedded interfaces look like non-embedded ones
Sean Liao [Sun, 20 Oct 2024 09:46:03 +0000 (10:46 +0100)]
encoding/xml: document that embedded interfaces look like non-embedded ones

Fixes #69941

Change-Id: Icc3c88d57c14fa9ca203c693d67f144686fed8cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/621076
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>
6 months agoruntime: optimize 8-byte allocation pointer data writing
Michael Anthony Knyszek [Wed, 18 Sep 2024 02:38:45 +0000 (02:38 +0000)]
runtime: optimize 8-byte allocation pointer data writing

This change brings back a minor optimization lost in the Go 1.22 cycle
wherein the 8-byte pointer-ful span class spans would have the pointer
bitmap written ahead of time in bulk, because there's only one possible
pattern.

                  │   before    │               after               │
                  │   sec/op    │   sec/op     vs base              │
MallocTypeInfo8-4   25.13n ± 1%   23.59n ± 2%  -6.15% (p=0.002 n=6)

Change-Id: I135b84bb1d5b7e678b841b56430930bc73c0a038
Reviewed-on: https://go-review.googlesource.com/c/go/+/614256
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agoruntime: don't call span.heapBits in writeHeapBitsSmall
Michael Anthony Knyszek [Wed, 18 Sep 2024 01:58:50 +0000 (01:58 +0000)]
runtime: don't call span.heapBits in writeHeapBitsSmall

For whatever reason, span.heapBits is kind of slow. It accounts for
about a quarter of the cost of writeHeapBitsSmall, which is absurd. We
get a nice speed improvement for small allocations by eliminating this
call.

                   │   before    │               after               │
                   │   sec/op    │   sec/op     vs base              │
MallocTypeInfo16-4   29.47n ± 1%   27.02n ± 1%  -8.31% (p=0.002 n=6)

Change-Id: I6270e26902e5a9254cf1503fac81c3c799c59d6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/614255
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

6 months agocmd/compile,internal/runtime/maps: add extendible hashing
Michael Pratt [Wed, 7 Aug 2024 17:02:43 +0000 (13:02 -0400)]
cmd/compile,internal/runtime/maps: add extendible hashing

Extendible hashing splits a swisstable map into many swisstables. This
keeps grow operations small.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-amd64-longtest-swissmap
Change-Id: Id91f34af9e686bf35eb8882ee479956ece89e821
Reviewed-on: https://go-review.googlesource.com/c/go/+/604936
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
6 months agocmd/asm: add position to PCALIGN directives
Paul E. Murphy [Wed, 16 Oct 2024 15:55:39 +0000 (10:55 -0500)]
cmd/asm: add position to PCALIGN directives

This allows PCALIGN to be used in the end-to-end assembly
tests without causing an error due to missing file position.

Change-Id: Iadea2875854ffd544a963acd21293dc9840da2d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/620635
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>
6 months agoruntime: revise the documentation comments for netpoll
Shuo Wang [Fri, 18 Oct 2024 02:51:35 +0000 (02:51 +0000)]
runtime: revise the documentation comments for netpoll

Supplement to CL 511455.

Updates #61454

Change-Id: I111cbf297dd9159cffba333d610a7a4542915c55
GitHub-Last-Rev: fe8fa184868d665a4d08d534d3bfb5ea446d12c0
GitHub-Pull-Request: golang/go#69900
Reviewed-on: https://go-review.googlesource.com/c/go/+/620495
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
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>
6 months agosyscall: skip TestSetuidEtc when root's gid is not 0
Shuo Wang [Fri, 18 Oct 2024 02:37:57 +0000 (02:37 +0000)]
syscall: skip TestSetuidEtc when root's gid is not 0

When the root user belongs to a special user group
(for example, in a mock environment), TestSetuidEtc will fail.

For example: Setegid(1)
want:"Gid: 0 1 0 1"
got:"Gid: 1001 1 1001 1"

Fixes #69921

Change-Id: I74d0a006b7529b1b569120a067eb4d7c4ed2e491
GitHub-Last-Rev: 5724383eb134c8a5c2a4a5ed67e2d3999073b98b
GitHub-Pull-Request: golang/go#69922
Reviewed-on: https://go-review.googlesource.com/c/go/+/620775
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
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>

6 months agocmd/link: check if the trampoline is actually added
limeidan [Thu, 21 Mar 2024 03:20:58 +0000 (11:20 +0800)]
cmd/link: check if the trampoline is actually added

Change-Id: I2ddffe9118fd9954d9bae60c92fd8fc5b311b93a
Reviewed-on: https://go-review.googlesource.com/c/go/+/603736
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
6 months agogo/ast: document invalid raw string literal end position containing carriage returns
Mateusz Poliwczak [Sat, 12 Oct 2024 17:34:52 +0000 (17:34 +0000)]
go/ast: document invalid raw string literal end position containing carriage returns

Fixes #69861

Change-Id: Id1684ee7d0c04262119d9e61f914bb9ecc0ef438
GitHub-Last-Rev: 5ad182c51aeb8b26631c6a97a7e9a2d89405ec06
GitHub-Pull-Request: golang/go#69862
Reviewed-on: https://go-review.googlesource.com/c/go/+/619835
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
6 months agoruntime: more thorough map benchmarks
Michael Pratt [Fri, 28 Jun 2024 17:15:48 +0000 (17:15 +0000)]
runtime: more thorough map benchmarks

Based on the benchmarks in github.com/cockroachlabs/swiss.

For #54766.

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

6 months agointernal/runtime/atomic: add Xchg8 for 386
Mauri de Souza Meneguzzo [Thu, 17 Oct 2024 12:57:26 +0000 (12:57 +0000)]
internal/runtime/atomic: add Xchg8 for 386

For #69735

Change-Id: I5b9f57315d693d613dc88dc02c10bee39aeeef76
GitHub-Last-Rev: 690337e5b81a48bdcb808526d0c5f4837e8912b7
GitHub-Pull-Request: golang/go#69923
Reviewed-on: https://go-review.googlesource.com/c/go/+/620756
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
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>
6 months agoruntime/testdata: fix for C23 nullptr keyword
Joseph Myers [Thu, 17 Oct 2024 20:30:37 +0000 (20:30 +0000)]
runtime/testdata: fix for C23 nullptr keyword

src/runtime/testdata/testprogcgo/threadprof.go contains C code with a
variable called nullptr.  This conflicts with the nullptr keyword in
the C23 revision of the C standard (showing up as gccgo test build
failures when updating GCC to use C23 by default when building C
code).

Rename that variable to nullpointer to avoid the clash with the
keyword (any other name that's not a keyword would work just as well).

Change-Id: Ida5ef371a3f856c611409884e185c3d5ded8e86c
GitHub-Last-Rev: 2ec464703be0507a67a077741789a37511d197e4
GitHub-Pull-Request: golang/go#69927
Reviewed-on: https://go-review.googlesource.com/c/go/+/620955
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>
6 months agoos: add precondition doc for Create and OpenFile
xieyuschen [Fri, 11 Oct 2024 04:45:11 +0000 (12:45 +0800)]
os: add precondition doc for Create and OpenFile

Fixes #69836

Change-Id: Ide243c2aa9c6f9d45976f728f97e32c4fbadb720
Reviewed-on: https://go-review.googlesource.com/c/go/+/619316
Reviewed-by: Ian Lance Taylor <iant@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: Dmitri Shuralyov <dmitshur@google.com>
6 months agocmd/compile: omit saved .closureptr in optimized code
David Chase [Mon, 14 Oct 2024 16:51:29 +0000 (12:51 -0400)]
cmd/compile: omit saved .closureptr in optimized code

This worsens debugging, but improves performance.

Change-Id: I7f3c0d174823b3de412478f9537adc61ae4c076e
Reviewed-on: https://go-review.googlesource.com/c/go/+/620219
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>
6 months agosyscall: keep write access when O_TRUNC is used on Windows
qmuntal [Wed, 16 Oct 2024 14:18:45 +0000 (16:18 +0200)]
syscall: keep write access when O_TRUNC is used on Windows

CL 618836 introduces a regression where O_APPEND and O_TRUNC could
not be used together on Windows.

This CL fixes the issue by keeping the write access when O_TRUNC is used
, which is required when overwriting data (as per the file
access rights docs: https://learn.microsoft.com/en-us/windows/win32/fileio/file-access-rights-constants).

Fixes #69902.

Change-Id: I77ec60ca6929124dd4490bdad6c3280c4db3efcb
Reviewed-on: https://go-review.googlesource.com/c/go/+/620575
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
6 months agocmd/compile: add patterns for bitfield opcodes on loong64
Xiaolin Zhao [Wed, 14 Aug 2024 09:11:08 +0000 (17:11 +0800)]
cmd/compile: add patterns for bitfield opcodes on loong64

goos: linux
goarch: loong64
pkg: math/bits
cpu: Loongson-3A6000 @ 2500.00MHz
                |  bench.old   |              bench.new               |
                |    sec/op    |    sec/op     vs base                |
LeadingZeros      1.0095n ± 0%   0.8011n ± 0%  -20.64% (p=0.000 n=10)
LeadingZeros8      1.201n ± 0%    1.167n ± 0%   -2.83% (p=0.000 n=10)
LeadingZeros16     1.201n ± 0%    1.167n ± 0%   -2.83% (p=0.000 n=10)
LeadingZeros32     1.201n ± 0%    1.134n ± 0%   -5.58% (p=0.000 n=10)
LeadingZeros64    0.8007n ± 0%   1.0115n ± 0%  +26.32% (p=0.000 n=10)
TrailingZeros     0.8054n ± 0%   0.8106n ± 1%   +0.65% (p=0.000 n=10)
TrailingZeros8     1.067n ± 0%    1.002n ± 1%   -6.09% (p=0.000 n=10)
TrailingZeros16   1.0540n ± 0%   0.8389n ± 0%  -20.40% (p=0.000 n=10)
TrailingZeros32   0.8014n ± 0%   0.8117n ± 0%   +1.29% (p=0.000 n=10)
TrailingZeros64   0.8015n ± 0%   0.8124n ± 1%   +1.36% (p=0.000 n=10)
OnesCount          3.418n ± 0%    3.417n ± 0%        ~ (p=0.911 n=10)
OnesCount8        0.8004n ± 0%   0.8004n ± 0%        ~ (p=1.000 n=10)
OnesCount16        1.440n ± 0%    1.299n ± 0%   -9.79% (p=0.000 n=10)
OnesCount32        2.969n ± 0%    2.940n ± 0%   -0.94% (p=0.000 n=10)
OnesCount64        3.563n ± 0%    3.558n ± 0%   -0.14% (p=0.000 n=10)
RotateLeft        0.6677n ± 0%   0.6670n ± 0%        ~ (p=0.055 n=10)
RotateLeft8        1.318n ± 1%    1.321n ± 0%        ~ (p=0.117 n=10)
RotateLeft16      0.8457n ± 1%   0.8442n ± 0%        ~ (p=0.325 n=10)
RotateLeft32      0.8004n ± 0%   0.8004n ± 0%        ~ (p=0.837 n=10)
RotateLeft64      0.6678n ± 0%   0.6670n ± 0%   -0.13% (p=0.000 n=10)
Reverse           0.8004n ± 0%   0.8004n ± 0%        ~ (p=1.000 n=10)
Reverse8          0.6989n ± 0%   0.6969n ± 1%        ~ (p=0.138 n=10)
Reverse16         0.6998n ± 1%   0.7004n ± 1%        ~ (p=0.985 n=10)
Reverse32         0.4158n ± 1%   0.4159n ± 1%        ~ (p=0.870 n=10)
Reverse64         0.4165n ± 1%   0.4194n ± 2%        ~ (p=0.093 n=10)
ReverseBytes      0.8004n ± 0%   0.8004n ± 0%        ~ (p=1.000 n=10)
ReverseBytes16    0.4183n ± 2%   0.4148n ± 1%        ~ (p=0.055 n=10)
ReverseBytes32    0.4143n ± 2%   0.4153n ± 1%        ~ (p=0.869 n=10)
ReverseBytes64    0.4168n ± 1%   0.4177n ± 1%        ~ (p=0.184 n=10)
Add                1.201n ± 0%    1.201n ± 0%        ~ (p=0.087 n=10)
Add32              1.603n ± 0%    1.601n ± 0%   -0.12% (p=0.000 n=10)
Add64              1.201n ± 0%    1.201n ± 0%        ~ (p=0.211 n=10)
Add64multiple      1.839n ± 0%    1.835n ± 0%   -0.24% (p=0.001 n=10)
Sub                1.202n ± 0%    1.201n ± 0%   -0.04% (p=0.033 n=10)
Sub32              2.401n ± 0%    1.601n ± 0%  -33.32% (p=0.000 n=10)
Sub64              1.201n ± 0%    1.201n ± 0%        ~ (p=1.000 n=10)
Sub64multiple      2.105n ± 0%    2.096n ± 0%   -0.40% (p=0.000 n=10)
Mul               0.8008n ± 0%   0.8004n ± 0%   -0.05% (p=0.000 n=10)
Mul32             0.8041n ± 0%   0.8014n ± 0%   -0.34% (p=0.000 n=10)
Mul64             0.8008n ± 0%   0.8004n ± 0%   -0.05% (p=0.000 n=10)
Div                8.977n ± 0%    8.945n ± 0%   -0.36% (p=0.000 n=10)
Div32              4.084n ± 0%    4.086n ± 0%        ~ (p=0.445 n=10)
Div64              9.316n ± 0%    9.301n ± 0%   -0.17% (p=0.000 n=10)
geomean            1.141n         1.117n        -2.09%

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

6 months agocmd/compile: optimize loong64 with register indexed load/store
Xiaolin Zhao [Thu, 26 Sep 2024 06:17:17 +0000 (14:17 +0800)]
cmd/compile: optimize loong64 with register indexed load/store

goos: linux
goarch: loong64
pkg: test/bench/go1
cpu: Loongson-3A6000 @ 2500.00MHz
                      |  bench.old  |              bench.new              |
                      |   sec/op    |   sec/op     vs base                |
BinaryTree17             7.766 ± 1%    7.640 ± 2%   -1.62% (p=0.000 n=20)
Fannkuch11               2.649 ± 0%    2.358 ± 0%  -10.96% (p=0.000 n=20)
FmtFprintfEmpty         35.89n ± 0%   35.87n ± 0%   -0.06% (p=0.000 n=20)
FmtFprintfString        59.44n ± 0%   57.25n ± 2%   -3.68% (p=0.000 n=20)
FmtFprintfInt           62.07n ± 0%   60.04n ± 0%   -3.27% (p=0.000 n=20)
FmtFprintfIntInt        97.90n ± 0%   97.26n ± 0%   -0.65% (p=0.000 n=20)
FmtFprintfPrefixedInt   116.7n ± 0%   119.2n ± 0%   +2.14% (p=0.000 n=20)
FmtFprintfFloat         204.5n ± 0%   201.9n ± 0%   -1.30% (p=0.000 n=20)
FmtManyArgs             455.9n ± 0%   466.8n ± 0%   +2.39% (p=0.000 n=20)
GobDecode               7.458m ± 1%   7.138m ± 1%   -4.28% (p=0.000 n=20)
GobEncode               8.573m ± 1%   8.473m ± 1%        ~ (p=0.091 n=20)
Gzip                    280.2m ± 0%   284.9m ± 0%   +1.67% (p=0.000 n=20)
Gunzip                  32.68m ± 0%   32.67m ± 0%        ~ (p=0.211 n=20)
HTTPClientServer        54.22µ ± 0%   53.24µ ± 0%   -1.80% (p=0.000 n=20)
JSONEncode              9.427m ± 1%   9.152m ± 0%   -2.92% (p=0.000 n=20)
JSONDecode              47.08m ± 1%   46.85m ± 1%   -0.49% (p=0.007 n=20)
Mandelbrot200           4.601m ± 0%   4.605m ± 0%   +0.08% (p=0.000 n=20)
GoParse                 4.776m ± 0%   4.655m ± 1%   -2.52% (p=0.000 n=20)
RegexpMatchEasy0_32     59.77n ± 0%   57.59n ± 0%   -3.66% (p=0.000 n=20)
RegexpMatchEasy0_1K     458.1n ± 0%   458.8n ± 0%   +0.15% (p=0.000 n=20)
RegexpMatchEasy1_32     59.36n ± 0%   59.24n ± 0%   -0.20% (p=0.000 n=20)
RegexpMatchEasy1_1K     557.7n ± 0%   560.2n ± 0%   +0.46% (p=0.000 n=20)
RegexpMatchMedium_32    803.1n ± 0%   772.8n ± 0%   -3.77% (p=0.000 n=20)
RegexpMatchMedium_1K    27.29µ ± 0%   25.88µ ± 0%   -5.18% (p=0.000 n=20)
RegexpMatchHard_32      1.385µ ± 0%   1.304µ ± 0%   -5.85% (p=0.000 n=20)
RegexpMatchHard_1K      40.92µ ± 0%   39.58µ ± 0%   -3.27% (p=0.000 n=20)
Revcomp                 474.3m ± 0%   410.0m ± 0%  -13.56% (p=0.000 n=20)
Template                78.16m ± 0%   76.32m ± 1%   -2.36% (p=0.000 n=20)
TimeParse               271.8n ± 0%   272.1n ± 0%   +0.11% (p=0.000 n=20)
TimeFormat              292.3n ± 0%   294.8n ± 0%   +0.86% (p=0.000 n=20)
geomean                 51.98µ        50.82µ        -2.22%

Change-Id: Ia78f1ddee8f1d9ec7192a4b8d2a4ec6058679956
Reviewed-on: https://go-review.googlesource.com/c/go/+/615918
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
6 months agotime: correct time.AppendText's error message
apocelipes [Wed, 16 Oct 2024 21:00:17 +0000 (21:00 +0000)]
time: correct time.AppendText's error message

"time.AppendText" returns error messages that start with the prefix
"time.MarshalText: " which seems confusion.

Now correct the message prefix to "time.AppendText: " and add a test
to prevent regression.

Change-Id: I5742c9c3ed802eb79c65d459910deae4f3652ffd
GitHub-Last-Rev: ce965595c1dafab4a3db3d3f9f9edc9e43c5dea2
GitHub-Pull-Request: golang/go#69914
Reviewed-on: https://go-review.googlesource.com/c/go/+/620597
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>

6 months agogo/internal/gcimporter: drop indexed import
Alan Donovan [Mon, 14 Oct 2024 17:05:55 +0000 (13:05 -0400)]
go/internal/gcimporter: drop indexed import

The compiler hasn't emitted indexed export data files since go1.19,
so this code, which is only statically reachable from
go/importer.For("gc") aka importer.Default(), is not dynamically
reachable since those files will not be in indexed format.

Updates #68898

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

6 months agostrconv: display format options as list
Sean Liao [Tue, 15 Oct 2024 23:51:22 +0000 (00:51 +0100)]
strconv: display format options as list

Fixes #69890

Change-Id: I1da4eb76c008679a687f4faa4294fe32b5fc7f42
Reviewed-on: https://go-review.googlesource.com/c/go/+/620236
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agocrypto/tls: include close notify in client tls test recordings
Ryan Granger [Fri, 11 Oct 2024 16:53:56 +0000 (16:53 +0000)]
crypto/tls: include close notify in client tls test recordings

This commit fixes the issue where tls testdata recordings made with the
newer version of the prerecorded tls conversation test harness, doesn't
end up capturing the final close notify message. The fix simply ensures
that the tls.Client closes before the recording of the conversation is
closed. The closing of the client connection directly is no longer
needed when updating the recording since it will be closed when the
tls.Client is closed.

Fixes golang/go#69846

Change-Id: I93898de32abd89659a32ed240df6daea5aeaa7fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/620395
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agoos: use relative paths in a test dir in TestOpenError
Damien Neil [Mon, 14 Oct 2024 22:30:13 +0000 (15:30 -0700)]
os: use relative paths in a test dir in TestOpenError

Refactor TestOpenError to use relative paths in test cases,
in preparation for extending it to test os.Root.

Use a test temporary directory instead of system directory
with presumed-known contents.

Move the testcase type and case definitions inline with the test.

For #67002

Change-Id: Idc53dd9fcecf763d3e4eb3b4643032e3003d7ef4
Reviewed-on: https://go-review.googlesource.com/c/go/+/620157
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agotimer: fix Stop link in Timer.Reset doc comment
Robert Pająk [Mon, 14 Oct 2024 20:30:20 +0000 (20:30 +0000)]
timer: fix Stop link in Timer.Reset doc comment

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

6 months agointernal/syscall/windows: fix handle leak in Mkdirat
qmuntal [Mon, 14 Oct 2024 19:32:40 +0000 (21:32 +0200)]
internal/syscall/windows: fix handle leak in Mkdirat

Mkdirat does not close the handle returned by CreateFile, but it should.

Mkdirat has been introduced in this developer cycle, so it is not
necessary to backport this fix to any release branch.

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

6 months agoruntime: clarify work.bytesMarked documentation
Austin Clements [Thu, 10 Oct 2024 18:20:45 +0000 (14:20 -0400)]
runtime: clarify work.bytesMarked documentation

Change-Id: If5132400aac0ef00e467958beeaab5e64d053d10
Reviewed-on: https://go-review.googlesource.com/c/go/+/619099
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agoall: wire up swisstable maps
Michael Pratt [Fri, 3 May 2024 17:03:04 +0000 (13:03 -0400)]
all: wire up swisstable maps

Use the new SwissTable-based map in internal/runtime/maps as the basis
for the runtime map when GOEXPERIMENT=swissmap.

Integration is complete enough to pass all.bash. Notable missing
features:

* Race integration / concurrent write detection
* Stack-allocated maps
* Specialized "fast" map variants
* Indirect key / elem

For #54766.

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

6 months agoruntime: don't frob isSending for tickers
Ian Lance Taylor [Mon, 14 Oct 2024 18:46:17 +0000 (11:46 -0700)]
runtime: don't frob isSending for tickers

The Ticker Stop and Reset methods don't report a value,
so we don't need to track whether they are interrupting a send.

This includes a test that used to fail about 2% of the time on
my laptop when run under x/tools/cmd/stress.

Change-Id: Ic6d14b344594149dd3c24b37bbe4e42e83f9a9ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/620136
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
6 months agocmd/cgo/internal/testsanitizers: correct comment in tsan test
zhangjian [Sun, 13 Oct 2024 12:10:10 +0000 (12:10 +0000)]
cmd/cgo/internal/testsanitizers: correct comment in tsan test

Change-Id: Id22ad7c92c54bc61f1f1d5544f17208f2f8648aa
GitHub-Last-Rev: 61eee331dc2da16358425440e5630117f45d5182
GitHub-Pull-Request: golang/go#69866
Reviewed-on: https://go-review.googlesource.com/c/go/+/619836
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>
6 months agocmd/cgo,cmd/go: preallocate slices if they have known fixed capacities
apocelipes [Fri, 11 Oct 2024 03:22:00 +0000 (03:22 +0000)]
cmd/cgo,cmd/go: preallocate slices if they have known fixed capacities

This allows for more efficient use of memory.

Change-Id: I16f399a25c23b804e55289ca055fa83ea9862f16
GitHub-Last-Rev: 19bb96a7cf4d27c085cfdb074905c4bf34eb660d
GitHub-Pull-Request: golang/go#69841
Reviewed-on: https://go-review.googlesource.com/c/go/+/618960
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>