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

54784 Commits

Author SHA1 Message Date
cui fliter
821e31042a all: add missing copyright header
Change-Id: Ia5a090953d324f0f8aa9c1808c88125ad5eb6f98
Reviewed-on: https://go-review.googlesource.com/c/go/+/448955
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-11-09 14:05:53 +00:00
Guoqi Chen
3a41094107 runtime: using wyrand for fastrand on linux/loong64
Benchmarks on linux/loong64:
name               old time/op    new time/op    delta
Fastrand           4.06ns ± 0%    3.60ns ± 0%    -11.29%  (p=0.000 n=32+27)
Fastrand64         7.20ns ± 0%    7.16ns ± 0%     -0.52%  (p=0.000 n=23+31)
FastrandHashiter   49.5ns ± 1%    48.9ns ± 2%     -1.24%  (p=0.000 n=32+32)
Fastrandn/2        4.45ns ± 0%    3.81ns ± 0%    -14.37%  (p=0.000 n=32+32)
Fastrandn/3        4.45ns ± 0%    3.81ns ± 0%    -14.32%  (p=0.000 n=32+32)
Fastrandn/4        4.45ns ± 0%    3.81ns ± 0%    -14.33%  (p=0.000 n=31+32)
Fastrandn/5        4.44ns ± 0%    3.81ns ± 0%    -14.26%  (p=0.000 n=31+30)

Change-Id: I0aba7d2331221426c44cc0d0dddecca3b585fda4
Reviewed-on: https://go-review.googlesource.com/c/go/+/446896
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-11-09 06:30:59 +00:00
Wayne Zuo
268f4629df cmd/compile: enable brachelim pass on loong64
Change-Id: I4fd1c307901c265ab9865bf8a74460ddc15e5d14
Reviewed-on: https://go-review.googlesource.com/c/go/+/416735
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: xiaodong liu <teaofmoli@gmail.com>
Auto-Submit: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
2022-11-09 06:10:55 +00:00
cui fliter
6b45863e47 all: fix some comments
Change-Id: I163ea3a770f2228f67d4fb1374653566e64b91f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/448575
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-11-09 04:03:15 +00:00
Daulet Zhanguzin
27c3814275 io: correctly process result of sendfile(2) when src returns 0 bytes
Fixes #53658. io.Copy() uses sendfile(2) to avoid allocating extra buffers when src is a file and dst is a TCPConn. However if src returns no bytes current logic treats it as failure and falls back to copying via user space. The following is a benchmark that illustrates the bug.

Benchmark: https://go.dev/play/p/zgZwpjUatSq

Before:
BenchmarkCopy-16          541006              2137 ns/op            4077 B/op          0 allocs/op

After:
BenchmarkCopy-16          490383              2365 ns/op             174 B/op          8 allocs/op

Change-Id: I703376d53b20e080c6204a73c96867cce16b24cf
GitHub-Last-Rev: 3a50be4f16
GitHub-Pull-Request: golang/go#53659
Reviewed-on: https://go-review.googlesource.com/c/go/+/415834
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-11-09 03:01:33 +00:00
Constantin Konstantinidis
f13849a7af encoding/xml: error when closing tag does not match opening tag
Comparing opening and closing tag is done using the prefix when available.
Documentation states that Token returns URI in the Space part of the Name.
Translation has been moved for the End tag before the namespace is removed
from the stack.

After closing a tag using a namespace, the valid namespace must be taken
from the opening tag. Tests added.

Fixes #20685

Change-Id: I4d90b19f7e21a76663f0ea1c1db6c6bf9fd2a389
Reviewed-on: https://go-review.googlesource.com/c/go/+/107255
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-11-09 03:01:28 +00:00
Constantin Konstantinidis
b459166219 encoding/xml: add check of namespaces to detect field names conflicts
Test added.

Fixes #8535

Change-Id: Ic89c2781e81d963a653180812748b3fc95fb7fae
Reviewed-on: https://go-review.googlesource.com/c/go/+/106575
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-11-09 03:01:25 +00:00
Matthew Horsnell
fe4e59e78b runtime internal/cpu: rename "Zeus" "NeoverseV1".
Rename "Zeus" to "NeoverseV1" for the partnum 0xd40 to be
consistent with the documentation of MIDR_EL1 as described in
https://developer.arm.com/documentation/101427/0101/?lang=en

Change-Id: I2e3d5ec76b953a831cb4ab0438bc1c403648644b
Reviewed-on: https://go-review.googlesource.com/c/go/+/414775
Reviewed-by: Jonathan Swinney <jswinney@amazon.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Eric Fang <eric.fang@arm.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-11-08 23:11:32 +00:00
Russ Cox
896faf306c net: allocate res_state entirely in C memory
The linux-amd64-wsl builder was failing because the res_nsearch
implementation was storing pointer to the res_state's own fields
in other fields in the res_state. If the res_state is Go memory, this
looks like pointers to Go pointers. Moving the res_state to C memory
avoids the problem.

The linux-amd64-wsl builder has been fixed a different way by
replacing res_nsearch with res_search on Linux, where it is thread-safe.
But other systems that still need to use res_nsearch (such as macOS)
may run into the same kind of problem, so it is probably still worth
arranging for the res_state to live entirely in C memory.

Fixes #56658 (again).

Change-Id: I58a14e72c866eaceb02ad828854a1f626b9b8e73
Reviewed-on: https://go-review.googlesource.com/c/go/+/448798
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-11-08 22:14:56 +00:00
Xiangdong Ji
8befe0e408 runtime: fix uncondition calls to traceGCSTWDone
startTheWorldWithSema should call traceGCSTWDone only when
the tracing is enabled.

Change-Id: Ibc7181834f68af3923e4b2aee01a57492ab6213e
Reviewed-on: https://go-review.googlesource.com/c/go/+/330835
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-08 21:50:06 +00:00
Jakub Ciolek
2df6c1abce runtime: remove the started field from sweepdata
This bool doesn't seem to be used anymore. Remove it.

Change-Id: Ic73346a98513c392d89482c5e1d818a90d713516
Reviewed-on: https://go-review.googlesource.com/c/go/+/419654
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-11-08 21:31:58 +00:00
Matthew Dempsky
9944ba757b cmd/compile: fix transitive inlining of generic functions
If an imported, non-generic function F transitively calls a generic
function G[T], we may need to call CanInline on G[T].

While here, we can also take advantage of the fact that we know G[T]
was already seen and compiled in an imported package, so we don't need
to call InlineCalls or add it to typecheck.Target.Decls. This saves us
from wasting compile time re-creating DUPOK symbols that we know
already exist in the imported package's link objects.

Fixes #56280.

Change-Id: I3336786bee01616ee9f2b18908738e4ca41c8102
Reviewed-on: https://go-review.googlesource.com/c/go/+/443535
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
2022-11-08 21:26:09 +00:00
Russ Cox
a7538d7821 net: fix res_search uses on alpine, android, dragonfly
On Android and Dragonfly, don't use -lresolv. It doesn't exist there.

On Linux, use res_search instead of res_nsearch.
glibc makes res_search thread-safe by having a per-thread __res.
It still also provides res_nsearch.
musl makes res_search thread-safe by ignoring __res completely.
It does not provide res_nsearch at all.
Changing to res_search on Linux will fix builds on musl-based systems
while keeping glibc-based systems working.

Fixes #56657.
Fixes #56660.

Change-Id: Id87dde6c8bbf6c0d34543c09782f3871489c8712
Reviewed-on: https://go-review.googlesource.com/c/go/+/448797
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-11-08 20:59:42 +00:00
Russ Cox
12ab0ac184 net: pass C string to res_nsearch, in case it stores the pointer
The current code passes a Go pointer to a NUL-terminated C string
to the C function res_nsearch (or res_search), but that function may
in turn store the pointer into the res_state, which is a violation of the
cgo pointer rules and is being detected on the linux-amd64-wsl builder.

Allocating the string in C memory is safer and should resolve
the cgo pointer check. When using libc/syscall mode, the memory
is still allocated Go-side, which could potentially be a problem
if we ever add a moving collector. For now it is OK.

Fixes #56658.

Change-Id: Ibd84a9665be16c71994ddb1eedf09d45a6553a3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/448795
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Bypass: Russ Cox <rsc@golang.org>
2022-11-08 20:59:36 +00:00
Damien Neil
a6642e67e1 net/textproto: reject invalid header keys/values in ReadMIMEHeader
Return an error when parsing a MIME header containing bytes in the
key or value outside the set allowed by RFC 7230.

For historical compatibility, accept spaces in keys (but do not
canonicalize the key in this case).

For #53188.

Change-Id: I195319362a2fc69c4e506644f78c5026db070379
Reviewed-on: https://go-review.googlesource.com/c/go/+/410714
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
2022-11-08 20:36:15 +00:00
qmuntal
41be62e168 cmd/go: fix svn vctest on Windows and make them timezone agnostic
This CL updates svn vctest so they work on Windows.

Side effect is that svn logs are no longer timezone dependant, as this
updated the `svn log` command to format logs using XML, which contain
UTC dates instead of local dates. Therefore it supersedes
https://go-review.googlesource.com/c/go/+/447795.

Fixes #56555
Fixes #56527

Change-Id: I5a654fd0a0f741e0a8a6ca7021ad699c07b974d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/447935
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
2022-11-08 19:37:03 +00:00
Cherry Mui
4b43b74171 cmd/go: add -pgo build flag
Add a -pgo flag for "go build" (and other build actions), to
specify the file path of a profile used for PGO. Special name
"off" turns off PGO.

The given profile path is passed to the compiler.

The build cache is sensitive to the content of the given PGO
profile.

TODO: auto mode.

For #55022.

Change-Id: Ieee1b131b4c041f9502fd0a1acf112f3e44246be
Reviewed-on: https://go-review.googlesource.com/c/go/+/438736
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-11-08 18:50:59 +00:00
Michael Anthony Knyszek
41795528b0 runtime: smooth cons/mark with a moving average and use actual trigger
This change modifies the pacer in two ways:
* It replaces the PI controller used as a smoothing function with a
  simple two-cycle moving average.
* It makes the pacer use the actual GC trigger point for cons/mark (and
  other) calculations instead of the precomputed one.

The second part of this change was attempted in the Go 1.19 release
cycle, but could not be done because although it resulted in a
better-behaved pacer, it exploited the PI controller's sensitivity to
history in a way that was ultimately unfavorable for most applications.

This sensitivity is complex to reason about, and forces us into choices
that don't really make sense (like using the precomputed trigger over
the actual one -- that's really a bug fix).

The net effect of this change is intended to be:
* The pacer computes a more stable estimate of the actual cons/mark
  ratio, making it easier to understand.
* The pacer is much more accurate at hitting the heap goal, so the GC
  respects GOGC much more often and reliably.
* The pacer forces a more stable rate of GC assists in the
  steady-state overall.

See https://perf.golang.org/search?q=upload:20221106.10 for benchmark
results and #53892 for complete context. The benchmarks that regress
in memory use appear to be not worth worrying about. In all cases, it appears that the GC was triggering super early, resulting in a lack
of adherence to rule of GOGC.

The fogleman benchmarks just have a single final GC that triggers
early and also happens to be the peak heap size. The tile38
WithinCircle benchmark only has 4 GC cycles in the benchmarked region,
so it's very sensitive to pacing. In this case, the old smoothing
function is getting lucky by starting way too early, avoiding assists. Meanwhile the 2-cycle moving average is more accurate on the heap
goal, but the 1st and 2nd cycle after the initialization phase are operating on a cons/mark from the initialization phase which is much
less active, resulting in a cons/mark that's too low, causing the GC
to start too late, increasing assists, and therefore latency (but
only transiently, at this phase change). I really do think the PI
controller is just getting lucky here with a particular history,
because I've definitely observed it oscillating wildly in response to
a phase change.

This change also moves the PI controller out of mgcpacer.go, because
it's no longer used there. It now lives in mgcscavenge.go, where it's
actually used.

Fixes #53892.

Change-Id: I3f875a2e40f31f381920f91d8b090556b17a2b16
Reviewed-on: https://go-review.googlesource.com/c/go/+/417558
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-08 18:45:45 +00:00
Tobias Klauser
26b2c9a620 reflect: use unsafe.String in name.name and name.tag
Change-Id: I9f54f1463b0682d0d76cd57e5fef318565883a87
Reviewed-on: https://go-review.googlesource.com/c/go/+/448675
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-11-08 18:33:21 +00:00
Cherry Mui
e5d2814576 cmd/compile: adjust PGO debug output slightly
- Include the callee names in hot call inlining message.
- Print the graph when pgoinline >= 2.

Change-Id: Iceb89b5f18cefc69ab9256aca9a910743d22ec0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/448496
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-11-08 18:10:43 +00:00
Cherry Mui
efe541d4e5 cmd/compile/internal/pgo: allow and ignore profiles with no sample
Passing a profile with no sample is arguably not a user error.
Accept such a profile, and ignore it as it doesn't indicate any
optimizations. This also makes testing easier.

Change-Id: Iae49a4260e20757419643153f50d8d5d51478411
Reviewed-on: https://go-review.googlesource.com/c/go/+/448495
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-11-08 18:10:34 +00:00
Cherry Mui
0409314db3 cmd/compile: fix PGO line offset matching
Appears to be a typo in CL 447315.

Change-Id: I9f380a3c7521f5ac5a1d7e271eaa60bd4bbcfb29
Reviewed-on: https://go-review.googlesource.com/c/go/+/448515
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-11-08 16:35:09 +00:00
Russ Cox
6939659a08 net: unify CNAME handling across ports
Unix and Windows differ in how they handle LookupCNAME(name).

If name exists in DNS with an A or AAAA record but no CNAME,
then on all operating systems and in the pure Go resolver,
LookupCNAME returns the name associated with the A/AAAA record
(the original name).

TestLookupCNAME has been testing this, because www.google.com
has no CNAME. I think it did at one point, but not anymore, and the
tests are still passing. Also added google.com as a test, since
top-level domains are disallowed from having CNAMEs.

If name exists in DNS with a CNAME record pointing to a record that
does not exist or that has no A or AAAA record,
then Windows has always reported the CNAME value,
but Unix-based systems and the pure Go resolver have reported
a failure instead. cname-to-txt.go4.org is an test record that is
a CNAME to a non-A/AAAA target (the target only has a TXT record).

This CL changes the Unix-based systems and the pure Go resolver
to match the Windows behavior, allowing LookupCNAME to succeed
whenever a CNAME exists.

TestLookupCNAME nows tests the new behavior by looking up
cname-to-txt.go4.org (run by bradfitz).

Fixes #50101.

Change-Id: Ieff5026c8535760e6313c7a41ebd5ff24de6d9be
Reviewed-on: https://go-review.googlesource.com/c/go/+/446179
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-11-08 14:54:25 +00:00
Russ Cox
a1c31d6803 cmd/go: replace Action.Func with Action.Actor
The interface will let us store actor-specific state in the
interface implementation instead of continuing to grow
the Action struct. In the long term we should remove fields
from the struct that are not used by all Actions.

Change-Id: I8ac89eda7a91d742cee547a1f779e9f254dfd2f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/448356
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2022-11-08 14:52:52 +00:00
Tobias Klauser
be3184c405 internal/coverage/slicereader: use unsafe.String
Change-Id: Ifd88315626e0ce5b9b8d3c66aa9dd9806f8407dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/448555
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
Auto-Submit: Than McIntosh <thanm@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-11-08 14:15:17 +00:00
Sameer Ajmani
5b42f89e39 context: add APIs for writing and reading cancelation cause
Extend the context package to allow users to specify why a context was
canceled in the form of an error, the "cause". Users write the cause
by calling WithCancelCause to construct a derived context, then
calling cancel(cause) to cancel the context with the provided cause.
Users retrieve the cause by calling context.Cause(ctx), which returns
the cause of the first cancelation for ctx or any of its parents.

The cause is implemented as a field of cancelCtx, since only cancelCtx
can be canceled. Calling cancel copies the cause to all derived (child)
cancelCtxs. Calling Cause(ctx) finds the nearest parent cancelCtx by
looking up the context value keyed by cancelCtxKey.

API changes:
+pkg context, func Cause(Context) error
+pkg context, func WithCancelCause(Context) (Context, CancelCauseFunc)
+pkg context, type CancelCauseFunc func(error)

Fixes #26356
Fixes #51365

Change-Id: I15b62bd454c014db3f4f1498b35204451509e641
Reviewed-on: https://go-review.googlesource.com/c/go/+/375977
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Sameer Ajmani <sameer@golang.org>
Auto-Submit: Sameer Ajmani <sameer@golang.org>
2022-11-08 13:51:16 +00:00
mantuliu
0b7aa9fa5b cmd/asm: optimize if statement to return directly
Change-Id: Iddf4d3bcc3bc2badf0d0f6b06375c901e76a40bb
GitHub-Last-Rev: 95586bfc16
GitHub-Pull-Request: golang/go#56268
Reviewed-on: https://go-review.googlesource.com/c/go/+/443315
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-11-08 08:14:37 +00:00
Eric Lagergren
9860faa512 math/big: remove underscores from Binomial docs
Change-Id: I7605bcbbaa64bb4273ad458a157b1c6011467973
Reviewed-on: https://go-review.googlesource.com/c/go/+/447915
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-08 05:24:43 +00:00
tk
e6f662d7b0 net/http: remove redundant code
Remove redundant code at line 365, `oldCtx := req.Context()`,  because it's the same as line 349.

Change-Id: I9b028e8c8740c22945708b143e4e86a0baa40f64
GitHub-Last-Rev: 4ad0f3871b
GitHub-Pull-Request: golang/go#54925
Reviewed-on: https://go-review.googlesource.com/c/go/+/428977
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
2022-11-08 03:06:55 +00:00
Tobias Klauser
dc98ccd836 net/netip: use slice-to-array conversions
Resend of CL 432735 (with one additional conversion that the original CL
missed) after it broke the longtest builder on x/tools and was reverted
in CL 433478. Now that x/tools/go/ssa has support for this, the longtest
x/tools build passes as well.

Use slice-to-array conversions in AddrFromSlice and
(*Addr).UnmarshalBinary. This allows using AddrFrom16 and drop the
redundant ipv6Slice helper.

For #46505

Change-Id: I4d8084b7a97f162e4f7d685c86aac56d960ff693
Reviewed-on: https://go-review.googlesource.com/c/go/+/448396
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-11-08 03:03:40 +00:00
Tobias Klauser
b417f62b00 net/netip: remove unused unexported functions and methods
Change-Id: I71774ad0197ce654dc56c2fa2fa12f1e6696382e
Reviewed-on: https://go-review.googlesource.com/c/go/+/448395
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-11-07 21:28:44 +00:00
Mateusz Poliwczak
6bead8f77a sync/atomic: disallow type conversions of atomic.Pointer[T]
Fixes #56603

Change-Id: I6af9d80201025ae4028bfaa4a62e5de9ac0c501d
GitHub-Last-Rev: e6ed5e1451
GitHub-Pull-Request: golang/go#56604
Reviewed-on: https://go-review.googlesource.com/c/go/+/448275
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-11-07 21:25:12 +00:00
David Chase
f3d656be50 cmd/compile: let compiler downgrade its own concurrency
This gets the Go command out of the business of thinking it understands
compiler debug flags, and allows the compiler to turn down its worker
concurrency instead of failing and forcing the user to do the very
same thing.  Debug flags that are obviously safe for concurrency
(at least to me) are tagged; probably there's more.

Change-Id: I59bb19861d8a654a9cfd2364ee78c8628212f82e
Reviewed-on: https://go-review.googlesource.com/c/go/+/448359
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-07 21:17:27 +00:00
Dmitry Alimov
4538f30e2d cmd/covdata: fix wrong struct name in the comment
Invalid struct name in the comment in merge.go
dstate -> mstate
dstate already exists and is in cmd/covdata/dump.go

Change-Id: Id8b2412d2f81ae8afa1e9df3d09c218d84818ffb
GitHub-Last-Rev: 898eda4a20
GitHub-Pull-Request: golang/go#56631
Reviewed-on: https://go-review.googlesource.com/c/go/+/448475
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-07 21:17:20 +00:00
Austin Clements
42105eb8a5 misc/cgo/test: skip Test9400 on Alpine
Alpine has a known issue where setgid clobbers the Go stack (#39857).
misc/cgo/test skips other tests that use setgid on Alpine, but not
this one. It's not clear to me why this test *used to* pass, but when
I refactored misc/cgo/test in CL 447355 it started failing.

Disable this test on Alpine, like the other setgid tests.

Change-Id: I2e646ef55e2201a4f0b377319d719a011ec847f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/448355
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-11-07 21:15:29 +00:00
Dan Peterson
e7422b0591 net: adjust build tags for darwin libc calls
Support for direct libc calls was added in CL 446178 but the build
tags weren't quite activating it when cgo was not enabled. Adjust them
and add a new supporting file for darwin.

This should use the new direct libc calls with both CGO_ENABLED=0 and
CGO_ENABLED=1 when building for darwin.

Updates #12524

Change-Id: Ieee4b298dee13f389ed3a63c0a4a3a18c9180163
Reviewed-on: https://go-review.googlesource.com/c/go/+/448020
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Dan Peterson <danp@danp.net>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-11-07 21:05:53 +00:00
cui fliter
969bea8d59 runtime: fix a few function names on comments
Change-Id: I9ef4898d68dfd06618c0bd8e23f81a1d2c77a836
Signed-off-by: cui fliter <imcusg@gmail.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/447460
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
2022-11-07 19:48:30 +00:00
Roland Shoemaker
72ce9ba9cb crypto/tls: use certificate cache in client
In verifyServerCertificate parse certificates using the global
certificate cache.

This should signficiantly reduce memory usage in TLS clients which make
concurrent connections which reuse certificates (anywhere in the chain)
since there will only ever be one copy of the certificate at once.

Fixes #46035

Change-Id: Icf5153d0ea3c14a0bdc8b26c794f21153bf95f85
Reviewed-on: https://go-review.googlesource.com/c/go/+/426455
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2022-11-07 19:47:10 +00:00
cui fliter
601ad2e457 math: fix function name in comment
Change-Id: Iabf955cdb161d02cb4a3e06f466b331e1b6eb2c2
Signed-off-by: cui fliter <imcusg@gmail.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/447456
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-11-07 19:46:45 +00:00
Roland Shoemaker
81ed1354e8 crypto/tls: add a certificate cache implementation
Adds a BoringSSL CRYPTO_BUFFER_POOL style reference counted intern
table for x509.Certificates. This can be used to significantly reduce
the amount of memory used by TLS clients when certificates are reused
across connections.

Updates #46035

Change-Id: I8d7af3bc659a93c5d524990d14e5254212ae70f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/426454
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-07 19:46:27 +00:00
Archana R
92c7df116e internal/bytealg: add PCALIGN to indexbodyp9 function on ppc64x
Adding PCALIGN in indexbodyp9 function shows
improvements in some SimonWaldherr benchmarks and one of the index
benchmarks on both Power9 and Power10

name              old time/op  new time/op  delta
Contains          19.8ns ± 0%  15.6ns ± 0%  -21.24%
ContainsNot       21.3ns ± 0%  18.9ns ± 0%  -11.03%
ContainsBytes     19.1ns ± 0%  16.0ns ± 0%  -16.54%
Index/10     17.3ns ± 0%    16.1ns ± 0%  -7.30%
Index/32     59.6ns ± 0%    59.6ns ± 0%  +0.12%
Index/4K     3.68µs ± 0%    3.68µs ± 0%    ~
Index/4M     3.74ms ± 0%    3.74ms ± 0%  -0.00%
Index/64M    59.8ms ± 0%    59.8ms ± 0%    ~

Change-Id: I784e57e0b0f5bac143f57f3a32845219e43d47fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/447595
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-07 19:27:43 +00:00
Michael Pratt
d2b5a6f332 cmd/trace: only include required frames in splits
Though we split traces into 100MB chunks, currently each chunk always
includes the entire stack frame map, including frames for all events in
the trace file, even if they aren't needed by events in this chunk.

This means that if the stack frame JSON alone is >100MB then there is no
space at all for events. In that case, we'll generate splits each
containing 1 event, which is effectively useless.

Handle this more efficiently by only including stack frames referenced
by events in the chunk. Each marginal events only adds at most a few
dozen stack frames, so it should now longer be possible to only include
a tiny number of events.

Fixes #56444.

Change-Id: I58aa8f271c32678028b72d82df16e6ea762ebb39
Reviewed-on: https://go-review.googlesource.com/c/go/+/445895
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-07 17:58:30 +00:00
Michael Pratt
50664c236f runtime: yield in goschedIfBusy if gp.preempt
runtime.bgsweep contains an infinite loop. With aggressive enough
inlining, it may not perform any CALLs on a typical iteration. If
the runtime trying to preempt this goroutine, the lack of CALLs may
prevent preemption for ever occurring.

bgsweep does happen to call goschedIfBusy. Add a preempt check there to
make sure we yield eventually.

For #55022.

Change-Id: If22eb86fd6a626094b3c56dc745c8e4243b0fb40
Reviewed-on: https://go-review.googlesource.com/c/go/+/447135
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-11-07 17:19:18 +00:00
Michael Matloob
82c6967ada doc: add a release note for fewer pre-compiled GOROOT .a files
For #47257

Change-Id: I3837220d02741da92d723484c82d11e82c92151a
Reviewed-on: https://go-review.googlesource.com/c/go/+/448017
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-11-07 15:51:10 +00:00
Paul E. Murphy
390abbbbf1 codegen: check for PPC64 ISEL in condmove tests
ISEL is roughly equivalent to CMOV on PPC64. Verify ISEL generation
in all reasonable cases.

Note "ISEL test x y z" is the same as "ISEL !test y x z". test is
always one of LT (0), GT (1), EQ (2), SO (3). Sometimes x and y are
swapped if GE/LE/NE is desired.

Change-Id: Ie1bf029224064e004d855099731fe5e8d05aa990
Reviewed-on: https://go-review.googlesource.com/c/go/+/445215
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-11-07 15:19:20 +00:00
Felix Geisendörfer
8ec1c9e285 testing: Document RunParallel ns/op behavior
Updates #31884

Change-Id: Ibad3d31038a8426c0bce61c1726392880f934865
Reviewed-on: https://go-review.googlesource.com/c/go/+/447136
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-07 10:44:33 +00:00
Yasuhiro Matsumoto
a9767ea59d cmd/vet: remove unused const
Change-Id: I1f713bbb35917ab50b0cde24a81340aa16c2ed03
Reviewed-on: https://go-review.googlesource.com/c/go/+/448195
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-07 10:42:25 +00:00
Dan Kortschak
1c05968c9a all: fix comment typos
Change-Id: Ic16824482142d4de4d0b949459e36505ee944ff7
Reviewed-on: https://go-review.googlesource.com/c/go/+/448175
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Dan Kortschak <dan@kortschak.io>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dan Kortschak <dan@kortschak.io>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-11-05 21:02:45 +00:00
Ian Lance Taylor
a343f4017b reflect: rewrite value.Equal to avoid allocations
For #46746

Change-Id: I75ddb9ce24cd3394186562dae156fef9fe2d55d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/447798
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-04 23:20:35 +00:00
cui fliter
a74985092c all: fix function names in comments
Change-Id: I871a747b4b47bccc889f2fdc93a2bcebb041b719
Reviewed-on: https://go-review.googlesource.com/c/go/+/447895
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-11-04 22:36:12 +00:00