Cherry Mui [Wed, 3 Sep 2025 15:19:43 +0000 (11:19 -0400)]
[dev.simd] all: merge master (4c4cefc) into dev.simd
Merge List:
+ 2025-09-03 4c4cefc19a cmd/gofmt: simplify logic to process arguments
+ 2025-09-03 925a3cdcd1 unicode/utf8: make DecodeRune{,InString} inlineable
+ 2025-09-03 3e596d448f math: rename Modf parameter int to integer
+ 2025-09-02 2a7f1d47b0 runtime: use one more address bit for tagged pointers
+ 2025-09-02 b09068041a cmd/dist: run racebench tests only in longtest mode
+ 2025-09-02 355370ac52 runtime: add comment for concatstring2
+ 2025-09-02 1eec830f54 go/doc: linkify interface methods
+ 2025-08-31 7bba745820 cmd/compile: use generated loops instead of DUFFZERO on loong64
+ 2025-08-31 882335e2cb cmd/internal/obj/loong64: add LDPTR.{W/D} and STPTR.{W/D} instructions support
+ 2025-08-31 d4b17f5869 internal/runtime/atomic: reset wrong jump target in Cas{,64} on loong64
+ 2025-08-31 6a08e80399 net/http: skip redirecting in ServeMux when URL path for CONNECT is empty
+ 2025-08-29 8bcda6c79d runtime/race: add race detector support for linux/riscv64
+ 2025-08-29 8377adafc5 cmd/cgo: split loadDWARF into two parts
+ 2025-08-29 a7d9d5a80a cmd/cgo: move typedefs and typedefList out of Package
+ 2025-08-29 1d459c4357 all: delete more windows/arm remnants
+ 2025-08-29 27ce6e4e26 cmd/compile: remove sign extension before MULW on riscv64
+ 2025-08-29 84b070bfb1 cmd/compile/internal/ssa: make oneBit function generic
+ 2025-08-29 fe42628dae internal/cpu: inline DebugOptions
+ 2025-08-29 94b7d519bd net: update document on limitation of iprawsock on Windows
+ 2025-08-29 ba9e1ddccf testing: allow specify temp dir by GOTMPDIR environment variable
+ 2025-08-29 9f6936b8da cmd/link: disallow linkname of runtime.addmoduledata
+ 2025-08-29 89d41d254a bytes, strings: speed up TrimSpace
+ 2025-08-29 38204e0872 testing/synctest: call out common issues with tests
+ 2025-08-29 252c901125 os,syscall: pass file flags to CreateFile on Windows
+ 2025-08-29 53515fb0a9 crypto/tls: use hash.Cloner
+ 2025-08-28 13bb48e6fb go/constant: fix complex != unknown comparison
+ 2025-08-28 ba1109feb5 net: remove redundant cgoLookupCNAME return parameter
+ 2025-08-28 f74ed44ed9 net/http/httputil: remove redundant pw.Close() call in DumpRequestOut
+ 2025-08-28 a9689d2e0b time: skip TestLongAdjustTimers in short mode on single CPU systems
+ 2025-08-28 ebc763f76d syscall: only get parent PID if SysProcAttr.Pdeathsig is set
+ 2025-08-28 7f1864b0a8 strings: remove redundant "runs" from string.Fields docstring
+ 2025-08-28 90c21fa5b6 net/textproto: eliminate some bounds checks
+ 2025-08-27 e47d88beae os: return nil slice when ReadDir is used with a file on file_windows
+ 2025-08-27 6b837a64db cmd/internal/obj/loong64: simplify buildop
+ 2025-08-27 765905e3bd debug/elf: don't panic if symtab too small
+ 2025-08-27 2ee4b31242 net/http: Ensure that CONNECT proxied requests respect MaxResponseHeaderBytes
+ 2025-08-27 b21867b1a2 net/http: require exact match for CrossSiteProtection bypass patterns
+ 2025-08-27 d19e377f6e cmd/cgo: make it safe to run gcc in parallel
+ 2025-08-27 49a2f3ed87 net: allow zero value destination address in WriteMsgUDPAddrPort
+ 2025-08-26 afc51ed007 internall/poll: remove bufs field from Windows' poll.operation
+ 2025-08-26 801b74eb95 internal/poll: remove rsa field from Windows' poll.operation
+ 2025-08-26 fa18c547cd syscall: sort Windows env block in StartProcess
+ 2025-08-26 bfd130db02 internal/poll: don't use stack-allocated WSAMsg parameters
+ 2025-08-26 dae9e456ae runtime: identify virtual memory layout for riscv64
+ 2025-08-25 25c2d4109f math: use Trunc to implement Modf
+ 2025-08-25 4e05a070c4 math: implement IsInf using Abs
+ 2025-08-25 1eed4f32a0 math: optimize Signbit implementation slightly
+ 2025-08-25 bd71b94659 cmd/compile/internal: optimizing add+sll rule using ALSLV instruction on loong64
+ 2025-08-25 ea55ca3600 runtime: skip doInit of plugins in runtime.main
+ 2025-08-25 9ae2f1fb57 internal/trace: skip async preempt off tests on low end systems
+ 2025-08-25 bbd5342a62 net: fix cgoResSearch
+ 2025-08-25 ed7f804775 os: set full name for Roots created with Root.OpenRoot
+ 2025-08-25 a21249436b internal/poll: use fdMutex to provide read/write locking on Windows
+ 2025-08-24 44c5956bf7 test/codegen: add Mul2 and DivPow2 test for loong64
+ 2025-08-24 0aa8019e94 test/codegen: add Mul* test for loong64
+ 2025-08-24 83420974b7 test/codegen: add sqrt* abs and copysign test for loong64
+ 2025-08-23 f2db0dca0b net/http/httptest: redirect example.com requests to server
+ 2025-08-22 d86ec92499 internal/syscall/windows: increase internal Windows O_ flags values
+ 2025-08-22 9d3f7fda70 crypto/tls: fix quic comment typo
+ 2025-08-22 78a05c541f internal/poll: don't pass non-nil WSAMsg.Name with 0 namelen on windows
+ 2025-08-22 52c3f73fda runtime/metrics: improve doc
+ 2025-08-22 a076f49757 os: fix Root.MkdirAll to handle race of directory creation
+ 2025-08-22 98238fd495 all: delete remaining windows/arm code
+ 2025-08-21 1ad30844d9 cmd/asm: process forward jump to PCALIGN
+ 2025-08-21 13c082601d internal/poll: permit nil destination address in WriteMsg{Inet4,Inet6}
+ 2025-08-21 9b0a507735 runtime: remove remaining windows/arm files and comments
+ 2025-08-21 1843f1e9c0 cmd/compile: use zero register instead of specialized *zero instructions on loong64
+ 2025-08-21 e0870a0a12 cmd/compile: simplify zerorange on loong64
+ 2025-08-21 fb8bbe46d5 cmd/compile/internal/ssa: eliminate unnecessary extension operations
+ 2025-08-21 9632ba8160 cmd/compile: optimize some patterns into revb2h/revb4h instruction on loong64
+ 2025-08-21 8dcab6f450 syscall: simplify execve handling on libc platforms
+ 2025-08-21 ba840c1bf9 cmd/compile: deduplication in the source code generated by mknode
+ 2025-08-21 fa706ea50f cmd/compile: optimize rule (x + x) << c to x << c+1 on loong64
+ 2025-08-21 ffc85ee1f1 cmd/internal/objabi,cmd/link: add support for additional riscv64 relocations
Daniel Martí [Sat, 30 Aug 2025 17:54:43 +0000 (18:54 +0100)]
cmd/gofmt: simplify logic to process arguments
Rather than stat-ing each argument and taking different code paths
depending on whether it's a directory or not, we can leverage
the fact that filepath.WalkDir works on regular files and already
has to figure out whether each file it walks is a directory or not.
We can then implement "always format non-directory arguments"
by looking at whether the path we are walking is the original argument,
meaning we are walking the top file.
For full clarity, we expand the skipping logic with a switch,
as before it was a bit confusing how we could `return err`
on directories and other non-Go files.
Given that we discard directories separately now,
simplify isGoFile to just be about filenames.
While here, also note that we called AddReport inside WalkDir;
this is unnecessary, as we can return the error for the same effect.
Change-Id: I50ab94710143f19bd8dd95a69e01a3dd228e397e
Reviewed-on: https://go-review.googlesource.com/c/go/+/700115 Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
unicode/utf8: make DecodeRune{,InString} inlineable
This change makes the fast path for ASCII characters inlineable in
DecodeRune and DecodeRuneInString and removes most instances of manual
inlining at call sites.
Here are some benchmark results (no change to allocations):
Michael Munday [Mon, 25 Aug 2025 21:52:02 +0000 (22:52 +0100)]
math: rename Modf parameter int to integer
Avoid using int as a parameter name. Also, rename frac to
fractional for consistency.
Addresses comment on CL 694896:
https://go-review.googlesource.com/c/go/+/694896/comment/a9723a07_8352e3aa/
Change-Id: Icedeecf65ad2f51d4e8d5bcf6e64c0eae9885dec
Reviewed-on: https://go-review.googlesource.com/c/go/+/699035
Auto-Submit: Sean Liao <sean@liao.dev> 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> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Joel Sing <joel@sing.id.au>
Keith Randall [Tue, 2 Sep 2025 22:46:11 +0000 (15:46 -0700)]
runtime: use one more address bit for tagged pointers
We use one extra bit to placate systems which simulate amd64 binaries on
an arm64 host. Allocated arm64 addresses could be as high as 1<<48-1,
which would be invalid if we assumed 48-bit sign-extended addresses.
(Note that this does not help the other way around, simluating arm64
on amd64, but we don't have that problem at the moment.)
Fixes #69255
Change-Id: Iace17a5d41a65e34abf201d03d8b0ff6f7bf1150
Reviewed-on: https://go-review.googlesource.com/c/go/+/700515 Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Michael Anthony Knyszek [Tue, 2 Sep 2025 18:35:21 +0000 (18:35 +0000)]
cmd/dist: run racebench tests only in longtest mode
The racebench tests represent a significant portion of the race
builders' runtimes, but these tests aren't providing a lot of value.
Disable them and run them only on -longtest-race builders.
For #32032.
Change-Id: Ic4383c3f3b51d123ae9f5c377bc0e2ec02f2ddd7
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-race,gotip-linux-amd64-longtest-race
Reviewed-on: https://go-review.googlesource.com/c/go/+/700455 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
Cherry Mui [Sat, 30 Aug 2025 00:33:19 +0000 (20:33 -0400)]
[dev.simd] internal/cpu: report AVX1 and 2 as supported on macOS 15 Rosetta 2
Apparently, on macOS 15 or newer, Rosetta 2 supports AVX1 and 2.
However, neither CPUID nor the Apple-recommended sysctl says it
has AVX. If AVX is used without checking the CPU feature, it may
run fine without SIGILL, but the runtime doesn't know AVX is
available therefore save and restore its states. This may lead to
value corruption.
Check if we are running under Rosetta 2 on macOS 15 or newer. If so,
report AVX1 and 2 as supported.
Change-Id: Ib981379405b1ae28faa378f051096827d760a4cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/700055 Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
Youlin Feng [Sat, 30 Aug 2025 09:18:10 +0000 (17:18 +0800)]
runtime: add comment for concatstring2
People always want to remove concatstring{2,3,4,5} for performance,
but we keep them to make the binary smaller. So, add a comment to
document why.
Updates #65020
Change-Id: I819976b700d45ce4d0846bf4481b2654b85708da
Reviewed-on: https://go-review.googlesource.com/c/go/+/700095
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: 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>
Damien Neil [Thu, 10 Jul 2025 22:43:43 +0000 (15:43 -0700)]
go/doc: linkify interface methods
Create doc links for references to interface methods,
such as "[Context.Err]".
This does not attempt to handle embedded interfaces:
The linked-to method must be declared within the named type.
Fixes #54033
Change-Id: I4d7a132affe682c85958ca785bcc96571404e6c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/687395 Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Guoqi Chen [Wed, 27 Aug 2025 06:45:58 +0000 (14:45 +0800)]
internal/runtime/atomic: reset wrong jump target in Cas{,64} on loong64
The implementation here needs to be consistent with ssa.OpLOONG64LoweredAtomicCas{32,64},
which was ignored in CL 613396.
Change-Id: I72e8d2318e0c1935cc3a35ab5098f8a84e48bcd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/699395 Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn> Reviewed-by: Meidan Li <limeidan@loongson.cn>
Nicholas Husin [Fri, 29 Aug 2025 14:34:10 +0000 (10:34 -0400)]
net/http: skip redirecting in ServeMux when URL path for CONNECT is empty
In 1.21 ServeMux, we had a special-case to skip redirection when a given
path is empty for CONNECT requests:
https://go.googlesource.com/go/+/refs/tags/go1.24.4/src/net/http/servemux121.go#205.
This special case seems to not have been carried over to 1.22 ServeMux.
This causes needless redirection, which this CL fixes.
Fixes #74422
Change-Id: I3cc5b4d195ab0591a9139225b632cbe17f4290db
Reviewed-on: https://go-review.googlesource.com/c/go/+/699915 Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sean Liao <sean@liao.dev> Reviewed-by: Damien Neil <dneil@google.com>
matloob [Mon, 25 Aug 2025 21:07:41 +0000 (17:07 -0400)]
cmd/cgo: split loadDWARF into two parts
The first part runs gcc to get the debug information, and the second
part processes the debug information. The first part doesn't touch the
global and package level information that's computed so we can run it
earlier and concurrently in a later CL.
For #75167
Change-Id: I6a6a6964769a47792892066d06c16f239f532858
Reviewed-on: https://go-review.googlesource.com/c/go/+/699018 Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Michael Munday [Wed, 27 Aug 2025 22:07:36 +0000 (23:07 +0100)]
cmd/compile: remove sign extension before MULW on riscv64
These sign extensions aren't necessary.
Change-Id: Id68ea596a18b30949d4605b2885f02e49e42d8e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/699595 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: Cherry Mui <cherryyz@google.com>
Tobias Klauser [Thu, 28 Aug 2025 14:50:12 +0000 (16:50 +0200)]
internal/cpu: inline DebugOptions
internal/cpu.DebugOptions is only ever set in runtime.cpuinit on
unix-like platforms. DebugOptions itself is only used in
MustHaveDebugOptionsSupport, so inline the GOOS check there.
Change-Id: I6a35d6b8afcdadfc59585258002f53c20026116c
Reviewed-on: https://go-review.googlesource.com/c/go/+/699775 Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
zuojunwei.1024 [Thu, 28 Aug 2025 09:32:09 +0000 (17:32 +0800)]
cmd/link: disallow linkname of runtime.addmoduledata
Although a comment on addmoduledata warns that it should not be
called from Go code, the linker still allow it to be accessed via
go:linkname. Using linkname on this function will cause a linker
crash when building with buildmode=plugin.
Fixes #75180
Change-Id: Ib72c367a8afaef712ca5e29b1d0a4fc98ed8f40f
Reviewed-on: https://go-review.googlesource.com/c/go/+/699655 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Julien Cretel [Mon, 25 Aug 2025 20:38:20 +0000 (20:38 +0000)]
bytes, strings: speed up TrimSpace
This change lifts bounds checks out of loops in the TrimSpace functions,
among other micro-optimizations. Here are some benchmark results
(no change to allocations):
Sean Liao [Sun, 17 Aug 2025 11:29:48 +0000 (12:29 +0100)]
testing/synctest: call out common issues with tests
While each point is explained their respective sections for Time,
Blocking, and Isolation, these appear to be the most common
issues worth calling out up front.
Fixes #75052
Change-Id: I916b559075ee4d1d23810a08459e037e21690193
Reviewed-on: https://go-review.googlesource.com/c/go/+/696736
Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
qmuntal [Fri, 20 Jun 2025 12:28:56 +0000 (14:28 +0200)]
crypto/tls: use hash.Cloner
A hash object needs to be cloned when doing certain steps in a
TLS 1.3 server handshake. It is more efficient to use the
hash.Cloner interface to clone a hash than to encode and decode
the hash object using the binary encoding interfaces.
We still need to support the binary encoding path in case the
hash objects come from the fips140 v1.0.0 module, given that
this module doesn't support the hash.Cloner interface.
Change-Id: I8425e14e481dcefafc9aa1e5bfd63b61c22675ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/682597 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Joel Sing [Sat, 23 Aug 2025 05:05:51 +0000 (15:05 +1000)]
time: skip TestLongAdjustTimers in short mode on single CPU systems
The OpenBSD armv7 port does not support SMP - on this platform the
TestLongAdjustTimers test passes in ~46 seconds on the openbsd/arm
builder when there is no other CPU contention, however it will almost
always fail when there is any other load.
Change-Id: Idf1c47b40376c749886843cdae11289c0984f714
Reviewed-on: https://go-review.googlesource.com/c/go/+/698556
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Commit-Queue: Cherry Mui <cherryyz@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Tobias Klauser [Tue, 26 Aug 2025 12:04:14 +0000 (14:04 +0200)]
syscall: only get parent PID if SysProcAttr.Pdeathsig is set
The value of the parent PID is only used to check against get value
returned by getppid(2) in case SysProcAttr.Pdeathsig is non-zero. Avoid
the useless getpid(2) system call otherwise.
Cq-Include-Trybots: luci.golang.try:gotip-freebsd-amd64
Change-Id: If89f9c7acc82016ec359c79bd861d41460f42218
Reviewed-on: https://go-review.googlesource.com/c/go/+/699175
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org>
qmuntal [Wed, 27 Aug 2025 07:12:29 +0000 (09:12 +0200)]
os: return nil slice when ReadDir is used with a file on file_windows
ReadDir should return (nil, ENOTDIR) when the path points to a file
instead of a directory. That's the behavior on Unix systems, and it also
used to be the behavior on Windows. However, Windows currently returns
([]DirEntry{}, ENOTDIR).
We should change the implementation to match the expected behavior.
Fixed #75157
Change-Id: I3a3ddb71b5cd6e51dbca435a1585f01116844d4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/699375 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Steven Hartland <stevenmhartland@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Nicholas Husin [Mon, 25 Aug 2025 13:07:25 +0000 (13:07 +0000)]
net/http: Ensure that CONNECT proxied requests respect MaxResponseHeaderBytes
Currently, CONNECT proxied requests use an unlimited Reader. As a
result, a malicious or misbehaving proxy server can send an unlimited
number of bytes to a client; causing the client to indefinitely receive bytes
until it runs out of memory.
To prevent this, we now use a LimitedReader that limits the number of
bytes according to MaxResponseHeaderBytes in Transport. If
MaxResponseHeaderBytes is not provided, we use the default value of 10
MB that has historically been used (see #26315).
Fixes #74633
Change-Id: I0b03bb354139dbc64318874402f7f29cc0fb42ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/698915 Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
matloob [Mon, 25 Aug 2025 21:36:30 +0000 (17:36 -0400)]
cmd/cgo: make it safe to run gcc in parallel
Use a new filename for each invocation so invocations run
concurrently don't overwrite the same file.
Change-Id: I6a6a696478b596a4819f41b3ac738263d41bbabf
Reviewed-on: https://go-review.googlesource.com/c/go/+/699017 Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
database64128 [Fri, 1 Aug 2025 16:42:27 +0000 (00:42 +0800)]
net: allow zero value destination address in WriteMsgUDPAddrPort
The existing address validity checks already cover both connected and
non-connected sockets. Pass a nil sockaddr just like WriteMsgUDP, when
the address is zero value.
TestWriteToUDP is extended to cover the netip APIs.
Fixes #74841
Change-Id: I2708e7747e224958198fe7abb3fcd8d59bc5a88a
Reviewed-on: https://go-review.googlesource.com/c/go/+/692437
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Damien Neil <dneil@google.com>
qmuntal [Mon, 25 Aug 2025 10:49:37 +0000 (12:49 +0200)]
internall/poll: remove bufs field from Windows' poll.operation
The bufs field is used to avoid allocating it every time it is needed.
We can do better by using a sync.Pool to reuse allocations across
operations and FDs instead of the field.
A side benefit is that FD is now 16 bytes smaller and operation more
stateless.
Change-Id: I5d686d1526f6c63e7ca1ae84da1fbf2044b24703
Reviewed-on: https://go-review.googlesource.com/c/go/+/698798 Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
qmuntal [Mon, 25 Aug 2025 09:44:16 +0000 (11:44 +0200)]
internal/poll: remove rsa field from Windows' poll.operation
The rsa field was added to the operation structure to avoid allocating
it every time it is needed. We can do better by using a sync.Pool to
reuse allocations across operations and FDs instead of the field.
A side benefit is that FD is now 16 bytes smaller and operation more
stateless.
Change-Id: I3b69a59e36b27f2cdd076cebd8d27a2a350b9c43
Reviewed-on: https://go-review.googlesource.com/c/go/+/698875 Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
Brad Fitzpatrick [Fri, 8 Aug 2025 19:44:42 +0000 (12:44 -0700)]
syscall: sort Windows env block in StartProcess
Fixes #29530
Change-Id: Ia28c78274b9288bfa5de9ccb142a452d291a5b66
Reviewed-on: https://go-review.googlesource.com/c/go/+/694435 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Brad Fitzpatrick <bradfitz@golang.org>
qmuntal [Mon, 25 Aug 2025 07:57:49 +0000 (09:57 +0200)]
internal/poll: don't use stack-allocated WSAMsg parameters
WSAMsg parameters should be passed to Windows as heap pointers instead
of stack pointers. This is because Windows might access the memory
after the syscall returned in case of a non-blocking operation (which
is the common case), and if the WSAMsg is on the stack, the Go
runtime might have moved it around.
Use a sync.Pool to cache WSAMsg structures to avoid a heap allocation
every time a WSAMsg is needed.
Fixes #74933
Cq-Include-Trybots: luci.golang.try:x_net-gotip-windows-amd64
Change-Id: I075e2ceb25cd545224ab3a10d404340faf19fc01
Reviewed-on: https://go-review.googlesource.com/c/go/+/698797 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Joel Sing [Tue, 22 Jul 2025 15:26:56 +0000 (15:26 +0000)]
runtime: identify virtual memory layout for riscv64
Identify sv39, sv48 and sv57 based on the system stack address.
The current approach to memory allocation is less than ideal on
RISC-V hardware that is using sv39 mode. On sv39 we currently end
up doing around 85 mmap and 66 munmap, since we are trying to map
an unusable range. With this change we do 22 mmap and 0 munmap at
runtime initialisation.
This will also be necessary to support the race detector on sv39.
Updates #64345
Cq-Include-Trybots: luci.golang.try:gotip-linux-riscv64
Change-Id: I4f8ba6763b5ecfedfad5438e025d633820e8265c
Reviewed-on: https://go-review.googlesource.com/c/go/+/690495 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com> Reviewed-by: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Michael Munday [Mon, 28 Jul 2025 23:30:04 +0000 (00:30 +0100)]
math: use Trunc to implement Modf
By implementing Modf using Trunc, rather than the other way round,
we can get a significant performance improvement on platforms where
Trunc is implemented as an intrinsic.
Trunc is implemented as an intrinsic on ppc64x and arm64 so the assembly
implementations of Modf are no longer needed (the compiler can generate
very similar code that can now potentially be inlined).
GOAMD64=v1
goos: linux
goarch: amd64
pkg: math
cpu: 12th Gen Intel(R) Core(TM) i7-12700T
│ sec/op │ sec/op vs base │
Gamma 4.257n ± 0% 3.890n ± 0% -8.61% (p=0.000 n=10)
Modf 1.6110n ± 0% 0.4243n ± 0% -73.67% (p=0.000 n=10)
geomean 2.619n 1.285n -50.94%
GOAMD64=v2
goos: linux
goarch: amd64
pkg: math
cpu: 12th Gen Intel(R) Core(TM) i7-12700T
│ sec/op │ sec/op vs base │
Gamma 4.100n ± 1% 3.717n ± 0% -9.35% (p=0.000 n=10)
Modf 1.6070n ± 0% 0.2158n ± 1% -86.57% (p=0.000 n=10)
geomean 2.567n 0.8957n -65.11%
Change-Id: I689a560c344cf1d39ef002b540749bacc3179786
Reviewed-on: https://go-review.googlesource.com/c/go/+/694896
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com>
Michael Munday [Mon, 11 Aug 2025 22:26:59 +0000 (23:26 +0100)]
math: implement IsInf using Abs
Abs is an intrinsic (or a relatively cheap operation) on most
architectures. Using it in IsInf typically saves a branch when
`sign` is 0 (note the `sign` variable is typically a constant).
This change doesn't make a huge difference on amd64 (these
benchmarks are fairly noisy too) but removing the branch will
allow rewrite rules to detect and optimize infinity checks on
other architectures. For example, riscv64 can check for
infinities with the FCLASSD instruction and s390x can use the
TCDB instruction.
Change-Id: I4814bb1e3d9d20e9d8cd7689e8d5383e36b00331
Reviewed-on: https://go-review.googlesource.com/c/go/+/694955 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
Wang Deyu [Wed, 20 Aug 2025 13:33:42 +0000 (21:33 +0800)]
runtime: skip doInit of plugins in runtime.main
Plugins may be loaded in the user's init code.
If loading fails, md.bad is true, and doInit should not be executed.
If loading succeeds, the plugin must run modulesinit and typelinksinit
before doInit. Here is not protected by pluginsMu, and in concurrent
scenarios it is possible to obtain the moduledata of the plugin that
is still in the loading process.
Any added modules after loop starts will do their own doInit calls.
This fixes the issue introduced by CL 520375.
Fixes #75102
Change-Id: I48e91ae21615a0c54176875a6a2dea8e1dade906
Reviewed-on: https://go-review.googlesource.com/c/go/+/697675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Joel Sing [Fri, 22 Aug 2025 17:02:57 +0000 (03:02 +1000)]
internal/trace: skip async preempt off tests on low end systems
The OpenBSD armv7 port does not support SMP - on this platform the
trace tests take ~300 seconds to run when async preempt is disabled,
which then times out on the builder. Skip these tests when run in
short mode on a single CPU system.
Change-Id: I9a697d5ba2b20652f76dcc97bd178a4ee8f1a2a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/698555
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
database64128 [Mon, 18 Aug 2025 08:55:40 +0000 (16:55 +0800)]
net: fix cgoResSearch
CL 457439 mistakenly redeclared size inside the for loop, causing
cgoResSearch to always fail and fall back to goLookupCNAME.
Change-Id: I3e142d34287388284a8998ac13761b1e0c2911a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/696895 Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
qmuntal [Thu, 21 Aug 2025 13:29:46 +0000 (15:29 +0200)]
internal/poll: use fdMutex to provide read/write locking on Windows
On Windows it is not possible to do concurrent I/O on file handles due
to the way FD.Pread and FD.Pwrite are implemented. This serialization is
achieved by having a dedicated mutex locked in the affected FD methods.
This makes the code difficult to reason about, as there is another
layer of locking introduced by the fdMutex. For example, it is not
obvious that concurrent I/O operations are serialized.
This CL removed the dedicated mutex and uses the fdMutex to provide
read/write locking.
Change-Id: I00389662728ce29428a587c3189bab90a0399215
Reviewed-on: https://go-review.googlesource.com/c/go/+/698096
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>
Sean Liao [Sat, 19 Apr 2025 12:50:35 +0000 (13:50 +0100)]
net/http/httptest: redirect example.com requests to server
The default server cert used by NewServer already includes example.com
in its DNSNames, and by default, the client's RootCA configuration
means it won't trust a response from the real example.com.
Fixes #31054
Change-Id: I0686977e5ffe2c2f22f3fc09a47ee8ecc44765db
Reviewed-on: https://go-review.googlesource.com/c/go/+/666855 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
qmuntal [Wed, 20 Aug 2025 10:39:31 +0000 (12:39 +0200)]
internal/syscall/windows: increase internal Windows O_ flags values
The lowercase o_ flags are invented values. These conflict with
constants that will soon be allowed by os.OpenFile, which values will
be mandated by the Windows API. To avoid this overlap, the internal
values have been increased to the 33-63 bit range, as the Windows ones
are in the 0-32 bit range.
Updates #73676
Change-Id: I0f657f3ed3403de150f1730a5a65ae887a18a4e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/697363 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Cherry Mui [Thu, 21 Aug 2025 19:22:57 +0000 (15:22 -0400)]
[dev.simd] cmd/compile: use X15 for zero value in AVX context
With the previous CL, the X15 (aliasd with Y15, Z15) register
holds the zero value for the whole register width. Use that in
AVX context when a zero value is needed.
Change-Id: If49b7059bce50c5e86f90bace0eaa830a91fa0fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/698238 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
Cherry Mui [Thu, 21 Aug 2025 18:37:18 +0000 (14:37 -0400)]
[dev.simd] cmd/compile: ensure the whole X15 register is zeroed
On AMD64, we reserve the X15 register as the zero register.
Currently we use an SSE instruction to zero it, and we only use
it in SSE contexts. When the machine supports AVX, the high bits
of the register is not necessarily zeroed.
Now that the compiler generates AVX code for SIMD, it would be
great to have a zero register in the AVX context. This CL zeroes
the whole X15 register if AVX is supported.
Change-Id: I4dc803362f2e007b1614b90de435fbb7814cebc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/698237
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: David Chase <drchase@google.com>
database64128 [Fri, 22 Aug 2025 06:53:45 +0000 (14:53 +0800)]
internal/poll: don't pass non-nil WSAMsg.Name with 0 namelen on windows
CL 692436 changed WriteMsgInet{4,6} on windows to pass a zero namelen
when the sockaddr is nil. Turns out Windows also requires name to be
nil when namelen is 0.
With this commit, WriteMsgInet4 and WriteMsgInet6 now nicely align with
WriteMsg.
For #74841
Change-Id: Ifadee2d12d9bce2411f11a0e12b9fa2b3d71990e
Reviewed-on: https://go-review.googlesource.com/c/go/+/698395 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Damien Neil <dneil@google.com>
database64128 [Thu, 21 Aug 2025 17:03:42 +0000 (01:03 +0800)]
os: fix Root.MkdirAll to handle race of directory creation
No tests were added, because in order to reproduce, the directory would
have to be created precisely between the rootOpenDir and mkdirat calls,
which is impossible to do in a test.
Fixes #75114
Change-Id: I6f86a5b33c87452c35728318eaf2169a7534ef37
Reviewed-on: https://go-review.googlesource.com/c/go/+/698215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Sean Liao <sean@liao.dev>
The namings follow the following convention:
- If its indices are from constant, amend "Constant" to the name.
- If its indices are used by multiple groups, mend "Grouped" to the
name.
- If its indexing only the low part, amend "Lo", similarly "Hi".
Change-Id: I6a58f5dae54c882ebd59f39b5288f6f3f14d957f
Reviewed-on: https://go-review.googlesource.com/c/go/+/698296
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
limeidan [Tue, 19 Aug 2025 11:16:31 +0000 (19:16 +0800)]
cmd/compile: use zero register instead of specialized *zero instructions on loong64
Refer to CL 633075, loong64 has a zero(R0) register that can be used to do this.
Change-Id: I846c6bdfcfd6dbfa18338afc13e34e350580ead4
Reviewed-on: https://go-review.googlesource.com/c/go/+/693876 Reviewed-by: Carlos Amedee <carlos@golang.org>
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>
limeidan [Thu, 21 Aug 2025 11:46:47 +0000 (19:46 +0800)]
cmd/compile: simplify zerorange on loong64
Refer to CL 678936, we also did the same thing on loong64.
Change-Id: I156a9110a034878192f64baf8018115424aa5f0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/697957 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Xiaolin Zhao [Fri, 15 Aug 2025 08:19:01 +0000 (16:19 +0800)]
cmd/compile: optimize some patterns into revb2h/revb4h instruction on loong64
Pattern1: (the type of c is uint16)
c>>8 | c<<8
To:
revb2h c
Pattern2: (the type of c is uint32)
(c & 0xff00ff00)>>8 | (c & 0x00ff00ff)<<8
To:
revb2h c
Pattern3: (the type of c is uint64)
(c & 0xff00ff00ff00ff00)>>8 | (c & 0x00ff00ff00ff00ff)<<8
To:
revb4h c
Change-Id: Ic6231a3f476cbacbea4bd00e31193d107cb86cda
Reviewed-on: https://go-review.googlesource.com/c/go/+/696335 Reviewed-by: Meidan Li <limeidan@loongson.cn> Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Joel Sing [Sat, 9 Aug 2025 14:40:07 +0000 (00:40 +1000)]
syscall: simplify execve handling on libc platforms
Rather than providing three different execve variables for different
platforms, use a single variable. Provide a small wrapper that handles
conversion to uintptr for the AIX/Solaris case.
Note that this removes special handling for openbsd/mips64, which is
now a dead port.
Updates #61546
Change-Id: I3d6387c31669f64bfb61639536803e595f478647
Reviewed-on: https://go-review.googlesource.com/c/go/+/693880 Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org>
Youlin Feng [Wed, 20 Aug 2025 03:48:05 +0000 (11:48 +0800)]
cmd/compile: deduplication in the source code generated by mknode
Most types in the ir package don't have hidden children, so having
their doChildrenWithHidden and editChildrenWithHidden methods call
their own doChildren and editChildren methods can save a lot of
duplicate code.
Change-Id: Ib22a29d6a9a32855f3c3191ca2d26dff94ac556b
Reviewed-on: https://go-review.googlesource.com/c/go/+/697476 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: Carlos Amedee <carlos@golang.org>
Xiaolin Zhao [Thu, 21 Aug 2025 08:52:02 +0000 (16:52 +0800)]
cmd/compile: optimize rule (x + x) << c to x << c+1 on loong64
Change-Id: I782f93510bba92ba60b298c1c1cde456c8bcec38
Reviewed-on: https://go-review.googlesource.com/c/go/+/697956 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>
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org>
Junyang Shao [Wed, 20 Aug 2025 18:42:52 +0000 (18:42 +0000)]
[dev.simd] cmd/compile, simd: add VPSADBW
This new API is given the name SumAbsDiff, a slightly-longer name for
its canonical abbreviation SAD(Sum-Absolute-Differences).
This instruction has some similar semantic's one, but their semantic is much more
specific and complex: MPSADBW, VDBPSADBW. They should have a more
specific name given this fact.
Change-Id: Ied9144440f82919c3c2d45ae4ce5b961ae91a020
Reviewed-on: https://go-review.googlesource.com/c/go/+/697776 Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Austin Clements [Thu, 21 Aug 2025 13:28:32 +0000 (09:28 -0400)]
[dev.simd] simd/_gen/unify: fix some missing environments
There were a couples places where we failed to provide a reasonable
variable environment for YAML encoding. I think this only affects
encoding "!repeat" nodes, which aren't common in practice and a bit of
a disaster, which is how this went unnoticed.
Change-Id: I1a37c00d5eaa1ee8e86d119a2fd73f6a28d69008
Reviewed-on: https://go-review.googlesource.com/c/go/+/698115
Auto-Submit: Austin Clements <austin@google.com> Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>