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

60485 Commits

Author SHA1 Message Date
Cuong Manh Le
b6efbd4efc cmd/compile, reflect: treat abi.NoEscape as cheap call
The abi.NoEscape function is introduced to replace all usages of
noescape wrapper in the standard library. However, the last usage in
reflect package is still present, because the inlining test failed if
abi.NoEscape were used. The reason is that reflect.noescape is treated
as a cheap call, while abi.NoEscape is not.

By treating abi.NoEscape a cheap call, the last usage of noescape in
reflect package can now be removed.

Change-Id: I798079780129221a5a26cbcb18c95ee30855b784
Reviewed-on: https://go-review.googlesource.com/c/go/+/601275
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-07-26 16:18:47 +00:00
Cuong Manh Le
deed521ea3 go/internal/gcimporter: cleanup test code pre Unified IR
Same as CL 543315 did for cmd/compile.

Change-Id: I56a200664c92fe34d4b78c2dbf6ed56288e89e0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/600675
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2024-07-26 16:16:28 +00:00
Cuong Manh Le
eb3dd019ed cmd/compile: cleanup test code pre Unified IR
Change-Id: Ibb9a7ce37ac28873aa720a64d1f89cb87fc5fa27
Reviewed-on: https://go-review.googlesource.com/c/go/+/543315
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-07-26 16:13:46 +00:00
Cuong Manh Le
9b4b4ae585 types2, go/types: fix instantiation of named type with generic alias
The typechecker is assuming that alias instances cannot be reached from
a named type. However, when type parameters on aliases are permited, it
can happen.

This CL changes the typechecker to propagate the correct named instance
is being expanded.

Updates #46477
Fixes #68580

Change-Id: Id0879021f4640c0fefe277701d5096c649413811
Reviewed-on: https://go-review.googlesource.com/c/go/+/601115
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-07-26 13:41:08 +00:00
HeGaoYuan
d8c7230c97 cmd/compile/internal/types: fix typo in comment
Change-Id: Iacf22578338c8aa99587826a8342e1da6dc166a6
GitHub-Last-Rev: cdb3235e8c
GitHub-Pull-Request: golang/go#46598
Reviewed-on: https://go-review.googlesource.com/c/go/+/325510
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
2024-07-25 22:41:07 +00:00
Chen Su
d69a0883d4 encoding/gob: fix package doc typo for wireType
Change-Id: Ib93f2b565e5271dfa3c3ca5d040ef24269c47cf8
GitHub-Last-Rev: 3f1da518a4
GitHub-Pull-Request: golang/go#68584
Reviewed-on: https://go-review.googlesource.com/c/go/+/601036
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: Dmitri Shuralyov <dmitshur@google.com>
2024-07-25 21:15:30 +00:00
Michael Anthony Knyszek
e76353d5a9 runtime: allow the tracer to be reentrant
This change allows the tracer to be reentrant by restructuring the
internals such that writing an event is atomic with respect to stack
growth. Essentially, a core set of functions that are involved in
acquiring a trace buffer and writing to it are all marked nosplit.

Stack growth is currently the only hidden place where the tracer may be
accidentally reentrant, preventing the tracer from being used
everywhere. It already lacks write barriers, lacks allocations, and is
non-preemptible. This change thus makes the tracer fully reentrant,
since the only reentry case it needs to handle is stack growth.

Since the invariants needed to attain this are subtle, this change also
extends the debugTraceReentrancy debug mode to check these invariants as
well. Specifically, the invariants are checked by setting the throwsplit
flag.

A side benefit of this change is it simplifies the trace event writing
API a good bit: there's no need to actually thread the event writer
through things, and most callsites look a bit simpler.

Change-Id: I7c329fb7a6cb936bd363c44cf882ea0a925132f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/587599
Reviewed-by: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-25 14:38:21 +00:00
apocelipes
bd6f911f85 archive: use slices and maps to clean up tests
Replace reflect.DeepEqual with slices.Equal/maps.Equal, which is
much faster.

Clean up some unnecessary helper functions.

Change-Id: I9b94bd43886302b9b327539ab065a435ce0d75d9
GitHub-Last-Rev: b9ca21f165
GitHub-Pull-Request: golang/go#67607
Reviewed-on: https://go-review.googlesource.com/c/go/+/587936
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: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
2024-07-25 00:25:45 +00:00
apocelipes
b5b9d24dc3 encoding: use slices and maps to clean up tests
Replace reflect.DeepEqual with slices.Equal/maps.Equal, which is
much faster.

Change-Id: I62ad60a66e28cfb2bb49c36037bafd4b9d201e88
GitHub-Last-Rev: 79554baddb
GitHub-Pull-Request: golang/go#67611
Reviewed-on: https://go-review.googlesource.com/c/go/+/587818
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: Dmitri Shuralyov <dmitshur@google.com>
2024-07-25 00:23:58 +00:00
apocelipes
05861ff90c os,path/filepath,testing: use slices to clean up tests
Replace reflect.DeepEqual with slices.Equal which is much faster.

Change-Id: I299db6f998738174983731f08c1021346b87dfaa
GitHub-Last-Rev: 44ca9015d6
GitHub-Pull-Request: golang/go#67613
Reviewed-on: https://go-review.googlesource.com/c/go/+/587938
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-07-25 00:23:06 +00:00
apocelipes
0b0dfcd540 runtime: use slices and maps to clean up tests
Replace reflect.DeepEqual with slices.Equal/maps.Equal, which is
much faster.

Also remove some unecessary helper functions.

Change-Id: I3e4fa2938fed1598278c9e556cd4fa3b9ed3ad6d
GitHub-Last-Rev: 69bb43fc6e
GitHub-Pull-Request: golang/go#67603
Reviewed-on: https://go-review.googlesource.com/c/go/+/587815
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-07-25 00:23:03 +00:00
apocelipes
2247afc0ae go,internal,io,mime: use slices and maps to clean tests
Replace reflect.DeepEqual with slices.Equal/maps.Equal, which is
much faster.

Change-Id: Id9cb550884da817da96befdeccfecb3325fb4414
GitHub-Last-Rev: 7d64d78feb
GitHub-Pull-Request: golang/go#67612
Reviewed-on: https://go-review.googlesource.com/c/go/+/587819
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-07-25 00:22:14 +00:00
apocelipes
1d717951f5 net: use slices and maps to clean up tests
Replace reflect.DeepEqual with slices.Equal/maps.Equal, which is
much faster.

Change-Id: I54600fb63a56460c11d3d5af9072da585e31b1a2
GitHub-Last-Rev: 08c1445ad5
GitHub-Pull-Request: golang/go#67606
Reviewed-on: https://go-review.googlesource.com/c/go/+/587816
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-07-25 00:20:13 +00:00
Dmitri Shuralyov
792a261303 doc/next: use relative link to Go issue
The Go release notes are served on multiple domains (go.dev,
golang.google.cn, tip.golang.org, localhost:8080 and so on), so links
pointing to the Go website itself need to be relative to work in all
those contexts.

Caught by a test in x/website. The next CL adds the same test to this
repository so these kinds of problems are caught sooner and with less
friction.

For #68545.
Fixes #68575.

Change-Id: I08056b98968c77a1d0ed93b63fccfbe41274ec8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/600656
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-24 18:59:46 +00:00
Roland Shoemaker
0826b90172 internal/cpu: add DIT detection on arm64
Add support for detecting the DIT feature on ARM64 processors. This
mirrors https://go.dev/cl/597377, but using the platform specific
semantics.

Updates #66450

Change-Id: Ia107e3e3369de7825af70823b485afe2f587358e
Reviewed-on: https://go-review.googlesource.com/c/go/+/598335
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-07-24 18:45:33 +00:00
Roland Shoemaker
b5c2b1ec13 cmd/internal/obj/arm64: support MSR DIT
Set the right instruction bits in asmout in order
to allow using MSR with DIT and an immediate
value. This allows us to avoid using an
intermediary register when we want to set DIT
(unsetting DIT already worked with the zero
register).

Ref: https://developer.arm.com/documentation/ddi0602/2024-06/Base-Instructions/MSR--immediate---Move-immediate-value-to-special-register-?lang=en
Change-Id: Id049a0b4e0feb534cea992553228f9b5e12ddcea
Reviewed-on: https://go-review.googlesource.com/c/go/+/597595
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-07-24 18:45:14 +00:00
apocelipes
c0eac35a4c bytes,strings,unicode/utf16: use slices to clean up tests
Replace reflect.DeepEqual with slices.Equal, which is much faster.
Remove some redundant helper functions.

Change-Id: I51b32a3d0c3fc5ad0d3b6ff0dd03f39c507e5762
GitHub-Last-Rev: e21f46d4a0
GitHub-Pull-Request: golang/go#67609
Reviewed-on: https://go-review.googlesource.com/c/go/+/587937
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>
Reviewed-by: Robert Griesemer <gri@google.com>
2024-07-24 18:45:08 +00:00
Damien Neil
910e6b5fae os: document CopyFS behavior for symlinks in destination
Also clarify the permissions of created files,
and note that CopyFS will not overwrite files.

Update a few places in documentation to use 0oXXX for octal consts.

For #62484

Change-Id: I208ed2bde250304bc7fac2b93963ba57037e791e
Reviewed-on: https://go-review.googlesource.com/c/go/+/600775
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-24 18:24:15 +00:00
apocelipes
074f2761b5 crypto/x509,embed: use slices to clean up tests
Replace reflect.DeepEqual with slices.Equal, which is much faster.

Change-Id: Ia93cc153d1f71ce92656129843be8dadcefbbca3
GitHub-Last-Rev: 0af0cc4205
GitHub-Pull-Request: golang/go#67610
Reviewed-on: https://go-review.googlesource.com/c/go/+/587817
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Commit-Queue: 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>
2024-07-24 16:44:15 +00:00
guoguangwu
c7ea20195a cmd/compile: fix typo in comment
Change-Id: Ied098312399d2d6557ebf0ee294ca0e71dfa677b
GitHub-Last-Rev: 82f914e857
GitHub-Pull-Request: golang/go#68565
Reviewed-on: https://go-review.googlesource.com/c/go/+/600655
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>
2024-07-24 15:39:28 +00:00
Koichi Shiraishi
3637aa3e1e internal/trace/event: fix typo in comment
Change-Id: Ia191daf8e748f17dcea6038166504fb50e7ddb0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/589535
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: 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>
2024-07-24 15:39:19 +00:00
Bryan Boreham
c5430dc1d8 regexp: allow patterns with no alternates to be one-pass
Check whether a regex has any 'alt' instructions before rejecting it as one-pass.
Previously `^abc` would run the backtrack matcher.

I tried to make the comment match what the code does now.

Updates #21463

```
name                            old time/op    new time/op    delta
Find-8                             167ns ± 1%     170ns ± 3%     ~     (p=0.500 n=5+5)
FindAllNoMatches-8                88.8ns ± 5%    87.3ns ± 0%     ~     (p=0.095 n=5+5)
FindString-8                       166ns ± 3%     164ns ± 0%     ~     (p=0.063 n=5+5)
FindSubmatch-8                     191ns ± 1%     191ns ± 0%     ~     (p=0.556 n=4+5)
FindStringSubmatch-8               183ns ± 0%     182ns ± 0%   -0.43%  (p=0.048 n=5+5)
Literal-8                         50.3ns ± 0%    50.1ns ± 0%   -0.40%  (p=0.016 n=5+4)
NotLiteral-8                       914ns ± 0%     927ns ± 7%     ~     (p=0.730 n=5+5)
MatchClass-8                      1.20µs ± 1%    1.22µs ± 6%     ~     (p=0.738 n=5+5)
MatchClass_InRange-8              1.20µs ± 6%    1.21µs ± 6%     ~     (p=0.548 n=5+5)
ReplaceAll-8                       796ns ± 0%     792ns ± 0%   -0.51%  (p=0.032 n=5+5)
AnchoredLiteralShortNonMatch-8    41.0ns ± 2%    34.2ns ± 2%  -16.47%  (p=0.008 n=5+5)
AnchoredLiteralLongNonMatch-8     53.3ns ± 0%    34.3ns ± 3%  -35.74%  (p=0.008 n=5+5)
AnchoredShortMatch-8              74.0ns ± 2%    75.8ns ± 0%   +2.46%  (p=0.032 n=5+4)
AnchoredLongMatch-8                146ns ± 3%      76ns ± 1%  -48.12%  (p=0.008 n=5+5)
OnePassShortA-8                    424ns ± 0%     423ns ± 0%     ~     (p=0.222 n=5+4)
NotOnePassShortA-8                 373ns ± 1%     375ns ± 2%     ~     (p=0.690 n=5+5)
OnePassShortB-8                    315ns ± 2%     308ns ± 0%   -2.12%  (p=0.008 n=5+5)
NotOnePassShortB-8                 244ns ± 3%     239ns ± 0%     ~     (p=0.476 n=5+5)
OnePassLongPrefix-8               61.6ns ± 2%    60.9ns ± 0%   -1.13%  (p=0.016 n=5+4)
OnePassLongNotPrefix-8             236ns ± 3%     230ns ± 0%     ~     (p=0.143 n=5+5)
```

Change-Id: I8a94b53bc761cd7ec89923c905ec8baaaa58a5fd
GitHub-Last-Rev: e9e0c29b74
GitHub-Pull-Request: golang/go#48748
Reviewed-on: https://go-review.googlesource.com/c/go/+/353711
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-07-24 01:01:48 +00:00
Ian Lance Taylor
8659ad972f encoding/json: rewrite interface{} to any
For #49884

Change-Id: I1623201c47c820a152773d2f43d0072a1466d3bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/588118
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2024-07-24 00:40:06 +00:00
Cuong Manh Le
72cc7699f8 test: add test cases for local not-in-heap types
Follow up review in CL 597535.

Updates #54846

Change-Id: Idf586552a22bbc6710c0888f046df0a5d1f0ce4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/597537
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-07-24 00:11:49 +00:00
Cuong Manh Le
b73875ff6c test: re-enabled fixedbugs/notinheap.go test
By using cgo.Incomplete to represent not-in-heap type.

While at it, also removing the type conversions tests, since they could
not be present without //go:notinheap pragma.

Fixes #54846

Change-Id: I5ee2a4b6498d4100c9770ed7bd62f52623e42526
Reviewed-on: https://go-review.googlesource.com/c/go/+/597536
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2024-07-24 00:11:47 +00:00
Cuong Manh Le
88833c9045 cmd/compile: restore not-in-heap check for map/channel type
CL 388538 removed unused -G=0 node types.

However, the code for checking not-in-heap types for map and channel
type was also removed, which is likely not intentional.

This CL restores the check, porting removed code to noder.

Updates #54846

Change-Id: I2995836b90e36d2684197fefc9829fddfffe8585
Reviewed-on: https://go-review.googlesource.com/c/go/+/597535
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-07-24 00:11:44 +00:00
Cuong Manh Le
864aa86448 cmd/compile: run checkbce after fuseLate pass
So the bounds check which are eliminated during late fuse pass could be
detected correctly.

Fixes #67329

Change-Id: Id7992fbb8c26e0d43e7db66a0a3a2c0d9ed937a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/598635
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-23 23:50:30 +00:00
Cuong Manh Le
3f9360345c cmd/compile: prevent un-necessary wrapping in switch statement
Follow up discussion in CL 594575.

The wrapping in "any" is only necessary if either casType or tagType is
an interface, as "==" in this situation is implemented by upconverting
to an interface anyway.

Change-Id: I73da771d25685a23eec612ac696965c892db4764
Reviewed-on: https://go-review.googlesource.com/c/go/+/596555
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2024-07-23 23:49:48 +00:00
Dmitri Shuralyov
d55253f5dd cmd/pprof: update vendored github.com/google/pprof
Pull in the latest published version of github.com/google/pprof
as part of the continuous process of keeping Go's dependencies
up to date.

For #36905.

[git-generate]
cd src/cmd
go get github.com/google/pprof@v0.0.0-20240722153945-304e4f0156b8
go mod tidy
go mod vendor

Change-Id: If009cff7f2d99ec58315102963cbe07b6739c09a
Reviewed-on: https://go-review.googlesource.com/c/go/+/600596
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
2024-07-23 23:05:51 +00:00
Dmitri Shuralyov
0d5fc4e1f0 cmd/go: fix TestNewReleaseRebuildsStalePackagesInGOPATH for runtime move
CL 600436 moved runtime/internal/sys to internal/runtime/sys and updated
TestNewReleaseRebuildsStalePackagesInGOPATH in part accordingly. This is
the other part that's needed for it to pass.

For #65355.

Change-Id: I26cff96c15caf185a4ee2c8fb31ec6c877ab87e2
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/600595
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2024-07-23 23:05:48 +00:00
Keith Randall
c18ff29295 cmd/compile: make sync/atomic AND/OR operations intrinsic on amd64
Update #61395

Change-Id: I59a950f48efc587dfdffce00e2f4f3ab99d8df00
Reviewed-on: https://go-review.googlesource.com/c/go/+/594738
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>
Reviewed-by: Nicolas Hillegeer <aktau@google.com>
2024-07-23 21:29:38 +00:00
Keith Randall
dbfa3cacc7 cmd/compile: fix typing of atomic logical operations
For atomic AND and OR operations on memory, we currently have two
views of the op. One just does the operation on the memory and returns
just a memory. The other does the operation on the memory and returns
the old value (before having the logical operation done to it) and
memory.

Update #61395

These two type differently, and there's currently some confusion in
our rules about which is which. Use different names for the two
different flavors so we don't get them confused.

Change-Id: I07b4542db672b2cee98169ac42b67db73c482093
Reviewed-on: https://go-review.googlesource.com/c/go/+/594976
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Nicolas Hillegeer <aktau@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-07-23 21:27:54 +00:00
Keith Randall
df009eead9 cmd/cgo: error on multiple incompatible function declarations
When there are multiple declarations of a function, ensure that
those declarations at least agree on the size/alignment of arguments
and return values.

It's hard to be stricter given existing code and situations where
arguments differ only by typedefs. For instance:
    int usleep(unsigned);
    int usleep(useconds_t);

Fixes #67699.

Change-Id: I3b4b17afee92b55f9e712b4590ec608ab1f7ac91
Reviewed-on: https://go-review.googlesource.com/c/go/+/588977
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-07-23 21:11:11 +00:00
Keith Randall
b0f7be3cfa cmd/compile: don't treat an InlMark as a read during deadstore
An InlMark "read" can't make an otherwise dead store live. Without this
CL, we sometimes zero an object twice in succession because we think
there is a reader in between.

Kind of challenging to make a test for this. The second zeroing has the
same instruction on the same line number, so codegen tests can't see it.

Fixes #67957

Change-Id: I7fb97ebff50d8eb6246fc4802d1136b7cc76c45f
Reviewed-on: https://go-review.googlesource.com/c/go/+/592615
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-07-23 20:55:24 +00:00
Keith Randall
f66db49976 cmd/compile: store constant floats using integer constants
x86 is better at storing constant ints than constant floats.
(It uses a constant directly in the instruction stream, instead of
loading it from a constant global memory.)

Noticed as part of #67957

Change-Id: I9b7b586ad8e0fe9ce245324f020e9526f82b209d
Reviewed-on: https://go-review.googlesource.com/c/go/+/592596
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-07-23 20:53:57 +00:00
Dmitri Shuralyov
d15525d596 all: update vendored dependencies
The Go 1.24 development tree has opened. This is a time to update
all golang.org/x/... module versions that contribute packages to the
std and cmd modules in the standard library to latest master versions.

For #36905.

[git-generate]
go install golang.org/x/build/cmd/updatestd@latest
go install golang.org/x/tools/cmd/bundle@latest
updatestd -goroot=$(pwd) -branch=master

Change-Id: I5a012af9f041f79ab4d5b30569a154e0c2d1617e
Reviewed-on: https://go-review.googlesource.com/c/go/+/600535
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2024-07-23 20:29:12 +00:00
Martin Garton
d567ea652a encoding/binary: add missing test helper calls
Various functions in binary_test.go were missing some t.Helper() calls,
so this adds them in.

Change-Id: I0e5894e3c3cf72627203694a32adca51fe1563f5
GitHub-Last-Rev: b28c9255b3
GitHub-Pull-Request: golang/go#63897
Reviewed-on: https://go-review.googlesource.com/c/go/+/539135
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: qiu laidongfeng2 <2645477756@qq.com>
Auto-Submit: Keith Randall <khr@golang.org>
2024-07-23 19:17:29 +00:00
David Chase
fc5073bc15 runtime,internal: move runtime/internal/sys to internal/runtime/sys
Cleanup and friction reduction

For #65355.

Change-Id: Ia14c9dc584a529a35b97801dd3e95b9acc99a511
Reviewed-on: https://go-review.googlesource.com/c/go/+/600436
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>
2024-07-23 19:05:35 +00:00
David Chase
f9eb3e3cd5 runtime,internal: move runtime/internal/math to internal/runtime/math
Cleanup and friction reduction.

Updates #65355.

Change-Id: I6c4fcd409d044c00d16561fe9ed2257877d73f5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/600435
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>
2024-07-23 19:05:16 +00:00
Cuong Manh Le
fe87b586c0 runtime: remove VZEROUPPER in asyncPreempt on darwin/amd64
Updates #37174
Updates #49233
Fixes #41152

Change-Id: I35b148c8bc132f02dd6a5a6bb48b711fb5c5df9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/560955
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-07-23 17:16:29 +00:00
Jakob Gillich
78c0ea5df7 cmd/link: raise pe export cap to 65535
fixes #68405

Change-Id: I043e16f43daa336005695f82a53f9a52cd770656
GitHub-Last-Rev: 69f1ae8b64
GitHub-Pull-Request: golang/go#68409
Reviewed-on: https://go-review.googlesource.com/c/go/+/597956
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Zxilly Chou <zxilly@outlook.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-07-23 15:10:37 +00:00
Michael Anthony Knyszek
5f073d361f cmd/trace: merge testdata debugging tools into the trace tool
Currently internal/trace/testdata contains three debugging tools which
were written early in the trace rewrite for debugging. Two of these are
completely redundant with go tool trace -d=1 and go tool trace -d=2. The
only remaining one landed in the last cycle and could easily also be
another debug mode.

This change thus merges gotraceeventstats into go tool trace as a new
debug mode, and updates the debug mode flag (-d) to accept a string,
giving each mode a more descriptive name.

Change-Id: I170f30440691b81de846b4e247deb3d0982fc205
Reviewed-on: https://go-review.googlesource.com/c/go/+/593975
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2024-07-23 14:57:42 +00:00
rhysd
b8f83e2270 os: check relative paths in UserConfigDir and UserCacheDir
Return errors by UserConfigDir and UserCacheDir when XDG environment
variables contain relative paths.

Fixes #68470

Change-Id: Ib36b56d73b066e002023be55ecfe74d5c0eedb15
GitHub-Last-Rev: c03f371a04
GitHub-Pull-Request: golang/go#68471
Reviewed-on: https://go-review.googlesource.com/c/go/+/598655
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2024-07-22 21:51:21 +00:00
guoguangwu
c4a595cf29 cmd/compile: use raw strings to avoid double escapes
Change-Id: I9b24ff7dec0825a8a9d094dfef6553aa605ef47d
GitHub-Last-Rev: 785589211c
GitHub-Pull-Request: golang/go#67871
Reviewed-on: https://go-review.googlesource.com/c/go/+/591257
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-07-22 21:50:36 +00:00
Cuong Manh Le
2edf00cf0d cmd/compile: simplify outerfn check in closureName
Since CL 523275, outerfn is always non-nil.

Change-Id: I42cfff90546e506e04a74fb4f754a25f1eadddc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/598636
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.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-07-22 21:27:57 +00:00
Cuong Manh Le
2e8b3425a2 cmd/compile: retire "IsHiddenClosure" and "IsDeadcodeClosure"
Since CL 522318, all closures are now hidden. Thus this CL removes all
codes that worries about hidden vs non-hidden closures.

Change-Id: I1ea124168c76cedbfc4053d2f150937a382aa330
Reviewed-on: https://go-review.googlesource.com/c/go/+/523275
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-07-22 21:27:37 +00:00
Ian Lance Taylor
d25a90676d make.bash: drop GNU/kFreeBSD handling
The GNU/kFreeBSD project has been canceled.
https://wiki.debian.org/Debian_GNU/kFreeBSD

For #3533

Change-Id: I30990fced48e1ba43e1e59806379eb97bac3ab6c
Reviewed-on: https://go-review.googlesource.com/c/go/+/596937
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-07-22 21:24:34 +00:00
Rhys Hiltner
1c4acea03d internal/trace: make Reader output deterministic
Multiple Ms can offer Events with identical timestamps. The Reader
edits those so the timestamps are strictly increasing, but it needs a
way to break the tie. Use something deterministic (such as the order of
the batches), rather than map iteration order.

Updates #68277

Change-Id: I4a1f70c1669ce1c9b52d09e2bc99acbc831ef9a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/596355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Rhys Hiltner <rhys.hiltner@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-07-22 21:23:42 +00:00
TangYang
601ea46a53 runtime: add ERMS-based memmove support for modern CPU platforms
The current memmove implementation uses REP MOVSB to copy data larger than
2KB when the useAVXmemmove global variable is false and the CPU supports
the ERMS feature.

This feature is currently only enabled on CPUs in the Sandy Bridge (Client)
, Sandy Bridge (Server), Ivy Bridge (Client), and Ivy Bridge (Server)
microarchitectures.

For modern Intel CPU microarchitectures that support the ERMS feature, such
as Ice Lake (Server), Sapphire Rapids , REP MOVSB achieves better
performance than the AVX-based copy currently implemented in memmove.

Benchstat result:

goos: linux
goarch: amd64
pkg: runtime
cpu: Intel(R) Xeon(R) Gold 6348 CPU @ 2.60GHz
               │  ./old.txt  │              ./new.txt              │
               │   sec/op    │   sec/op     vs base                │
Memmove/2048-2   25.24n ± 0%   24.27n ± 0%   -3.84% (p=0.000 n=10)
Memmove/4096-2   44.87n ± 0%   33.16n ± 1%  -26.11% (p=0.000 n=10)
geomean          33.65n        28.37n       -15.71%

               │  ./old.txt   │               ./new.txt               │
               │     B/s      │      B/s       vs base                │
Memmove/2048-2   75.56Gi ± 0%    78.59Gi ± 0%   +4.02% (p=0.000 n=10)
Memmove/4096-2   85.01Gi ± 0%   115.05Gi ± 1%  +35.34% (p=0.000 n=10)
geomean          80.14Gi         95.09Gi       +18.65%

Fixes #66958

Change-Id: I1fafd1b51a16752f83ac15047cf3b29422a79d5d
GitHub-Last-Rev: 89cf5af32b
GitHub-Pull-Request: golang/go#66959
Reviewed-on: https://go-review.googlesource.com/c/go/+/580735
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-07-22 21:22:16 +00:00
Diego Augusto Molina
20e18c9550 unicode/utf8: AppendRune and EncodeRune performance improvement
- Prefer the evaluation of the valid higher byte-width runes branches
over the one for invalid ones
- Avoid the evaluation of the bytes of the RuneError constant, and
instead hard code its byte values
- EncodeRune only: inline for fast handling of ASCII

goos: linux
goarch: amd64
pkg: unicode/utf8
cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
                              │ baseline.test-append.txt │ append-rune-invalid-case-last.test.txt │
                              │          sec/op          │     sec/op      vs base                │
AppendASCIIRune-8                           0.2135n ± 0%     0.2135n ± 0%        ~ (p=0.578 n=20)
AppendSpanishRune-8                          1.645n ± 1%      1.509n ± 2%   -8.30% (p=0.000 n=20)
AppendJapaneseRune-8                         2.196n ± 1%      2.004n ± 1%   -8.74% (p=0.000 n=20)
AppendMaxRune-8                              2.670n ± 1%      2.349n ± 3%  -12.01% (p=0.000 n=20)
AppendInvalidRuneMaxPlusOne-8                2.214n ± 2%      1.798n ± 3%  -18.77% (p=0.000 n=20)
AppendInvalidRuneSurrogate-8                 2.258n ± 1%      1.793n ± 2%  -20.59% (p=0.000 n=20)
AppendInvalidRuneNegative-8                  2.171n ± 2%      1.767n ± 2%  -18.61% (p=0.000 n=20)
geomean                                      1.559n           1.361n       -12.69%

goos: linux
goarch: amd64
pkg: unicode/utf8
cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
                              │ baseline.test-encode.txt │     encode-rune-invalid-last.txt     │
                              │          sec/op          │    sec/op     vs base                │
EncodeASCIIRune-8                           1.0950n ± 1%   0.2140n ± 0%  -80.46% (p=0.000 n=20)
EncodeSpanishRune-8                          1.499n ± 0%    1.414n ± 2%   -5.64% (p=0.000 n=20)
EncodeJapaneseRune-8                         1.960n ± 2%    1.716n ± 4%  -12.43% (p=0.000 n=20)
EncodeMaxRune-8                              2.145n ± 2%    2.227n ± 1%   +3.78% (p=0.000 n=20)
EncodeInvalidRuneMaxPlusOne-8                1.955n ± 2%    1.802n ± 2%   -7.80% (p=0.000 n=20)
EncodeInvalidRuneSurrogate-8                 1.946n ± 3%    1.777n ± 2%   -8.68% (p=0.000 n=20)
EncodeInvalidRuneNegative-8                  1.968n ± 2%    1.766n ± 2%  -10.29% (p=0.000 n=20)
geomean                                      1.757n         1.308n       -25.57%

Fixes #68131

Change-Id: Ibcafa75d63cca07a2e78cd06f6f1e382cb8c716e
Reviewed-on: https://go-review.googlesource.com/c/go/+/594115
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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-07-22 21:20:30 +00:00