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

53586 Commits

Author SHA1 Message Date
Cuong Manh Le
a2af095699 runtime: run "gofmt -s -w"
Change-Id: I7eb3de35d1f1f0237962735450b37d738966f30c
Reviewed-on: https://go-review.googlesource.com/c/go/+/423254
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-08-12 15:45:17 +00:00
Andy Pan
f67c766069 cmd/internal/obj/ppc64: eliminate dead code from asm9.go
Change-Id: Ie59703ea7315a3f8efa1f543a8ca0afecff014d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/421754
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Paul Murphy <murp@ibm.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-08-12 12:26:45 +00:00
Michael Pratt
8cb350d69a runtime: synchronize P wakeup and dropping Ps
CL 310850 dropped work re-checks on non-spinning Ms to fix #43997.

This introduced a new race condition: a non-spinning M may drop its P
and then park at the same time a spinning M attempts to wake a P to
handle some new work. The spinning M fails to find an idle P (because
the non-spinning M hasn't quite made its P idle yet), and does nothing
assuming that the system is fully loaded. This results in loss of work
conservation. In the worst case we could have a complete deadlock if
injectglist fails to wake anything just as all Ps are going idle.

sched.needspinning adds new synchronization to cover this case. If work
submission fails to find a P, it sets needspinning to indicate that a
spinning M is required. When non-spinning Ms prepare to drop their P,
they check needspinning and abort going idle to become a spinning M
instead. This addresses the race without extra spurious wakeups. In the
normal (non-racing case), an M will become spinning via the normal path
and clear the flag.

injectglist must change in addition to wakep because it is a similar
form of work submission, notably used following netpoll at a point when
we might not have a P that would guarantee the work runs.

Fixes #45867

Change-Id: Ieb623a6d4162fb8c2be7b4ff8acdebcc3a0d69a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/389014
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2022-08-12 03:22:59 +00:00
Michael Pratt
54cf1b107d runtime: convert prof.hz to atomic type
This converts several unsynchronized reads (reads without holding
prof.signalLock) into atomic reads.

For #53821.
For #52912.

Change-Id: I421b96a22fbe26d699bcc21010c8a9e0f4efc276
Reviewed-on: https://go-review.googlesource.com/c/go/+/420196
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-12 01:53:44 +00:00
Michael Pratt
3121c2bf64 runtime: convert prof.signalLock to atomic type
For #53821.

Change-Id: I3e757fc6a020be10ee69459c395cb7eee49b0dfb
Reviewed-on: https://go-review.googlesource.com/c/go/+/420195
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
2022-08-12 01:53:29 +00:00
Michael Pratt
b04e4637db runtime: convert timeHistogram to atomic types
I've dropped the note that sched.timeToRun is protected by sched.lock,
as it does not seem to be true.

For #53821.

Change-Id: I03f8dc6ca0bcd4ccf3ec113010a0aa39c6f7d6ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/419449
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
2022-08-12 01:53:11 +00:00
Michael Pratt
09cc9bac72 runtime: convert schedt.sysmonwait to atomic type
This converts a few unsynchronized accesses.

For #53821.

Change-Id: Ie2728779111e3e042696f15648981c5d5a86ca6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/419448
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2022-08-12 01:52:46 +00:00
Michael Pratt
88ef50e662 runtime: convert schedt.gcwaiting to atomic type
Note that this replaces numerous unsynchronized loads throughout the
scheduler.

For #53821.

Change-Id: Ica80b04c9e8c184bfef186e549526fc3f117c387
Reviewed-on: https://go-review.googlesource.com/c/go/+/419447
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-12 01:52:29 +00:00
Michael Pratt
1eeef5d5b4 runtime: convert schedt.nmspinning to atomic type
Note that this converts nmspinning from uint32 to int32 for consistency
with the other count fields in schedt.

For #53821.

Change-Id: Ia6ca7a2b476128eda3b68e9f0c7775ae66c0c744
Reviewed-on: https://go-review.googlesource.com/c/go/+/419446
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
2022-08-12 01:52:18 +00:00
Michael Pratt
58a1dabfd1 runtime: convert schedt.npidle to atomic type
Note that this converts npidle from uint32 to int32 for consistency with
the other count fields in schedt and the type of p.id.

Note that this changes previously unsynchronized operations to
synchronized operations in:
  * handoffp
  * injectglist
  * schedtrace
  * schedEnableUser
  * sync_runtime_canSpin

For #53821.

Change-Id: I36d1b3b4a28131c9d47884fade6bc44439dd6937
Reviewed-on: https://go-review.googlesource.com/c/go/+/419445
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
2022-08-12 01:52:06 +00:00
Michael Pratt
449691b3ef runtime: convert schedt.ngsys to atomic type
Note that this converts ngsys from uint32 to int32 to match the other
(non-atomic) counters.

For #53821.

Change-Id: I3acbfbbd1dabc59b0ea5ddc86a97e0d0afa9f80c
Reviewed-on: https://go-review.googlesource.com/c/go/+/419444
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2022-08-12 01:51:51 +00:00
Michael Pratt
0fc774a68f runtime: convert schedt.pollUntil to atomic type
Note that this converts pollUntil from uint64 to int64, the type used by
nanotime().

For #53821.

Change-Id: Iec9ec7e09d3350552561d0708ba6ea9e8a8ae7ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/419443
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-12 01:49:13 +00:00
Michael Pratt
5d7d50111f runtime: convert schedt.lastpoll to atomic type
Note that this changes the type from uint64 to int64, the type used by
nanotime(). It also adds an atomic load in pollWork(), which used to use
a non-atomic load.

For #53821.

Change-Id: I6173c90f20bfdc0e0a4bc3a7b1c798d1c429fff5
Reviewed-on: https://go-review.googlesource.com/c/go/+/419442
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-12 01:49:02 +00:00
Michael Pratt
98e1648823 runtime: print irrelevant IDs as nil in schedtrace
We currently print these as -1, but some are technically uint64. We can
be more explicit about their irrelevance by printing 'nil' rather than
-1.

Change-Id: I267fd8830564c75032bfe9176af59047f5a90202
Reviewed-on: https://go-review.googlesource.com/c/go/+/419441
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
2022-08-12 01:39:40 +00:00
Michael Pratt
dd8cb66d0b runtime: convert g.goid to uint64
schedt.goidgen and p.goidcache are already uint64, this makes all cases
consistent.

The only oddball here is schedtrace which prints -1 as an equivalent for
N/A or nil. A future CL will make this more explicit.

Change-Id: I489626f3232799f6ca333d0d103b71d9d3aa7494
Reviewed-on: https://go-review.googlesource.com/c/go/+/419440
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-12 01:39:28 +00:00
Michael Pratt
b464708b46 runtime: convert schedt.goidgen to atomic type
For #53821.

Change-Id: I84c96ade5982b8e68d1d1787bf1bfa16a17a4fb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/419439
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-12 01:39:14 +00:00
Michael Pratt
bd302502d3 runtime: convert panicking to atomic type
For #53821.

Change-Id: I93409f377881a3c029b41b0f1fbcef5e21091f2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/419438
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-12 01:38:55 +00:00
Michael Pratt
7666ec1c99 runtime: convert runningPanicDefers to atomic type
For #53821.

Change-Id: Ib48a1f2ff85d667c86dbd0b7662efab5a0abd837
Reviewed-on: https://go-review.googlesource.com/c/go/+/419437
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2022-08-12 01:38:41 +00:00
Michael Pratt
40fa2dabe0 runtime: convert pendingPreemptSignals to atomic type
For #53821.

Change-Id: I106adbcb00b7b887d54001c2d7d97345a13cc662
Reviewed-on: https://go-review.googlesource.com/c/go/+/419436
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
2022-08-12 01:31:57 +00:00
Filippo Valsorda
a5cd894318 crypto/ecdh,crypto/internal/nistec: enable pruning of unused curves
If a program only uses ecdh.P256(), the implementation of the other
curves shouldn't end up in the binary. This mostly required moving some
operations from init() time. Small performance hit in uncompressed
Bytes/SetBytes, but not big enough to show up in higher-level
benchmarks. If it becomes a problem, we can fix it by pregenerating the
p-1 bytes representation in generate.go.

For #52182
Updates #52221

Change-Id: I64460973b59ee3df787d7e967a6c2bcbc114ba65
Reviewed-on: https://go-review.googlesource.com/c/go/+/402555
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Fernando Lobato Meeser <felobato@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
2022-08-12 00:04:29 +00:00
Filippo Valsorda
d88d91e32e crypto/ecdh: new package
We use crypto/internal/edwards25519/field to implement X25519 directly,
so that golang.org/x/crypto/curve25519 can be dropped from the src
module dependencies, and eventually replaced with a crypto/ecdh wrapper,
removing the need to keep golang.org/x/crypto/curve25519/internal/field
in sync with crypto/internal/edwards25519/field.

In crypto/internal/nistec, we add BytesX to serialize only the x
coordinate, which we'll need for the horrible ECDSA x-coord-to-scalar
operation, too.

In crypto/tls, we replace the ECDHE implementation with crypto/ecdh,
dropping the X25519 special cases and related scaffolding.

Finally, FINALLY, we deprecate the ~white whale~ big.Int-based APIs of
the crypto/elliptic package.   •_•)   ( •_•)>⌐■-■   (⌐■_■)

Fixes #52182
Fixes #34648
Fixes #52221

Change-Id: Iccdda210319cc892e96bb28a0e7b7123551982c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/398914
Reviewed-by: Fernando Lobato Meeser <felobato@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-12 00:03:39 +00:00
David Chase
0b79abc27e cmd/compile: avoid copying Pos from ONAME when creating converts for maps
ONAME nodes are shared, so using their position for anything is almost
always a mistake.  There are probably more instances of this mistake
elsewhere.  For now, handle the case of map key temporaries, where it's
been a problem.

Fixes #53456.

Change-Id: Id44e845d08d428592ad3ba31986635b6b87b0041
Reviewed-on: https://go-review.googlesource.com/c/go/+/417076
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-11 21:21:49 +00:00
Ian Lance Taylor
7367aedfd2 debug/elf: use saferio to read section data
For #47653
Fixes #45599
Fixes #52522

Change-Id: Id6a80186434080cb0a205978ad7f224252674604
Reviewed-on: https://go-review.googlesource.com/c/go/+/408679
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-08-11 20:34:03 +00:00
Austin Clements
502b6057d2 runtime: add mayAcquire annotation for trace.lock
Now that we've moved the trace locks to the leaf of the lock graph, we
can safely annotate that any trace event may acquire trace.lock even
if dynamically it turns out a particular event doesn't need to flush
and acquire this lock.

This reveals a new edge where we can trace while holding the mheap
lock, so we add this to the lock graph.

For #53789.
Updates #53979.

Change-Id: I13e2f6cd1b621cca4bed0cc13ef12e64d05c89a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/418720
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-11 20:16:37 +00:00
Austin Clements
cc8bac8835 runtime: move trace locks to the leaf of the lock graph
Now that trace.lock cannot be held over a stack split, we can move
that lock and traceStackTab to the leaf of the lock graph. We add a
couple edges to STACKGROW that were previously passing through trace.

Fixes #53979.

Change-Id: Ie664ff7bb33973745f991f7516dc6106e60f5892
Reviewed-on: https://go-review.googlesource.com/c/go/+/418957
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-11 20:16:36 +00:00
Austin Clements
6c2e327e35 runtime: only acquire trace.lock on the system stack
Currently, trace.lock can be acquired while on a user G and stack
splits can happen while holding trace.lock. That means every lock used
by the stack allocator must be okay to acquire while holding
trace.lock, including various locks related to span allocation. In
turn, we cannot safely emit trace events while holding any
allocation-related locks because this would cause a cycle in the lock
rank graph.

To fix this, require that trace.lock only be acquired on the system
stack, like mheap.lock. This pushes it into the "bottom half" and
eliminates the lock rank relationship between tracing and stack
allocation, making it safe to emit trace events in many more places.

One subtlety is that the trace code has race annotations and uses
maps, which have race annotations. By default, we can't have race
annotations on the system stack, so we borrow the user race context
for these situations.

We'll update the lock graph itself in the next CL.

For #53979. This CL technically fixes the problem, but the lock rank
checker doesn't know that yet.

Change-Id: I9f5187a9c52a67bee4f7064db124b1ad53e5178f
Reviewed-on: https://go-review.googlesource.com/c/go/+/418956
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-11 20:16:35 +00:00
Austin Clements
9923162f1c runtime: don't use trace.lock for trace reader parking
We're about to require that all uses of trace.lock be on the system
stack. That's mostly easy, except that it's involving parking the
trace reader. Fix this by changing that parking protocol so it instead
synchronizes through an atomic.

For #53979.

Change-Id: Icd6db8678dd01094029d7ad1c612029f571b4cbb
Reviewed-on: https://go-review.googlesource.com/c/go/+/418955
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-11 20:16:33 +00:00
Austin Clements
b648591b70 runtime: simplify trace buffer management around footer
Writing out the trace footer currently manages trace buffers
differently from the rest of trace code. Rearrange it so it looks like
the rest of the code. In particular, we now write the frequency event
out to the trace buffer rather than returning it in a special byte
slice, and (*traceStackTable).dump threads a traceBufPtr like most
other functions that write to the trace buffers.

Change-Id: I3d0e108e56df884e7bd19823310dfbc0e21af9a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/422974
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-11 20:16:32 +00:00
Austin Clements
0293a1f308 runtime: avoid large object stack copy in traceStackTable.dump
Following up on the previous CL, this CL removes a unnecessary stack
copy of a large object in a range loop. This drops another 64 KiB from
(*traceStackTable).dump's stack frame so it is now roughly 80 bytes
depending on architecture, which will easily fit on the system stack.

For #53979.

Change-Id: I16f642f6f1982d0ed0a62371bf2e19379e5870eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/422955
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
2022-08-11 20:16:31 +00:00
Austin Clements
d4a3466519 runtime: write trace stack tab directly to trace buffer
Currently, the stack frame of (*traceStackTable).dump is 68KiB. We're
about to move (*traceStackTable).dump to the system stack, where we
often don't have this much room.

5140 bytes of this is an on-stack temporary buffer for constructing
potentially large trace events before copying these out to the actual
trace buffer.

Reduce the stack frame size by writing these events directly to the
trace buffer rather than temporary space. This introduces a couple
complications:

- The trace event starts with a varint encoding the event payload's
  length in bytes. These events are large and somewhat complicated, so
  it's hard to know the size ahead of time. That's not a problem with
  the temporary buffer because we can just construct the event and see
  how long it is. In order to support writing directly to the trace
  buffer, we reserve enough bytes for a maximum size varint and add
  support for populating a reserved space after the fact.

- Emitting a stack event calls traceFrameForPC, which can itself emit
  string events. If these were emitted in the middle of the stack
  event, it would corrupt the stream. We already allocate a []Frame to
  convert the PC slice to frames, and then convert each Frame into a
  traceFrame with trace string IDs, so we address this by combining
  these two steps into one so that all trace string events are emitted
  before we start constructing the stack event.

For #53979.

Change-Id: Ie60704be95199559c426b551f8e119b14e06ddac
Reviewed-on: https://go-review.googlesource.com/c/go/+/422954
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-11 20:16:29 +00:00
Matthew Dempsky
db84f5315f cmd/compile/internal/noder: fix implicit conversion position
In go.dev/cl/413396, I implemented implicit conversions by setting the
conversion's position to the enclosing statement that necessitated the
conversion. However, users actually want the position information to
be at the expression itself, and this seems sensible anyway.

This was noticed because x/tools had a test for:

	fmt.Println(42)

and it was checking where the escape analysis diagnostic for
`42` (really `any(42)`) was reported.

Historically, we reported the column of the `4`; but CL 413396 caused
unified IR to instead report the column of the `(` instead (the
position associated with the call expression, which forced `42` to be
implicitly converted from `int` to `any`).

I chalk this mistake up to being accustomed to working with ir, where
we can't reliably use n.Pos() because of how ONAME positions work, so
I was trying to avoid relying on the implicitly converted expression's
own position.

Change-Id: I762076af6f65ebe6d444d64630722a5016dc2698
Reviewed-on: https://go-review.googlesource.com/c/go/+/422976
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-11 20:13:14 +00:00
Matthew Dempsky
8743198152 test: make issue54343.go robust against the tiny allocator
I structured the test for issue54343.go after issue46725.go, where I
was careful to use `[4]int`, which is a type large enough to avoid the
tiny object allocator (which interferes with finalizer semantics). But
in that test, I didn't note the importance of that type, so I
mistakenly used just `int` in issue54343.go.

This CL switches issue54343.go to use `[4]int` too, and then adds
comments to both pointing out the significance of this type.

Updates #54343.

Change-Id: I699b3e64b844ff6d8438bbcb4d1935615a6d8cc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/423115
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
2022-08-11 20:13:07 +00:00
Ian Lance Taylor
141f15303d internal/saferio: new package to avoid OOM
Broken out of debug/pe. Update debug/pe to use it.

For #47653

Change-Id: Ib3037ee04073e005c4b435d0128b8437a075b00a
Reviewed-on: https://go-review.googlesource.com/c/go/+/408678
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dan Kortschak <dan@kortschak.io>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-08-11 20:05:25 +00:00
Dmitri Shuralyov
527565b1f1 lib/time, time/tzdata: update to 2022b
Version 2022b was released on 2022-08-10 and we can start using it.
Its release announcement was
https://mm.icann.org/pipermail/tz-announce/2022-August/000071.html.

For #22487.

Change-Id: I0ec68968d82561da566f945608bfacb3c8b0e958
Reviewed-on: https://go-review.googlesource.com/c/go/+/422875
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-11 20:03:19 +00:00
Matthew Dempsky
72a857a280 test: relax fixedbugs/issue20250.go expectations
With GOEXPERIMENT=unified, the order variables are printed in "live at
entry to f.func1" is sensitive to whether regabi is enabled for some
reason. The order shouldn't matter to correctness, but it is odd.

For now, this CL just relaxes the test expectation order to unblock
enabling GOEXPERIMENT=unified by default. I've filed #54402 to
investigate further to confirm this a concern.

Updates #54402.

Change-Id: Iddfbb12c6cf7cc17b2aec8102b33761abd5f93ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/422975
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-08-11 20:03:02 +00:00
WANG Xuerui
0337fc7e0e debug/elf: add new-style LoongArch reloc types
LoongArch ELF psABI spec update:
https://github.com/loongson/LoongArch-Documentation/pull/57

Corresponding binutils implementation:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=6d13722a97cee3fd397e116bde3bcedbb1e220be
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=9801120721c3a702ce3bd50433ef920f92a83502

For #54222

Change-Id: I51e72294205847a69c01d741a3126248f7a7e41c
Reviewed-on: https://go-review.googlesource.com/c/go/+/420982
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
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: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
2022-08-11 19:32:40 +00:00
Cuong Manh Le
62654dfd4f cmd/compile: fix wrong typeparams for selector expr with embedded generic type
For selector expression "x.M" where "M" is a promoted method, irgen is using
the type of receiver "x" for determining the typeparams for instantiation.
However, because M is a promoted method, so its associated receiver is
not "x", but "x.T" where "T" is the embedded field of "x". That casues a
mismatch when converting non-shape types arguments.

Fixing it by using the actual receiver which has the method, instead of
using the base receiver.

Fixes #53982

Change-Id: I1836fc422d734df14e9e6664d4bd014503960bfc
Reviewed-on: https://go-review.googlesource.com/c/go/+/419294
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2022-08-11 19:05:54 +00:00
Mateusz Poliwczak
9e4638ad20 net: discard unrooted 254 byte names, not rooted ones
Fixes #54285

Change-Id: I20d4d6b9d0532d8a344582b99d446352ae94edcf
GitHub-Last-Rev: ad1337450c
GitHub-Pull-Request: golang/go#54293
Reviewed-on: https://go-review.googlesource.com/c/go/+/421674
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-08-11 18:25:36 +00:00
Daniel Martí
a526ec1569 go/printer: avoid copying bytes when counting node sizes
When making the recursive call to fprint,
we just need to know how many bytes were written
and whether multiple lines were written.

We don't need a buffer to accomplish those;
a custom writer can keep track of the two in a cheap way,
avoiding the allocation of a byte slice and copying bytes.

	name      old time/op    new time/op    delta
	Print-16    6.28ms ± 2%    6.12ms ± 1%  -2.50%  (p=0.000 n=10+9)

	name      old speed      new speed      delta
	Print-16  8.26MB/s ± 3%  8.47MB/s ± 1%  +2.56%  (p=0.000 n=10+9)

	name      old alloc/op   new alloc/op   delta
	Print-16     483kB ± 0%     443kB ± 0%  -8.20%  (p=0.000 n=10+10)

	name      old allocs/op  new allocs/op  delta
	Print-16     17.8k ± 0%     17.3k ± 0%  -2.31%  (p=0.000 n=9+10)

Change-Id: Ib8411ae6738a2acae6af6d185da71727ce2eb97a
Reviewed-on: https://go-review.googlesource.com/c/go/+/412555
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
2022-08-11 17:53:50 +00:00
Archana R
dfbecc06e7 misc/cgo/testsanitizers: fix code to detect gcc version correctly
The current implementation of compilerVersion incorrectly gives an
error message that the compiler version is too old even though the
system has a recent compiler. This happens for specifically for the
gcc compiler and causes ASAN tests to be skipped.
Replacing -v with gcc dump version options seems to fix it. Running
./testsanitizers.test -test.v now shows the ASAN tests being run.
--- PASS: TestASAN (16.81s)
    --- PASS: TestASAN/asan_useAfterReturn (0.60s)
    --- PASS: TestASAN/asan_global5 (0.61s)
    --- PASS: TestASAN/asan_unsafe_fail1 (0.73s)
    --- PASS: TestASAN/asan_unsafe_fail3 (0.73s)
    --- PASS: TestASAN/asan_unsafe_fail2 (0.74s)
    --- PASS: TestASAN/asan_global4_fail (0.74s)
    --- PASS: TestASAN/asan5_fail (0.74s)
    --- PASS: TestASAN/asan3_fail (0.88s)
    --- PASS: TestASAN/asan4_fail (0.89s)
    --- PASS: TestASAN/asan2_fail (0.99s)
    --- PASS: TestASAN/asan_global3_fail (1.00s)
    --- PASS: TestASAN/asan_global1_fail (1.01s)
    --- PASS: TestASAN/asan1_fail (1.01s)
    --- PASS: TestASAN/asan_global2_fail (1.02s)
PASS

Fixes #54370

Change-Id: Iac13a1cf37de54432a6e49555f61e9ec1d781ab8
Reviewed-on: https://go-review.googlesource.com/c/go/+/422574
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-08-11 17:23:33 +00:00
Amarjeet Anand
133c0e9011 time: optimize Format for RFC3339 and RFC3339Nano
Optimise Format for the most frequently used RFC3339
and RFC3339Nano layouts by avoiding parsing of layout.

> benchstat oldBench.txt newBench.txt
name                 old time/op    new time/op    delta
FormatRFC3339-8         302ns ± 1%     203ns ± 0%  -32.89%  (p=0.016 n=5+4)
FormatRFC3339Nano-8     337ns ± 1%     219ns ± 1%  -34.91%  (p=0.008 n=5+5)

name                 old alloc/op   new alloc/op   delta
FormatRFC3339-8         32.0B ± 0%     32.0B ± 0%     ~     (all equal)
FormatRFC3339Nano-8     32.0B ± 0%     32.0B ± 0%     ~     (all equal)

name                 old allocs/op  new allocs/op  delta
FormatRFC3339-8          1.00 ± 0%      1.00 ± 0%     ~     (all equal)
FormatRFC3339Nano-8      1.00 ± 0%      1.00 ± 0%     ~     (all equal)

Fixes #54093

Change-Id: Ifc84fce6078e24514ecbcd234875bca4aaab5e0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/421877
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
2022-08-11 17:14:08 +00:00
Joe Tsai
8298c545f3 reflect: fix stale Value.Pointer comment
The comment claims that reflect users cannot obtain an unsafe.Pointer
without also importing the unsafe package explicitly.
This is no longer true now that the Value.UnsafePointer method
directly returns an unsafe.Pointer.

Change-Id: Ia5bf2e8aead681c8fac5b011129954d075ae5a43
Reviewed-on: https://go-review.googlesource.com/c/go/+/404396
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-08-11 16:59:34 +00:00
Abirdcfly
f469f20e79 internal/pprof/profile: simplify variable use
Change-Id: I73b5d7602fccec00e68e4516f483f90163088ad1
GitHub-Last-Rev: 9366b89c47
GitHub-Pull-Request: golang/go#54083
Reviewed-on: https://go-review.googlesource.com/c/go/+/419635
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-08-11 16:28:37 +00:00
Cuong Manh Le
515040548c cmd/compile/internal/amd64: more robust detection of GOAMD64=v1
Using build tool tags instead of relying on GOAMD64 env, which can be
overriden at make.bash time.

Change-Id: I96bb4b7416ea0bd1ab552feec9ede45b89a584c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/422614
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-08-11 16:21:41 +00:00
Andy Pan
cc9584b54b runtime: eliminate a few usages of named return values in functions to make it consistent
Change-Id: Ia7d72b134a52627fd3c19a3c238fba8deb5e01c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/407534
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-08-11 16:20:20 +00:00
Jeremy Quirke
2340d37179 cmd/link: fix trampolines breaking DWARF line info
When trampolines are needed (e.g. Darwin ARM64), the DWARF LPT (Line
Program Table - see DWARF section 6.1) generation fails because the
replacement symbols are marked as external symbols and skipped during
the DWARF LPT generation phase.

Fixes #54320

Change-Id: I6c93f5378f50e5edf30d5121402a48214abb1ce2
GitHub-Last-Rev: 085bbc55db
GitHub-Pull-Request: golang/go#54321
Reviewed-on: https://go-review.googlesource.com/c/go/+/422154
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-11 14:11:53 +00:00
Ludi Rehak
a1337ef40c crypto/tls: change Conn.handshakeStatus type to atomic.Bool
Change the type of Conn.handshakeStatus from an atomically
accessed uint32 to an atomic.Bool. Change its name to
Conn.isHandshakeComplete to indicate it is a boolean value.
Eliminate the handshakeComplete() helper function, which checks
for equality with 1, in favor of the simpler
c.isHandshakeComplete.Load().

Change-Id: I084c83956fff266e2145847e8645372bef6ae9df
Reviewed-on: https://go-review.googlesource.com/c/go/+/422296
Auto-Submit: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
2022-08-11 13:58:45 +00:00
Matthew Dempsky
de95dca32f cmd/compile/internal/noder: explicit receiver expression handling
This CL adds a helper expression code for receiver addressing; i.e.,
the implicit addressing, dereferencing, and field selections involved
in changing the `x` in `x.M()` into an appropriate expression to pass
as an argument to the method.

Change-Id: I9be933e2a38c8f94f6a85d95b54f34164e5efb0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/421820
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2022-08-10 23:27:42 +00:00
Matthew Dempsky
29b07037b1 cmd/compile/internal/noder: prune unified IR's dictionary logic
Unified IR uses static dictionaries for some itabs and function/method
expressions, and they're roughly the right idea. But at the same time,
they're actually somewhat brittle and I need to reorganize some ideas
anyway to get shaped-based stenciling working. So this CL just rips
them out entirely.

Note: the code for emitting runtime dictionaries with *runtime._type
symbols is still present, and continues to demonstrate that basic
runtime dictionary handling is working.

Change-Id: I44eb1c7974fb397909ad5db12987659e7505c2ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/421819
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-08-10 23:27:37 +00:00
Matthew Dempsky
88635b3862 cmd/compile/internal/noder: explicitly handle separate selectors
This CL separates out the handling of selector expressions for field
values, method values, and method expressions. Again part of
refactoring to make it possible to access runtime dictionaries where
needed.

No behavioral change; just duplicating and then streamlining the
existing code paths.

Change-Id: I53b2a344f4bdba2c9f37ef370dc9a091a3941021
Reviewed-on: https://go-review.googlesource.com/c/go/+/421818
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
2022-08-10 23:27:27 +00:00