Andy Pan [Thu, 1 Feb 2024 01:07:43 +0000 (09:07 +0800)]
syscall: call internal/runtime/syscall.Syscall6 in RawSyscall6
For #65355
Change-Id: I9168d9a767e3b2ece65ac6dcab6827ab6f6b11bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/560136 Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
cui fliter [Thu, 29 Feb 2024 08:50:23 +0000 (16:50 +0800)]
doc: close HTML tags
Add unclosed HTML tags and remove redundant </a> tags.
Change-Id: I3fffbcfd640001c9cc4f6085150344daa0c4369b
Reviewed-on: https://go-review.googlesource.com/c/go/+/568155 Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
cui fliter [Thu, 29 Feb 2024 08:09:31 +0000 (16:09 +0800)]
bytes: add a colon after Output to make the Example in the document display correctly
The document address currently showing the problem is: https://pkg.go.dev/bytes#Buffer.ReadByte
Change-Id: Ib52747e38f72541f3ca2a595aa8eca5d91281c80
Reviewed-on: https://go-review.googlesource.com/c/go/+/568135
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
David Chase [Thu, 29 Feb 2024 20:02:44 +0000 (15:02 -0500)]
cmd/compile: add 0-sized-value simplification to copyelim
The problem was caused by faulty handling of unSSA-able
operations on zero-sized data in expand calls, but there
is no point to operations on zero-sized data. This CL adds
a simplify step to the first place in SSA where all values
are processed and replaces anything producing a 0-sized
struct/array with the corresponding Struct/Array Make0
operation (of the appropriate type).
I attempted not generating them in ssagen, but that was a
larger change, and also had bugs. This is simple and obvious.
The only question is whether it would be worthwhile to do it
earlier (in numberlines or phielem).
Fixes #65808.
Change-Id: I0a596b3d272798015e7bb6b1a20411241759fe0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/568258 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Joel Sing [Tue, 27 Feb 2024 12:57:43 +0000 (23:57 +1100)]
cmd/link/internal/riscv64: generate local text symbols for R_RISCV_CALL
Correctly generate local text symbols needed for R_RISCV_CALL when
external linking. R_RISCV_CALL was added in CL #520095 as a way of
marking AUIPC+JALR pairs, instead of overloading R_RISCV_PCREL_ITYPE.
However, genSymsLate was not updated to generate local text symbols
for the new relocation type, leading to HI20 symbol lookup failures.
This issue is detected by cmd/internal/obj/riscv.TestLargeCall,
however this is unfortunately skipped in short mode.
Fixes #65646
Change-Id: I8ee0f13791e0628f31657bf7dae2be8482b689b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/567375 Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
guoguangwu [Thu, 29 Feb 2024 07:48:17 +0000 (07:48 +0000)]
cmd/compile: remove unnecessary fmt.Sprintf call
Change-Id: I38ba7cb0179ec9226a68629c53ea2d81fa19c059
GitHub-Last-Rev: a3d4fe2ac2d2f40033ae0244a264074d45b3ad52
GitHub-Pull-Request: golang/go#66024
Reviewed-on: https://go-review.googlesource.com/c/go/+/568115
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com> Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Cuong Manh Le [Thu, 29 Feb 2024 13:17:09 +0000 (20:17 +0700)]
cmd/internal/testdir: support -godebug
Similar with what we are doing for -goexperiment.
For #65778
Change-Id: I7dda69512a3ffb491e3de31941ae1c3d34fececf
Reviewed-on: https://go-review.googlesource.com/c/go/+/568156
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Robert Griesemer [Wed, 28 Feb 2024 00:26:41 +0000 (16:26 -0800)]
go/types, types2: consistently use error_ type for sub-errors (cleanup)
Also, rename reportAltDecl/recordAltDecl to addAltDecl and
move function into errors.go.
Change-Id: Ie5210d1989f1e51fc5fec483dfa6dba8c4212b59
Reviewed-on: https://go-review.googlesource.com/c/go/+/567616 Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Robert Griesemer [Wed, 28 Feb 2024 19:49:37 +0000 (11:49 -0800)]
go/types: generate typeset.go from types2 source
To simplify the translation, use extra atPos calls where needed
in the respective types2 source.
This CL reduces the amount of code that needs to be maintained
manually by about 420 LOC.
Change-Id: I839844a6e85ccb1111d76c43de23127d8f9fbbce
Reviewed-on: https://go-review.googlesource.com/c/go/+/567776 Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Robert Griesemer [Thu, 29 Feb 2024 00:13:24 +0000 (16:13 -0800)]
go/types, types2: better error position for invalid (infinite) types
Provide an explicit start position to Checker.cycleError for better
control over the reported error.
For #65711.
Change-Id: Ie3016523442d75f348a033c1b944db493943f433
Reviewed-on: https://go-review.googlesource.com/c/go/+/567916
Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
Robert Griesemer [Wed, 28 Feb 2024 23:47:28 +0000 (15:47 -0800)]
go/types, types2: disable incorrect optimization in type validity check
Fixes #65711.
Change-Id: I3196b7d053c9868b74c53623526f2da0ab878f53
Reviewed-on: https://go-review.googlesource.com/c/go/+/567976 Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
khr@golang.org [Tue, 20 Feb 2024 18:32:26 +0000 (10:32 -0800)]
cmd/compile: soften type matching when allocating stack slots
Currently we use pointer equality on types when deciding whether we can
reuse a stack slot. That's too strict, as we don't guarantee pointer
equality for the same type. In particular, it can vary based on whether
PtrTo has been called in the frontend or not.
Instead, use the type's LinkString, which is guaranteed to both be
unique for a type, and to not vary given two different type structures
describing the same type.
Update #65783
Change-Id: I64f55138475f04bfa30cfb819b786b7cc06aebe4
Reviewed-on: https://go-review.googlesource.com/c/go/+/565436 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Damien Neil [Sat, 6 Jan 2024 00:10:33 +0000 (16:10 -0800)]
net/http: remove Content-Length header in http.Error
Error replies to a request with an error message and HTTP code.
Delete any preexisting Content-Length header before writing the header;
if a Content-Length is present, it's probably for content that the
caller has given up on writing.
For #50905
Change-Id: Ia3d4ca008be46fa5d41afadf29ca5cacb1c47660
Reviewed-on: https://go-review.googlesource.com/c/go/+/554216 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
Russ Cox [Wed, 14 Feb 2024 16:57:05 +0000 (11:57 -0500)]
runtime: move per-P timers state into its own struct
Continuing conversion from C to Go, introduce type timers
encapsulating all timer heap state, with methods for operations.
This should at least be easier to think about, instead of having
these fields strewn through the P struct. It should also be easier
to test.
I am skeptical about the pair of atomic int64 deadlines:
I think there are missed wakeups lurking.
Having the code in an abstracted API should make it easier
to reason through and fix if needed.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
guoguangwu [Thu, 29 Feb 2024 01:50:51 +0000 (01:50 +0000)]
internal/trace: fix typo in comment
Change-Id: I7c82426ea9eb8ed100af08cd5aa302e9582055b3
GitHub-Last-Rev: 23535cd52f03ec611c8a11b4ac3993137cbc6655
GitHub-Pull-Request: golang/go#66013
Reviewed-on: https://go-review.googlesource.com/c/go/+/568075
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Jes Cok [Wed, 28 Feb 2024 23:50:37 +0000 (23:50 +0000)]
encoding/json: make use of reflect.Type.{OverflowInt, OverflowUint}
CL 567296 added {OverflowComplex, OverflowFloat, OverflowInt, OverflowUint}
to reflect.Type, this CL uses these methods to simplify code.
For #60427
Change-Id: I229aef9e4095a2f025afd782081f6c9e6d7710f3
GitHub-Last-Rev: c824e5a1b5547e2cc23142fbcf0d6dd59f0e8506
GitHub-Pull-Request: golang/go#66000
Reviewed-on: https://go-review.googlesource.com/c/go/+/567775 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Daniel Martà <mvdan@mvdan.cc>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
khr@golang.org [Wed, 28 Feb 2024 00:00:52 +0000 (16:00 -0800)]
runtime: don't re-initialize itab while looking for missing function
The itab we're initializing again, just to figure out which method
is missing, might be stored in read-only memory.
This can only happen in certain weird generics situations, so it is
pretty rare, but it causes a runtime crash when it does happen.
Fixes #65962
Change-Id: Ia86e216fe33950a794ad8e475e76317f799e9136
Reviewed-on: https://go-review.googlesource.com/c/go/+/567615 Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
Robert Griesemer [Wed, 28 Feb 2024 23:01:25 +0000 (15:01 -0800)]
go/types, types2: add tracing to Checker.validType
Debugging support.
For #65711.
Change-Id: I2b8b03d2c6e02d32a4f9272313e852f17da35b3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/567975 Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Nicolas Hillegeer [Wed, 28 Feb 2024 23:21:18 +0000 (15:21 -0800)]
text/tabwriter: add recovered panic message to rethrow
Without it, there is little information to debug why the original write
failed.
Change-Id: I21615ab7ca402115d02becdbd11bbacde55b98b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/567955
Auto-Submit: Nicolas Hillegeer <aktau@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Nick Revin [Mon, 26 Feb 2024 19:54:41 +0000 (19:54 +0000)]
cmd/link: add option to enable full RELRO for ELF
-bindnow linker option enables full RELRO on ELF targets.
This options defaults to false and preserves
current behavior - partial relro for buildmode=pie.
Also, the following changes were made to align
internal linker's behavior with external ELF linkers:
- GNU_RELRO segment is marked Read-only
- .dynamic is a relro section for partial and full RELRO
- .got is a relro section for partial and full RELRO
- .got.plt is a relro section for full RELRO only
Supersedes #45681 (golang.org/cl/312509)
Change-Id: I51c4ef07b14beceb7cd6fd989f323e45f89a63ca
GitHub-Last-Rev: bc6826441065395b80a2b66cde67466c4d9bce2e
GitHub-Pull-Request: golang/go#58869
Reviewed-on: https://go-review.googlesource.com/c/go/+/473495
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Ian Lance Taylor [Tue, 27 Feb 2024 21:22:40 +0000 (13:22 -0800)]
runtime/cgo: ignore unknown warning options
For #65290
Fixes #65971
Change-Id: If15853f287e06b85bb1cb038b3785516d5812f84
Reviewed-on: https://go-review.googlesource.com/c/go/+/567556
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com>
sivchari [Mon, 26 Feb 2024 05:59:15 +0000 (14:59 +0900)]
all: run go fmt
I ran go fmt to fix format on the entire repository.
Change-Id: I2f09166b6b8ba0ffb0ba27f6500efb0ea4cf21ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/566835 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
guoguangwu [Tue, 27 Feb 2024 01:15:10 +0000 (01:15 +0000)]
database/sql: add error check
Change-Id: Ib9f7a1a4bf23f76457dabf85610f4799502631dc
GitHub-Last-Rev: afbb86fde12d2eeaa8121c25787b0e9c290edbc7
GitHub-Pull-Request: golang/go#65947
Reviewed-on: https://go-review.googlesource.com/c/go/+/566857 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Constantin Konstantinidis [Sun, 15 Oct 2023 15:58:43 +0000 (17:58 +0200)]
encoding/xml: display closing space in error message
Fixes #48890
Change-Id: I7644d091ad92663bda52ef4905239ec499ef9207
Reviewed-on: https://go-review.googlesource.com/c/go/+/535535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Nick Ripley [Tue, 19 Sep 2023 18:10:27 +0000 (14:10 -0400)]
runtime,runtime/pprof: avoid tiny allocations in finalizer-related tests
A few tests rely on finalizers running, but are doing tiny allocations.
These tests will break if, for example, the testing package does is own
tiny allocations before calling the test function (see CL 478955). The
tiny allocator will group these allocations together and the ones done
for the tests themselves will live longer than desired. Use types which
have/are pointers for these tests so they won't be allocated by the tiny
allocator.
While here, pick up a small refactor suggested by Michael Knyszek to use
the BlockUntilEmptyFinalizerQueue helper to wait for the finalizers to
run in TestFinalizerRegisterABI.
Change-Id: I39f477d61f81dc76c87fae215339f8a38979cf94
Reviewed-on: https://go-review.googlesource.com/c/go/+/529555
Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Robert Griesemer [Wed, 28 Feb 2024 17:43:52 +0000 (09:43 -0800)]
cmd/compile/internal/syntax: rename test file to match issue
Follow-up on CL 565518 which addressed issue #65790 but added
testdata/issue65970.go instead of testdata/issue65790.go.
Rename that file to match the issue.
For #65790.
Change-Id: I647c297286355137fa950fb6722e31ae4340393b
Reviewed-on: https://go-review.googlesource.com/c/go/+/567875 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This CL refactors the interleaved fixpoint algorithm so that calls can
be inlined in any order. This has no immediate effect, but it will
allow a subsequent CL to prioritize calls by inlheur score.
Change-Id: I11a84d228e9c94732ee75f0d3c99bc90d83fea09
Reviewed-on: https://go-review.googlesource.com/c/go/+/567695
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
guoguangwu [Wed, 28 Feb 2024 02:52:55 +0000 (02:52 +0000)]
internal/abi: fix typo in comment
Change-Id: I27ad7ce266edc255c93012b24b6f275dd1512dc2
GitHub-Last-Rev: d196b48875861d4dff290fbda04546f0dedf0281
GitHub-Pull-Request: golang/go#65981
Reviewed-on: https://go-review.googlesource.com/c/go/+/567538 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Damien Neil [Tue, 27 Feb 2024 22:53:33 +0000 (14:53 -0800)]
net/http: make timeout errors match context.DeadlineExceeded
When returning an error which implements net.Error and reports
itself as a timeout, also report it as matching context.DeadlineExceeded.
This matches the behavior of timeout errors in the net package
and elsewhere.
Fixes #50856
Change-Id: I2ca911e3677a699af27ba89b1200401baa8b3b1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/567537 Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Russ Cox [Wed, 14 Feb 2024 16:57:05 +0000 (11:57 -0500)]
runtime: use methods for timer
Continuing conversion from C to Go, change timer API to use methods.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: I4cb88a366993a77aa4fad739793a7db7213cc38c
Reviewed-on: https://go-review.googlesource.com/c/go/+/564131 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Russ Cox [Wed, 14 Feb 2024 16:57:04 +0000 (11:57 -0500)]
runtime: change timer.status to timer.state
The status enumeration is simple enough now that we can
view it as a bit set instead. Switch to a bit set, freeing up
the remaining bits for use in followup work to allow
garbage-collecting timers.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: I5f331fe3db1b5cb52f8571091f97f8ba029f3ac9
Reviewed-on: https://go-review.googlesource.com/c/go/+/564130
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Russ Cox [Wed, 14 Feb 2024 16:57:02 +0000 (11:57 -0500)]
runtime: use timer.lock in moveTimers
Continue using timer.lock to simplify timer operations.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: Iaf371315308425d132217eacb20b1e120a6833c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/564127 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Russ Cox [Wed, 14 Feb 2024 16:57:03 +0000 (11:57 -0500)]
runtime: use timer.lock in adjusttimers
Continue using timer.lock to simplify timer operations.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: I2298cede902cbf0aea268c54d741190007a733c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/564128 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Russ Cox [Wed, 14 Feb 2024 16:57:03 +0000 (11:57 -0500)]
runtime: use timer.lock in runtimer
Continue using timer.lock to simplify timer operations.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: I504335a010d6eb4d7d627145b64a896582158406
Reviewed-on: https://go-review.googlesource.com/c/go/+/564129
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Russ Cox [Wed, 14 Feb 2024 16:57:01 +0000 (11:57 -0500)]
runtime: use timer.lock in cleantimers
Continue using timer.lock to simplify timer operations.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: Ic12fd2630e8ac23cddd00fa7e3240a1ac19da596
Reviewed-on: https://go-review.googlesource.com/c/go/+/564126
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Russ Cox [Wed, 14 Feb 2024 16:57:01 +0000 (11:57 -0500)]
runtime: use timer.lock in modtimer
Continue using timer.lock to simplify timer operations.
Note the removal of a previous potential deadlock.
(Explained at new line 325, there was a lock inversion
between individual timer locks and the 'timers' lock.)
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: I8c9be00d13c6acd171a8aa2882a4fc844498f754
Reviewed-on: https://go-review.googlesource.com/c/go/+/564125 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Russ Cox [Wed, 14 Feb 2024 16:57:00 +0000 (11:57 -0500)]
runtime: use timer.lock in deltimer
The state set is now simplified enough that all the CAS loops
are starting to look the same: they are just spin locks.
So introduce an actual timer.lock method and use it in deltimer.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: Ifd7f20eeede5c764ef10ecba64855c29a5ddbe39
Reviewed-on: https://go-review.googlesource.com/c/go/+/564124 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Russ Cox [Wed, 14 Feb 2024 16:57:00 +0000 (11:57 -0500)]
runtime: merge timerDeleted into timerModified
When we make a change to a timer, we have to note the
desired change to t.when and then wait for the timer heap
owner to apply the change. There are two possible changes:
delete or set a new t.when. Most of the code for processing
these changes is the same, so we can simplify the code by
making both have the same state: timerDeleted is now
timerModified with t.nextwhen == 0.
This is part of a larger simplification of the state set.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: I1a2a12f8250bcd40f7b08b83f22c3a82b124eda6
Reviewed-on: https://go-review.googlesource.com/c/go/+/564123 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Russ Cox [Wed, 14 Feb 2024 16:56:59 +0000 (11:56 -0500)]
runtime: merge timerNoStatus into timerRemoved
For historical reasons, we have to treat a zero timer as
the same as an initialized timer that was stopped (removed).
The two states are already treated mostly identically.
Merge them.
This is part of a larger simplification of the state set.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: I9c3aeb8f92bafb18c47489c1ec20a7b87ac5cd9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/564122
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Russ Cox [Wed, 14 Feb 2024 16:56:58 +0000 (11:56 -0500)]
runtime: merge timerMoving into timerModifying
timerMoving is just a kind of "locked for modification",
so merge it into timerModifying.
This is part of a larger simplification of the state set.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: I5379122f96d9921ecda7a6a37cabd6c6b4d529a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/564121 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Russ Cox [Wed, 14 Feb 2024 16:56:58 +0000 (11:56 -0500)]
runtime: merge timerRemoving into timerModifying
timerRemoving is just a kind of "locked for modification",
so merge it into timerModifying. This does potentially remove
a fast path from deltimer, in that deltimer of timerRemoving
is a fast-path exit while deltimer of timerModifying has to
wait for the timer to settle. Since all the timerModifying
critical paths are bounded and short, this should not matter.
This is part of a larger simplification of the state set.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: I039bf6a5a041a158dc3d1af8127f28eed50fc540
Reviewed-on: https://go-review.googlesource.com/c/go/+/564120 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Russ Cox [Wed, 14 Feb 2024 16:56:57 +0000 (11:56 -0500)]
runtime: merge timerModifiedEarlier and timerModifierLater
Nothing actually needs to know the difference between these
two states, so merge them.
This is part of a larger simplification of the state set.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: Ia30699ac92e66467773942e7df1fb21470a6e51a
Reviewed-on: https://go-review.googlesource.com/c/go/+/564119
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Russ Cox [Wed, 14 Feb 2024 16:56:57 +0000 (11:56 -0500)]
runtime: delete addtimer
modtimer can always be used in place of addtimer.
Do that and delete addtimer, avoiding duplicated logic.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: I70291796bdac3bef5e0850f039f6f4a1da4498ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/564118 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Russ Cox [Wed, 14 Feb 2024 16:56:56 +0000 (11:56 -0500)]
runtime: move all timer-locking code into time.go
No code changes, only code moves here.
Move all code that locks pp.timersLock into time.go
so that it is all in one place, for easier abstraction.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: I1b59af7780431ec6479440534579deb1a3d9d7a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/564117 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Russ Cox [Wed, 14 Feb 2024 03:31:33 +0000 (22:31 -0500)]
runtime: delete clearDeletedTimers
adjusttimers already contains the same logic. Use it instead.
This avoids having two copies of the code and is faster.
adjusttimers was formerly O(n log n) but is now O(n).
clearDeletedTimers was formerly O(n² log n) and is now gone!
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: I32bf24817a589033dc304b359f8df10ea21f48fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/564116 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Russ Cox [Wed, 14 Feb 2024 16:56:50 +0000 (11:56 -0500)]
runtime: simplify, speed up adjusttimers
The current adjusttimers does an O(n) loop and then queues
a bunch of reinsertions, each of which is O(log n), for a worst
case of O(n log n) time plus an allocation of n elements.
Reestablishing the heap invariant from an arbitrarily ordered
slice can be done in O(n) time, so it is both simpler and faster
to avoid the allocated temporary queue and just re-init the
heap if we have damaged it. The cost of doing so is no worse
than the O(n) loop we already did.
This change also avoids holding multiple timers locked (status
set to timerMoving) at any given moment, as well as holding
individual timers locked for unbounded amounts of time,
as opposed to fixed-size critical sections.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: If966c1d1e66db797f4b19e7b1abbc06ab651764d
Reviewed-on: https://go-review.googlesource.com/c/go/+/564115 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Jes Cok [Tue, 27 Feb 2024 22:39:35 +0000 (22:39 +0000)]
reflect: add Overflow methods to Type
This CL adds new methods synonymous with the method of the same name
in reflect.Value to reflect.Type: OverflowComplex, OverflowFloat, OverflowInt, OverflowUint.
Fixes #60427
Change-Id: I7a0bb35629e59a7429820f13fcd3a6f120194bc6
GitHub-Last-Rev: 26c11bcffe0f418e7d5c37e14587e738d5d939d6
GitHub-Pull-Request: golang/go#65955
Reviewed-on: https://go-review.googlesource.com/c/go/+/567296
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
qiulaidongfeng [Wed, 14 Feb 2024 01:51:47 +0000 (01:51 +0000)]
cmd/dist: let the three runtime -quick tests run simultaneously
For #65164
Change-Id: Ied19cebd113ef91c34f613cafbeb92a335d6420d
GitHub-Last-Rev: 8118be6e30ffc4edcd88b8a1d5ee3105e2c760de
GitHub-Pull-Request: golang/go#65444
Reviewed-on: https://go-review.googlesource.com/c/go/+/560597
Commit-Queue: Ian Lance Taylor <iant@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
zuojunwei.1024 [Tue, 27 Feb 2024 11:14:00 +0000 (19:14 +0800)]
cmd/compile: mark pointer to noalg type as noalg
When the compiler writes PtrToThis field of noalg type, it generates
its pointer type. Mark them as noalg to prevent put them in typelinks.
Fixes #65957
Change-Id: Icbc3b18bc866f9138c7648e42dd500a80326f72b
Reviewed-on: https://go-review.googlesource.com/c/go/+/567335 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
Robert Griesemer [Tue, 27 Feb 2024 22:04:00 +0000 (14:04 -0800)]
go/types, types2: move Checker.langCompat from version.go to expr.go (cleanup)
This makes version.go holding core version checking code only.
No functional changes.
Change-Id: Ia88a48166cad2698765697dd7a8625b56ecc2226
Reviewed-on: https://go-review.googlesource.com/c/go/+/567536 Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Robert Griesemer [Tue, 27 Feb 2024 17:21:44 +0000 (09:21 -0800)]
go/types, types2: consistently use singular when reporting version errors
Change-Id: I39af932b789cd18dc4bfc84f9667b1c32c9825f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/567476 Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Robert Griesemer [Tue, 27 Feb 2024 00:45:28 +0000 (16:45 -0800)]
go/types, types2: initial support for parameterized type aliases
Permit type parameters on type alias declarations depending on
Go language version.
Implement various version checks such that at most one version
error is reported per type alias declaration.
Add tparams field to Alias type node.
Missing:
- instantiation of alias types
- API additions (requires proposal)
For #46477.
Change-Id: Ica658292bd096d3bceb513027d3353501a6c58e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/566856
Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Robert Griesemer [Fri, 23 Feb 2024 22:40:37 +0000 (14:40 -0800)]
go/types, types2: separate formatting from error handling functions
This change moves formatting-specific functionality into a new file
format.go and rearranges the code in the errors.go files to be in
the same order for go/types and types2, making them more similar.
No functionality change. This is a pure code reordering.
Change-Id: Ibd818792397be146ad510a6c7308c85d3bb65956
Reviewed-on: https://go-review.googlesource.com/c/go/+/566555
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Robert Griesemer [Wed, 21 Feb 2024 23:08:21 +0000 (15:08 -0800)]
go/types: generate initorder.go from types2 source
This CL reduces the amount of code that needs to be maintained
manually by about 320 LOC.
Change-Id: Ib797e86dd4abd3a9fe614787103f0e5cebd5e4ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/565838 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Robert Griesemer [Wed, 21 Feb 2024 23:33:28 +0000 (15:33 -0800)]
go/types: generate mono.go from types2 source
This CL reduces the amount of code that needs to be maintained
manually by about 340 LOC.
Change-Id: If7b96c30e5a2f1ff28ebf4ca2f3ac3f73d6a8865
Reviewed-on: https://go-review.googlesource.com/c/go/+/565839 Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
Robert Griesemer [Fri, 23 Feb 2024 20:43:51 +0000 (12:43 -0800)]
go/types, types2: call error handler for each sub-error as needed
Factor out calling or typechecker error handler from error_.report.
In error_.report, decide if the typechecker error handler needs to
be called once or multiple times.
This change enables the use of sub-errors for types2 and go/types,
with the error handler taking care of deciding how many "separate"
errors are reported via the API.
Use new error reporting in go/types mono and initorder computation;
with the above adjustments, these changes should now pass gopls tests.
Also: adjust some format strings to avoid vet errors.
Change-Id: If05a7044399b4783c596c69a8158619f83c21c70
Reviewed-on: https://go-review.googlesource.com/c/go/+/566537
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Damien Neil [Mon, 26 Feb 2024 21:45:42 +0000 (13:45 -0800)]
net/http/httputil: avoid ReverseProxy data race on 1xx response and error
ReverseProxy uses a httptrace.ClientTrace.Got1xxResponse trace hook
to capture 1xx response headers for proxying. This hook can be called
asynchrnously after RoundTrip returns. (This should only happen when
RoundTrip has failed for some reason.) Add synchronization so we don't
attempt to modifying the ResponseWriter headers map from the hook
after another goroutine has begun making use of it.
Fixes #65123
Change-Id: I8b7ecb1a140f7ba7e37b9d27b8a20bca41a118b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/567216
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Deleplace [Thu, 22 Feb 2024 22:44:31 +0000 (23:44 +0100)]
slices: Delete clears the tail when j == len(s)
Fixes #65669
Change-Id: Ifd2011dd604fef399e4352b804fc2f6a9e74096e
Reviewed-on: https://go-review.googlesource.com/c/go/+/566237 Reviewed-by: Ian Lance Taylor <iant@google.com> 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: Keith Randall <khr@golang.org>
Cuong Manh Le [Wed, 21 Feb 2024 11:50:11 +0000 (18:50 +0700)]
cmd/compile: fix early deadcode with label statement
CL 517775 moved early deadcode into unified writer. with new way to
handle dead code with label statement involved: any statements after
terminating statement will be considered dead until next label
statement.
However, this is not safe, because code after label statement may still
refer to dead statements between terminating and label statement.
It's only safe to remove statements after terminating *and* label one.
Fixes #65593
Change-Id: Idb630165240931fad50789304a9e4535f51f56e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/565596
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Nick Ripley [Mon, 5 Feb 2024 19:20:10 +0000 (14:20 -0500)]
runtime: don't clobber saved frame pointer during arm64 racecall
During calls to the race detector on arm64, we switch to the g0 stack if
we aren't already on it. If we are already on the g0 stack, the race
detector library code can then create a stack frame using the stack
pointer coming from Go code. The race detector library can go on to
write values to the top of its stack frame. But the Go ABI for arm64
saves the caller's frame pointer in the word below the current stack
frame. So, the saved frame pointer on the stack can be clobbered by the
race detector. Decrement the stack pointer to account for where the
frame pointer is saved, like we do for asmcgocall.
Change-Id: I66e5e4a671c3befc10776bac6869810ecf71790d
Reviewed-on: https://go-review.googlesource.com/c/go/+/561515
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@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Michael Pratt [Mon, 22 Jan 2024 22:50:44 +0000 (17:50 -0500)]
runtime: disable use of runnext on wasm
When readying a goroutine, the scheduler typically places the readied
goroutine in pp.runnext, which will typically be the next goroutine to
run in the schedule.
In order to prevent a set of ping-pong goroutines from simply switching
back and forth via runnext and starving the rest of the run queue, a
goroutine scheduled via runnext shares a time slice (pp.schedtick) with
the previous goroutine.
sysmon detects "long-running goroutines", which really means Ps using
the same pp.schedtick for too long, and preempts them to allow the rest
of the run queue to run. Thus this avoids starvation via runnext.
However, wasm has no threads, and thus no sysmon. Without sysmon to
preempt, the possibility for starvation returns. Avoid this by disabling
runnext entirely on wasm. This means that readied goroutines always go
on the end of the run queue and thus cannot starve via runnext.
Note that this CL doesn't do anything about single long-running
goroutines. Without sysmon to preempt them, a single goroutine that
fails to yield will starve the run queue indefinitely.
For #65178.
Change-Id: I10859d088776125a2af8c9cd862b6e071da628b5
Cq-Include-Trybots: luci.golang.try:gotip-js-wasm,gotip-wasip1-wasm_wasmtime,gotip-wasip1-wasm_wazero
Reviewed-on: https://go-review.googlesource.com/c/go/+/559798
Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kkhaike [Wed, 21 Feb 2024 13:40:02 +0000 (21:40 +0800)]
net: Correct the code snippet erroneously rolled back in CL550435
In CL https://golang.org/cl/550435, a segment that had already been reviewed and modified was rolled back due to an erroneous operation. Here, submit a correct code snippet.
Change-Id: I46adfad110d532aec5f557c350fe6dccbc583968
Reviewed-on: https://go-review.googlesource.com/c/go/+/565628
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: qiulaidongfeng <2645477756@qq.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Mauri de Souza Meneguzzo [Wed, 10 Jan 2024 13:33:40 +0000 (13:33 +0000)]
net/http: prevent redirect loop in serveFile if "/" is a normal file
When FileServer(Dir("file")) is used where "file" is a normal file and
not a directory, the server enters a redirect loop.
The usage of a file inplace of a directory path is not documented in
http.Dir and it could be considered undefined behavior.
This CL updates serveFile to check if we are trying to traverse a normal
file instead of a directory and return an error, preventing the redirect
loop.
Matteo Vaccari [Thu, 22 Feb 2024 11:36:38 +0000 (11:36 +0000)]
net/http/pprof: avoid panic with user-defined "GET /" route
With the new routing style in go 1.22, declaring
http.Handle("GET /", h)
generates a conflict with route "/debug/pprof/" and the others declared in
the net/http/pprof package. You get an error such as:
panic: pattern "GET /" (registered at .../pprof.go:94): GET / matches
fewer methods than /debug/pprof/, but has a more general path pattern
This patch prevents that error. Adding GET is correct because no other
method makes sense with the /debug/pprof routes. However, a tool using any
method other than GET will break.
We preserve the traditional behaviour when GODEBUG=httpmuxgo121=1 is
specified.
Updates #65723
Change-Id: I49c21f5f3e802ad7538062d824354b2e4d8a800e
GitHub-Last-Rev: 35e4012663f454fee8f00a321c43592ce4754feb
GitHub-Pull-Request: golang/go#65791
Reviewed-on: https://go-review.googlesource.com/c/go/+/565176
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Robert Griesemer [Mon, 26 Feb 2024 21:26:39 +0000 (13:26 -0800)]
go/types: added test case for Checker.CheckExpr
For #65898.
Change-Id: I495e53060ac56b88a551ccd9901f25bbce97c714
Reviewed-on: https://go-review.googlesource.com/c/go/+/567215 Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
qmuntal [Fri, 23 Feb 2024 13:01:34 +0000 (14:01 +0100)]
os: avoid GetFileInformationByHandleEx call when stat'ing files on Windows
os.Stat and os.Lstat on Windows use GetFileInformationByHandleEx to
retrieve file information for reparse points and files that
GetFileAttributesEx does not handle.
However, GetFileInformationByHandleEx is only necessary for
reparse points, so we can avoid the call for regular files.
With this change we can drop the FAT hack that was added in CL 154377,
as files won't have the FILE_ATTRIBUTE_REPARSE_POINT attribute set
on that file system.
Change-Id: Id18639067a6c3fa1bb2c6706d5b79358c224fe37
Reviewed-on: https://go-review.googlesource.com/c/go/+/566397 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Bryan Mills <bcmills@google.com>
guoguangwu [Mon, 26 Feb 2024 09:32:48 +0000 (09:32 +0000)]
reflect: fix typo in comment
Change-Id: Ia8e666b128622391d72e42449c01c4e10f3c9e1e
GitHub-Last-Rev: c74cf13b70772a965a14630108544a89690d1383
GitHub-Pull-Request: golang/go#65938
Reviewed-on: https://go-review.googlesource.com/c/go/+/566855 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
guoguangwu [Sun, 25 Feb 2024 12:59:23 +0000 (12:59 +0000)]
archive/tar: check returned error before use hdr
Change-Id: I8c28dac73427e37d58d970b00d8f0f1413bede2e
GitHub-Last-Rev: a11a8036028ecf6f811b1470becc924b77a2c734
GitHub-Pull-Request: golang/go#65932
Reviewed-on: https://go-review.googlesource.com/c/go/+/566695
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Joseph Tsai <joetsai@digital-static.net> Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
guoguangwu [Tue, 20 Feb 2024 06:20:13 +0000 (06:20 +0000)]
html/template: replace bytes.Compare call with bytes.Equal
Change-Id: I1bd3fdf0ceb9a83dbcc07f55b81489eb2c82c9ba
GitHub-Last-Rev: 05d49d7fb921e59529f7105a93b4b7fba51ab525
GitHub-Pull-Request: golang/go#65418
Reviewed-on: https://go-review.googlesource.com/c/go/+/560115
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
guoguangwu [Fri, 23 Feb 2024 01:07:08 +0000 (01:07 +0000)]
encoding/xml: remove unnecessary fmt.Sprintf call
Change-Id: Iba6014340d8b697a3a26b35e8d5a702ccf332e10
GitHub-Last-Rev: ef60463c7b98c2bdabe6d04e0f86947b7f395765
GitHub-Pull-Request: golang/go#65872
Reviewed-on: https://go-review.googlesource.com/c/go/+/565841 Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
aimuz [Wed, 21 Feb 2024 02:15:40 +0000 (02:15 +0000)]
database/sql: wrap errors with %w in driverArgsConnLocked
Use fmt.Errorf %w verb to wrap errors in driverArgsConnLocked,
which allows for easier unwrapping and checking of error types.
Add tests in sql_test.go to ensure that Stmt.Exec and Stmt.Query
correctly wrap underlying Valuer errors, adhering to the new change.
Fixes #64707.
Change-Id: Id9f80e265735d0849ee7abba63e58e4c26e658ad
GitHub-Last-Rev: 0df367e0fb5b213513d4e0ab7f5a87984798f96d
GitHub-Pull-Request: golang/go#64728
Reviewed-on: https://go-review.googlesource.com/c/go/+/550116 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Roland Shoemaker [Thu, 15 Feb 2024 01:18:36 +0000 (17:18 -0800)]
html/template: escape additional tokens in MarshalJSON errors
Escape "</script" and "<!--" in errors returned from MarshalJSON errors
when attempting to marshal types in script blocks. This prevents any
user controlled content from prematurely terminating the script block.
Fixes #65697
Change-Id: Icf0e26c54ea7d9c1deed0bff11b6506c99ddef1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/564196
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
Bryan C. Mills [Wed, 31 Jan 2024 16:43:38 +0000 (11:43 -0500)]
net/http: reject client-side retries in server timeout tests
This breaks an unbounded client-side retry loop if the server's
timeout happens to fire during its final read of the TLS handshake.
The retry loop was observed on wasm platforms at CL 557437.
I was also able to reproduce chains of dozens of retries on my
linux/amd64 workstation by adjusting some timeouts and adding a couple
of sleeps, as in this patch:
https://gist.github.com/bcmills/d0a0a57e5f64eebc24e8211d8ea502b3
However, on linux/amd64 on my workstation the test always eventually
breaks out of the retry loop due to timing jitter.
I couldn't find a retry-specific hook in the http.Client,
http.Transport, or tls.Config structs, so I have instead abused the
Transport.Proxy hook for this purpose. Separately, we may want to
consider adding a retry-specific hook, or changing the net/http
implementation to avoid transparently retrying in this case.
Fixes #65410.
Updates #65178.
Change-Id: I0e43c039615fe815f0a4ba99a8813c48b1fdc7e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/559835 Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
guoguangwu [Sun, 25 Feb 2024 10:15:17 +0000 (10:15 +0000)]
cmd/gofmt: remove impossible err!=nil conditional
Change-Id: Ife63c766cefc14d2f6bdd3c706f913b1b6f99949
GitHub-Last-Rev: 04e23349e68a3ce12b7d33c0fd3ad8c7ffbd8aaa
GitHub-Pull-Request: golang/go#65929
Reviewed-on: https://go-review.googlesource.com/c/go/+/566099 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Daniel Martà <mvdan@mvdan.cc>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Tobias Klauser [Thu, 22 Feb 2024 21:03:50 +0000 (22:03 +0100)]
net: use bytealg.IndexByte in cgoLookupAddrPTR
Change-Id: I76f4dc1e8bda98936c1198cb45ce8141ca88845b
Reviewed-on: https://go-review.googlesource.com/c/go/+/566235
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
guoguangwu [Thu, 22 Feb 2024 01:32:06 +0000 (01:32 +0000)]
crypto/tls: fix typo in comment
Change-Id: I77371ef99797e2b53f1292c9d6a4eb157f116f88
GitHub-Last-Rev: 7ce7d014c0c46b320f9e4b742ae9360d1b5cf4dc
GitHub-Pull-Request: golang/go#65836
Reviewed-on: https://go-review.googlesource.com/c/go/+/565440 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>