1
0
mirror of https://github.com/golang/go synced 2024-11-05 17:46:16 -07:00
Commit Graph

58097 Commits

Author SHA1 Message Date
Robert Griesemer
5914f6a482 go/types, types2: introduce isValid predicate and use throughout
Preparation for Alias type nodes. Using a predicate will ensure
that alias indirection can be taken care of when needed, eventually.

Change-Id: I689fab6052060eb6bcb2eeac28ba09fdb73f6868
Reviewed-on: https://go-review.googlesource.com/c/go/+/528695
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2023-09-15 16:16:58 +00:00
Paul E. Murphy
5f872db5fc cmd/internal/obj/ppc64: improve RLWNM encoding
If the rotate argument is the constant 0, rlwnm may be generated
instead of rlwinm. In all reasonable cases, this is OK as R0 should
hold 0. However, this could be problematic in some cases when
writing PPC64 assembly.

This consolidates the RLWNM and RLWMI optab entries. Invalid RLWMI
usage is still rejected, however the error will be be slightly
different. The invalid usage will be caught in oprrr instead of oplook.

Change-Id: I9958bd24660fea5f8fc9e3e50d51daa7349e3206
Reviewed-on: https://go-review.googlesource.com/c/go/+/527275
Reviewed-by: Heschi Kreinick <heschi@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
2023-09-15 15:33:33 +00:00
Arnaud Lacombe
7286800338 testdata/vcstest/bzr: fix unit test with Ubuntu 2020 LTS bzr 3.0.2
As pointed by @bcmills, upstream fixed this in 3.1.0 in 30143860ce

Fixes #62620.

Change-Id: I9fa179a5293aec59496ddd401edec02e1080f1a5
GitHub-Last-Rev: 6066b05054
GitHub-Pull-Request: golang/go#62652
Reviewed-on: https://go-review.googlesource.com/c/go/+/528437
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2023-09-15 15:22:32 +00:00
apocelipes
1fde99cd6e net: use bytealg.LastIndexByteString
There is no need to handwrite the "last" function, the bytealg package already provides "LastIndexByteString".

Change-Id: I6000705bffe8450a10cf8f3fa716a8d4605ada1f
GitHub-Last-Rev: 6627c65fb4
GitHub-Pull-Request: golang/go#62647
Reviewed-on: https://go-review.googlesource.com/c/go/+/527976
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2023-09-15 12:57:52 +00:00
Than McIntosh
00073c25f6 cmd/compile/internal/inline/inlheur: rescore callsites based on result use
Add a post-processing pass that updates the scores on callsites based
on how their results are used. This is similar to the "param feeds
unmodified into <XXX>" heuristics, but applies to returned results
instead: if we know that function F always returns a constant, and we
can see that the result from a given call feeds unmodified into an
if/switch, then decrease the score on the call to encourage inlining.

Change-Id: If513765c79d868cbdf672facbff9d92ad24f909e
Reviewed-on: https://go-review.googlesource.com/c/go/+/521819
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-09-15 12:45:59 +00:00
Than McIntosh
a9cfbec17b cmd/compile/internal/inlheur: minor debug trace changes
Minor changes to debug tracing and to the -d=dumpinlfuncprops
debug flag implementation.

Change-Id: Ibaefd489c94675ac7f5a04ec0331b7f888c15a49
Reviewed-on: https://go-review.googlesource.com/c/go/+/521818
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2023-09-15 12:45:47 +00:00
Than McIntosh
eac1f3e461 cmd/compile/internal/inl: use func-level "never returns" flag
Make use of the "never returns" flag bit in ir.Func when computing
function properties: update the bit when we're done looking at a given
function, and read the bit from imported functions during flag
analysis. The advantage of using the ir.Func flag is that it will get
set (and will propagate through to export data) for all functions,
nost just those that are inline candidates.

Change-Id: I7002364b2c4ff5424ed70748fad87fad1a9e4786
Reviewed-on: https://go-review.googlesource.com/c/go/+/518257
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2023-09-15 12:45:33 +00:00
Than McIntosh
dab9c502c4 cmd/compile/internal/inline: add callsite trace output debugging flag
Add a new debug flag "-d=dumpinlcallsitescores" that dumps out a
summary of all callsites in the package being compiled with info on
inlining heuristics, for human consumption. Sample output lines:

  Score  Adjustment  Status  Callee  CallerPos ScoreFlags
  ...
  115    40	     DEMOTED  cmd/compile/internal/abi.(*ABIParamAssignment).Offset	expand_calls.go:1679:14|6	panicPathAdj
  ...
  76     -5          PROMOTED runtime.persistentalloc	mcheckmark.go:48:45|3	inLoopAdj
  ...
  201    0	     --- PGO  unicode.DecodeRuneInString	utf8.go:312:30|1
  ...
  7      -5	     --- PGO  internal/abi.Name.DataChecked	type.go:625:22|0	inLoopAdj

Here "Score" is the final score calculated for the callsite,
"Adjustment" is the amount added to or subtracted from the original
hairyness estimate to form the score. "Status" shows whether anything
changed with the site -- did the adjustment bump it down just below
the threshold ("PROMOTED") or instead bump it above the threshold
("DEMOTED") or did nothing happen as a result of the heuristics
("---"); "Status" also shows whether PGO was involved. "Callee" is the
name of the function called, "CallerPos" is the position of the
callsite, and "ScoreFlags" is a digest of the specific properties we
used to make adjustments to callsite score via heuristics.

Change-Id: Iea4b1cbfee038bc68df6ab81e9973f145636300b
Reviewed-on: https://go-review.googlesource.com/c/go/+/513455
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-09-15 12:45:14 +00:00
Hana (Hyang-Ah) Kim
a278550c40 .github: issue template for telemetry proposals
This uses the github's newer template syntax.

https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms

See
https://github.com/hyangah/go/issues/new?assignees=&labels=Telemetry-Proposal&projects=hyangah%2F3&template=12-telemetry.yml&title=x%2Ftelemetryconfig%3A+
for demo.

Change-Id: I13105711b1fe97680b505eefa1f0e7082e76e92c
Reviewed-on: https://go-review.googlesource.com/c/go/+/528357
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2023-09-14 21:29:10 +00:00
Than McIntosh
e356aa656d cmd/cover: add new "emit meta file" mode for packages without tests
Introduce a new mode of execution for instrumenting packages that have
no test files. Instead of just skipping packages with no test files
(during "go test -cover" runs), the go command will invoke cmd/cover
on the package passing in an option in the config file indicating that
it should emit a coverage meta-data file directly for the package (if
the package has no functions, an empty file is emitted). Note that
this CL doesn't actually wire up this functionality in the Go command,
that will come in a later patch.

Updates #27261.
Updates #58770
Updates #24570.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: I01e8a3edb62441698c7246596e4bacbd966591c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/495446
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-09-14 19:44:37 +00:00
Than McIntosh
0b07bbd2be cmd/compile/internal/inl: inline based on scoring when GOEXPERIMENT=newinliner
This patch changes the inliner to use callsite scores when deciding to
inline as opposed to looking only at callee cost/hairyness.

For this to work, we have to relax the inline budget cutoff as part of
CanInline to allow for the possibility that a given function might
start off with a cost of N where N > 80, but then be called from a
callsites whose score is less than 80. Once a given function F in
package P has been approved by CanInline (based on the relaxed budget)
it will then be emitted as part of the export data, meaning that other
packages importing P will need to also need to compute callsite scores
appropriately.

For a function F that calls function G, if G is marked as potentially
inlinable then the hairyness computation for F will use G's cost for
the call to G as opposed to the default call cost; for this to work
with the new scheme (given relaxed cost change described above) we
use G's cost only if it falls below inlineExtraCallCost, otherwise
just use inlineExtraCallCost.

Included in this patch are a bunch of skips and workarounds to
selected 'errorcheck' tests in the <GOROOT>/test directory to deal
with the additional "can inline" messages emitted when the new inliner
is turned on.

Change-Id: I9be5f8cd0cd8676beb4296faf80d2f6be7246335
Reviewed-on: https://go-review.googlesource.com/c/go/+/519197
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2023-09-14 19:43:26 +00:00
Cosmos Nicolaou
7d0b611dbe runtime/pprof: TestVMInfo reworked to avoid test flakiness.
Fixes #62352.

Change-Id: Ib137a5f39d4630c4737badfabe8e6740593ecbcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/527276
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2023-09-14 18:57:54 +00:00
Cherry Mui
743121c45c cmd/link: clean up some unnecessary casts
In CL 527822, the type of FlagRound is changed to *int64, so casts
to int64 are no longer necessary. Remove them.

Change-Id: I68a89f6e51e0ae3813cb79959b8062ca6bea4980
Reviewed-on: https://go-review.googlesource.com/c/go/+/528575
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-09-14 18:47:36 +00:00
Bryan C. Mills
09300d89e9 net/http: synchronize tests that use reqNum counters
This suppresses the race reported in #62638.

I am not 100% certain how that race happens, but here is my theory.
The increment of reqNum happens before the server writes the response
headers, and the server necessarily writes the headers before the
client receives them. However, that write/read pair occurs through I/O
syscalls rather than Go synchronization primitives, so it doesn't
necessarily create a “happens before” relationship as defined by the
Go memory model: although we can establish a sequence of events, that
sequence is not visible to the race detector, nor to the compiler.

Fixes #62638.

Change-Id: I90d66ec3fc32b9b8e1f9bbf0bc2eb289b964b99b
Reviewed-on: https://go-review.googlesource.com/c/go/+/528475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2023-09-14 17:45:18 +00:00
Chris Duncan
65c53a1833 log/slog: fix Record.back slice always too small during Add()
When slog.Record.Add(args) is called, with enough args to cause the
Record.back []Attr to be created, it is being created 1 too small, which
results in it immediately being grown again by append before the function
exits (needless allocation and copying).
This is because it is created with a capacity equal to countAttrs(args),
but forgets that there is an additional attribute to be appended: a
(args is just the remaining unconsumed attributes).
This PR fixes that by adding 1 to the capacity to account for the `a` attribute.

Additionally, when Record.back already exists, it will most likely be at
max capacity already. Rather than append to it and risk having it grown
multiple times, or grow too large, this adds a slices.Grow call to set it
to the right capacity, similar to what is already done in the
Record.AddAttrs(attrs) function.

Change-Id: Ic4bcf45909fe4436c586ccd2b8d61f24606b6be8
GitHub-Last-Rev: 4c924b610a
GitHub-Pull-Request: golang/go#62388
Reviewed-on: https://go-review.googlesource.com/c/go/+/524618
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2023-09-14 17:38:25 +00:00
limeidan
ed26e2fe34 cmd/link/internal/loadelf: correct the relocation size of R_LARCH_64
Change-Id: If3eaca8b92e8f5265c7763d13021a6353b9df9b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/528455
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-09-14 17:34:12 +00:00
Tobias Klauser
630fff76f9 syscall: remove unused ptracePtr on openbsd
ptracePtr was introduced in CL 470299 for openbsd but it's not used on
this platform.

For #58387

Change-Id: I27901c3f4497e18dc407a9248b66e2691c9a6abb
Reviewed-on: https://go-review.googlesource.com/c/go/+/527535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-09-14 17:26:57 +00:00
Jes Cok
0256198129 regexp: use built-in clear to clear b.visited in *bitState.reset
Change-Id: I1a723124f7050aeb971377db8c3cd04ebf9f7a16
GitHub-Last-Rev: 465da88feb
GitHub-Pull-Request: golang/go#62611
Reviewed-on: https://go-review.googlesource.com/c/go/+/527975
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
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: Heschi Kreinick <heschi@google.com>
2023-09-14 17:25:39 +00:00
Matthew Dempsky
a03f1aeb55 cmd/compile/internal/ir: remove Func.ReflectMethod
This flag doesn't serve any purpose anymore. The only place that it's
currently set happens after it's checked.

Change-Id: Idb6455416f68e502e0b0b1d80e2d6bb5956ee45b
Reviewed-on: https://go-review.googlesource.com/c/go/+/528435
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-09-14 13:23:21 +00:00
Matthew Dempsky
d2e2da83b1 cmd/compile: move remaining instrumentation logic into ssagen
Allows removing Func.{Enter,Exit}, which were only ever used to hold
at most one function call each.

Change-Id: I8b629c82e90bac3fcbe54db89900492406c7dca6
Reviewed-on: https://go-review.googlesource.com/c/go/+/528319
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2023-09-14 13:21:53 +00:00
Bryan C. Mills
9ee23e97a2 cmd/cgo/internal/testcshared: remove an arbitrary timeout in TestSignalHandlersWithNotify
Also log verbose information when -test.v is set.

We need an arbitrary delay when checking that a signal is *not*
delivered, but when we expect the signal to arrive we don't need to
set an arbitrary limit on how long that can take.

Fixes #61264.

Change-Id: If3bbbf78e3c22694bf825d90d7ee9564ce8daedd
Reviewed-on: https://go-review.googlesource.com/c/go/+/509636
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2023-09-14 13:19:50 +00:00
Matthew Dempsky
a55ef98239 cmd/compile/internal/noder: drop unused *types.Pkg results
Several methods return a (*types.Pkg, *types.Sym) pair instead of just
a *types.Sym, because we used to need to preserve the *types.Pkg for
certain types so that we could write out export data for go/types to
use (which exposes these through its APIs).

But now that we write export data from the types2 representation
directly, there's no need for the rest of the compiler to be
concerned about that.

Change-Id: I6ac81a6db71b8e0795ff2f33399b839871564eb7
Reviewed-on: https://go-review.googlesource.com/c/go/+/528416
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-09-14 13:17:26 +00:00
Matthew Dempsky
d18e9407b0 cmd/compile/internal/ir: add Func.DeclareParams
There's several copies of this function. We only need one.

While here, normalize so that we always declare parameters, and always
use the names ~pNN for params and ~rNN for results.

Change-Id: I49e90d3fd1820f3c07936227ed5cfefd75d49a1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/528415
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2023-09-14 13:15:50 +00:00
qmuntal
de4ead8102 time: unconditionally use RegLoadMUIString on Windows
RegLoadMUIString is supported on Windows Vista and later, so this
should be safe to do unconditionally.

While here, also unconditionally use GetDynamicTimeZoneInformation
in syscall/windows/registry tests, since it's also supported on Windows
Vista and later.

Change-Id: Ifa32a81f4727d4810f2b9ccc814aa77a43513e59
Reviewed-on: https://go-review.googlesource.com/c/go/+/527595
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
2023-09-14 07:20:34 +00:00
Matthew Dempsky
856cf23a8a spec: specify evaluation order for binary logical operations
This CL clarifies the order of evaluation of the binary logical
operators, && and ||. The clarified semantics matches what cmd/compile
and x/tools/go/ssa already implement, and prohibit some optimizations
that are arguably allowed today but risk surprising users.

First, it specifies that the left operand is evaluated before the
right operand. This prohibits "(f() || true) && *p" from evaluating
"*p" before "f()".

Second, it specifies that binary logical operations are also ordered
lexically left-to-right with regard to function calls and receive
operations. This prohibits "h(*p || true || f(), g())" from evaluating
"*p" after "g()".

Finally, the "order of evaluation of [...] is not specified" wording
in the example is clarified to acknowledge that there are still some
other orderings that are implied lexically; e.g., x must be evaluated
and indexed before g(), and z now must be evaluated before h(). (Note:
Whether z is evaluated before or after f() remains unspecified, as
there's no lexical dependency.)

Change-Id: I9d316a7f1fbc83be663e116380a2cc7a4ace623d
Reviewed-on: https://go-review.googlesource.com/c/go/+/522938
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-09-14 05:14:44 +00:00
Jonathan Amsterdam
495830acd6 net/http: implement path value methods on Request
Add Request.PathValue and Request.SetPathValue,
and the fields on Request required to support them.

Populate those fields in ServeMux.ServeHTTP.

Updates #61410.

Change-Id: Ic88cb865b0d865a30d3b35ece8e0382c58ef67d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/528355
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-09-14 00:00:28 +00:00
Ian Lance Taylor
fccd0b9b70 context: support non-standard Context in Cause
If Cause is called on a non-standard Context, call ctx.Err.

Fixes #62582

Change-Id: Iac4ed93203eb5529f8839eb479b6ee2ee5ff6cbc
Reviewed-on: https://go-review.googlesource.com/c/go/+/527277
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-09-13 23:32:41 +00:00
Jonathan Amsterdam
399b2a4b1b net/http: give ServeMux.handler a better name
Change-Id: I27bb7d9d5f172a84aa31304194b8a13036b9c5d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/528275
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-09-13 21:00:43 +00:00
Jonathan Amsterdam
e277455164 net/http: add test for registration errors
Change-Id: Ice378e2f1c4cce180f020683d25070c5ae1edbad
Reviewed-on: https://go-review.googlesource.com/c/go/+/528255
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-09-13 21:00:34 +00:00
Bryan C. Mills
6760f20ef5 net/http: scale rstAvoidanceDelay to reduce test flakiness
As far as I can tell, some flakiness is unavoidable in tests
that race a large client request write against a server's response
when the server doesn't read the full request.
It does not appear to be possible to simultaneously ensure that
well-behaved clients see EOF instead of ECONNRESET and also prevent
misbehaving clients from consuming arbitrary server resources.
(See RFC 7230 §6.6 for more detail.)

Since there doesn't appear to be a way to cleanly eliminate
this source of flakiness, we can instead work around it:
we can allow the test to adjust the hard-coded delay if it
sees a plausibly-related failure, so that the test can retry
with a longer delay.

As a nice side benefit, this also allows the tests to run more quickly
in the typical case: since the test will retry in case of spurious
failures, we can start with an aggressively short delay, and only back
off to a longer one if it is really needed on the specific machine
running the test.

Fixes #57084.
Fixes #51104.
For #58398.

Change-Id: Ia4050679f0777e5eeba7670307a77d93cfce856f
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-race,gotip-linux-amd64-race,gotip-windows-amd64-race
Reviewed-on: https://go-review.googlesource.com/c/go/+/527196
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2023-09-13 20:57:25 +00:00
Jonathan Amsterdam
545e4f38e0 net/http: ServeMux handles extended patterns
Modify ServeMux to handle patterns with methods and wildcards.

Remove the map and list of patterns. Instead patterns
are registered and matched using a routing tree.

We also reorganize the code around "trailing-slash redirection,"
the feature whereby a trailing slash is added to a path
if it doesn't match an existing one. The existing code
checked the map of paths twice, but searching the tree
twice would be needlessly expensive. The rewrite
searches the tree once, and then again only if a
trailing-slash redirection is possible.

There are a few omitted features in this CL, indicated
with TODOs.

Change-Id: Ifaef59f6c8c7b7131dc4a5d0f101cc22887bdc74
Reviewed-on: https://go-review.googlesource.com/c/go/+/528039
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2023-09-13 20:07:22 +00:00
Bryan C. Mills
f7f266c885 os/exec: avoid calling LookPath in cmd.Start for resolved paths
This reapplies CL 512155, which was previously reverted in CL 527337.
The race that prompted the revert should be fixed by CL 527820,
which will be submitted before this one.

For #36768.
Updates #62596.

Change-Id: I3c3cd92470254072901b6ef91c0ac52c8071e0a2
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-race,gotip-windows-amd64-race,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/528038
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2023-09-13 19:38:12 +00:00
Bryan C. Mills
07d4de9312 os/exec: fix edge cases in Windows PATH resolution
- Ignore empty entries in PATH, like PowerShell does.

- If we resolve a path using an explicit relative entry in PATH,
  treat it the same as we do for the implicit "." search path,
  by allowing a later (absolute) PATH entry that resolves to the
  same executable to return the absolute version of its path.

- If the requested path does not end with an extension matching
  PATHEXT, return ErrNotFound (indicating that we potentially searched
  for multiple alternatives and did not find one) instead of
  ErrNotExist (which would imply that we know the exact intended path
  but couldn't find it).

Fixes #61493.

Change-Id: I5b539d8616e3403825749d8eccf46725fa808a17
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-race,gotip-windows-amd64-race,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/528037
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-09-13 19:38:10 +00:00
Cherry Mui
d66fc90a0d cmd/link: round up default start address to alignment
If the -R flag (the segment alignment) is specified but the -T
flag (start address) is not, currently the default start address
may be under-aligned, and some math in the linker may be broken.
Round up the start address to align it.

Fixes #62064.

Change-Id: I3b98c9d0cf7d3cd944b9436a36808899d2e52572
Reviewed-on: https://go-review.googlesource.com/c/go/+/527822
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-09-13 19:32:19 +00:00
Michael Pratt
da13da1fce cmd/compile/internal/pgo: remove stale comment
targetDeclFuncs was removed before CL 492436 was ever merged.

Change-Id: I1aafc28446ad23f63bcafc144b91f924dacd676e
Reviewed-on: https://go-review.googlesource.com/c/go/+/528176
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2023-09-13 19:30:06 +00:00
Bryan C. Mills
36facaa1f9 os/exec: avoid writing to Cmd.Path in Cmd.Start on Windows
Fixes #62596.

Change-Id: I9003318ac1c4e3036f32383e62e9ba08c383d5c2
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-race,gotip-windows-amd64-race,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/527820
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-09-13 19:25:41 +00:00
Mauri de Souza Meneguzzo
6ecd5f7504 runtime/internal/atomic: add wasm And/Or operators
In the WebAssembly version of these operators we avoid using
a CAS loop since the Go wasm implementation is single-threaded.

A new test file has been added that has build tags in order to
only test this feature on implemented architectures.

This is part of a series of CLs aimed to add the primitives
for And/Or atomic operations that will be used by the public
sync/atomic apis.

For #61395

Change-Id: Ic67ffefc9cfb626915ea86b6b21b500117710327
GitHub-Last-Rev: bbec3a5f35
GitHub-Pull-Request: golang/go#62517
Reviewed-on: https://go-review.googlesource.com/c/go/+/526656
Run-TryBot: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
2023-09-13 18:36:37 +00:00
doujiang24
bfa8a8586f runtime: silently allow pinning of non-Go pointers in runtime.Pinner.Pin
People may not know the details of a pointer, this makes the
runtime.Pinner.Pin API easier to use.

Fixes #62356

Change-Id: I071df44e01320648a6df5e2a1e65afd6ea52e274
GitHub-Last-Rev: 560a581b63
GitHub-Pull-Request: golang/go#62549
Reviewed-on: https://go-review.googlesource.com/c/go/+/527156
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2023-09-13 18:36:12 +00:00
Li Gang
b45b00162b runtime: resolve false sharing for frequent memory allocate workloads
False sharing observed inside mheap struct, between arenas and preceding
variables.Pad mheap.arenas and preceding variables to avoid false sharing

This false-sharing getting worse and impact performance on multi core
system and frequent memory allocate workloads. While running MinIO On a
2 socket system(56 Core per socket) and GOGC=1000, we observed HITM>8%
(perf c2c) on this cacheline.

After resolve this false-sharing issue, we got performance 17% improved.

Improvement verified on MinIO:
Server: https://github.com/minio/minio
Client: https://github.com/minio/warp
Config: Single node MinIO Server with 6 ramdisk, without TLS enabled,
        Run warp GET request, 128KB object and 512 concurrent

Fixes #62472

Signed-off-by: Li Gang<gang.g.li@intel.com>
Change-Id: I9a4a3c97f5bc8cd014c627f92d59d9187ebaaab5
Reviewed-on: https://go-review.googlesource.com/c/go/+/525955
Reviewed-by: Heschi Kreinick <heschi@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2023-09-13 18:36:09 +00:00
Abhinav Gupta
794e7ea15b net/http: use new Go Doc list syntax
This tweaks the documentation for http.Client
to use the list syntax introduced in Go 1.19.

Change-Id: I1f7e0256c13f57e04fc76e5e2362608c8f9f524d
GitHub-Last-Rev: 11d384f9ad
GitHub-Pull-Request: golang/go#62574
Reviewed-on: https://go-review.googlesource.com/c/go/+/527335
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2023-09-13 18:35:12 +00:00
Tobias Klauser
2c74018d7b path: use bytealg.LastIndexByteString
While strings.LastIndex{,Byte} cannot be used in package path, the
respective internal/bytealg function can be used.

Change-Id: If0ecc36484308221f50875c8609913f6f2887fba
Reviewed-on: https://go-review.googlesource.com/c/go/+/527855
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2023-09-13 18:34:40 +00:00
Alexander Yastrebov
3e1db32657 internal/zstd: fix window resizing
Incorrect window resizing led to checksum error and invalid result.
To demonstrate the problem bigData must be a bit bigger, 3x is enough.

This change fixes window resizing, increases bigData size and decouples
TestLargeXXHash from bigData because it uses hardcoded hash value.

Change-Id: I50f74315b083f42e1ccd7ab2093e084f44631bb6
GitHub-Last-Rev: dbc90ba7a5
GitHub-Pull-Request: golang/go#62543
Reviewed-on: https://go-review.googlesource.com/c/go/+/527115
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-09-13 18:34:35 +00:00
Matthew Dempsky
dc0d126e37 cmd/compile/internal/abi: replace types.Object with *ir.Name
types.Object only exists to avoid a circular dependency between
package types and ir.

Change-Id: I35196aff765d6977ca1e69fe482edbc987c381c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/527340
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2023-09-13 18:34:03 +00:00
Matthew Dempsky
c0e2a9dffd cmd/compile/internal/abi: use Type.Registers
Now that types can self-report how many registers they need, it's much
easier to determine whether a parameter will fit into the available
registers: simply compare the number of registers needed against the
number of registers still available.

This also eliminates the need for the NumParamRegs cache.

Also, the new code in NumParamRegs is stricter in only allowing it to
be called on types that can actually be passed in registers, which
requires a test to be corrected for that. While here, change mkstruct
to a variadic function, so the call sites require less boilerplate.

Change-Id: Iebe1a0456a8053a10e551e5da796014e5b1b695b
Reviewed-on: https://go-review.googlesource.com/c/go/+/527339
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2023-09-13 18:34:00 +00:00
Matthew Dempsky
c80a9f172b cmd/compile/internal/types: add Type.Registers
To be used by package abi in the following CL.

Change-Id: Ic2470069e65f8d9b01ec161c28e5b86dca2ec141
Reviewed-on: https://go-review.googlesource.com/c/go/+/527338
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-09-13 18:33:58 +00:00
Tobias Klauser
65c407b405 syscall: use SYS_SETRLIMIT in //sysnb setrlimit1 on linux/arm64
Otherwise the setrlimit1 wrapper would be generated using the inexistent
SYS_GETRLIMIT1 syscall number.

This was likely missed in CL 476097.

For #476097

Change-Id: I5cfa2ebacb58aeeaddd3db3639a45cf368fbe0ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/527555
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-09-13 18:29:13 +00:00
Bryan C. Mills
105f9d5169 os/exec: simplify Windows-specific tests
- Use the test binary itself for printing paths instead of building a
  separate binary and running it through additional subprocesses.

- Factor out a common chdir helper.

- Use t.Setenv where appropriate.

- Reduce indirection in test helpers.

- Set NoDefaultCurrentDirectoryInExePath consistently in the
  environment.

Also add a test case demonstrating an interesting behavior for
relative paths that may interact with #62596.

Fixes #62594.
For #62596.

Change-Id: I19b9325034edf78cd0ca747594476cd7432bb451
Reviewed-on: https://go-review.googlesource.com/c/go/+/528035
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-09-13 18:19:21 +00:00
Tobias Klauser
dd2279ee34 testing: use strings.LastIndexAny in (*common).decorate
Change-Id: I14c521f4e599e14c71a52342b0ead5d0d4007f1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/527655
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-09-13 18:06:09 +00:00
Than McIntosh
3251006291 cmd/link: fix malformed .shstrtab section
For ELF targets, the code in the go linker that generates the
".shstrtab" section was using a loader symbol to accumulate the
contents of the section, then setting the section type to
sym.SELFROSECT. This resulted in a section whose offset indicated that
it fell into a loadable ELF segment, which is not how the .shstrtab is
supposed to work (it should be outside of all loadable segments,
similar to .strtab and .symtab). The peculiar .shstrtab caused
confusion in third party tools that operate on ELF files, notably
llvm-strip.

This patch rewrites the .shstrtab generation code to avoid using a
loader.Symbol and instead accumulate the contents of the section into
a regular byte slice, then emit the section's data in the same way
that .strtab is handled.

Fixes #62600.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: Ie54020d7b2d779d3ac9f5465fd505217d0681f79
Reviewed-on: https://go-review.googlesource.com/c/go/+/528036
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-09-13 16:29:40 +00:00
qiulaidongfeng
584aad5c57 go/doc/comment: use slices.BinarySearch
Change-Id: Ifb28dd08faa59d9186a4a2337aab0c536d9a885e

Change-Id: Ifb28dd08faa59d9186a4a2337aab0c536d9a885e
GitHub-Last-Rev: dba95de0fb
GitHub-Pull-Request: golang/go#62610
Reviewed-on: https://go-review.googlesource.com/c/go/+/527956
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2023-09-13 15:48:13 +00:00