1
0
mirror of https://github.com/golang/go synced 2024-11-15 06:00:30 -07:00
Commit Graph

61355 Commits

Author SHA1 Message Date
Adam
f7a14ae0cd math/big: properly linkify a reference
Change-Id: Ie7649060db25f1573eeaadd534a600bb24d30572
GitHub-Last-Rev: c617848a4e
GitHub-Pull-Request: golang/go#70134
Reviewed-on: https://go-review.googlesource.com/c/go/+/623757
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-10-31 19:23:59 +00:00
Xiaolin Zhao
ac396b4b91 all: update golang.org/x/sys to v0.26.0
Commands run (in both src and src/cmd):
	go get golang.org/x/sys@v0.26.0
	go mod tidy
	go mod vendor

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

Change-Id: I122bb3a3bc97610ba71c52263b99c56e3354b59d
Reviewed-on: https://go-review.googlesource.com/c/go/+/623855
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2024-10-31 19:23:01 +00:00
George Adams
325ee1ce3d os: fix findOneDriveDir to expand REG_SZ registry values
On some Windows systems the SOFTWARE\Microsoft\OneDrive registry key is REG_SZ rather than REG_EXPAND_SZ.

Change-Id: I3ccb8771377a73456f48da1b5cfae668130b3f7b
Reviewed-on: https://go-review.googlesource.com/c/go/+/623515
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
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: Carlos Amedee <carlos@golang.org>
2024-10-31 19:21:20 +00:00
Michael Pratt
99d60c24e2 all: enable GOEXPERIMENT=swissmap by default
For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-linux-amd64-longtest-race,gotip-linux-arm64-longtest,gotip-linux-386-longtest,gotip-darwin-amd64-longtest,gotip-darwin-arm64_13,gotip-linux-ppc64_power10,gotip-linux-arm
Change-Id: I5db0edcc156ed2e4bedc036b0baba2669e10c87a
Reviewed-on: https://go-review.googlesource.com/c/go/+/594597
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>
2024-10-31 17:43:00 +00:00
Ian Lance Taylor
2bb820fd5b cmd/go: if GOPATH and GOROOT are the same, refer to wiki page
This gives us a place to clarify what the problem is
and how people should fix it.

For #65656
Fixes #70093

Change-Id: I555399c52e9b72a7a66f0bd38df178c0efad6c27
Reviewed-on: https://go-review.googlesource.com/c/go/+/623815
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-31 17:19:47 +00:00
Mauri de Souza Meneguzzo
5dbb0a5c6b internal/runtime/atomic: fix uintptr usage in arm And8/Or8
In CL 622075, I introduced code that violated unsafe.Pointer rules
by casting to uintptr and back across statements. This change corrects it.

Change-Id: Ib6f6c08d9ce33aaeaf41f390c7e9f13a7b8cb974
GitHub-Last-Rev: 01cc68a87c
GitHub-Pull-Request: golang/go#70129
Cq-Include-Trybots: luci.golang.try:gotip-linux-arm
Reviewed-on: https://go-review.googlesource.com/c/go/+/623755
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2024-10-31 16:57:53 +00:00
Hao Liu
6d39245514 cmd/internal/obj/arm64: make sure prologue and epilogue are pattern matched for small frames
CL 379075 implemented function prologue/epilogue with STP/LDP.
To fix issue #53374, CL 412474 reverted the prologue STP change for
small frames, and the LDP in epilogue was kept. The current instructions
are:

  prologue:
    MOVD.W	R30, -offset(RSP)
    MOVD	R29, -8(RSP)
  epilogue:
    LDP		-8(RSP), (R29, R30)
    ADD		$offset, RSP, RSP

It seems a bit strange, as:

1) The prolog and epilogue are not in the same pattern (either STR-LDR,
   or STP-LDP).
2) Go Internal ABI defines that R30 is saved at 0(RSP) and R29 is saved
   at -8(RSP), so we can not use a single STP.W/LDP.P to save/restore
   LR&FP and adjust SP. Changing the ABI causes too much complexity,
   and the benefit is not that big.

This patch reverts the small frames' epilogue change in CL 379075. It
converts LDP in the epilogue to LDR-LDR. Another solution is to re-apply
the STP change in prologue, which requires to fix #53609. This seems the
easier and safer solution in the mean time. The new instructions are:

  prologue:
    MOVD.W	R30, -offset(RSP)
    MOVD	R29, -8(RSP)
  epilogue:
    MOVD	-8(RSP), R29
    MOVD.P	offset(RSP), R30

The current pattern may cause performance issues in Store-Forwarding on
micro-architectures like AmpereOne. Assuming a function call in the
middle of such code is short enough that the stores are still around,
then the LDP executes and it may wait longer to get the results from
separated stores in Store Buffers other than single STP.

Store-Forwarding aims to improve the efficiency of the processor by
allowing data to be forwarded directly from a store operation to a
subsequent load operation when certain conditions are met. See the
paper: "Memory Barriers: a Hardware View for Software Hackers"
(chapter 3.2: Store Forwarding).

The performance of following ARM64 Linux servers were tested:

1) AmpereOne (ARM v8.6+) from Ampere Computing.
2) Ampere Altra (ARM Neoverse N1) from Ampere Computing.
3) Graviton2 (ARM Neoverse N1) from AWS.

The effect of this change depends the hardware implementation of
store-forwarding. It can obviously improve AmpereOne, especially for
small functions that are frequently called and returned quickly.
E.g., JSON Marshal/Unmarshal benchmarks on AmpereOne:

    goos: linux
    goarch: arm64
    pkg: encoding/json
                             │ ampere-one.base │            ampere-one.new            │
                             │     sec/op      │    sec/op     vs base                │
    CodeMarshal-8                 882.1µ ±  1%   779.6µ ±  1%  -11.62% (p=0.000 n=10)
    CodeMarshalError-8            961.5µ ±  0%   855.7µ ±  1%  -11.01% (p=0.000 n=10)
    MarshalBytes/32-8             207.6n ±  1%   187.8n ±  0%   -9.52% (p=0.000 n=10)
    MarshalBytes/256-8            501.0n ±  1%   482.6n ±  1%   -3.68% (p=0.000 n=10)
    MarshalBytes/4096-8           5.336µ ±  1%   5.074µ ±  1%   -4.92% (p=0.000 n=10)
    MarshalBytesError/32-8        242.3µ ±  2%   205.7µ ±  3%  -15.08% (p=0.000 n=10)
    MarshalBytesError/256-8       242.4µ ±  1%   205.2µ ±  2%  -15.35% (p=0.000 n=10)
    MarshalBytesError/4096-8      247.9µ ±  0%   210.1µ ±  1%  -15.24% (p=0.000 n=10)
    MarshalMap-8                  150.8n ±  1%   145.7n ±  0%   -3.35% (p=0.000 n=10)
    EncodeMarshaler-8             50.30n ± 26%   54.48n ±  6%        ~ (p=0.739 n=10)
    CodeUnmarshal-8               4.796m ±  2%   4.055m ±  1%  -15.45% (p=0.000 n=10)
    CodeUnmarshalReuse-8          4.260m ±  1%   3.496m ±  1%  -17.94% (p=0.000 n=10)
    UnmarshalString-8             73.89n ±  1%   65.83n ±  1%  -10.91% (p=0.000 n=10)
    UnmarshalFloat64-8            60.63n ±  1%   58.66n ± 25%        ~ (p=0.143 n=10)
    UnmarshalInt64-8              55.62n ±  1%   53.25n ± 22%        ~ (p=0.468 n=10)
    UnmarshalMap-8                255.3n ±  1%   230.3n ±  1%   -9.77% (p=0.000 n=10)
    UnmarshalNumber-8             467.2n ±  1%   367.0n ±  0%  -21.43% (p=0.000 n=10)
    geomean                       6.224µ         5.605µ         -9.94%

Other ARM64 micro-architectures may be not affected so much by such
issue. E.g., benchmarks on Ampere Altra and Graviton2 show slight
improvements:

                             │ altra.base  │             altra.new              │
                             │   sec/op    │   sec/op     vs base               │
    CodeMarshal-8              980.1µ ± 1%   977.3µ ± 1%       ~ (p=0.912 n=10)
    CodeMarshalError-8         1.109m ± 3%   1.096m ± 5%       ~ (p=0.971 n=10)
    MarshalBytes/32-8          246.8n ± 1%   245.4n ± 0%  -0.55% (p=0.002 n=10)
    MarshalBytes/256-8         590.9n ± 1%   606.6n ± 1%  +2.67% (p=0.000 n=10)
    MarshalBytes/4096-8        6.351µ ± 1%   6.376µ ± 1%       ~ (p=0.183 n=10)
    MarshalBytesError/32-8     245.3µ ± 2%   246.1µ ± 2%       ~ (p=0.684 n=10)
    MarshalBytesError/256-8    245.5µ ± 1%   248.7µ ± 2%       ~ (p=0.218 n=10)
    MarshalBytesError/4096-8   254.2µ ± 1%   254.9µ ± 1%       ~ (p=0.481 n=10)
    MarshalMap-8               152.7n ± 2%   151.5n ± 3%       ~ (p=0.782 n=10)
    EncodeMarshaler-8          45.95n ± 7%   42.88n ± 5%  -6.70% (p=0.014 n=10)
    CodeUnmarshal-8            5.121m ± 4%   5.125m ± 3%       ~ (p=0.579 n=10)
    CodeUnmarshalReuse-8       4.616m ± 3%   4.634m ± 2%       ~ (p=0.529 n=10)
    UnmarshalString-8          72.12n ± 2%   72.20n ± 2%       ~ (p=0.912 n=10)
    UnmarshalFloat64-8         64.44n ± 5%   63.20n ± 4%       ~ (p=0.393 n=10)
    UnmarshalInt64-8           61.49n ± 2%   58.14n ± 4%  -5.45% (p=0.002 n=10)
    UnmarshalMap-8             263.6n ± 2%   266.2n ± 1%       ~ (p=0.196 n=10)
    UnmarshalNumber-8          464.7n ± 1%   464.0n ± 0%       ~ (p=0.566 n=10)
    geomean                    6.617µ        6.575µ       -0.64%

                             │ graviton2.base │            graviton2.new            │
                             │     sec/op     │    sec/op     vs base               │
    CodeMarshal-8                1.122m ±  0%   1.118m ±  1%       ~ (p=0.052 n=10)
    CodeMarshalError-8           1.216m ±  1%   1.214m ±  0%       ~ (p=0.631 n=10)
    MarshalBytes/32-8            289.9n ±  0%   280.8n ±  0%  -3.17% (p=0.000 n=10)
    MarshalBytes/256-8           675.9n ±  0%   664.7n ±  0%  -1.66% (p=0.000 n=10)
    MarshalBytes/4096-8          6.884µ ±  0%   6.885µ ±  0%       ~ (p=0.565 n=10)
    MarshalBytesError/32-8       293.1µ ±  2%   288.9µ ±  2%       ~ (p=0.123 n=10)
    MarshalBytesError/256-8      296.0µ ±  3%   289.0µ ±  1%  -2.36% (p=0.019 n=10)
    MarshalBytesError/4096-8     300.4µ ±  1%   295.6µ ±  0%  -1.60% (p=0.000 n=10)
    MarshalMap-8                 168.8n ±  1%   168.8n ±  1%       ~ (p=1.000 n=10)
    EncodeMarshaler-8            53.77n ±  8%   50.05n ± 12%       ~ (p=0.579 n=10)
    CodeUnmarshal-8              5.875m ±  2%   5.882m ±  1%       ~ (p=0.796 n=10)
    CodeUnmarshalReuse-8         5.383m ±  1%   5.366m ±  0%       ~ (p=0.631 n=10)
    UnmarshalString-8            74.59n ±  1%   73.99n ±  0%  -0.80% (p=0.001 n=10)
    UnmarshalFloat64-8           68.52n ±  7%   64.19n ± 18%       ~ (p=0.868 n=10)
    UnmarshalInt64-8             65.32n ± 13%   62.24n ±  8%       ~ (p=0.138 n=10)
    UnmarshalMap-8               290.1n ±  0%   291.3n ±  0%  +0.43% (p=0.010 n=10)
    UnmarshalNumber-8            514.4n ±  0%   499.4n ±  0%  -2.93% (p=0.000 n=10)
    geomean                      7.459µ         7.317µ        -1.91%

Change-Id: If27386fc5f514b76bdaf2012c2ce86cc65f7ca5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/621775
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-31 01:28:37 +00:00
Damien Neil
4efd519165 internal/poll: avoid overflow in sendfile limit, simplify Solaris
Avoid integer overflow when passing a number of bytes to sendfile.

Also, Solaris might not support passing a 0 length to read to
the end of a file, but it does support passing a very large length.
So just do that instead of looking up the source file size.

Change-Id: Ibf750892938d9e2bafb1256c6e380c88899495f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/623315
TryBot-Bypass: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-10-30 20:15:22 +00:00
Damien Neil
0fd414c652 internal/poll: handle (0, EINVAL) return from sendfile on Solaris
Also check for GOOS=illumos as well as GOOS=solaris.

Change-Id: I887e6cddc1b8ad0f4624c9491e089c6bb8bce70e
Reviewed-on: https://go-review.googlesource.com/c/go/+/622977
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>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-10-30 19:53:06 +00:00
Cherry Mui
76a8409eb8 runtime: update and restore g0 stack bounds at cgocallback
Currently, at a cgo callback where there is already a Go frame on
the stack (i.e. C->Go->C->Go), we require that at the inner Go
callback the SP is within the g0's stack bounds set by a previous
callback. This is to prevent that the C code switches stack while
having a Go frame on the stack, which we don't really support. But
this could also happen when we cannot get accurate stack bounds,
e.g. when pthread_getattr_np is not available. Since the stack
bounds are just estimates based on the current SP, if there are
multiple C->Go callbacks with various stack depth, it is possible
that the SP of a later callback falls out of a previous call's
estimate. This leads to runtime throw in a seemingly reasonable
program.

This CL changes it to save the old g0 stack bounds at cgocallback,
update the bounds, and restore the old bounds at return. So each
callback will get its own stack bounds based on the current SP,
and when it returns, the outer callback has the its old stack
bounds restored.

Also, at a cgo callback when there is no Go frame on the stack,
we currently always get new stack bounds. We do this because if
we can only get estimated bounds based on the SP, and the stack
depth varies a lot between two C->Go calls, the previous
estimates may be off and we fall out or nearly fall out of the
previous bounds. But this causes a performance problem: the
pthread API to get accurate stack bounds (pthread_getattr_np) is
very slow when called on the main thread. Getting the stack bounds
every time significantly slows down repeated C->Go calls on the
main thread.

This CL fixes it by "caching" the stack bounds if they are
accurate. I.e. at the second time Go calls into C, if the previous
stack bounds are accurate, and the current SP is in bounds, we can
be sure it is the same stack and we don't need to update the bounds.
This avoids the repeated calls to pthread_getattr_np. If we cannot
get the accurate bounds, we continue to update the stack bounds
based on the SP, and that operation is very cheap.

On a Linux/AMD64 machine with glibc:

name                     old time/op  new time/op  delta
CgoCallbackMainThread-8  96.4µs ± 3%   0.1µs ± 2%  -99.92%  (p=0.000 n=10+9)

Fixes #68285.
Fixes #68587.

Change-Id: I3422badd5ad8ff63e1a733152d05fb7a44d5d435
Reviewed-on: https://go-review.googlesource.com/c/go/+/600296
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-10-30 19:09:32 +00:00
Ian Lance Taylor
555ef55460 cmd/internal/osinfo: stop importing golang.org/x/sys/unix
This is the only non-vendored file that imports x/sys/unix.
Switch to fetching the information in this package.

Change-Id: I4e54c2cd8b4953066e2bee42922f35c387fb43e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/623435
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-30 18:19:19 +00:00
Mauri de Souza Meneguzzo
060bd25310 internal/runtime/atomic: add Xchg8 for arm
For #69735

Change-Id: I18c0ca15d94a9b1751c1e55459283e01dc114150
GitHub-Last-Rev: dd9a39a555
GitHub-Pull-Request: golang/go#69924
Cq-Include-Trybots: luci.golang.try:gotip-linux-arm
Reviewed-on: https://go-review.googlesource.com/c/go/+/620855
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>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-10-30 18:09:49 +00:00
Michael Pratt
63ba2b9d84 cmd/compile,internal/runtime/maps: stack allocated maps and small alloc
The compiler will stack allocate the Map struct and initial group if
possible.

Stack maps are initialized inline without calling into the runtime.
Small heap allocated maps use makemap_small.

These are the same heuristics as existing maps.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: I6c371d1309716fd1c38a3212d417b3c76db5c9b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/622042
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>
Auto-Submit: Michael Pratt <mpratt@google.com>
2024-10-30 15:43:54 +00:00
Michael Pratt
aefb173b0a internal/runtime/maps: store group across Iter.Next calls
A previous CL kept it across loop iterations, but those are more rare
than call iterations.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: Ieea0f1677e357f5e451650b1c697da7f63f3bca1
Reviewed-on: https://go-review.googlesource.com/c/go/+/621116
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-30 15:41:29 +00:00
Michael Pratt
7b3ac0ca5d internal/runtime/maps: avoid table lookup on most Iter.Next calls
Speeds up iteration by about 3%.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: I3406376fb8db87306d52e665fcee1f33cf610f24
Reviewed-on: https://go-review.googlesource.com/c/go/+/621115
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>
Auto-Submit: Michael Pratt <mpratt@google.com>
2024-10-30 15:35:37 +00:00
Michael Pratt
d51f92e737 internal/runtime/maps: optimize small map lookups with int keys
Load the field we need from the type once outside the search loop.
Get rid of the multiply to compute the slot position. Instead compute
the slot position incrementally using addition.
Move the hashing later in access2.

Based on khr@'s CL 618959.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: Id11b5479fa5bc0130a1d8d9e664d0206d24942ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/620217
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: Michael Pratt <mpratt@google.com>
2024-10-30 15:31:50 +00:00
Michael Pratt
0b652e3ef6 internal/runtime/maps: use uintptr instead of uint32 for index in group
This avoids some zero-extension ops on 64-bit machines.

Based on khr@'s CL 619479.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: Ie9a56da26382dc9e515c613abc8cf6fec3767671
Reviewed-on: https://go-review.googlesource.com/c/go/+/620216
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>
Auto-Submit: Michael Pratt <mpratt@google.com>
2024-10-30 15:22:32 +00:00
Michael Pratt
d95b7980aa internal/runtime/maps: cleanup seed usage
Keep only a single seed; initialize it; and reset it when the map is
empty.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: Icc231f70957337a2d0dcd9c7daf9bd3cb4354d71
Reviewed-on: https://go-review.googlesource.com/c/go/+/616466
Auto-Submit: Michael Pratt <mpratt@google.com>
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>
2024-10-30 15:20:52 +00:00
Michael Pratt
f782e16162 runtime,internal/runtime/maps: specialized swissmaps
Add all the specialized variants that exist for the existing maps.

Like the existing maps, the fast variants do not support indirect
key/elem.

Note that as of this CL, the Get and Put methods on Map/table are
effectively dead. They are only reachable from the internal/runtime/maps
unit tests.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: I95297750be6200f34ec483e4cfc897f048c26db7
Reviewed-on: https://go-review.googlesource.com/c/go/+/616463
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-10-30 15:14:31 +00:00
Michael Pratt
b5fec2cf54 cmd/compile,runtime: add indirect key/elem to swissmap
We use the same heuristics as existing maps.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: I44bb51483cae2c1714717f1b501850fb9e55a39a
Reviewed-on: https://go-review.googlesource.com/c/go/+/616461
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-30 15:11:27 +00:00
Michael Pratt
2220fd3636 runtime: add concurrent write checks to swissmap
This is the same design as existing maps.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: I5f6ef5fea1e0f0616bcd90eaae7faee4cdac58c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/616460
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-10-30 15:05:37 +00:00
Michael Pratt
3a6795554d internal/runtime/maps: enable race for map functions in internal/runtime/maps
For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: Iebc7f5482299cb7c4ecccc4c2eb46b4bc42c5fc3
Reviewed-on: https://go-review.googlesource.com/c/go/+/616459
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>
Reviewed-by: Keith Randall <khr@golang.org>
2024-10-30 14:59:34 +00:00
Michael Pratt
e25b913127 internal/race,runtime: linkname contents of internal/race
Rather than importing runtime directly, linkname the functions from
runtime. This allows importing internal/race from internal/runtime/*
packages, similar to internal/asan and internal/msan.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: Ibd9644557782076e3cee7927c8a6e6d2909f0a6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/616458
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>
2024-10-30 14:20:18 +00:00
Michael Pratt
3b424cfa9d internal/runtime/maps: proper capacity hint handling
When given a hint size, set the initial capacity large enough to avoid
requiring growth in the average case.

When not given a hint (or given 0), don't allocate anything at all.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: I8844fc652b8d2d4e5136cd56f7e78999a07fe381
Reviewed-on: https://go-review.googlesource.com/c/go/+/616457
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>
Auto-Submit: Michael Pratt <mpratt@google.com>
2024-10-30 14:07:22 +00:00
Joel Sing
89d7f03172 cmd/internal/obj/riscv: update RISC-V instruction table
Regenerate RISC-V instruction table from the riscv-opcodes repository,
due to various changes and shuffling upstream.

This has been changed to remove pseudo-instructions, since Go only
needs the instruction encodings and including the pseudo-instructions
is creating unnecessary complications (for example, the inclusion
of ANOP and ARET, as well as strangely named aliases such as
AJALPSEUDO/AJALRPSEUDO). Remove pseudo-instructions that are not
currently supported by the assembler and add specific handling for
RDCYCLE, RDTIME and RDINSTRET, which were previously implemented
via the instruction encodings.

Change-Id: I78be4506ba6b627eba1f321406081a63bab5b2e6
Cq-Include-Trybots: luci.golang.try:gotip-linux-riscv64
Reviewed-on: https://go-review.googlesource.com/c/go/+/616116
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-10-30 13:30:43 +00:00
Michael Anthony Knyszek
67f1314855 runtime: skip TestMemmoveOverflow with asan
On a whim I decided to investigate the possibility of whether the
flakiness on the asan builder was due to a concurrently executing test.
Of the most recent failures there were a few candidates, and this test
was one of them. After disabling each candidate one by one, we had a
winner: this test causes other concurrently executing tests, running
pure Go code, to spuriously fail.

I do not know why yet, but this test doesn't seem like it would have
incredibly high value for ASAN, and does funky things like MAP_FIXED in
recently unmapped regions, so I think it's fine.

For #70054.
For #64257.

Change-Id: Ib9a84d9b69812e76c390d99b00698710ee1ece1a
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-asan-clang15
Reviewed-on: https://go-review.googlesource.com/c/go/+/623336
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-10-29 22:12:53 +00:00
Michael Pratt
0564fa6820 runtime: move mapaccess1 and mapassign to internal/runtime/maps
This enables manual inlining Map.Get/table.getWithoutKey to create a
simple fast path with no calls.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: Ic208dd4c02c7554f312b85b5fadccaf82b23545c
Reviewed-on: https://go-review.googlesource.com/c/go/+/616455
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>
Auto-Submit: Michael Pratt <mpratt@google.com>
2024-10-29 20:37:41 +00:00
Michael Pratt
0c934b5645 runtime: skip most map benchmark combinations by default
Fixes #70008.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-race
Change-Id: I1fd7d1cbda20cc96016c864bcf0696382453e807
Reviewed-on: https://go-review.googlesource.com/c/go/+/623335
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-29 20:04:40 +00:00
Michael Pratt
ed035af7b7 internal/runtime/maps: remove type fields
Rather than storing the same type pointer in multiple places, just pass
it around.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: Ia6c74805c7a44125ae473177b317f16c6688e6de
Reviewed-on: https://go-review.googlesource.com/c/go/+/622377
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-29 18:54:17 +00:00
Tobias Klauser
cf96717209 internal/poll: use io.Seek* constants
internal/poll already imports io so use the io.Seek* constants instead
of defining them locally.

Change-Id: I91218c021e882e044503cae64b699e5a236ecc38
Reviewed-on: https://go-review.googlesource.com/c/go/+/623236
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
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: Ian Lance Taylor <iant@google.com>
2024-10-29 17:01:50 +00:00
Keith Randall
4b30a40d88 strings,bytes: use result of copy in subsequent slicing
This can get rid of a bounds check.
Followup to CL 622240.

Change-Id: I9d0a2c0408b8d274c46136d32d7a5fb09b4aad1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/622955
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-10-29 16:47:05 +00:00
Keith Randall
4dcbb00be2 cmd/compile: teach prove about min/max phi operations
If there is a phi that is computing the minimum of its two inputs,
then we know the result of the phi is smaller than or equal to both
of its inputs. Similarly for maxiumum (although max seems less useful).

This pattern happens for the case

  n := copy(a, b)

n is the minimum of len(a) and len(b), so with this optimization we
know both n <= len(a) and n <= len(b). That extra information is
helpful for subsequent slicing of a or b.

Fixes #16833

Change-Id: Ib4238fd1edae0f2940f62a5516a6b363bbe7928c
Reviewed-on: https://go-review.googlesource.com/c/go/+/622240
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
2024-10-29 16:46:48 +00:00
Michael Anthony Knyszek
f5526b56db runtime: skip TestNewOSProc0 with asan and msan
These fail for the same reason as for the race detector, and is the most
frequently failing test in both.

For #70054.
For #64257.
For #64256.

Change-Id: I3649e58069190b4450f9d4deae6eb8eca5f827a3
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-asan-clang15,gotip-linux-amd64-msan-clang15
Reviewed-on: https://go-review.googlesource.com/c/go/+/623176
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-10-29 16:24:08 +00:00
George Adams
b813465c4f os: check for valid Windows path when creating files
Checks for a valid Windows path by ensuring the path doesn't end with trailing spaces or periods.

Fixes #54040.

Cq-Include-Trybots: luci.golang.try:gotip-windows-arm64
Change-Id: I266f79963c821f8cc474097d3e57c5645ad996fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/618496
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2024-10-29 15:25:26 +00:00
Jayanth Krishnamurthy
fdfb3067a8 cmd/internal/obj/ppc64: support for extended mnemonics of BC
BGT, BLT, BLE, BGE, BNE, BVS, BVC, and BEQ support by assembler. This will simplify the usage of BC constructs like
BC 12, 30, LR    <=>  BEQ CR7, LR
BC 12, 2, LR     <=>  BEQ CR0, LR
BC 12, 0, target  <=>  BLT CR0, target
BC 12, 2, target  <=>  BEQ CR0, target
BC 12, 5, target  <=>  BGT CR1, target
BC 12, 30, target <=>  BEQ CR7, target
BC 4, 6, target	  <=>  BNE CR1, target
BC 4, 5, target   <=>  BLE CR1, target
code cleanup based on the above additions.

Change-Id: I02fdb212b6fe3f85ce447e05f4d42118c9ce63b5
Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-ppc64_power8,gotip-linux-ppc64le_power8,gotip-linux-ppc64le_power9,gotip-linux-ppc64le_power10
Reviewed-on: https://go-review.googlesource.com/c/go/+/612395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Paul Murphy <murp@ibm.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-10-29 13:14:38 +00:00
Jayanth Krishnamurthy
b03b1acfb0 cmd/internal/obj/ppc64: add double-decimal arithmetic instructions
Assembler support provided for the instructions DADD, DSUB, DMUL, and DDIV.

Change-Id: Ic12ba02ce453cb1ca275334ca1924fb2009da767
Reviewed-on: https://go-review.googlesource.com/c/go/+/620856
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Paul Murphy <murp@ibm.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-10-29 13:14:03 +00:00
Filippo Valsorda
f505d6c581 crypto/internal/fips: add self-test mechanism
Updates #69536

Change-Id: Ib68b0e7058221a89908fd47f255f0a983883bee8
Reviewed-on: https://go-review.googlesource.com/c/go/+/621075
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2024-10-29 12:57:23 +00:00
Charlie Vieth
ff86b8b62f database/sql: allocate once when assigning a time.Time to a byte slice
Change convertAssignRows to use time.AppendFormat and a pre-allocated
buffer when assigning a time.Time to a byte slice. Previously, the
result of time.Format was converted to a byte slice which required
two allocations.

Change-Id: I19db5e4d295e882070f947eca318a4e33520cda1
Reviewed-on: https://go-review.googlesource.com/c/go/+/622597
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-10-29 11:38:05 +00:00
Joel Sing
851ebc2dca cmd/internal/objfile,cmd/objdump: add disassembly support for riscv64
Add support to `go tool objdump` for disassembling riscv64 binaries.

Revendor to bring in cmd/vendor/golang.org/x/arch/riscv64/riscv64asm,
which provides the actual disassembly implementation.

Fixes #36738

Change-Id: I0f29968509041c0c5698fc2d6910a6a0bea9d3c0
Cq-Include-Trybots: luci.golang.try:gotip-linux-riscv64
Reviewed-on: https://go-review.googlesource.com/c/go/+/622257
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-10-29 08:17:00 +00:00
Xiaolin Zhao
aef81a7551 cmd/compile: add rules to optimize go codes to constant 0 on loong64
goos: linux
goarch: loong64
pkg: test/bench/go1
cpu: Loongson-3A6000 @ 2500.00MHz
                      │  old.bench  │             new.bench              │
                      │   sec/op    │   sec/op     vs base               │
BinaryTree17             7.735 ± 1%    7.716 ± 1%  -0.23% (p=0.041 n=15)
Fannkuch11               2.645 ± 0%    2.646 ± 0%  +0.05% (p=0.013 n=15)
FmtFprintfEmpty         35.87n ± 0%   35.89n ± 0%  +0.06% (p=0.000 n=15)
FmtFprintfString        59.54n ± 0%   59.47n ± 0%       ~ (p=0.213 n=15)
FmtFprintfInt           62.23n ± 0%   62.06n ± 0%       ~ (p=0.212 n=15)
FmtFprintfIntInt        98.16n ± 0%   97.90n ± 0%  -0.26% (p=0.000 n=15)
FmtFprintfPrefixedInt   117.0n ± 0%   116.7n ± 0%  -0.26% (p=0.000 n=15)
FmtFprintfFloat         204.6n ± 0%   204.2n ± 0%  -0.20% (p=0.000 n=15)
FmtManyArgs             456.3n ± 0%   455.4n ± 0%  -0.20% (p=0.000 n=15)
GobDecode               7.210m ± 0%   7.156m ± 1%  -0.75% (p=0.000 n=15)
GobEncode               8.143m ± 1%   8.177m ± 1%       ~ (p=0.806 n=15)
Gzip                    280.2m ± 0%   279.7m ± 0%  -0.19% (p=0.005 n=15)
Gunzip                  32.71m ± 0%   32.65m ± 0%  -0.19% (p=0.000 n=15)
HTTPClientServer        53.76µ ± 0%   53.65µ ± 0%       ~ (p=0.083 n=15)
JSONEncode              9.297m ± 0%   9.295m ± 0%       ~ (p=0.806 n=15)
JSONDecode              46.97m ± 1%   47.07m ± 1%       ~ (p=0.683 n=15)
Mandelbrot200           4.602m ± 0%   4.600m ± 0%  -0.05% (p=0.001 n=15)
GoParse                 4.682m ± 0%   4.670m ± 1%  -0.25% (p=0.001 n=15)
RegexpMatchEasy0_32     59.80n ± 0%   59.63n ± 0%  -0.28% (p=0.000 n=15)
RegexpMatchEasy0_1K     458.3n ± 0%   457.3n ± 0%  -0.22% (p=0.001 n=15)
RegexpMatchEasy1_32     59.39n ± 0%   59.23n ± 0%  -0.27% (p=0.000 n=15)
RegexpMatchEasy1_1K     557.9n ± 0%   556.6n ± 0%  -0.23% (p=0.001 n=15)
RegexpMatchMedium_32    803.6n ± 0%   801.8n ± 0%  -0.22% (p=0.001 n=15)
RegexpMatchMedium_1K    27.32µ ± 0%   27.26µ ± 0%  -0.21% (p=0.000 n=15)
RegexpMatchHard_32      1.385µ ± 0%   1.382µ ± 0%  -0.22% (p=0.000 n=15)
RegexpMatchHard_1K      40.93µ ± 0%   40.83µ ± 0%  -0.24% (p=0.000 n=15)
Revcomp                 474.8m ± 0%   474.3m ± 0%       ~ (p=0.250 n=15)
Template                77.41m ± 1%   76.63m ± 1%  -1.01% (p=0.023 n=15)
TimeParse               271.1n ± 0%   271.2n ± 0%  +0.04% (p=0.022 n=15)
TimeFormat              290.0n ± 0%   289.8n ± 0%       ~ (p=0.118 n=15)
geomean                 51.73µ        51.64µ       -0.18%

Change-Id: I45a1e6c85bb3cea0f62766ec932432803e9af10a
Reviewed-on: https://go-review.googlesource.com/c/go/+/619315
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2024-10-29 01:17:54 +00:00
Damien Neil
98b3be702b os, net, internal/poll: combine unix sendfile implementations
The internal/poll/sendfile_{bsd,linux,solaris}.go implementations
have more in common than not. Combine into a single sendfile_unix.go.

The net and os packages have redundant code dealing with sendfile
quirks on non-Linux Unix systems, such as the need to determine the
size of the source file before sending. Move the common code into
internal/poll.

Remove some obsolete or incorrect behaviors:

Drop the maximum sendfile chunk size. If we ask the kernel
to copy more data than it is willing to send, it'll copy up to
its limit.

There was a comment in net/sendfile_unix_alt.go indicating that
copying more bytes than a file contains results in the kernel
looping back to the start of the file. I am unable to replicate
this behavior anywhere. Dropped the comment, the workarounds,
and added a test covering this case.

Darwin, Dragonfly, and FreeBSD all support copying the entire
contents of a file by passing 0 for the copy limit.
Take advantage of this.

Change-Id: I9f707ac7a27c165020ae02a6b5bb8f6f16f3c530
Reviewed-on: https://go-review.googlesource.com/c/go/+/621416
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-10-28 23:45:31 +00:00
Michael Pratt
cd54b9bae9 internal/runtime/maps: shift optimizations
Masking the shift lets the compiler elide a few instructions for
handling a shift of > 63 bits.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: I669fe01caa1de1b8521f1f56b6906f3e9066a39b
Reviewed-on: https://go-review.googlesource.com/c/go/+/611190
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@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2024-10-28 21:25:50 +00:00
Michael Pratt
775837f51f internal/runtime/maps: avoid passing unused key return
For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: Idee1e021e3cef8f0c031e8f06efbcf6e88918d8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/622376
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-28 21:25:16 +00:00
Michael Anthony Knyszek
579eb79f62 all: skip and fix various tests with -asan and -msan
First, skip all the allocation count tests.

In some cases this aligns with existing skips for -race, but in others
we've got new issues. These are debug modes, so some performance loss is
expected, and this is clearly no worse than today where the tests fail.

Next, skip internal linking and static linking tests for msan and asan.

With asan we get an explicit failure that neither are supported by the C
and/or Go compilers. With msan, we only get the Go compiler telling us
internal linking is unavailable. With static linking, we segfault
instead. Filed #70080 to track that.

Next, skip some malloc tests with asan that don't quite work because of
the redzone.

This is because of some sizeclass assumptions that get broken with the
redzone and the fact that the tiny allocator is effectively disabled
(again, due to the redzone).

Next, skip some runtime/pprof tests with asan, because of extra
allocations.

Next, skip some malloc tests with asan that also fail because of extra
allocations.

Next, fix up memstats accounting for arenas when asan is enabled. There
is a bug where more is added to the stats than subtracted. This also
simplifies the accounting a little.

Next, skip race tests with msan or asan enabled; they're mutually
incompatible.

Fixes #70054.
Fixes #64256.
Fixes #64257.
For #70079.
For #70080.

Change-Id: I99c02a0b9d621e44f1f918b307aa4a4944c3ec60
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-asan-clang15,gotip-linux-amd64-msan-clang15
Reviewed-on: https://go-review.googlesource.com/c/go/+/622855
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
2024-10-28 21:04:51 +00:00
Michael Pratt
808da68c1c internal/runtime/maps: linear scan of small map
We still use the hash and control word, but loop over all 8 bytes
instead of doing the match operation, which ends up being slightly
faster when there is only one group.

Note that specialized variants added later will avoid hashing at all.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: I3bb353b023dd6120b6585e87d3efe2f18ac9e1ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/611189
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>
2024-10-28 20:35:27 +00:00
Michael Pratt
77e3d8cf13 internal/runtime/maps: small maps point directly to a group
If the map contains 8 or fewer entries, it is wasteful to have a
directory that points to a table that points to a group.

Add a special case that replaces the directory with a direct pointer to
a group.

We could theoretically do similar for single table maps (no directory,
just point directly to a table), but that is left for later.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: I6fc04dfc11c31dadfe5b5d6481b4c4abd43d48ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/611188
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-10-28 20:35:25 +00:00
Michael Pratt
bb46b754be internal/runtime/maps: speed up modulo
For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: Ic47721e101f6fee650e6825a5a241fcd12fa0009
Reviewed-on: https://go-review.googlesource.com/c/go/+/611185
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-10-28 20:35:22 +00:00
Michael Pratt
efa43c57b1 internal/runtime/maps: reuse deleted slots on insert
While walking the probe sequence, Put keeps track of the first deleted
slot it encountered. If it reaches the end of the probe sequence without
finding a match, then it will prefer to use the deleted slot rather than
a new empty slot.

For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: I19356ef6780176506f57b42990ac15dc426f1b14
Reviewed-on: https://go-review.googlesource.com/c/go/+/618016
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>
Reviewed-by: Keith Randall <khr@golang.org>
2024-10-28 20:34:48 +00:00
Michael Pratt
7de87ebd59 internal/runtime/maps: merge Iter.groupIdx and Iter.slotIdx
For #54766.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-swissmap
Change-Id: Ie21ef0f33f42735eadccd75eeebb3b5e81c2f459
Reviewed-on: https://go-review.googlesource.com/c/go/+/618535
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Commit-Queue: Michael Pratt <mpratt@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-28 20:33:03 +00:00
qmuntal
3387be0eb1 cmd: use internal/syscall/windows to get Windows version
internal/syscall/windows already provides a function to get the Windows
version. There is no need to use golang.org/x/sys/windows for this.

Change-Id: If31e9c662b10716ed6c3e9054604366e494345cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/622815
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-10-28 20:02:54 +00:00