1
0
mirror of https://github.com/golang/go synced 2024-11-11 18:21:40 -07:00
Commit Graph

60945 Commits

Author SHA1 Message Date
Cuong Manh Le
2d9255b0ea cmd/compile/internal/typecheck: simplify IndexConst
types2 handles all constant-related bounds checks in user Go code now,
so it's safe to remove the check in IndexConst function.

Change-Id: I9116493f191c4df1cce7e43c8ac3dc5bf020fd5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/611675
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2024-09-11 17:13:48 +00:00
Cuong Manh Le
820329508a runtime: Goexit on C-created thread report more useful error message
This reverts CL 609296, with the fix for failing builders.

Fixes #68275

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-nocgo,gotip-darwin-amd64-nocgo,gotip-linux-ppc64_power10,gotip-linux-ppc64_power8
Change-Id: I0f539ee7b0be720642eee8885946edccd9c6e04e
Reviewed-on: https://go-review.googlesource.com/c/go/+/612335
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: qiu laidongfeng2 <2645477756@qq.com>
2024-09-11 17:05:32 +00:00
Mark D Ryan
26aa8d6eb8 runtime: add asm_riscv64.h
asm_riscv64.h will be used to define macros for each riscv64
extension that is not part of the rva20u64 base profile but that the
_riscv64.s assembly files are allowed to use because the user has
specified a more capable profile in the GORISCV64 variable. This will
allow us, for example, to test for the hasZba macro in those assembly
files instead of the GORISCV64_rva22u64 macro before using a Zba
instruction.  This is important as it means that in the future when
we add support for new profiles that support Zba, e.g., rva23u64,
we only need to update asm_riscv64.h to indicate rva23u64 supports
Zba.  We will not need to update every assembly language file that
already uses Zba instructions.

Updates #61476

Change-Id: I83abfeb20d08a87ac8ea88f4d8a93437f0631353
Reviewed-on: https://go-review.googlesource.com/c/go/+/608255
Auto-Submit: Tim King <taking@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-11 16:49:16 +00:00
Cuong Manh Le
5d06d165ff cmd/compile: remove types.Type rparams field
This field is present during the initial development of generic support
inside compiler, and indicating whether a type is fully instantiated is
the solely purpose at this moment. Further, its name is also confused,
and there have been a TODO to chose a better name for it.

Instead, just using a bit to track whether a type is fully instantiated,
then this rparams field can be removed to simplify the code.

Change-Id: Ia29c6dd5792487c440b83b0f3b77bd60917c2019
Reviewed-on: https://go-review.googlesource.com/c/go/+/611255
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2024-09-11 16:48:39 +00:00
Ian Lance Taylor
ec67622d04 cmd/compile, go/types: add missing space in error message
Otherwise "print(nil)" gets an error like
    use of untyped nil in argument to built-inprint

Change-Id: Iaa841df106f90787031dce75a49af69860a9dbc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/611918
Commit-Queue: 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>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2024-09-11 16:19:00 +00:00
Tobias Klauser
9deda35ff8 cmd/cgo: use slices.ContainsFunc
Now that Go 1.22.6 is the minimum bootstrap toolchain (cf. CL 606156),
the slices package (introduced in Go 1.21) can be used in packages built
using the bootstrap toolchain.

For #64751

Change-Id: Ib36f39016f57c5e110f78a85ca9c806d91356024
Reviewed-on: https://go-review.googlesource.com/c/go/+/612316
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-11 14:12:40 +00:00
Dmitri Shuralyov
ad6ee21bbf go/printer: revert "do not treat comments inside a ast.Decl as godoc"
This reverts commit CL 609077.

Reason for revert: it turned out to also introduce a change to the
formatting as described in issue #69382, which wasn't intended.

For #69382.

Change-Id: Id8f36e5503e63e7586c8afe7c7d3dc25fd56ed94
Reviewed-on: https://go-review.googlesource.com/c/go/+/612137
Reviewed-by: Christian Höppner <hoeppi@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-11 06:30:02 +00:00
Meng Zhuo
90391c2e8a math: add round assembly implementations on riscv64
This CL reapplies CL 504737 and adds integer precision
limitation check, since CL 504737 only checks whether
floating point number is +-Inf or NaN.

This CL is also ~7% faster than CL 504737.

Updates #68322

goos: linux
goarch: riscv64
pkg: math
            │ math.old.bench │           math.new.bench            │
            │     sec/op     │   sec/op     vs base                │
Ceil             54.09n ± 0%   18.72n ± 0%  -65.39% (p=0.000 n=10)
Floor            40.72n ± 0%   18.72n ± 0%  -54.03% (p=0.000 n=10)
Round            20.73n ± 0%   20.73n ± 0%        ~ (p=1.000 n=10)
RoundToEven      24.07n ± 0%   24.07n ± 0%        ~ (p=1.000 n=10)
Trunc            38.72n ± 0%   18.72n ± 0%  -51.65% (p=0.000 n=10)
geomean          33.56n        20.09n       -40.13%

Change-Id: I06cfe2cb9e2535cd705d40b6650a7e71fedd906c
Reviewed-on: https://go-review.googlesource.com/c/go/+/600075
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
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>
2024-09-11 02:28:10 +00:00
Meng Zhuo
2982253c42 test/codegen: add Rotate test for riscv64
Change-Id: I7d996b8d46fbeef933943f806052a30f1f8d50c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/588836
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-11 01:37:00 +00:00
Xiaolin Zhao
9b88f58099 cmd/compile/internal/ssa: optimize rules Zero and Move on loong64
goos: linux
goarch: loong64
pkg: runtime
cpu: Loongson-3A6000 @ 2500.00MHz
             │  old.bench   │              new.bench               │
             │    sec/op    │    sec/op     vs base                │
ClearFat7      3.6020n ± 0%   0.5087n ± 1%  -85.88% (p=0.000 n=20)
ClearFat8      0.5137n ± 0%   0.8004n ± 0%  +55.81% (p=0.000 n=20)
ClearFat11     5.2030n ± 0%   0.5082n ± 1%  -90.23% (p=0.000 n=20)
ClearFat12     0.8244n ± 0%   0.8004n ± 0%   -2.91% (p=0.000 n=20)
ClearFat13     6.0030n ± 0%   0.5077n ± 1%  -91.54% (p=0.000 n=20)
ClearFat14     6.4030n ± 0%   0.8004n ± 0%  -87.50% (p=0.000 n=20)
ClearFat15     6.8030n ± 0%   0.5065n ± 1%  -92.55% (p=0.000 n=20)
ClearFat16     2.4010n ± 0%   0.8004n ± 0%  -66.66% (p=0.000 n=20)
ClearFat24      3.202n ± 0%    1.601n ± 0%  -50.00% (p=0.000 n=20)
ClearFat32      4.002n ± 0%    2.001n ± 0%  -50.00% (p=0.000 n=20)
ClearFat40      4.802n ± 0%    1.601n ± 0%  -66.66% (p=0.000 n=20)
ClearFat48      5.603n ± 0%    2.001n ± 0%  -64.29% (p=0.000 n=20)
ClearFat56      6.403n ± 0%    2.001n ± 0%  -68.75% (p=0.000 n=20)
ClearFat64      7.204n ± 0%    2.401n ± 0%  -66.67% (p=0.000 n=20)
ClearFat72      8.004n ± 0%    2.001n ± 0%  -75.00% (p=0.000 n=20)
ClearFat128    14.010n ± 0%    3.218n ± 0%  -77.03% (p=0.000 n=20)
ClearFat256    26.810n ± 0%    6.727n ± 0%  -74.91% (p=0.000 n=20)
ClearFat512     52.43n ± 0%    16.40n ± 0%  -68.72% (p=0.000 n=20)
ClearFat1024   103.65n ± 0%    37.49n ± 0%  -63.83% (p=0.000 n=20)
ClearFat1032   104.50n ± 0%    52.83n ± 0%  -49.44% (p=0.000 n=20)
ClearFat1040   105.30n ± 0%    53.23n ± 0%  -49.45% (p=0.000 n=20)
CopyFat7       6.0030n ± 0%   0.6048n ± 0%  -89.93% (p=0.000 n=20)
CopyFat8       0.8004n ± 0%   0.5974n ± 0%  -25.37% (p=0.000 n=20)
CopyFat11      9.2050n ± 0%   0.6057n ± 0%  -93.42% (p=0.000 n=20)
CopyFat12      0.8103n ± 0%   0.6064n ± 0%  -25.16% (p=0.000 n=20)
CopyFat13      6.4030n ± 0%   0.6052n ± 0%  -90.55% (p=0.000 n=20)
CopyFat14      6.8040n ± 0%   0.6064n ± 0%  -91.09% (p=0.000 n=20)
CopyFat15      7.2040n ± 0%   0.6071n ± 0%  -91.57% (p=0.000 n=20)
CopyFat16      2.8010n ± 0%   0.6064n ± 0%  -78.35% (p=0.000 n=20)
CopyFat24       3.602n ± 0%    2.001n ± 0%  -44.45% (p=0.000 n=20)
CopyFat32       4.402n ± 0%    2.001n ± 0%  -54.54% (p=0.000 n=20)
CopyFat64       7.604n ± 0%    2.802n ± 0%  -63.15% (p=0.000 n=20)
CopyFat72       8.405n ± 0%    3.202n ± 0%  -61.90% (p=0.000 n=20)
CopyFat128     14.410n ± 0%    5.480n ± 0%  -61.97% (p=0.000 n=20)
CopyFat256      28.57n ± 0%    12.16n ± 0%  -57.44% (p=0.000 n=20)
CopyFat512      63.63n ± 0%    24.88n ± 0%  -60.90% (p=0.000 n=20)
CopyFat520      67.23n ± 0%    24.11n ± 0%  -64.14% (p=0.000 n=20)
CopyFat1024    125.00n ± 0%    50.60n ± 0%  -59.52% (p=0.000 n=20)
CopyFat1032    121.30n ± 0%    64.32n ± 0%  -46.97% (p=0.000 n=20)
CopyFat1040    124.50n ± 0%    67.23n ± 0%  -46.00% (p=0.000 n=20)
geomean         9.539n         2.779n       -70.87%

Change-Id: Ic04e5f849f20ec3ec748d6763d4c9f8a1f21ee49
Reviewed-on: https://go-review.googlesource.com/c/go/+/592115
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2024-09-11 00:35:48 +00:00
Tim King
a9bd84e037 Revert "runtime: Goexit on C-created thread report more useful error message"
This reverts CL 602296.

Reason for revert: Failing on several builders.

Change-Id: I889c566d34294032c330d4f9402300ad0d5d3bf5
Reviewed-on: https://go-review.googlesource.com/c/go/+/611919
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-09-10 23:32:53 +00:00
Ian Lance Taylor
493517bb5c runtime, reflect: avoid allocation in structType.Field common cases
Use assembler to make runtime.staticuint64s into a readonly array
so that the reflect package can safely create a slice without requiring
any allocation.

Fixes #2320
Fixes #68380

Change-Id: If2c97238eca782d0632db265c840581d4ecb9d18
Reviewed-on: https://go-review.googlesource.com/c/go/+/597855
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2024-09-10 22:38:30 +00:00
Ian Lance Taylor
8926ca9c5e syscall: on exec failure, close pidfd
Fixes #69284

Change-Id: I6350209302778ba5e44fa03d0b9e680d2b4ec192
Reviewed-on: https://go-review.googlesource.com/c/go/+/611495
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: roger peppe <rogpeppe@gmail.com>
Reviewed-by: Tim King <taking@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-10 22:35:31 +00:00
WuGuangyao
cdca671855 runtime: update documentation for ios addr bits
After this merge: https://go-review.googlesource.com/c/go/+/344401, ios/arm64 was treated as a 64 bit system and the addr bits of ios/arm64 was set to 40

Change-Id: I32d72787d20a3cf952b036e3e887cf5bae2273d8
GitHub-Last-Rev: 8917029fdd
GitHub-Pull-Request: golang/go#69343
Reviewed-on: https://go-review.googlesource.com/c/go/+/610856
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Tim King <taking@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-10 21:49:04 +00:00
Tobias Klauser
aef61555da time: don't check non-nil err twice in parse
Change-Id: I40a1b49035321b05032eacf4525a62b8c562e0d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/612195
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-09-10 21:43:25 +00:00
Cuong Manh Le
d288776d91 cmd/compile: remove trivial closure reference
Trivial closures will be converted to global functions, thus they are
not closures anymore. Using fn.IsClosure function is enough, allow
removing the trivial/non-trivial closures in the code.

Change-Id: Iceb186dd92c1732b101e221ebc13406db35c69ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/611995
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Tim King <taking@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: Keith Randall <khr@google.com>
2024-09-10 21:30:16 +00:00
Paschalis Tsilias
fe69121bc5 cmd/compile: optimize []byte(string1 + string2)
This CL optimizes the compilation of string-to-bytes conversion in the
case of string additions.

Fixes #62407

Change-Id: Ic47df758478e5d061880620025c4ec7dbbff8a64
Reviewed-on: https://go-review.googlesource.com/c/go/+/527935
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
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: Tim King <taking@google.com>
2024-09-10 21:20:57 +00:00
qiulaidongfeng
3da4281df1 runtime: Goexit on C-created thread report more useful error message
Fixes #68275

Change-Id: I47b7a2092f1b4d48aebf437db4e329815c956bb9
GitHub-Last-Rev: b89bf3cab7
GitHub-Pull-Request: golang/go#69126
Reviewed-on: https://go-review.googlesource.com/c/go/+/609296
Reviewed-by: Tim King <taking@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-09-10 21:10:43 +00:00
Jes Cok
77e42fdeaf net/http: make use of maps.Clone for Transport.{Clone, RegisterProtocol}
Not a big deal, maybe it's a bit clearer that it's cloning a map.

Change-Id: I7c85382a01df97d1f58109b2483061e6decdf03a
GitHub-Last-Rev: 7a88af7f56
GitHub-Pull-Request: golang/go#69357
Reviewed-on: https://go-review.googlesource.com/c/go/+/612015
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-09-10 19:59:02 +00:00
amusman
af0c40311e cmd/compile: emit tail call wrappers when possible
Use OTAILCALL in wrapper if the receiver and method are both pointers and it is
not going to be inlined, similar to how it is done in reflectdata.methodWrapper.
Currently tail call may be used for functions with identical argument types.
This change updates wrappers where both wrapper and the wrapped method's
receiver are pointers. In this case, we have the same signature for the
wrapper and the wrapped method (modulo the receiver's pointed-to types),
and do not need any local variables in the generated wrapper (on stack)
because the arguments are immediately passed to the wrapped method in place
(without need to move some value passed to other register or to change any
argument/return passed through stack). Thus, the wrapper does not need its
own stack frame.

This applies to promoted methods, e.g. when we have some struct type U with
an embedded type *T and construct a wrapper like
func (recv *U) M(arg int) bool { return recv.T.M(i) }

See also test/abi/method_wrapper.go for a running example.

Code size difference measured with this change (tried for x86_64):
etcd binary:
.text section size: 21472251 -> 21432350 (0.2%)
total binary size:  32226640 -> 32191136 (0.1%)

compile binary:
.text section size: 17419073 -> 17413929 (0.03%)
total binary size:  26744743 -> 26737567 (0.03%)

Change-Id: I9bbe730568f6def21a8e61118a6b6f503d98049c
Reviewed-on: https://go-review.googlesource.com/c/go/+/578235
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>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2024-09-09 20:20:10 +00:00
Michael Matloob
adf220a5d5 cmd/go/testdata/script: skip part of test on unsupported platforms
The telemetry script test checks for the existence of telemetry data as
a baseline before checking that the act of setting telemtetry to off
while in local mode doesn't produce telemetry data. Of course, when
we're running on platforms where telemetry is not supported, telemetry
data won't be produced on disk either way. Only check for the existence
of telemetry data on supported platforms.

For #69269

Change-Id: I3a06bbc3d3ca0cf0203b84883f632ecfd9445aae
Reviewed-on: https://go-review.googlesource.com/c/go/+/611876
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Matloob <matloob@golang.org>
2024-09-09 17:11:52 +00:00
cuishuang
cc912bd8eb all: remove unnecessary symbols and add missing symbols
Change-Id: I535a7aaaf3f9e8a9c0e0c04f8f745ad7445a32f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/611678
Run-TryBot: shuang cui <imcusg@gmail.com>
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>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2024-09-09 16:44:45 +00:00
Michael Matloob
5858205831 cmd/go: add an exception for 'go telemetry off' to not open counters
There is the expectation that if 'go telemetry off' is run with a clean
home directory that no counter files are written. But we were writing
counters in that case because the act of turning telemetry off was done
after the act of opening the counter files, so the counter files were
opened depending on what the previous mode was. Add a special check that
the command is not 'go telemetry off' before opening counter files.

Fixes #69269

Change-Id: I8fc37dfe24ec7f454676cc2fdd4b79a13a7aba9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/611456
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Michael Matloob <matloob@golang.org>
2024-09-09 14:36:44 +00:00
Tobias Klauser
807e01db48 syscall: follow convention for generated code comment
Follow the convention (https://golang.org/s/generatedcode) for generated
code as if we would regenerate them using mkall.sh. This also drops the
superfluous //go:build tags which are already implied by the file names.

Change-Id: Ic97c6ba9d707d347f06a7d6c1dd07b556d82c882
Reviewed-on: https://go-review.googlesource.com/c/go/+/611115
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-07 18:31:28 +00:00
Mateusz Poliwczak
464aae706b go/printer: check whether !isTypeElem, instead of combinesWithName when ParenExpr
See discussion in CL 610115 and CL 610758.

For #69206

Change-Id: I16f394cb3440106650fb64a466f2723a4dba3871
GitHub-Last-Rev: 37993b5baf
GitHub-Pull-Request: golang/go#69309
Reviewed-on: https://go-review.googlesource.com/c/go/+/611355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-09-06 20:59:01 +00:00
Michael Matloob
42d1f08cbb src/cmd/go/internal/load: remove PackageError.Hard
This field isn't actually used. The last usage was deleted in CL 518775
and even then it wasn't actually being set.

Change-Id: Ifbe9da9c2a6d81a40c136a60028902176f443588
Reviewed-on: https://go-review.googlesource.com/c/go/+/610255
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-06 18:32:48 +00:00
Sebastian Nickolls
557211c150 cmd/internal/obj/arm64: Add helpers for span7 passes
Adds helper functions for the literal pooling, large branch handling
and code emission stages of the span7 assembler pass. This hides the
implementation of the current assembler from the general workflow in
span7 to make the implementation easier to change in future.

Updates #44734

Change-Id: I8859956b23ad4faebeeff6df28051b098ef90fed
Reviewed-on: https://go-review.googlesource.com/c/go/+/595755
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-06 17:30:53 +00:00
Kir Kolyshkin
8cd550a232 internal/syscall/unix: Eaccess: return ENOSYS on Android
On Android, faccessat2 syscall (which supports flags like AT_EACCESS) is
not allowed, so syscall.Faccessat tries to emulate AT_EACCESS check in
userspace using os.Stat, os.Geteuid etc.

Also, according to [1],

> Android doesn't have setuid programs, and never runs code with euid!=uid.

This means on Android the proper AT_EACCESS check is neither possible
nor really needed.

Let's skip the syscall.Faccessat userspace emulation of AT_EACCESS
check and return ENOSYS, so the callers can use a fallback.

This should speed up exec.LookPath on Android.

[1]: 508b2f6e5c/libc/bionic/faccessat.cpp (50)

Change-Id: If7b529fa314480b70e9ae9cdd8c7ce82cd55d233
Reviewed-on: https://go-review.googlesource.com/c/go/+/611298
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-06 13:49:31 +00:00
Kir Kolyshkin
a0d7bfa286 internal/syscall/unix: implement Eaccess on all unix platforms
Eaccess, initially added by CL 414824 for linux only, was later
implemented for freebsd (CL 531155), netbsd (CL 531876), dragonfly
(CL 532675), openbsd (CL 538836), and darwin (CL 579976).

The only unix platforms which lack Eaccess are Solaris/Illumos and AIX.

For AIX, syscall.Faccessat is already available, the only missing piece
was AT_EACCESS constant. Let's take it from [1], which, judging by a few
other known AT_ constants, appears to be accurate.

For Solaris, wire the faccessat using the same logic as in the syscall
package.

Now, when we have faccessat for every unix, we can drop eaccess_other.go
and consolidate Eaccess implementations to use faccessat.

[1]: https://github.com/rust-lang/libc/blob/main/src/unix/aix/mod.rs

Change-Id: I7e1b90dedc5d8174235d3a79d5c662f3dcb909c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/611295
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
2024-09-06 13:29:47 +00:00
Kir Kolyshkin
8f2486d2e0 cmd/internal: use t.TempDir in tests
Change-Id: I3d4c66793afa3769a8450e2d65093a0f9115596e
Reviewed-on: https://go-review.googlesource.com/c/go/+/611043
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>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-06 13:28:35 +00:00
Kir Kolyshkin
a77b93c0b2 cmd/internal/script: use sync.OnceValue
Change-Id: I384a7391a26f24402c055aec98b37927305e2a39
Reviewed-on: https://go-review.googlesource.com/c/go/+/611042
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-09-06 13:28:33 +00:00
Kir Kolyshkin
a1c3e24b54 cmd/internal/objabi: use sync.OnceValue
Change-Id: I09c134fff728d32c5bc475889b8c673cc18120a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/611041
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-09-06 13:27:54 +00:00
Kir Kolyshkin
ca2cb8d7a7 cmd/internal/testdir: remove temp files
Function stdlibImportcfgFile creates a temporary directory and a file in
it, which are never deleted.

The easiest to fix this (without creating the file unnecessarily, or
creating it multiple times) is to add a global tmpDir and use it in
stdlibImportcfgFile.

Change-Id: Ia971b4478d9e0fa7c3a9b4c66e13fd5a4af9cbaa
Reviewed-on: https://go-review.googlesource.com/c/go/+/610818
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-09-06 13:27:07 +00:00
Kir Kolyshkin
2b832b4296 cmd/internal/testdir: use sync.OnceValue
Change-Id: I90fd0318c7f85032ef8b6621331fe2a8a2da41f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/611040
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>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-09-06 13:26:38 +00:00
Kir Kolyshkin
46bccdebfa cmd/internal/testdir: use os.ReadDir
Change-Id: I9828c7c4f9c27efabf072ec1d83b3ce94c14cc0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/610817
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>
2024-09-06 13:26:35 +00:00
Kir Kolyshkin
29a3a39b61 cmd/nm: use t.TempDir
Change-Id: I6c1d148ae4c899142b160533d8bdf662494bcd7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/611039
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>
2024-09-06 13:25:54 +00:00
Kir Kolyshkin
2be9309983 cmd/addr2line: use t.TempDir
Change-Id: I62f1c51be89e9c2f22cc7b0b2e554ffa3da907ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/611038
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-09-06 13:23:48 +00:00
Kir Kolyshkin
86d74894cc os: use Mkdir in TestCopyFSWithSymlinks
This code creates a few directories under a temporary directory that was
just created before, so using MkdirTemp is not needed here.

Change-Id: Icfc45b70349bc1927efb1647bcc9fd58aa82b792
Reviewed-on: https://go-review.googlesource.com/c/go/+/611037
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>
2024-09-06 13:23:10 +00:00
Kir Kolyshkin
6cb8e5ca9f os: use t.TempDir in TestRemoveAllRace
Change-Id: I35d47bcac37945237bfef9f06195bc55dc9aa920
Reviewed-on: https://go-review.googlesource.com/c/go/+/611036
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>
2024-09-06 13:22:35 +00:00
Mateusz Poliwczak
8cb6143fed go/printer: mention that input file is formatted in TestFiles error message
Currently when one of the tests in TestFiles fail, then the error looks
like this:

--- testdata/generics.input
+++ testdata/generics.golden

which is confusing, with this change it will be:

--- format(testdata/generics.input)
+++ testdata/generics.golden

Change-Id: Id5c080c5237acd82303d2f41cace8a3fe9ea08e0
GitHub-Last-Rev: aedafc05fd
GitHub-Pull-Request: golang/go#69292
Reviewed-on: https://go-review.googlesource.com/c/go/+/610559
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-06 13:22:32 +00:00
Kir Kolyshkin
d1ce116e40 cmd/go/internal: use sync.OnceFunc, sync.OnceValue
Cleaner code, less global variables

Change-Id: I6d842932e538849260b36fa408bc5ddae68c05ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/611018
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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-09-06 13:19:58 +00:00
Kir Kolyshkin
4777fd3d31 cmd/go/internal/toolchain: use sync.OnceValue
Rename initPathExts to pathExts, make it return the slice of extensions,
and wrap into sync.OnceValue.

While at it, return early if PATHEXT is empty.

Change-Id: I33508762e87edd226e0a52df4063473c496c0210
Reviewed-on: https://go-review.googlesource.com/c/go/+/611017
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>
2024-09-06 13:19:20 +00:00
Kir Kolyshkin
ba2a16cb63 cmd/go/internal/auth: use sync.OnceValues
Use sync.OnceValues (CL 451356, since Go 1.21) instead of sync.Once for
cleaner code and less global variables, preventing their potential
misuse.

Change-Id: I9d7ccc42847fe77af1757672c31bb39e20007f92
Reviewed-on: https://go-review.googlesource.com/c/go/+/611016
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-09-06 13:19:17 +00:00
Tobias Klauser
e6ae2d83ac cmd/asm/internal: use slices.Contains
Now that Go 1.22.6 is the minimum bootstrap toolchain (cf. CL 606156),
the slices package (introduced in Go 1.21) can be used in packages built
using the bootstrap toolchain.

For #64751

Change-Id: I0115213da4b1f0a1fa0ef7ad34456fbf52e00fae
Reviewed-on: https://go-review.googlesource.com/c/go/+/611095
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-06 13:17:27 +00:00
apocelipes
12dcbed451 compress/flate: use built-in clear to simplify the code
The new bootstrap toolchain allows us to use the built-in clear.

Updates #64751

Change-Id: Ic363e1059f34c46eaa4267c0b40a4ed8d5b3961b
GitHub-Last-Rev: 46ca735bfc
GitHub-Pull-Request: golang/go#69253
Reviewed-on: https://go-review.googlesource.com/c/go/+/610516
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-09-06 13:15:29 +00:00
Kyle Xiao
123594d386 runtime: remove cloudwego/frugal unused linkname from comment
frugal no longer uses these methods from next Go version

Fixes #69222

Change-Id: Ie71de0752cabef7d5584d3392d6e5920ba742350
Reviewed-on: https://go-review.googlesource.com/c/go/+/609918
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-06 11:47:06 +00:00
Ian Lance Taylor
9e9b1f57c2 reflect: gofmt all_test.go
CL 580779 accidentally committed an un-gofmt-ed all_test.go

Change-Id: I071ad8d8d08cab12032ff8d3eebecb55e808f14a
Reviewed-on: https://go-review.googlesource.com/c/go/+/610561
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
2024-09-06 04:48:35 +00:00
Robert Griesemer
9e621c3ae0 go/types, types2: remove unused argument from Checker.updateExprType0
With Checker.updateExprType0 and Checker.updateExprType being the
same now, rename updateExprType0 to updateExprType and remove the
old updateExprType.

Change-Id: Ib5c3d74e7fac9cedcc87ad521b7543b8d7f83943
Reviewed-on: https://go-review.googlesource.com/c/go/+/611276
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-09-05 22:12:16 +00:00
Robert Griesemer
e4f9cb5f77 go/types, types2: remove unused argument from Checker.compositeLit
Change-Id: I4f52503bab569d85f28ae8920079de26a331b7ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/610560
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Tim King <taking@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-05 22:12:07 +00:00
Robert Griesemer
0fc3b127a0 go/types, types2: factor type checking of basic literals and generate go/types code
Move the code for type checking of basic literals into literals.go.

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

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