Commit graph

65336 commits

Author SHA1 Message Date
Cherry Mui
c7fed112a9 [dev.simd] all: merge master (99d7121) into dev.simd
Conflicts:

- src/internal/buildcfg/exp.go
- src/simd/archsimd/_gen/simdgen/xed.go

Merge List:

+ 2026-02-05 99d7121934 cmd/link: add more clang driver flags when testing flag
+ 2026-02-04 b8bccb9798 cmd/compile: don't double-walk the map argument of clear
+ 2026-02-04 513bb875bc test/codegen: codify bit related code generation for loong64
+ 2026-02-04 c5a3cf6e08 net/http: use SplitSeq in ParseCookie
+ 2026-02-04 3b092b27a9 net/textproto: add Referer to commonHeader
+ 2026-02-04 9972154461 go/build: don't invoke go command when setting UseAllFiles
+ 2026-02-04 f2e7fa6d31 net/http/httptrace: compose ClientTrace without reflect
+ 2026-02-04 044fe174d7 internal/stringslite: remove duplicate code in Index
+ 2026-02-04 f766b8da6c cmd/link: remove obsolete duffzero/duffcopy code
+ 2026-02-04 28fbdf7acb cmd/go: fix pkg-config flag sanitization
+ 2026-02-04 045d1270a7 internal/poll: unlock read lock if write lock fails in readWriteLock
+ 2026-02-04 bd1b41eb81 reflect, runtime: adjust user-created GCData on AIX
+ 2026-02-04 01299a31c2 cmd/cgo: use objdir consistently, create it as needed
+ 2026-02-04 1bbb78e777 cmd/go: rewrite cgo names to "C." in compiler error messages
+ 2026-02-03 a3688ab13e cmd/compile: add node collapse/expand to html ast output
+ 2026-02-03 ae7b257f24 cmd/compile: enhance astdump flag to also generate HTML
+ 2026-02-03 835d6d42c4 cmd/compile: add astdump debug flag
+ 2026-02-03 1179cfc9b4 net/http: prevent blocking when draining response body after it has been closed
+ 2026-02-03 8572b1cfea internal/runtime: fix assembly for spectre retpoline instrumentation
+ 2026-02-03 e0414d74fe bytes, strings: replace asciiSet bitset with lookup table
+ 2026-02-03 b691a2edc7 crypto/tls: revalidate whole chain on resumption on Windows and macOS
+ 2026-02-03 31c9bcb103 internal/poll: readWriteUnlock should destroy fd when no remaining references
+ 2026-02-02 18d31e3e8b compress/bzip2: use obscuretestdata.ReadFile to avoid creating temporary
+ 2026-02-02 7fd116f864 go/types, types2: add missing Named.unpack call in Checker.hasVarSize
+ 2026-02-02 8ac41b52c4 testing/synctest: add Sleep
+ 2026-02-02 62d08234b7 internal/maps,cmd/compile/internal/walk: replace calls to mapaccess1* with mapaccess2*
+ 2026-02-02 35abaf75c3 encoding/json: use pooled encoder in Encoder.Encode
+ 2026-02-02 07f7f8ca52 cmd/cover, cmd/covdata: actually delete temp dirs
+ 2026-02-02 1c9abbdc8e crypto/tls: document resumption behavior across Configs
+ 2026-02-02 cce3fea08f internal/poll: move buffer pinning inside execIO
+ 2026-02-02 3b2a451cef internal/poll: consolidate cancelIO logic into waitIO
+ 2026-02-02 6de7a19fea net: don't wait 5 seconds to re-read /etc/resolv.conf
+ 2026-02-02 11d5284363 net/http: try to drain response body upon closing for better connection re-use
+ 2026-02-02 d99be5c444 crypto/sha1: use const table for key loading on loong64
+ 2026-01-30 acd65ebb13 runtime: delete unused parameter of userForced
+ 2026-01-30 045fe9aa8c fmt: avoid storing input arguments on pp to help escape analysis
+ 2026-01-30 f14d8975a2 runtime: align end of systemstack_switch prologue on amd64 for consistency with gosave_systemstack_switch
+ 2026-01-30 35c5deb1d4 all: switch linux-ppc64 target to ELFv2 ABI
+ 2026-01-30 afae853072 cmd/go,crypto/mlkem,crypto/x509,encoding/ascii85: clean up tautological/impossible nil conditions
+ 2026-01-29 5aa006dee0 test/codegen: add bitwise operation combination tests
+ 2026-01-29 bae9486d07 cmd/compile/internal/bloop: avoid extraneous heap allocs in b.Loop body due to autotmp variable scope
+ 2026-01-29 c08f6a5b26 cmd/link: put type:* at the start of the type descriptors
+ 2026-01-29 14a4cb13e3 cmd/compile: make prove use non-equality in subtraction for a stronger bound
+ 2026-01-29 ee7a2119ac cmd/link: remove AIX special case for first type descriptor
+ 2026-01-29 48788436b8 go/token: simplify fixOffset
+ 2026-01-29 5593ea4634 cmd/link: adjust symkind comparisons in XCOFF code
+ 2026-01-29 baa6b1f2bf cmd/compile: update ABI document for loong64
+ 2026-01-29 10ed9b6ed5 runtime: use smaller max align for arm32
+ 2026-01-29 1172294145 runtime, cmd/link: store type descriptor length, not end
+ 2026-01-28 2bd7f15dd7 go/scanner: document implicit semicolon in multiline comments
+ 2026-01-28 74c909b2c5 go/parser: use (*Scanner).End instead of scannerhooks
+ 2026-01-28 15882523a1 go/parser: use (*Scanner).End in error testing
+ 2026-01-28 3c924059e6 go/scanner: add End method to Scanner
+ 2026-01-28 7f0f671951 math: optimize the floating-point pipeline on loong64
+ 2026-01-28 985b0b3fe2 simd/archsimd: add missing cpufeature to generated mask/merge methods
+ 2026-01-28 83b232b0af cmd/compile, simd: capture VAES instructions and fix AVX512VAES feature
+ 2026-01-28 6aef900af4 runtime/metrics: fix panic in Read with empty slice
+ 2026-01-28 026fa9dc59 crypto/tls: check verifiedChains roots when resuming sessions
+ 2026-01-28 133b339ca5 crypto/tls: add verifiedChains expiration checking during resumption
+ 2026-01-28 4f9c3439a3 Revert "crypto/tls: don't copy auto-rotated session ticket keys in Config.Clone"
+ 2026-01-28 134035855c cmd/compile: simplify slice/array range loops on loong64
+ 2026-01-28 f65fe3216e cmd/compile: (loong64) optimize float32(abs|sqrt64(float64(x)))
+ 2026-01-28 514790c2b9 cmd/compile: remove the NORconst op on mips{,64}
+ 2026-01-27 a0796d8af6 reflect: allow conversions between slices of named {byte,rune} and string
+ 2026-01-27 481ab86aaf cmd/link, runtime: remove typelinks
+ 2026-01-27 251f3aa6ee os/exec: document blocking Stdin/Stdout/Stderr
+ 2026-01-27 5ec5fdc093 cmd/link: remove unused symbol kind SFUNCTAB
+ 2026-01-27 0f72aff835 simd/archsimd: fix typo in the SHA256Message1 documentation string
+ 2026-01-27 03a6a20740 cmd/link: handle SRODATALRELRO in xcoffUpdateOuterSize
+ 2026-01-27 ffb50fb716 go/types, types2: rename Named.finite to Named.varSize
+ 2026-01-27 d8d2b90a46 internal/runtime/gc/scan: include package in expandAVX512 symbol names
+ 2026-01-27 64e8b238a1 runtime: rename aeshashbody to runtime.aeshashbody
+ 2026-01-27 a977717393 go/types, types2: add check for map value completeness in IndexExpr
+ 2026-01-27 8ca47fab42 go/types, types2: replace pendingType with completion check
+ 2026-01-27 2d1f571c6b cmd/compile, runtime: avoid improper control transfer instruction hints on riscv64
+ 2026-01-27 f532f87a98 crypto/subtle: add vector implementation of xorBytes for riscv64
+ 2026-01-26 cf0c42c2ca cmd/compile/internal/reflectdata: fix divide by zero for zero-size array elements
+ 2026-01-26 bb221e8954 doc/go1.27: document macOS requirements
+ 2026-01-26 d381731e06 README.vendor: document release cycle considerations
+ 2026-01-26 cffd7a3ec4 cmd/pprof: update vendored github.com/google/pprof
+ 2026-01-26 b04e7f31c8 internal/reflectlite: remove unused code
+ 2026-01-26 cc6923e839 cmd/compile: reduce lock/scheduler contention
+ 2026-01-26 f809faeb8e go/scanner: clear all fields after Scanner reuse
+ 2026-01-23 1bd5dbfc41 cmd/compile: simplify AlgType usage
+ 2026-01-23 59ed013621 cmd/compile: simplify array parsing in equality signatures
+ 2026-01-23 cca64d0f5c cmd/compile: clean up eq and hash implementations
+ 2026-01-23 0da8979210 cmd/compile: use equality signatures in hash function generation
+ 2026-01-23 6eec9bcdb2 cmd/compile: reorg equality functions a bit
+ 2026-01-23 30dff416e4 cmd/compile: redo how equality functions are generated
+ 2026-01-23 f8b72802d7 encoding/json: fix typo in package doc.
+ 2026-01-23 b408256be7 cmd/compile: fix loopvar version detection with line directives
+ 2026-01-23 27fcec4d8f runtime: speed up cheaprand and cheaprand64
+ 2026-01-23 478d86446e cmd/compile: on amd64 use 32bits copies for 64bits copies of 32bits values
+ 2026-01-23 8f739162e6 cmd/compile: cleanup noLimit in prove
+ 2026-01-23 f35fb95503 cmd/compile: improve PopCount's limits modeling and add bruteforce tests
+ 2026-01-23 417d5e6627 cmd/compile: add limits bruteforce tests for bitlen
+ 2026-01-23 a4fda8d32a cmd/compile: improve Ctz's limits modeling and add bruteforce tests
+ 2026-01-23 82ef9f5b21 cmd/compile: cleanup isUnsignedPowerOfTwo
+ 2026-01-23 3443ae0863 net: fix some ineffectual assignments reported by ineffassign
+ 2026-01-23 ca5ffe0092 all: update vendored dependencies
+ 2026-01-23 4af8ad24ee internal/buildcfg: disable sizespecializedmalloc by default
+ 2026-01-23 b291c3c35c cmd/compile: fix typos in types2 api_test.go
+ 2026-01-23 d774ced6a9 cmd/go/internal/vcs: support git worktrees
+ 2026-01-23 6d89ab44cc go/types, types: flip field/method selection logic inside out (cleanup)
+ 2026-01-23 021d5ca042 cmd/compile: avoid extending when already sufficiently shifted on loong64
+ 2026-01-23 c04335e33a math/pow10: remove overlapping boundary (n=0)
+ 2026-01-23 a1150b5017 cmd/compile/internal/pgo: error parsing profile (for pgo) after scaling
+ 2026-01-23 6b7206feb2 runtime: remove logical stack sentinel for runtime lock stacks
+ 2026-01-23 23f7ba554d math: use shared signMask constant
+ 2026-01-23 84c8483e02 runtime: remove unused mutexevent linkname
+ 2026-01-22 13096a62e6 cmd/link: put type descriptors in .go.type section
+ 2026-01-22 6edb9f9c51 go/types, types2: remove support for gotypesalias GODEBUG flag
+ 2026-01-22 819c53c25f cmd/compile: ensure ops have the expected argument widths
+ 2026-01-22 c7258178cd cmd/compile: optimize small constant-sized MemEq
+ 2026-01-22 26ffe78b8c encoding/json: remove unneeded unsafe import
+ 2026-01-22 e0c4ad77cf net/http: Add Server.DisableClientPriority field
+ 2026-01-22 dd39dfb534 all: update to Unicode 17
+ 2026-01-22 a006e17162 syscall: document Sendfile semantics
+ 2026-01-22 858d4bf851 debug/elf: return FormatError when reading short files
+ 2026-01-22 8e3104dc26 simd/archsimd/_gen/simdgen: fix typos in error messages
+ 2026-01-22 eaf6650c2b test: use lower-case error message in heapsampling.go
+ 2026-01-22 1b7e5836ad cmd/compile: speedup large init function compile time
+ 2026-01-22 e9e05687de internal/runtime: remove math.Mul64
+ 2026-01-22 1996c22f0a syscall: return early on error in Recvmsg
+ 2026-01-22 c61a48619f cmd/compile: allow Bswap{64,32,16} on loong64
+ 2026-01-22 6ba3494e16 cmd/go/internal/vcs: use 0o for octal
+ 2026-01-22 dcb42485ac cmd/cgo: add test for sanitizing smuggled doc comment code
+ 2026-01-22 fde15bbfc1 strings: use bytealg.LastIndexRabinKarp on strings.LastIndex
+ 2026-01-22 0f9cdc2fbc net/http: use math/rand/v2 instead of math/rand
+ 2026-01-22 d2aad0df60 runtime: guard unexpected return pc gp.m dereference
+ 2026-01-22 bfb851c31e cmd/compile: reserve less memory for bitvectors
+ 2026-01-22 0152075d5a encoding/json/v2: remove issue reference in Duration formatting error
+ 2026-01-22 a535896627 cmd/compile: remove unnecessary code in keepAliveAt
+ 2026-01-22 dae71067ce cmd/compile: fix mis-compilation for static array initialization
+ 2026-01-22 adb64adfd7 cmd/compile: refactor preserveStmt
+ 2026-01-22 540ccca0a7 cmd/compile: better name for BloopWalk
+ 2026-01-21 2d37c20778 go/types, types2: better error when selecting field on type rather than value
+ 2026-01-21 455282911a doc/next: initialize
+ 2026-01-21 83c44ec032 internal/goversion: update Version to 1.27
+ 2026-01-21 2baa1d1762 runtime: remove the unused scanIdx from mspan
+ 2026-01-20 a8291eb614 cmd/compile/internal/staticinit: fix bug in global new(expr)
+ 2026-01-20 4edaaf2b52 strconv: don't call internal Atoi twice in Atoi
+ 2026-01-16 7251c9e0f0 doc: fix urlmaxqueryparams typos
+ 2026-01-15 532e320349 go/types,cmd/compile/internal/types2: better diagnostic for type shadowing
+ 2026-01-15 bb7c0c717c archive/zip: reduce CPU usage in index construction
+ 2026-01-15 2dcaaa7512 net/url: add urlmaxqueryparams GODEBUG to limit the number of query parameters
+ 2026-01-15 5e1ad12db9 cmd/go/internal/work: sanitize flags before invoking 'pkg-config'
+ 2026-01-15 94a1296a45 cmd/go: update VCS commands to use safer flag/argument syntax
+ 2026-01-15 bba24719a4 crypto/tls: don't copy auto-rotated session ticket keys in Config.Clone
+ 2026-01-15 9ef26e96e3 sort: improve comment readability for Stable function
+ 2026-01-14 2bc4315d92 crypto/internal/fips140test: add ML-DSA to FIPS 140-3 functional tests
+ 2026-01-13 e242961960 simd/archsimd: 128- and 256-bit FMA operations do not require AVX-512
+ 2026-01-13 9ef1692c93 simd/archsimd/_gen/simdgen: feature implications
+ 2026-01-13 e2fef50def runtime: rename mallocTiny* to mallocgcTinySize*
+ 2026-01-13 7f6418bb4e all: fix misspellings in comments
+ 2026-01-12 c16402d15b os/exec: move platform-specific LookPath docs to a common comment
+ 2026-01-12 b7e6d8b923 os/exec_test: fix test on Plan 9
+ 2026-01-12 cbe153806e net: fix socket duplication error handling on Windows
+ 2026-01-12 30d0b40264 net: don't ignore getsockname errors in newFileFD
+ 2026-01-12 5741608de2 net: don't ignore errors in TestUnixUnlink
+ 2026-01-12 df6c351aa4 crypto: use testenv.Executable(t) instead of os.Args[0] in tests
+ 2026-01-12 cc1d7afb24 spec: slightly re-arrange composite literal section for readability
+ 2026-01-09 fed3b0a298 cmd/dist: fix goroot typo in panic message
+ 2026-01-09 55ab5bba17 path/filepath: Match: improve doc comment
+ 2026-01-09 088ba94439 crypto/rsa: log key on test failure
+ 2026-01-09 108b333d51 cmd/go: only use check cache action's dependencies to build vet config
+ 2026-01-08 2bbb2ace34 runtime/trace: fix documentation comment
+ 2026-01-08 6b2505c79c cmd/go: remove user-content from doc strings in cgo ASTs.
+ 2026-01-08 4b89bcb8b7 lib/fips140: freeze v1.26.0 FIPS 140-3 module
+ 2026-01-08 8ac4477d83 simd/archsimd: rename Broadcast methods
+ 2026-01-08 5facb3b24b internal/types: add test for cycles in value context
+ 2026-01-07 28147b5283 cmd/go: guarantee a minimum of min(4,GOMAXPROCS) to compile -c
+ 2026-01-07 874d8b98eb cmd/go/internal/work: decrement concurrentProcesses when action finishes
+ 2026-01-07 d1e7f49e3d internal/trace: fix recorder.Write return value for header-only buffers
+ 2026-01-07 f6ebd91129 all: update vendored x/tools
+ 2026-01-06 d1d0fc7a97 os/exec: avoid atomic.Bool for Cmd.startCalled
+ 2026-01-05 9b2e3b9a02 simd/archsimd: use V(P)MOVMSK for mask ToBits if possible
+ 2026-01-02 f8ee0f8475 cmd/go/testdata/vcstest/git: use git commands that work on older git versions
+ 2026-01-02 b094749bad test/codegen: codify bit related code generation for arm64

Change-Id: I1a49d6ac582b1fffd48cdc65ac4b59c46eb71d69
2026-02-05 14:23:43 -05:00
Corentin Kerisit
99d7121934 cmd/link: add more clang driver flags when testing flag
This changes does 2 things:

- Move `-L` to `prefixesToKeep` since it allows providing a custom
default libs search path.

- Allow various flags that impact the behaviour of the clang driver.

The latter allows for LLVM only toolchains to be compatible with
linkerFlagSupported checks.

The end goal of this PR is to allow fully hermetic toolchains,
especially pure LLVM ones, to be used to cross-compile CGO.

Fixes #76825

Change-Id: I2311c9566ce9c7e8f6b325258af58eb333663cf0
GitHub-Last-Rev: 74342aae35
GitHub-Pull-Request: golang/go#76858
Reviewed-on: https://go-review.googlesource.com/c/go/+/730561
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2026-02-05 08:01:38 -08:00
Keith Randall
b8bccb9798 cmd/compile: don't double-walk the map argument of clear
mkcallstmt1 already walks the map argument of clear. mapClear then
walks it again, which can cause problems if it is some syntax that is
non-idempotent under walk.  That is the case for the new way map
lookups are being lowered in CL 736020.

Fixes #77435

Change-Id: Ib2f6d7f2270308c2462aa276ed4413aaf7799fe3
Reviewed-on: https://go-review.googlesource.com/c/go/+/742120
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>
2026-02-04 17:48:06 -08:00
Xiaolin Zhao
513bb875bc test/codegen: codify bit related code generation for loong64
Change-Id: Ibaee223894693ac4e2694bd1748f57a3e76c0b12
Reviewed-on: https://go-review.googlesource.com/c/go/+/735980
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Pratt <mpratt@google.com>
2026-02-04 17:02:07 -08:00
Carlo Alberto Ferraris
c5a3cf6e08 net/http: use SplitSeq in ParseCookie
goos: linux
goarch: amd64
pkg: net/http
cpu: 12th Gen Intel(R) Core(TM) i7-12700
                           │ master.txt  │             patch.txt              │
                           │   sec/op    │   sec/op     vs base               │
ReadCookies/readCookies-20   1.499µ ± 1%   1.482µ ± 3%       ~ (p=0.197 n=10)
ReadCookies/ParseCookie-20   1.552µ ± 2%   1.437µ ± 2%  -7.44% (p=0.000 n=10)
geomean                      1.525µ        1.459µ       -4.34%

                           │  master.txt  │               patch.txt               │
                           │     B/op     │     B/op      vs base                 │
ReadCookies/readCookies-20   1.953Ki ± 0%   1.953Ki ± 0%       ~ (p=1.000 n=10) ¹
ReadCookies/ParseCookie-20   2.109Ki ± 0%   1.953Ki ± 0%  -7.41% (p=0.000 n=10)
geomean                      2.030Ki        1.953Ki       -3.77%
¹ all samples are equal

                           │ master.txt │              patch.txt              │
                           │ allocs/op  │ allocs/op   vs base                 │
ReadCookies/readCookies-20   11.00 ± 0%   11.00 ± 0%       ~ (p=1.000 n=10) ¹
ReadCookies/ParseCookie-20   12.00 ± 0%   11.00 ± 0%  -8.33% (p=0.000 n=10)
geomean                      11.49        11.00       -4.26%
¹ all samples are equal

Change-Id: I7e84d52ac8d25991595d1b0480334fe9d1a84ffb
Reviewed-on: https://go-review.googlesource.com/c/go/+/727520
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-02-04 15:16:43 -08:00
guoguangwu
3b092b27a9 net/textproto: add Referer to commonHeader
Change-Id: Id4c95138788d90779aa7b9a54e58f9e4cb271163
GitHub-Last-Rev: ee43b95269
GitHub-Pull-Request: golang/go#65985
Reviewed-on: https://go-review.googlesource.com/c/go/+/567539
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2026-02-04 14:45:25 -08:00
AN Long
9972154461 go/build: don't invoke go command when setting UseAllFiles
Fixes #68556

Change-Id: I36b08577243a6b3a13b3adef116411d73a2d3428
Reviewed-on: https://go-review.googlesource.com/c/go/+/700337
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-04 14:45:16 -08:00
Randy Reddig
f2e7fa6d31 net/http/httptrace: compose ClientTrace without reflect
This is to enable use of package httptrace on TinyGo, which does not have an implementation of reflect.MakeFunc.

Change-Id: I4f1f94352797bfe3553c1c2d4d1d3dca44b03e43
GitHub-Last-Rev: 4587368ad8
GitHub-Pull-Request: golang/go#69172
Reviewed-on: https://go-review.googlesource.com/c/go/+/609763
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>
Reviewed-by: Sean Liao <sean@liao.dev>
2026-02-04 14:44:58 -08:00
Олег Световидов
044fe174d7 internal/stringslite: remove duplicate code in Index
Merge two nearly identical loops into one by selecting the fallback
method (IndexString vs IndexRabinKarp) inside the loop based on
whether n <= bytealg.MaxLen.

Fixes #77364#

Change-Id: Iefbef60922ca24e4dda3016127f54290096bcfed
Reviewed-on: https://go-review.googlesource.com/c/go/+/741340
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2026-02-04 12:19:11 -08:00
Keith Randall
f766b8da6c cmd/link: remove obsolete duffzero/duffcopy code
Change-Id: Icf94808a6c137c3c114a0be1f8da85ee5f68d58e
Reviewed-on: https://go-review.googlesource.com/c/go/+/740740
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2026-02-04 12:16:14 -08:00
Roland Shoemaker
28fbdf7acb cmd/go: fix pkg-config flag sanitization
Implement a new pkg-config safe flag list (containing everything except
for --log-file) and use that when checking flags passed to pkg-config,
instead of using checkCompilerFlags.

Fixes #77387

Change-Id: Id6141d0a2934053aa43e3aa8ce402bd499c4c028
Reviewed-on: https://go-review.googlesource.com/c/go/+/741042
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2026-02-04 12:14:51 -08:00
qmuntal
045d1270a7 internal/poll: unlock read lock if write lock fails in readWriteLock
If the write lock acquisition fails, the read lock acquired earlier is
not released, leading to a potential deadlock.

The deadlock shouldn't occur because when the write lock fails, it
indicates that the FD is closing, and no other goroutine should be
holding the read lock. However, better to be safe and release the read
lock in such cases.

Change-Id: If593c36040a97357f835b42bb3133ff1dc55a638
Reviewed-on: https://go-review.googlesource.com/c/go/+/740560
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2026-02-04 11:54:32 -08:00
Ian Lance Taylor
bd1b41eb81 reflect, runtime: adjust user-created GCData on AIX
On AIX the runtime adjusts the GCData field in getGCMaskOnDemand
to account for the AIX dynamic loader moving the data section.
That works fine for statically generated types,
but it breaks user generated types. The user generated type
will have a normal, correct, pointer, and adjusting the pointer
will make it point elsewhere.

This all happens to work OK when doing an external link,
because in that case we do have dynamic relocs and there is no adjustment.
But it fails with an internal link.

This CL fixes the problem by applying a reverse adjustment to
user generated types, so that the adjustment winds up with the
original pointer value.

Change-Id: Ibf3199b9ffb36e79af134fbed41db2853297de74
Reviewed-on: https://go-review.googlesource.com/c/go/+/740800
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2026-02-04 11:28:03 -08:00
Ian Lance Taylor
01299a31c2 cmd/cgo: use objdir consistently, create it as needed
Previously we added a slash to the end of objdir only after
processing input files. The effect was that the temporary gcc
output files were placed in /tmp, using objdir as a prefix.
Those output files were not removed by anything.

Now we consistently use objdir as a directory, not a prefix.
We only create it when needed; there is already a test for that in
cmd/go/testdata/script/build_cwd_newline.txt.

Change-Id: Ie66d9c04ecc3c0f5950fc1111c74e1d01c67304c
Reviewed-on: https://go-review.googlesource.com/c/go/+/740742
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-04 11:28:00 -08:00
Ian Lance Taylor
1bbb78e777 cmd/go: rewrite cgo names to "C." in compiler error messages
We used to do this but it broke in Go 1.10. This restores the rewrite,
but only applied to compiler output for packages that use cgo.
That is all that the original rewrite applied to anyhow.

Fixes #76339

Change-Id: Ife8ee858ddd0ff7bcc7423455b2eabf8381b7bde
Reviewed-on: https://go-review.googlesource.com/c/go/+/721821
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2026-02-04 11:25:57 -08:00
David Chase
a3688ab13e cmd/compile: add node collapse/expand to html ast output
AI-generated code, plus a lot of reviewing and tweaking
of arrows and fonts.

This adds subtree collapse/expand triangles.

Change-Id: I2dd322abdf7ef956b1435946d79f864a6150f976
Reviewed-on: https://go-review.googlesource.com/c/go/+/740481
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-03 20:24:21 -08:00
David Chase
ae7b257f24 cmd/compile: enhance astdump flag to also generate HTML
AI-generated code, 3 merged commits, plus a LOT of hand
cleanups and tweaks, including removing cargo-culted dead
code from the SSA example, reorganizing CSS and JS out of a
single giant comment, using defer appropriately to ensure
balanced open/close tags, running output through tidy to
check compliance.  Prompts are included for reference.

This is intended to produce an HTML file in the style of "ssa.html",
but for AST.  The result of various phases appears in columns,
which can be scrolled side to side, and also dragged sideways
to make them wider (because AST tends wide).

This supports three kinds of highlighting, which I tweaked
along the way to make them (in my opinion) more useful.

1) Node outlining.  This outlines a node and all of its subtrees.
When the cursor is a "cell" (outlined cross) node highlighting
is available.  Note that "NAME" nodes are repeated within the
tree, so click on one of these will outline every occurrence.
This is actually done with pointer identity.

2) Name highlighting, available with a "crosshair" cursor.
This highlights a name, e.g. "autotmp_1".

3) Position highlighting, available with a "crosshair" cursor.
This highlights either a file (all occurrences of that file's positions),
a line within a file (all occurrences of that file:line combination),
or a column (all occurrences of that particular file:line:column).
Inlined positions are treated as a sequence of positions, not a single
position.

Prompts:
```
The file cmd/compile/internal/ir/dump.go contains a function AstDump
that calls FDump to generate a textual representation of the AST from
several phases within the compiler.

The file cmd/compile/internal/ir/fmt.go contains the definition of
FDump.

The SSA phases of the compiler use code in
cmd/compile/internal/ssa/html.go to render its textual representation
into an html display that allows hiding phases and highlighting blocks,
identifiers and line numbers.

Please write a similar HTML-generating phase for AST that produces an
output that will allow hiding phases and perhaps hiding subtrees, and
highlighting identifiers and line numbers.  The idioms and hacks used
in the SSA html display have worked well, if you want to copy them.
```

```
Not bad, but the output contains a strike-through beginning on a line
that contains  "TYPE  type *testing.B tc(1)".  The strike through
begins after "TYPE " and continues for the rest of the output.  Can you
find that bug and fix it?
```

```
The AST output is often wider than the statically sized columns in the
HTML output.  Either the columns need to have a width that can be
resized (dragged wider, for example) or the AST needs to be draggable,
side-to-side, within the columns.  Resizable columns seems like the
preferable choice, if it is possible.
```

```
The highlighting for file name and line number is not quite right -- all
the lines in the same file are grouped together, where what I want, is
that each different file:line:column gets its own number.  There's also
the issue of inlining, in some cases the location is described as more
than one file:line:column, where the first is the call site and the
second is the inlined function.  I think it makes sense to treat each
single file:line:column as its own item for highlighting, instead of
trying to treat the sequence of file:line:column as a single distinct
location.  One thing that might be interesting, but I am not sure how
hard it would be, is to distinguish between clicks to the file part,
the line part, and the column part -- click on file means highlight
all that matches file, click on line means all that machines file:line
(not just the line numner, since there may be different files, with
inlining) and click on the column means to highlight the specific
file:line:column triple.  That is, if it is possible.
```

```
Lovely.  Can you implement highlighting for names, strings
like "NAME-testing.b" so that all uses of a variable or a temporary can
easily be seen?
```

Change-Id: I1ed97cd92cdae16d556e3334e543af37973799e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/740563
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: t hepudds <thepudds1460@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
2026-02-03 20:24:06 -08:00
David Chase
835d6d42c4 cmd/compile: add astdump debug flag
This was extraordinarily useful for inlining work.
I have cleaned it up somewhat, and did some additional tweaks
after working on changes to bloop.

-gcflags=-d=astdump=SomeFunc
-gcflags=-d=astdump=SomeSubPkg.SomeFunc
-gcflags=-d=astdump=Some/Pkg.SomeFunc
-gcflags=-d=astdump=~YourRegExpHere

Change-Id: I3f98601ca96c87d6b191d4b64b264cd236e6d8bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/629775
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>
2026-02-03 20:22:18 -08:00
Nicholas S. Husin
1179cfc9b4 net/http: prevent blocking when draining response body after it has been closed
Previously, draining the response body after it has been closed causes
Response.Body.Close to block for longer than it otherwise would. In a
worst-case scenario, this means that we are incurring a 50 ms delay for
each HTTP/1 request that we make.

This CL makes sure that a response body is drained asynchronously and
updates relevant documentations to reflect the current behavior.

For #77370

Change-Id: I2486961bc1ea3d43d727d0aabc7a6ca7dfb166ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/741222
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Nicholas Husin <husin@google.com>
2026-02-03 17:14:44 -08:00
Michael Anthony Knyszek
8572b1cfea internal/runtime: fix assembly for spectre retpoline instrumentation
In the last year we added two CALLs whose targets are loaded from
memory. Change them to call from a register so that the instrumentation
for spectre mitigations works.

This change also adds a smoke test for the spectre build flags.

For #77420.

Change-Id: I35ec723449ff6a712bcce3276bf1df3fa932bddc
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/741541
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2026-02-03 11:56:29 -08:00
Corentin Chary
e0414d74fe bytes, strings: replace asciiSet bitset with lookup table
Replace the 32-byte bitset implementation with a 256-byte lookup table
for simpler and faster ASCII character membership testing.

The bitset implementation used bit manipulation (shifts, masks, AND/OR)
requiring multiple CPU operations per lookup. The lookup table uses
direct array indexing with a single load and compare, reducing CPU
overhead significantly.

Using [256]bool instead of [256]byte allows the compiler to eliminate
the comparison instruction entirely, as bool values are guaranteed to be
either 0 or 1.

The full 256-element array (rather than 128 elements) is used because it
eliminates branches entirely. Testing shows [256]bool is 68% faster than
[128]bool with an explicit bounds check (488µs vs 821µs) due to avoiding
branch misprediction penalties in the hot path. Using [128]bool with bit
masking (c&0x7f) eliminates bounds checks but still costs ~10% performance
due to the AND operation.

The 224-byte increase in memory usage is acceptable for modern systems,
and the simpler implementation is easier to understand and maintain.

Full benchmark results demonstrating ~1.5x improvements across all
affected functions are available at:
https://github.com/golang/go/issues/77194#issuecomment-3814095806

This supersedes CL 737920 with a simpler approach that improves
performance for all architectures without requiring SIMD instructions.

Updates #77194

Change-Id: I272ee6de05b963a8efc62e7e8838735fb0c4f41b
Reviewed-on: https://go-review.googlesource.com/c/go/+/739982
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2026-02-03 11:43:42 -08:00
Filippo Valsorda
b691a2edc7 crypto/tls: revalidate whole chain on resumption on Windows and macOS
TestHandshakeChangeRootCAsResumption and TestHandshakeGetConfigForClientDifferentClientCAs 
changed because previously rootA and rootB shared Subject and SPKI,
which made the new full-chain revalidation check succeed, as the
same leaf would verify against both roots.

Fixes #77376

Cq-Include-Trybots: luci.golang.try:gotip-darwin-arm64-longtest
Change-Id: I60bed694bdc621c9e83f1bd8a8224c016a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/741361
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
2026-02-03 10:34:45 -08:00
qmuntal
31c9bcb103 internal/poll: readWriteUnlock should destroy fd when no remaining references
Fixes #77404

Change-Id: I0402becb94855baf942d6ba3815cc2a3c1526d6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/740921
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2026-02-03 01:00:16 -08:00
Ian Lance Taylor
18d31e3e8b compress/bzip2: use obscuretestdata.ReadFile to avoid creating temporary
The temporary was not being deleted. Not creating it at all is better.

Change-Id: Id9c5498a2f7d2f58770a09a2a76f4ab30943dd3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/740780
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-02 19:40:59 -08:00
Mark Freeman
7fd116f864 go/types, types2: add missing Named.unpack call in Checker.hasVarSize
CL 734980 swapped use of Type.Underlying() in Checker.hasVarSize for
traversal of Named.fromRHS. It forgot to call Named.unpack() before
inspecting Named.fromRHS, allowing access of unexpanded instantiated
types.

These unexpanded instantiated types are then mistakenly marked as having
fixed size, which fails assertions downstream. This change adds the
missing Named.unpack() call and swaps direct access of Named.fromRHS for
Named.rhs(), which verifies such access in debug mode.

Fixes #77382

Change-Id: I324bbbbf790f8b09e95902ebe67f775483f88417
Reviewed-on: https://go-review.googlesource.com/c/go/+/740620
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-02 15:18:11 -08:00
Damien Neil
8ac41b52c4 testing/synctest: add Sleep
Add a convenience function which combines time.Sleep and synctest.Wait.

Fixes #77169

Change-Id: I2ff105105e95cfd8e5b4f72ccacf7afa59efb6bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/740066
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-02 14:43:36 -08:00
ArsenySamoylov
62d08234b7 internal/maps,cmd/compile/internal/walk: replace calls to mapaccess1* with mapaccess2*
mapaccess1* and mapaccess2* functions share the same implementation and differ only in whether the boolean "found" is returned.

This change replaces mapaccess1* calls with mapaccess2*.
We can do this transparently, since the call site can safely discard the second (boolean) result.

Ideally, mapacces1* functions could be removed entirely, but this change keeps them as thin wrappers for compatibility.

Fixes #73196
Change-Id: I07c3423d22ed1095ac3666d00e134c2747b2f9c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/736020
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
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@golang.org>
2026-02-02 13:24:26 -08:00
Joe Tsai
35abaf75c3 encoding/json: use pooled encoder in Encoder.Encode
Due to the lack of MarshalWrite in the v1 API,
it is unfortunately common to see:

    json.NewEncoder(out).Encode(in)

where a single-use Encoder is constructed and thrown away.
This performed acceptably in v1 since every call to Encode
used a globally pooled encoder resource.

Prior to this change, the v1-in-v2 implementation relied
on a bytes.Buffer cached only for the lifetime of the Encoder
object itself. Thus, a single-use Encoder does not benefit.
Modify the wrapper implementation to use the internal
pooled encoder from v2 and use the intermediate buffer
to write directly to the output io.Writer.

We assume that the user-provided io.Writer never leaks the buffer,
but this assumption was already held in the v1 implementation.
We are not increasing the surface area of data corruption risk.

Performance of v1 to v1-in-v2 (before the pool fix):

	name                 old time/op    new time/op    delta
	NewEncoderEncode-32    30.2ms ± 4%    28.3ms ± 9%    -6.19%  (p=0.002 n=9+10)

	name                 old alloc/op   new alloc/op   delta
	NewEncoderEncode-32    7.64MB ± 0%   28.37MB ± 0%  +271.23%  (p=0.000 n=10+10)

	name                 old allocs/op  new allocs/op  delta
	NewEncoderEncode-32      200k ± 0%      100k ± 0%   -49.99%  (p=0.000 n=9+10)

Interestingly, v1-in-2 is slightly faster,
but the amount of allocated memory is massive.

Performance of v1 to v1-in-v2 (after the pool fix):

	name                 old time/op    new time/op    delta
	NewEncoderEncode-32    30.2ms ± 4%    24.0ms ± 7%  -20.36%  (p=0.000 n=9+10)

	name                 old alloc/op   new alloc/op   delta
	NewEncoderEncode-32    7.64MB ± 0%    4.09MB ± 3%  -46.52%  (p=0.000 n=10+10)

	name                 old allocs/op  new allocs/op  delta
	NewEncoderEncode-32      200k ± 0%      100k ± 0%  -50.00%  (p=0.000 n=9+9)

Now, the v1-in-v2 implementation is better than v1 on all metrics.

Fixes #75026

Change-Id: I50c975b1d5b8da806e46bc627966b0a39c1817eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/740660
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-02 13:05:45 -08:00
Ian Lance Taylor
07f7f8ca52 cmd/cover, cmd/covdata: actually delete temp dirs
The code was using defer in TestMain, but was also calling os.Exit,
which meant that the deferred functions did not run.
TestMain does not require calling os.Exit, so stop doing it.

Change-Id: I25ca64c36acf65dae3dc3f46e5fa513b9460a8e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/740781
Reviewed-by: Than McIntosh <thanm@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2026-02-02 12:16:54 -08:00
Filippo Valsorda
1c9abbdc8e crypto/tls: document resumption behavior across Configs
Updates #77113
Updates #77217
Updates CVE-2025-68121

Change-Id: Ia47904a9ed001275aad0243a6a0ce57e6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/740240
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
2026-02-02 12:11:19 -08:00
qmuntal
cce3fea08f internal/poll: move buffer pinning inside execIO
This is a step towards deferring adding the handle to IOCP until the
first IO operation.

The goal of this CL is to avoid the fd.isBlocking check in fd.pin,
which was happening outside execIO, and making buffer pinning less
error-prone.

This also fixes an issue where buffer used in Pwrite and WriteTo
were unpinned too early when the write buffer was larger than the
maximum chunk size.

For #76391

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-amd64-race
Change-Id: Ia181dcb57a559ae466a4341c36a307ad6678aac0
Reviewed-on: https://go-review.googlesource.com/c/go/+/740561
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-02 11:06:07 -08:00
qmuntal
3b2a451cef internal/poll: consolidate cancelIO logic into waitIO
This is a step towards deferring adding the handle to IOCP until the
first IO operation.

The main goal of this CL is to remove the fd.pollable() check in
cancelIO.

For #76391

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-amd64-race
Change-Id: I76263ce12980297d88a5f6c514e4074dfee428cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/740540
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2026-02-02 10:51:25 -08:00
Brad Fitzpatrick
6de7a19fea net: don't wait 5 seconds to re-read /etc/resolv.conf
If a Go process starts up, finds /etc/resolv.conf empty, then the DHCP
client writes /etc/resolv.conf, the Go program would find itself
broken for up to 5 seconds.

We noticed this during integration tests in ephemeral VMs using
gokrazy that boot into our application.

Change-Id: Ia64c2b5c698a4ee3efc15d8a8f1850c47e531b84
Reviewed-on: https://go-review.googlesource.com/c/go/+/739620
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-02-02 10:15:12 -08:00
Nicholas S. Husin
11d5284363 net/http: try to drain response body upon closing for better connection re-use
Currently, we have a rather inconsistent behavior in terms of whether a
connection can be re-used or not when an HTTP body is not read to
completion:

- In HTTP/2, not reading bodies to completion is not an issue, since a
  new HTTP/2 stream can be created on the same TCP connection.
- In HTTP/1 server, we discard up to 256 KiB of unconsumed request body,
  to potentially allow re-use.
- In HTTP/1 client, we do not do anything, and fail to re-use a TCP
  connection if there are any unconsumed response body at all.

This has led to some confusion. For example, some users have mistakenly
discarded response body for HTTP/2 when doing so is not needed. Manually
discarding response body can also be disadvantageous if the body is
excessively large or is a never-ending stream.

To solve this issue, this CL makes it so that closing a response body
will cause any remaining content to be drained, up to a limit of 256 KiB
or 50 milliseconds, whichever one is reached first. This allows better
connection re-use for HTTP/1, and most users can now avoid having to
manually drain their response body.

For #77370

Change-Id: I71e1227fc9cf5f901362c8e234320817f6b0be24
Reviewed-on: https://go-review.googlesource.com/c/go/+/737720
Reviewed-by: Nicholas Husin <husin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2026-02-02 09:54:16 -08:00
Julian Zhu
d99be5c444 crypto/sha1: use const table for key loading on loong64
Load constant keys from a static memory table rather than loading immediates into registers on loong64.

Benchmark for Loongson-3A5000:
goos: linux
goarch: loong64
pkg: crypto/sha1
cpu: Loongson-3A5000-HV @ 2500.00MHz
                   │     old      │                new                │
                   │    sec/op    │   sec/op     vs base              │
Hash8Bytes/New-4      235.9n ± 0%   229.1n ± 0%  -2.88% (p=0.000 n=8)
Hash8Bytes/Sum-4      1.892µ ± 0%   1.882µ ± 0%  -0.50% (p=0.000 n=8)
Hash320Bytes/New-4   1022.0n ± 0%   963.8n ± 0%  -5.70% (p=0.000 n=8)
Hash320Bytes/Sum-4   1037.0n ± 0%   981.1n ± 0%  -5.39% (p=0.000 n=8)
Hash1K/New-4          2.760µ ± 0%   2.594µ ± 0%  -6.01% (p=0.000 n=8)
Hash1K/Sum-4          2.775µ ± 0%   2.610µ ± 0%  -5.95% (p=0.000 n=8)
Hash8K/New-4          20.46µ ± 0%   19.20µ ± 0%  -6.17% (p=0.000 n=8)
Hash8K/Sum-4          20.49µ ± 0%   19.22µ ± 0%  -6.17% (p=0.000 n=8)
geomean               2.498µ        2.377µ       -4.87%

                   │     old      │                new                 │
                   │     B/s      │     B/s       vs base              │
Hash8Bytes/New-4     32.34Mi ± 0%   33.30Mi ± 0%  +2.98% (p=0.000 n=8)
Hash8Bytes/Sum-4     4.034Mi ± 0%   4.053Mi ± 0%  +0.47% (p=0.000 n=8)
Hash320Bytes/New-4   298.7Mi ± 0%   316.7Mi ± 0%  +6.02% (p=0.000 n=8)
Hash320Bytes/Sum-4   294.3Mi ± 0%   311.0Mi ± 0%  +5.69% (p=0.000 n=8)
Hash1K/New-4         353.8Mi ± 0%   376.5Mi ± 0%  +6.41% (p=0.000 n=8)
Hash1K/Sum-4         351.9Mi ± 0%   374.1Mi ± 0%  +6.31% (p=0.000 n=8)
Hash8K/New-4         381.8Mi ± 0%   406.9Mi ± 0%  +6.57% (p=0.000 n=8)
Hash8K/Sum-4         381.4Mi ± 0%   406.4Mi ± 0%  +6.58% (p=0.000 n=8)
geomean              146.1Mi        153.6Mi       +5.11%

Change-Id: I7305caefa1434ab2bb4ce94a1c789d4ee5b7ccf3
Reviewed-on: https://go-review.googlesource.com/c/go/+/732580
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-02-02 01:42:56 -08:00
Tony Tang
acd65ebb13 runtime: delete unused parameter of userForced
delete unused parameter userForced

Change-Id: I71c26ab5e3fadc532b6b1f266212c6f620769efd
GitHub-Last-Rev: 6a32c8ff6e
GitHub-Pull-Request: golang/go#76732
Reviewed-on: https://go-review.googlesource.com/c/go/+/727680
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Tony Tang <jianfeng.tony@gmail.com>
2026-01-30 18:35:34 -08:00
thepudds
045fe9aa8c fmt: avoid storing input arguments on pp to help escape analysis
This is part of a series of CLs that aim to reduce how often
interface arguments escape for the print functions in fmt,
such as val here:

  func f(val int) {
      fmt.Sprintf("%d", val)
  }

Prior to this change, arguments immediately escape in doPrintf
because they are stored on the *pp in printArg:

  parameter a leaks to <heap> for (*pp).doPrintf with derefs=1:
    flow: <heap> ← *a:
      from a[argNum] (dot of pointer) at .\print.go:1077:18
      from (*pp).printArg(p, a[argNum], rune(c)) (call parameter) at .\print.go:1077:16

  parameter arg leaks to <heap> for (*pp).printArg with derefs=0:
    flow: <heap> ← arg:
      from p.arg = arg (assign) at .\print.go:682:8

The *pp is heap allocated, and the heap cannot point to stack
variables, so the arguments currently cannot be on the stack.

This change instead threads through the input arguments as individual
type any and reflect.Value parameters, rather than storing on the *pp.

After this change, input arguments still escape, but now for
other reasons.

Updates #8618
Updates #62653

Change-Id: I81984daeceb761ce4ce269b150b888950ce2c5d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/524938
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-01-30 14:22:48 -08:00
Vasily Leonenko
f14d8975a2 runtime: align end of systemstack_switch prologue on amd64 for consistency with gosave_systemstack_switch
gosave_systemstack_switch saves PC with fixed offset of 8 bytes from systemstack_switch to bypass prologue.
This commit makes this offset consistent with actual address of UNDEF instruction intended to be at that address.

Fixes #71440

Change-Id: Ibe6458c5bcb0bdaec228a2f13d6aec7ecc0e319e
Reviewed-on: https://go-review.googlesource.com/c/go/+/740360
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: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-01-30 09:55:05 -08:00
Paul Murphy
35c5deb1d4 all: switch linux-ppc64 target to ELFv2 ABI
Go is only capable of producing internally linked, static binaries
on linux-ppc64. As such, binaries should run in either ELFv1 or
ELFv2 ppc64 userspaces today.

This opens the door to enabling cgo and external linking which
will require ELFv2 support and userspace, eventually.

Fixes #76244

Change-Id: I5ca15037cbe546f352e8693dcf14da51a308b8ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/734540
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>
2026-01-30 08:06:41 -08:00
Neal Patel
afae853072 cmd/go,crypto/mlkem,crypto/x509,encoding/ascii85: clean up tautological/impossible nil conditions
Change-Id: I3cdc599ebc93f5c9be5645e7ef7ce167242d9c1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/739800
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-01-30 07:54:05 -08:00
Xiaolin Zhao
5aa006dee0 test/codegen: add bitwise operation combination tests
This commit adds two test functions, bitsOptXor1 and bitsOptXor2,
to verify that the compiler correctly optimizes certain bitwise
expression patterns in future CLs.

Change-Id: Idf5bd1ff8653f8fa218604d857639e063546d8e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/736540
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-01-29 16:48:45 -08:00
thepudds
bae9486d07 cmd/compile/internal/bloop: avoid extraneous heap allocs in b.Loop body due to autotmp variable scope
The motivating example I created for #73137 still seems
to heap allocate in go1.26rc2 when used in a b.Loop body.

                    │   go1.25    │            go1.26rc2               │
                    │  allocs/op  │ allocs/op   vs base                │
NewX/b.Loop-basic-4   1.000 ± 0%     1.000 ± 0%       ~ (p=1.000 n=10) ¹

I suspect it is because the temps are by default declared
outside the loop body, which escape analysis will determine is
an escaping value and result in a heap allocation. (I've seen
this problem before, including in my older CL 546023 that attempts
to help PGO with a similar issue.)

This is an attempt to address that by placing ODCLs within the
b.Loop body for the temps that are created so that they can be
marked keepalive.

There are two cases handled in the CL: function return values
and function arguments. The first case is what affects my example
from #73137, and is also illustrated via the NewX test case in
the new test/escape_bloop.go file.

Without this CL, the NewX call in the BenchmarkBloop test is inlined,
which is an improvement over Go 1.25, but the slice still escapes
because the temporary used for the return value is declared outside
the loop body.

With this CL, the slice does not escape.

The second case is illustrated via the new BenchmarkBLoopFunctionArg
test, which shows a function argument that escapes without this CL
but does not escape with this CL.

We can also make the two new b.Loop tests in testing/benchmark_test.go
individually pass or fail as expected based on individually
reverting the two changes in this CL.

While we are here, we add a note to typecheck.TempAt to help
make people aware of this behavior.

Updates #73137
Fixes #77339

Change-Id: I69abe978367a8d3a931430aec5d85c9c54b42c1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/738822
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2026-01-29 15:51:12 -08:00
Ian Lance Taylor
c08f6a5b26 cmd/link: put type:* at the start of the type descriptors
That used to happen naturally because the symbol had zero size.
After CL 724261 we need to force it.

Fixes #77372

Change-Id: Ia8eef989bc9cbad5459b60ff6535136e7e0c6cab
Reviewed-on: https://go-review.googlesource.com/c/go/+/740400
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
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>
2026-01-29 15:15:54 -08:00
Jonah Uellenberg
14a4cb13e3 cmd/compile: make prove use non-equality in subtraction for a stronger bound
Given:
  s := /* slice */
  k := /* proved valid index in s (0 <= k < len(s)) */
  v := s[k:]

len(v) >= 1, so v[0] needs no bounds check. However, for
len(v) = len(s) - k, we only checked if len(s) >= k and so could only
prove len(v) >= 0, thus the bounds check wasn't removed.

As far as I can tell these checks were commented out for performance,
but after benchmarking prove I see no difference.

Fixes: #76429

Change-Id: I39ba2a18cbabc0559924d4d226dcb99dbe9a06ed
GitHub-Last-Rev: 53f3344d26
GitHub-Pull-Request: golang/go#76609
Reviewed-on: https://go-review.googlesource.com/c/go/+/725100
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>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-01-29 14:08:19 -08:00
Ian Lance Taylor
ee7a2119ac cmd/link: remove AIX special case for first type descriptor
It doesn't seem to be necessary, and removing it seems cleaner
than adding an AIX case to the code in runtime.moduleTypelinks.

Fixes #77365

Change-Id: I59fa56abf42e18017bd112481ea09d0cca47d105
Reviewed-on: https://go-review.googlesource.com/c/go/+/740220
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@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-01-29 13:17:26 -08:00
Mateusz Poliwczak
48788436b8 go/token: simplify fixOffset
Each time I go to definition of this I am deeply confused
at what I am looking, so let's clean this a bit with modern Go.

Change-Id: I8f44e78f0cdde9b970388f9b98a2720e6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/738341
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2026-01-29 13:17:22 -08:00
Ian Lance Taylor
5593ea4634 cmd/link: adjust symkind comparisons in XCOFF code
This XCOFF symkind comparison broke when STYPE moved in CL 723580.
These comparisons are unmaintainable, but at least the new code
is no worse than the old code.

Change-Id: I1be9de6afdf1814aaadcd2105e6247a4b66b46fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/740200
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>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2026-01-29 13:15:54 -08:00
Guoqi Chen
baa6b1f2bf cmd/compile: update ABI document for loong64
The duff device has been dropped on loong64,
now we can remove related documentation.

Change-Id: I0bd721adc227522ae3c56dfe199ef735cfdf5d33
Reviewed-on: https://go-review.googlesource.com/c/go/+/740260
Auto-Submit: 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>
Reviewed-by: Keith Randall <khr@golang.org>
2026-01-29 13:11:41 -08:00
Keith Randall
10ed9b6ed5 runtime: use smaller max align for arm32
Maybe fixes a dashboard build failure for linux/arm32 casued
by CL 724261.

This value comes from cmd/link/internal/arm/l.go (and in general,
maxAlign in cmd/link/internal/$ARCH/<something>.go).

Change-Id: I4d02cd41072da1b6ad6c7405044bd7788626b013
Reviewed-on: https://go-review.googlesource.com/c/go/+/740101
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@golang.org>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-01-29 13:04:30 -08:00
Ian Lance Taylor
1172294145 runtime, cmd/link: store type descriptor length, not end
Storing the type descriptor length lets us save a relocation.
It also avoids a problem for Darwin dynamic linking.

For #6853
Fixes #77350

Change-Id: If5c94330fe10d75690325f3d0b0658060ef3eb2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/739681
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>
2026-01-29 08:14:53 -08:00