Robert Findley [Wed, 10 Nov 2021 02:39:53 +0000 (21:39 -0500)]
go/types: use Identical to verify type identity in the Context map
We don't have guarantees that our type hash is perfect, and in fact
fuzzing found cases where identical types hashed to different values. In
case non-identical types hash to the same value, we should ensure that
we de-duplicate using Identical.
Adjust the type map to keep a slice of distinct type identities, so that
we can guarantee that type identity is preserved by de-duplication.
To allow look-up of instances by their identity, before they are
actually instantiated, add a Context.lookup method that accepts origin
type and type arguments. Replace the multi-function typeForHash method
with an update method that requires its argument be non-nil.
Change-Id: I8fe6fb2955f508db608161b7285b02d0a2fa0e46
Reviewed-on: https://go-review.googlesource.com/c/go/+/362798
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Michael Anthony Knyszek [Fri, 12 Nov 2021 05:04:32 +0000 (05:04 +0000)]
test/recover4.go: use mprotect to create a hole instead of munmap
Currently the recover4 test, which recovers from a panic created from a
fault, generates a fault by creating a hole in a mapping. It does this
via munmap. However, it's possible the runtime can create a new mapping
that ends up in that hole, for example if the GC executes, causing the
test to fail.
In fact, this is the case now with a smaller minimum heap size.
Modify the test to use mprotect, and clean up the code a little while
we're here: define everything in terms of the length of original
mapping, deduplicate some constants and expressions, and have the test
recover properly even if recover() returns nil (right now it panics
because it fails to type assert nil as error).
Fixes #49381.
Change-Id: If399eca564466e5e8aeb2dc6f86a246d0fce7b5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/363534
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Cherry Mui [Fri, 12 Nov 2021 00:58:23 +0000 (19:58 -0500)]
reflect: keep pointer in aggregate-typed args live in Call
When register ABI is used, reflect.Value.Call prepares the call
arguments in a memory representation of the argument registers.
It has special handling to keep the pointers in arguments live.
Currently, this handles pointer-typed arguments. But when an
argument is an aggregate-type that contains pointers and passed
in registers, it currently doesn't keep the pointers live. Do
so in this CL.
May fix #49363.
Change-Id: Ic6a0c5fdf9375ef02f7c03fbe9345e2e98c9353d
Reviewed-on: https://go-review.googlesource.com/c/go/+/363358
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Cherry Mui [Thu, 11 Nov 2021 21:51:08 +0000 (16:51 -0500)]
cmd/link: don't unmap output file at error exit
When the link exits on error it currently calls Out.Close, which
will munmap the output buffer and close the file. This may be
called in concurrent phase where other goroutines may be writing
to the output buffer. The munmap can race with the write, causing
it to write to unmapped memory and crash. This CL changes it to
just close the file without unmapping. We're exiting on error
anyway so no need to unmap.
Fixes #47816.
Change-Id: I0e89aca991bdada3d017b7d5c8efc29e46308c03
Reviewed-on: https://go-review.googlesource.com/c/go/+/363357
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
Pedro Lopez Mareque [Fri, 8 Oct 2021 05:01:35 +0000 (07:01 +0200)]
math/bits: add examples for Add, Sub, Mul and Div
Change-Id: I2f3619aa827e18f356871511c20cf2c712f496b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/353189
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Keith Randall <khr@golang.org>
Katie Hockman [Tue, 9 Nov 2021 22:13:36 +0000 (17:13 -0500)]
all: update terminology for fuzzing
This change doesn't modify any functionality.
It also doesn't update all of the comments and
variable names of the internal code, but everything
user facing should be correct.
Updates #49185
Change-Id: Ia8b2c94b89ba45897c4085ea0c17a3d8896f7ec7
Reviewed-on: https://go-review.googlesource.com/c/go/+/362794
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org>
Robert Griesemer [Thu, 11 Nov 2021 19:57:43 +0000 (11:57 -0800)]
go/types, types2: document nil scope for imported and instantiated Func objects
Also, don't set the scope anymore when instantiating (substituting)
a signature.
Per discussion with rfindley.
Change-Id: I560d4571c7ff14b0df3e15fece634cb5f9f94a99
Reviewed-on: https://go-review.googlesource.com/c/go/+/363435
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Keith Randall [Thu, 11 Nov 2021 16:45:02 +0000 (08:45 -0800)]
cmd/compile: ensure stenciled function bodies are nonempty
Our compiler gets confused between functions that were declared
with no body, and those which have a body but it is empty.
Ensure that when stenciling, we generate a nonempty body.
The particular test that causes this problem is in
cmd/compile/internal/gc/main.go:enqueueFunc. It thinks that if
a function has no body, then we need to generate ABI wrappers for
it, but not compile it.
Fixes #49524
Change-Id: Id962666a2098f60a2421484b6a776eafdc4f4a63
Reviewed-on: https://go-review.googlesource.com/c/go/+/363395
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
Ian Lance Taylor [Thu, 11 Nov 2021 04:28:45 +0000 (20:28 -0800)]
go/build: skip rune literals when looking for go:embed
Fixes #49514
Change-Id: Id687eead731ba49974f11d2e5b489f11eff7d07b
Reviewed-on: https://go-review.googlesource.com/c/go/+/363275
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Michael Anthony Knyszek [Thu, 11 Nov 2021 17:31:36 +0000 (17:31 +0000)]
runtime: adjust TestPhysicalMemoryUtilization to handle large page sizes
Currently TestPhysicalMemoryUtilization can fail on systems with large
physical page sizes like 64 KiB because all the of the holes to be
scavenged are not aligned to the page size. The holes themselves are 64
KiB so this is actually quite likely.
Bump the size of the allocations for systems with larger physical page
sizes, and add additional slack to the threshold for unaligned pieces of
the holes that may be unaligned.
Fixes #49411.
Change-Id: Iafb35b8761dc9cdc53d3745c4771b1a64c5c97b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/363415
Trust: Michael Knyszek <mknyszek@google.com> Reviewed-by: David Chase <drchase@google.com>
Michael Anthony Knyszek [Wed, 10 Nov 2021 22:03:28 +0000 (22:03 +0000)]
runtime/debug: make TestFreeOSMemory more robust
FreeOSMemory relies on the function FreeOSMemory increasing HeapReleased
as opposed to the background scavenger, because it reads memory stats
*after* the free of a large allocation. However, before that even
happens, the background scavenger can swoop in and release all that
memory, making it appear as if FreeOSMemory didn't do anything.
This change modifies the test to just make sure that the large
allocation's memory is returned to the OS *somehow*, by the end of the
test. It doesn't really care which happens. It also increases the size
of that large allocation to increase the likelihood that the test isn't
relying 100% on the background scavenger, and that FreeOSMemory is doing
some of the work.
Fixes #49478.
Change-Id: Ief1d839753720ebb88cbb616c46302293ee2d19c
Reviewed-on: https://go-review.googlesource.com/c/go/+/363414 Reviewed-by: David Chase <drchase@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
Pavel [Mon, 8 Nov 2021 14:29:16 +0000 (14:29 +0000)]
database/sql: prevent closes slices from assigning to free conn
In function connectionCleanerRunLocked append to closing slice affects db.freeConns and vise versa. Sometimes valid connections are closed and some invalid not.
Change-Id: I5282f15be3e549533b7d994b17b2060db3c0e7da
GitHub-Last-Rev: b3eb3ab6f49c036519f777fc7189e9507010c166
GitHub-Pull-Request: golang/go#49429
Reviewed-on: https://go-review.googlesource.com/c/go/+/362214 Reviewed-by: Daniel Theophanes <kardianos@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Robert Griesemer [Thu, 11 Nov 2021 16:36:15 +0000 (08:36 -0800)]
spec: fix a broken link
Thanks for jtagcat@ for finding this.
Change-Id: If7324808edbae19ec8bf503b04e0426f3fb3b47a
Reviewed-on: https://go-review.googlesource.com/c/go/+/363394
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
hasheddan [Thu, 11 Nov 2021 15:02:13 +0000 (10:02 -0500)]
obj/riscv: fix link to risc-v dwarf register numbers
The repository name and structure in the RISC-V GitHub org has been
modified, rendering the existing link invalid. This updates to point at
the new location of the RISC-V DWARF specification.
Change occured in https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/208
jiahua wang [Sat, 2 Oct 2021 14:50:31 +0000 (22:50 +0800)]
io: add error check to TeeReader Example
Change-Id: I0b94bdced47483c6412e9979ce2d103fbfc52afb
Reviewed-on: https://go-review.googlesource.com/c/go/+/353729
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Carlos Amedee <carlos@golang.org>
Cuong Manh Le [Thu, 11 Nov 2021 08:29:38 +0000 (15:29 +0700)]
cmd/compile: fix missing ddd when building call for function instantiation closure
When building a call expression for function instantiation closure, if
it's a variadic function, the CallExpr.IsDDD must be set for typecheck
to work properly. Otherwise, there will be a mismatch between the
arguments type and the function signature.
Fixes #49516
Change-Id: I0af90ee3fcc3e6c8bba8b20e331e044cbce17985
Reviewed-on: https://go-review.googlesource.com/c/go/+/363314
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Cherry Mui [Wed, 10 Nov 2021 00:50:47 +0000 (19:50 -0500)]
runtime: bypass scheduler when doing traceback for goroutine profile
When acquire a goroutine profile, we stop the world then acquire a
stack trace for each goroutine. When cgo traceback is used, the
traceback code may call the cgo traceback function using cgocall.
As the world is stopped, cgocall will be blocked at exitsyscall,
causing a deadlock. Bypass the scheduler (using asmcgocall) to fix
this.
Change-Id: Ic4e596adc3711310b6a983d73786d697ef15dd72
Reviewed-on: https://go-review.googlesource.com/c/go/+/362757
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Than McIntosh [Thu, 11 Nov 2021 12:06:24 +0000 (07:06 -0500)]
net: skip new testpoint TestUDPIPVersionReadMsg on plan9
Skip TestUDPIPVersionReadMsg on plan9, since it does things
not supported on that OS.
Change-Id: Icd1716fb5ed4e8877e57acb8c851ec3be72e83e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/363354 Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Than McIntosh [Wed, 10 Nov 2021 20:36:25 +0000 (15:36 -0500)]
cmd/compile: use canonical stringslice/ representations in abiutils
A chunk of code in abiutils was synthesizing the internals of a Go
string type as "struct { unsafe.Pointer, uintptr }" instead of the
more canonical representation "struct { *uint8, int }" used elsewhere
in the compiler. The abiutils type was being pulled into the code
during late call expansion, which resulted in two different entries in
the SSA named value table for the same variable piece, each with
different types; this then confused DWARF location list generation.
This patch changes the abiutils synthesized type to be consistent with
other parts of the back end, and makes a similar change for
synthesized slice types (use "struct { *uint8, int, int }").
Fixes #47354.
Change-Id: If789031cdc7abaf215bc75ee6eb863defbe530be
Reviewed-on: https://go-review.googlesource.com/c/go/+/362715
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Than McIntosh [Wed, 10 Nov 2021 15:44:00 +0000 (10:44 -0500)]
cmd/compile: include register-resident output params in DWARF-gen
During the register ABI work, a change was made in CL 302071 to
"stackframe" to treat register-resident output parameter (PARAMOUT)
variables that same as locals, which meant that if they were unused,
we'd delete them from the "Dcl" slice. This has the effect of making
them invisible to DWARF generation later on in the pipeline, meaning
that we don't get DIEs for them in the debug info. This patch fixes
the problem by capturing these params prior to optimization and then
adding them back in for consideration when we're processing the
params/locals of a function during DWARF generation.
Fixes #48573.
Change-Id: I2b32882911c18f91c3e3d009486517522d262685
Reviewed-on: https://go-review.googlesource.com/c/go/+/362618
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
Than McIntosh [Mon, 8 Nov 2021 18:53:55 +0000 (13:53 -0500)]
cmd/compile/internal/ssa: fix debug location gen issue with zero width ops
Revamp the way that buildLocationLists() handles zero-width
operations, to fix a couple of problems that result in bad debug
locations.
The problematic scenario in this specific bug is where you have a
parameter arriving in a register X, then a spill of register X to
memory as the first non-zero-width instruction in the function.
Example:
The existing buildLocationLists implementation effectively buffers or
bundles changes from zero-width instructions until it it sees a
non-zero-width instruction, but doing that in this case winds up
making it look as though the parameter is live into the function in
memory, not in a register.
The fix for this to separate out zero-width ops into two distinct
categories: those that whose lifetimes begin at block start (ex:
OpArg, Phi) and those whose effects are taking place at the nearest
non-zero-width instruction (ex: OpSelect0). In this patch we now
handle the first category of ops in an initial pre-pass for each
block, and leave the second category for the main pass through the
block. See the notes on the issue below for a more detailed
explanation of the failure mode.
Fixes #46845.
Change-Id: I27488d4c041019d5a0b897b7cf53000f63aab1cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/362244
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
Jason A. Donenfeld [Wed, 10 Nov 2021 00:04:12 +0000 (01:04 +0100)]
net: add conversion from AddrPort to TCPAddr to complement existing inverse
We already have various member functions of TCPAddr that return an
AddrPort, but we don't have a helper function to go from a AddrPort to a
TCPAddr. UDP has this, but it was left out of TCP. This commit adds the
corresponding function.
Updates #49298.
Change-Id: I85732cf34f47c792fe13a6b4af64fd4b0e85d06a
Reviewed-on: https://go-review.googlesource.com/c/go/+/362596
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Dmitry Vyukov [Wed, 10 Nov 2021 18:51:34 +0000 (19:51 +0100)]
cmd/link/internal/loadelf: better error message for ignored symbols
Currently it's quite hard to debug these error messages about ignored symbols
because there are only some numbers and no symbol name. Add symbol name. Before:
135029: sym#952: ignoring symbol in section 11 (type 0)
After:
135029: sym#952 (_ZN11__sanitizer9SpinMutexC5Ev): ignoring symbol in section 11 (type 0)
Change-Id: I7fec50b5798068c74827376613be529803838c5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/363034
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitry Vyukov <dvyukov@google.com>
Ian Lance Taylor [Wed, 10 Nov 2021 00:17:50 +0000 (16:17 -0800)]
lib/time, time/tzdata: update to 2021e
Doing this a little early in the release cycle as there have been some
changes in the handling of old timezones. They should continue to
work as expected, but more testing time may be useful.
For #22487
Change-Id: I3686fed79a052c46112445055044cff5842f2a45
Reviewed-on: https://go-review.googlesource.com/c/go/+/362874
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Ian Lance Taylor [Wed, 10 Nov 2021 17:35:59 +0000 (09:35 -0800)]
misc/cgo/testshared: correct test of gccgo version number
We still don't run the gccgo tests, because they don't run in module mode.
But now we at least get the version number check right.
Change-Id: Ifde4512c30605d1cb7e3a521f381a05c783549b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/362996
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Changkun Ou [Mon, 26 Jul 2021 08:56:30 +0000 (10:56 +0200)]
sync: clarify the validity to call Map methods inside Range
This change clarifies that calling all Map methods inside the callback
of Range is allowed. For further assurance, a nested range call test
is also added.
Fixes #46399
Change-Id: I0a766a5c1470e6b573ec35df1ccd62b2e46f1561
Reviewed-on: https://go-review.googlesource.com/c/go/+/337389 Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
Ian Lance Taylor [Thu, 11 Nov 2021 00:06:18 +0000 (16:06 -0800)]
test: add test that was miscompiled by gccgo
For #49512
Change-Id: Ic08652a4ec611b27150bf10b1118c1395715e5d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/363156
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
Jason A. Donenfeld [Fri, 5 Nov 2021 12:02:09 +0000 (13:02 +0100)]
net: do more faithful conversion from AddrPort to UDPAddr
A UDPAddr with a nil IP is a valid state, representing an AF-agnostic
unspecified address, so checking for addr.IsValid() isn't correct;
remove that, as it's only needed in the UDP rx path where it can be
added. Secondly, forcing everything to be IPv6 also is not correct, and
was likely done when the missing .AsSlice() made doing the right thing
less ergonomic. Fix this by using .AsSlice(), which properly preserves
IP version.
Change-Id: Idd1eaecd4076f32a843f859a0a9802ef98f956d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/361478
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
Robert Griesemer [Wed, 10 Nov 2021 21:36:23 +0000 (13:36 -0800)]
cmd/compile/internal/types2: remove structuralString in favor of inlined code
structuralString was used only in one place (for built-in copy).
Remove it in favor of custom and more efficient inlined code.
Follow-up on feedback received for CL 363075.
Change-Id: Ic5857c47255c5c712be7971aae4542fef9960fe6
Reviewed-on: https://go-review.googlesource.com/c/go/+/363154
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Robert Griesemer [Wed, 10 Nov 2021 20:11:03 +0000 (12:11 -0800)]
cmd/compile/internal/types2: slightly relax notion of structural type
If we have all channel types in a constraint, there is no structural type
if they don't all have the same channel direction (and identical element
types, of course). By allowing different channel types for the purposes of
the structural type, as long as there is not a send-only _and_ a receive-
only channel in the type set, we make it possible to find a useful, if
restricted by channel direction, structural type where before there was
none.
So if we have unrestricted and send-only channels, the structural type is
the send-only channel, and vice versa.
For all operations on channels that rely on a structural type, it's always
ok to have an unrestricted channel, so this is not affecting their behavior.
But it makes those operations more flexible in the presence of type parameters
containing mixed channel types.
For constraint type inference, where we currently may not infer a channel
at all, this change allows us to infer a more restricted channel (send- or
receive-only). If the inferred channel type is a valid type argument we win;
if not we haven't lost anything.
Use structuralType for send and receive operations and adjust related
error messages (the error message that change are the ones involving
type parameters, so historic error messages are preserved).
Fixes #45920.
Change-Id: If3a64d29c37e7734d3163df330f8b02dd032bc60
Reviewed-on: https://go-review.googlesource.com/c/go/+/363075
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Dan Scales [Wed, 10 Nov 2021 19:39:18 +0000 (11:39 -0800)]
cmd/compile: don't do Resolve on OKEY identifiers during import
For generic functions, we can export untransformed OKEY nodes, and the
key identifier is written as an ONONAME. But in this case, we do not
want to call Resolve() on the identifier, since we may resolve to a
global type (as happens in this issue) or other global symbol with the
same name, if it exists. We just want to keep the key identifier as an
Ident node.
To solve this, I added an extra bool when exporting an ONONAME entry,
which indicates if this entry is for a key or for a global (external)
symbol. When the bool is true (this is for a key), we avoid calling
Resolve().
Fixes #49497
Change-Id: Ic8fa93d37bcad2110e0e0d060080b733e07e35d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/363074
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Adds a new flag to 'go mod vendor' which overrides the default
'vendor' destination directory. This can be helpful for writing the
vendor tree to a temporary location for use by other tools.
The argument can be a relative or an absolute path.
This flag has no other influence on how the command behaves.
Fixes #47327
Change-Id: I4502931127616b181dc90a2066d2fb57bfe48f96
Reviewed-on: https://go-review.googlesource.com/c/go/+/338149 Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Robert Griesemer [Wed, 10 Nov 2021 16:33:26 +0000 (08:33 -0800)]
cmd/compile/internal/types2: move some functions into different files (cleanup)
- move structuralType/structuralString into type.go
- move functions exported for the compiler into compilersupport.go
- updated/added comments
- removed AsNamed and AsInterface - not needed by compiler
No semantic changes.
Change-Id: Ia454a49edafd627c2a25b0b71db4aa93ddd7f1f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/362995
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Robert Findley [Wed, 10 Nov 2021 16:21:57 +0000 (11:21 -0500)]
go/doc: don't treat functions returning type parameters as constructors
Functions returning type parameters were erroneously being interpreted
as 'constructors' of their type parameter, resulting in them being
excluded from documentation. Fix this by explicitly excluding type
parameters when looking for defined type names among function results.
Fixes #49477
Change-Id: I22510f655f47e192a852332df5b91740f46c51eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/362758
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Robert Griesemer [Wed, 10 Nov 2021 16:12:21 +0000 (08:12 -0800)]
cmd/compile/internal/types2: rename structure to structuralType
And rename structureString to structuralString.
Now that we have an updated definition for structural types in
the (forthcoming) spec, name the corresponding function accordingly.
No semantic changes.
Change-Id: Iab838f01a37075bedf2d8bc4f166b0217672b85f
Reviewed-on: https://go-review.googlesource.com/c/go/+/362994
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Robert Griesemer [Wed, 10 Nov 2021 05:12:03 +0000 (21:12 -0800)]
cmd/compile/internal/types2: use type variables consistently in Checker.conversion
We have V and T and Vu and Tu. When calling the various isX predicates
consistently use Vu and Tu.
(We could also use V an T because the predicates call under anyway,
but using Vu and Tu removes an unnecessary call to Named.under if
V or T are *Named.)
Also, removed some outdated comments.
Change-Id: I6fcd9ce5f6292e89ac2afd597b72fd0790e84ff1
Reviewed-on: https://go-review.googlesource.com/c/go/+/362895
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Robert Griesemer [Wed, 10 Nov 2021 04:22:26 +0000 (20:22 -0800)]
doc: make a copy of the latest Go 1.17 spec
This will allow us to compare the changes made for Go 1.18.
Change-Id: I1456270b201967f5cb05e66cec556939e6e33265
Reviewed-on: https://go-review.googlesource.com/c/go/+/362894
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Hajime Hoshi [Fri, 5 Nov 2021 14:50:55 +0000 (23:50 +0900)]
runtime: fix unworkable comments for go:nosplit
Change-Id: I71c29a2dc7e5b2b6bc35093535228d2907b16b47
Reviewed-on: https://go-review.googlesource.com/c/go/+/361595
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Hajime Hoshi <hajimehoshi@gmail.com>
Robert Findley [Sun, 31 Oct 2021 15:33:00 +0000 (11:33 -0400)]
go/parser: allow parsing aliases with type parameters
We already guard against this in the type checker, and it will
eventually be allowed per the accepted proposal.
Add a placeholder error code for the corresponding type checker error.
Change-Id: I5cc2f1413ecc89ec2094f7178fdb156fb8cc2e43
Reviewed-on: https://go-review.googlesource.com/c/go/+/360235
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Robert Findley [Tue, 9 Nov 2021 23:48:16 +0000 (18:48 -0500)]
go/types: disallow type cycles through type parameter lists
This is a port of CL 361922 to go/types.
Change-Id: I790c8121a640c25fb655c926fb434d667dd59f76
Reviewed-on: https://go-review.googlesource.com/c/go/+/362756
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Robert Griesemer [Tue, 9 Nov 2021 00:09:11 +0000 (16:09 -0800)]
cmd/compile/internal/types2: disallow type cycles through type parameter lists
If we reach a generic type that is part of a cycle
and we are in a type parameter list, we have a cycle
through a type parameter list, which is invalid.
Fixes #49439.
Change-Id: Ia6cf97e1748ca0c0e61c02841202050091365b0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/361922
Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Robert Griesemer [Tue, 9 Nov 2021 04:17:22 +0000 (20:17 -0800)]
cmd/compile/internal/types2: rename Checker.cycle to Checker.validCycle
Also, invert the boolean result. This matches Checker.validType;
it's also easier to understand. Preparation for the next CL which
detects cycles through type parameter lists.
Change-Id: I00a75d2359ca20827c9bf406945508716c826fc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/362336
Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Robert Findley [Tue, 9 Nov 2021 23:40:38 +0000 (18:40 -0500)]
go/types: rename Checker.cycle to Checker.validCycle
This is a clean port of CL 362336 to go/types.
Change-Id: Iafeae7024fbb2872b07748affcea9676324ea59e
Reviewed-on: https://go-review.googlesource.com/c/go/+/362755
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Robert Findley [Tue, 9 Nov 2021 21:41:01 +0000 (16:41 -0500)]
go/types: remove most asX converters (cleanup)
This is a port of CL 362118 to go/types, which is itself a roll-forward
of CL 362254, containing a bugfix.
Change-Id: I20067c7adf56bf64fe9ad080d998a7aefbdc1053
Reviewed-on: https://go-review.googlesource.com/c/go/+/362617
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Robert Findley [Tue, 9 Nov 2021 19:20:11 +0000 (14:20 -0500)]
go/types: report error for incomplete struct composite literal type
This is a port of CL 361412 to go/types.
Change-Id: Ie5bccc7faba7ca9230e712f867b27ca9dcddba79
Reviewed-on: https://go-review.googlesource.com/c/go/+/362739
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Robert Findley [Tue, 9 Nov 2021 19:56:39 +0000 (14:56 -0500)]
go/types: don't return an array type with invalid length
In preparation for porting CL 361412, fix a discrepancy in go/types,
where [-1]T is returned for an array type with invalid length.
Change-Id: Ia32f5b66c9c561ccf0c32af1922fc4690c66dbc3
Reviewed-on: https://go-review.googlesource.com/c/go/+/362738
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Michael Matloob [Tue, 19 Oct 2021 18:05:29 +0000 (14:05 -0400)]
cmd/go: add workspace pruning mode
[ this is a roll-forward of golang.org/cl/357169 with minor changes
to fix the cmd/go/internal/modload tests: because they don't run the
go command, some initialization isn't run on the test and modroots is
empty in cases it can't be when the full command setup is done. So
directly check for workFilePath != "" instead of calling inWorkspaceMode
which checks that Init is called first, and check that modRoots is non
empty when calling mustGetSingleMainModule.]
This change corrects a bug in the handling of module loading of
workspaces. Namely, there is an assumption by the module pruning code
that if a root module is selected then the packages of that module can
be resolved without loading the whole module graph. This is not true
in workspace mode because two workspace modules can require different
versions of a dependency. Worse, one workspace module can directly
require a depencency that is transitively required by another
workspace module, changing the version of that module loaded in the
fully expanded graph.
To correct this, a new 'workspace' pruning mode is added where the
roots are the workspace modules themselves, satisfying the assumption
made by the module pruning logic.
The rest of this change accounts for the new pruning mode where it's
used and correctly sets the requirements in this pruning mode.
Change-Id: I8bdf4b30f669c1ded0ed8a5dd202ac8d1939bbbd
Reviewed-on: https://go-review.googlesource.com/c/go/+/362754
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Manlio Perillo [Sun, 16 May 2021 17:52:37 +0000 (19:52 +0200)]
cmd/dist: wait for exit in bgwait after a fatal error
Currently, when a command scheduled by bgrun fails, bgwait returns to
the caller even in case the fatal error was detected.
In case of a syntax error in one of the standard packages, as an
example, the runInstall function will try to read the generated archive
file, only to fail since the file does not exist. Since the runInstall
function is called in a goroutine, cmd/dist will continue to report
errors until all background goroutines are done.
Update the bgwait function to wait until program termination in case of
a fatal error, since returning to the caller (with an error, as an
example) will cause cmd/dist to report an additional error during the
next build phase.
Fixes #45410
Change-Id: If89976abad70f8d6ec79b2a5a1f2306e9c034c5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/320311
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Keith Randall [Tue, 12 Oct 2021 23:50:35 +0000 (16:50 -0700)]
encoding/xml: add generic encoding test
Fixes #48521
Change-Id: Id8402bcff243c0ab19e4ec0b138b9af8c111f88d
Reviewed-on: https://go-review.googlesource.com/c/go/+/355492
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
Robert Findley [Tue, 9 Nov 2021 19:10:37 +0000 (14:10 -0500)]
go/types: clearer object string for type parameters
This is a port of CL 361401 to go/types.
Change-Id: I5b1c7cf1d7a819b2902c304f884492ec02c7eaa1
Reviewed-on: https://go-review.googlesource.com/c/go/+/362737
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
David Chase [Tue, 9 Nov 2021 16:47:49 +0000 (11:47 -0500)]
cmd/compile: add line number test for #49436
This enhances the existing line number test
to allow a specific -gcflags (e.g., -G=3)
and to permit ignoring duplicate line numbers
(which is arguably a bug, but not THIS bug,
and it lowers the risk of a flaky test).
Limited to Linux/Darwin and amd64/arm64,
also tests with "unified" mangling.
And, using these new powers, adds a test.
Updates #49436.
Change-Id: I09c82e6a08d53edd5a752522a827e872d3e16e0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/362714
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Dmitri Shuralyov [Tue, 9 Nov 2021 18:54:57 +0000 (13:54 -0500)]
all: update vendored golang.org/x/tools for Go 1.18 release
The Go 1.18 code freeze has recently started. This is a time to update
all golang.org/x/... module versions that contribute packages to the
std and cmd modules in the standard library to latest master versions.
This CL updates only the tools module, keeping mod unchanged because
its lastest commit isn't ready to be vendored yet.
For #36905.
Updates #49350.
Change-Id: Ib39713d28a55fc9ec79058aab9919eba912def5f
Reviewed-on: https://go-review.googlesource.com/c/go/+/361094
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Dmitri Shuralyov [Tue, 9 Nov 2021 18:49:45 +0000 (13:49 -0500)]
all: update vendored golang.org/x/crypto for Go 1.18 release
The Go 1.18 code freeze has recently started. This is a time to update
all golang.org/x/... module versions that contribute packages to the
std and cmd modules in the standard library to latest master versions.
This CL updates only the crypto module, as well as the TestDependencies
policy to accommodate the dependency order change done in CL 345649.
The next CL will update further modules.
For #36905.
Change-Id: If93160d8d72ca86e9995aaf5bdfc3d2c20b4695d
Reviewed-on: https://go-review.googlesource.com/c/go/+/362736
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
Dmitri Shuralyov [Tue, 9 Nov 2021 18:31:45 +0000 (13:31 -0500)]
all: update vendored golang.org/x/{net,text} for Go 1.18 release
The Go 1.18 code freeze has recently started. This is a time to update
all golang.org/x/... module versions that contribute packages to the
std and cmd modules in the standard library to latest master versions.
This CL updates only the net, text modules.
The next CL will update further ones.
For #36905.
Change-Id: I9a5ac3cca22da961cfd09f3202e01e1187d42bdd
Reviewed-on: https://go-review.googlesource.com/c/go/+/362735
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
Dmitri Shuralyov [Tue, 9 Nov 2021 18:31:45 +0000 (13:31 -0500)]
all: update vendored golang.org/x/{arch,sys,term} for Go 1.18 release
The Go 1.18 code freeze has recently started. This is a time to update
all golang.org/x/... module versions that contribute packages to the
std and cmd modules in the standard library to latest master versions.
This CL updates only the lower-level modules arch, sys, term for better
bisection. The next CL will update further ones.
For #36905.
Change-Id: I455428c051ec49b446b8b558a6f579cd9be4d796
Reviewed-on: https://go-review.googlesource.com/c/go/+/362734
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Ian Lance Taylor [Tue, 9 Nov 2021 02:30:30 +0000 (18:30 -0800)]
os: clarify that File.{Read,Write} use the buffer
Fixes #49470
Change-Id: I81fd4b0e2eef1d8d430b5d1d10c4f824e803a75c
Reviewed-on: https://go-review.googlesource.com/c/go/+/362335
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Ian Lance Taylor [Mon, 8 Nov 2021 21:57:50 +0000 (13:57 -0800)]
bufio: document that NewWriter can return its argument
Fixes #49446
Change-Id: Ib0b53a7dd5d567a2dd0bdf29f53d276587b60afb
Reviewed-on: https://go-review.googlesource.com/c/go/+/361921
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Chaoqun Han [Mon, 8 Nov 2021 14:58:51 +0000 (22:58 +0800)]
cmd/compile: NewSelectorExpr use n.Pos instead of base.Pos
Fixes #49436
Change-Id: I4c8851e7aaee631d5eb22f2ef0aea5a25e936d87
Reviewed-on: https://go-review.googlesource.com/c/go/+/361917
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Trust: David Chase <drchase@google.com>
Robert Findley [Tue, 9 Nov 2021 16:19:20 +0000 (11:19 -0500)]
go/types: make object test an external test
This is a port of CL 361409 to go/types.
Change-Id: I17ccf8a5b4ba715fd8a87ea2c1811700fb1157e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/362538
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Robert Findley [Tue, 9 Nov 2021 16:14:37 +0000 (11:14 -0500)]
go/types: check non-generic conversions first
This is a clean port of CL 361269 to go/types.
Change-Id: I2caaf08eabdf1707ae83ec1e628fd26f21b2b8e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/362616
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Robert Findley [Tue, 9 Nov 2021 16:09:13 +0000 (11:09 -0500)]
go/types: minor cleanups in predicates.go
This is a clean port of CL 360956 to go/types.
Change-Id: Iac437e72bb760e7e90236a86e7473d6a440df081
Reviewed-on: https://go-review.googlesource.com/c/go/+/362615
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Clément Chigot [Tue, 9 Nov 2021 09:01:05 +0000 (10:01 +0100)]
cmd/link: fix GCC startfiles names on AIX
Since GCC version 11, the 64-bit version of GCC starting files are
now suffixed by "_64" instead of being stored without suffix under
"ppc64" multilib directory.
Change-Id: Ibe53521ed24d36e5f6282e3574849b9ae11a1e9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/362594 Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
Carl Johnson [Tue, 31 Aug 2021 20:35:35 +0000 (20:35 +0000)]
net/http: add MaxBytesHandler
Fixes #39567
Change-Id: I226089b678a6a13d7ce69f360a23fc5bd297d550
GitHub-Last-Rev: 6435fd5881fc70a276d04df5a60440e365924b49
GitHub-Pull-Request: golang/go#48104
Reviewed-on: https://go-review.googlesource.com/c/go/+/346569
Trust: Damien Neil <dneil@google.com>
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
Russ Cox [Thu, 28 Oct 2021 17:22:07 +0000 (13:22 -0400)]
cmd/go: add //go:embed all:pattern
When //go:embed d matches directory d, it embeds the directory
tree rooted at d, but it excludes files beginning with . and _,
as well as files having problematic names that will not be packaged
into modules (names such as .git and com1).
After long discussions on #42328 and #43854, we decided to keep
the behavior of excluding . and _ files by default, but to allow the pattern
prefix 'all:' to override this default. This CL implements that change.
Note that paths like .git and com1 are still excluded, as they must be,
since they will never be packed into a module.
Fixes #43854.
Change-Id: I4f3731e14ecffd4b691fda3a0890b460027fe209
Reviewed-on: https://go-review.googlesource.com/c/go/+/359413
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Michael Pratt [Tue, 9 Nov 2021 16:35:52 +0000 (11:35 -0500)]
runtime: add upper half and carry bit with zero
https://golang.org/cl/246763 accidentally changed this from upper + 0 +
carry to upper + old vdsoSP + carry.
The old value of vdsoPC is usually zero, so this typically works.
However, the reentrant case will have a non-zero value, resulting in a
bogus returned time.
Fixes #49481
Change-Id: I0110b84277bf911804cb0ff8097aebf1b7eb100a
Reviewed-on: https://go-review.googlesource.com/c/go/+/362674
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Michael Pratt [Tue, 9 Nov 2021 15:59:32 +0000 (10:59 -0500)]
runtime/pprof: include labels in profile dump
For tests of pprof label support having the sample labels in the output
is needed for effective debugging.
For #48577
Change-Id: Ic7c5bc90cb33e8fb477f7db62d9b56a7a9d6ffa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/362614
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Robert Findley [Mon, 8 Nov 2021 18:08:59 +0000 (18:08 +0000)]
cmd/compile/internal/types2: roll-forward removal of asX converters
This CL reverts CL 361964, rolling forward the original CL 362254 with a
fix for re-entrant expansion via type hashing (compare patchsets 1 and
2).
Change-Id: I62869e50e919f42eb8d6fef5b0d7a5ec8960bd84
Reviewed-on: https://go-review.googlesource.com/c/go/+/362118
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Dan Scales [Tue, 9 Nov 2021 02:10:30 +0000 (18:10 -0800)]
cmd/compile: disable doubleCheck and remove unused checkDictionary
In stencil.go, change doubleCheck to false, which will turn off some
double-checking code which isn't needed generally, now that we have lots
of tests of end-to-end runs.
Also, removed checkDictionary() which is unused and is unlikely to be
useful in the future.
Change-Id: I4e5acceab80f4904b174422bae21ca82cf04f943
Reviewed-on: https://go-review.googlesource.com/c/go/+/361923
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com> Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Robert Findley [Tue, 9 Nov 2021 15:20:50 +0000 (10:20 -0500)]
go/types: rename is_X predicates back to isX (step 2 of 2)
This is a port of CL 361134 to go/types.
Change-Id: Ibac4365a85561b32a90b0118d48aa9302f227b2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/362554
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Robert Findley [Mon, 8 Nov 2021 18:09:41 +0000 (13:09 -0500)]
go/types: rename isX predicates to allX, add simple is_X (step 1 of 2)
This is a port of CL 360955 to go/types. Note that go/types and types2
differ in handling of untyped nil within both Checker.shift and
Checker.implicitTypeAndValue.
A missing comment was added to Checker.indexExpr.
Change-Id: Ia9149ff9c0af68213c579090902ab7989828ddd2
Reviewed-on: https://go-review.googlesource.com/c/go/+/362534
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Jason A. Donenfeld [Tue, 9 Nov 2021 00:23:02 +0000 (01:23 +0100)]
runtime: revert recent Windows crashdump changes
Recent changes to runtime enabled crashdumps, which under some
circumstances apparently might result in memory being uploaded to
Microsoft. A change like this should go through the proper proposals
process where we can discuss how to gate it and what all of its
implications are.
This reverts CL 307372 and its cleanup CL 360617.
Change-Id: If2e74015899d746831da40546c82eacacdf739e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/362454
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Cuong Manh Le [Mon, 8 Nov 2021 06:08:58 +0000 (13:08 +0700)]
cmd/compile: fix irgen mis-handling of ... argument when creating closure
When bulding formal arguments of newly created closure, irgen forgets to
set "..." field attribute, causing type mismatched between the closure
function and the ONAME node represents that closure function.
Fixes #49432
Change-Id: Ieddaa64980cdd3d8cea236a5a9de0204ee21ee39
Reviewed-on: https://go-review.googlesource.com/c/go/+/361961
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
Matthew Dempsky [Mon, 8 Nov 2021 21:13:30 +0000 (13:13 -0800)]
test: add regress test for reported non-monomorphizable example
Fixes #48711.
Change-Id: I2ed1ef5267343d4b9f91da0618905098d178db90
Reviewed-on: https://go-review.googlesource.com/c/go/+/362394
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Michael Matloob [Tue, 19 Oct 2021 18:05:29 +0000 (14:05 -0400)]
cmd/go: add workspace pruning mode
This change corrects a bug in the handling of module loading of
workspaces. Namely, there is an assumption by the module pruning code
that if a root module is selected then the packages of that module can
be resolved without loading the whole module graph. This is not true
in workspace mode because two workspace modules can require different
versions of a dependency. Worse, one workspace module can directly
require a depencency that is transitively required by another
workspace module, changing the version of that module loaded in the
fully expanded graph.
To correct this, a new 'workspace' pruning mode is added where the
roots are the workspace modules themselves, satisfying the assumption
made by the module pruning logic.
The rest of this change accounts for the new pruning mode where it's
used and correctly sets the requirements in this pruning mode.
Change-Id: I5d4d9877e492e196681f6ee9f8f18a08b4e95c61
Reviewed-on: https://go-review.googlesource.com/c/go/+/357169
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Cuong Manh Le [Mon, 8 Nov 2021 17:05:58 +0000 (00:05 +0700)]
cmd/compile,cmd/go: fix long test builders
CL 361411 improved error message for go version requirement, but forgot
to update the test in cmd/go to match new error message. That causes
longtest builders failed.
This CL changes mod_vendor_goversion.txt to match compiler error, and
limit fixedbugs/issue49368.go to run with -G=3 only.
Updates #49368
Change-Id: I125fe0a8c2a1595066d39c03e97819e7a1274e0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/361963
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Though the unified IR is not for go1.18, it's the only user of types2
lazy resolution APIs at this moment. And it consistently failed after
CL 362254 is the sign that the change was wrong somehow.
Change-Id: I6bfc3192904fe2129fd3c165f0df8761e8eb441c
Reviewed-on: https://go-review.googlesource.com/c/go/+/361964
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Michael Anthony Knyszek [Fri, 5 Nov 2021 23:47:51 +0000 (23:47 +0000)]
runtime: disable GC in TestPanicSystemstack's subprocess
TestPanicSystemstack spins up a subprocess that has 2 goroutines
deadlock on a runtime lock while on the system stack, with GOMAXPROCS=2.
Each goroutine is going to be running on a P, and then is going to wedge
itself up on that P.
If a GC is active and a worker starts executing (using a P), then it
could try to preempt a goroutine that is already blocked. It won't be
able to, so it'll just sit there forever trying to suspend it. At this
point there are no more Ps to execute the remaining goroutine that needs
to print something so the parent process can continue the test.
This change fixes this issue by disabling GCs in the child process. An
alternative fix could be to increase GOMAXPROCS in the child, but maybe
letting the GC be on (which assumes it'll always be able to *eventually*
suspend a G) is just asking for trouble.
Fixes #49388.
Change-Id: I405c9dad50e24e1e68f2c52a646538da15797fbe
Reviewed-on: https://go-review.googlesource.com/c/go/+/361897
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com>
Michael Anthony Knyszek [Fri, 5 Nov 2021 23:35:58 +0000 (23:35 +0000)]
runtime: disable GC during debug call tests
Currently the debug call protocol implementation we use for testing is
riddled with write barriers, and called from a signal handler. This is
not safe, as write barriers need a P to execute.
Ideally this implementation would be rewritten to avoid the write
barriers, but it's not straightforward, and needs some thought. As a
temporary measure, disable GC during the debug call tests to avoid a
write barrier.
Note that this does not indicate a problem with real use of the debug
call protocol. Only our test implementation has this issue, because it
needs to get executed in a signal handler, normally a separate process
is interfacing with the protocol via process signals and ptrace (and the
like).
Fixes #49370.
Change-Id: Ic0fde5d0f4c64f9ecc9789b7dabb3954538fe0a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/361896
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com>
Robert Griesemer [Mon, 8 Nov 2021 04:08:13 +0000 (20:08 -0800)]
cmd/compile/internal/types2: remove most asX converters (cleanup)
Make it explicit in the code where we call under.
The asNamed and asTypeParam converters need to
stay: asNamed does resolution if necessary, and
asTypeParam may or may not call under() depending
on the next CL.
Reviewed uses of asNamed and .(*Named) for correctness.
Removed unnecessary Named.resolve call in lookup.
Change-Id: I2acf176925e00bd1703a00230a779aa65a8f5a51
Reviewed-on: https://go-review.googlesource.com/c/go/+/362254
Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
smasher164 [Sat, 6 Nov 2021 06:59:00 +0000 (02:59 -0400)]
doc/go1.18: strings,bytes: deprecate Title
Updates #48367.
Change-Id: Ib8fc6d9dd7c3c6a70fefe077615f51a71d9c42ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/361899 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>