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

49360 Commits

Author SHA1 Message Date
astraw99
850768bbc9 time: update current time comment
In the time package, the ticker and timer both send
current time to channel C, so this PR update the comment
to understand them better.

Change-Id: I99846a40bf8ef780bf0062dd84cf721b3b892a1b
GitHub-Last-Rev: 535da54b8e
GitHub-Pull-Request: golang/go#47597
Reviewed-on: https://go-review.googlesource.com/c/go/+/340649
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-08-16 17:24:37 +00:00
Matt Layher
a0adf91d85 internal/syscall/unix: change Ioctl arg type to unsafe.Pointer on AIX
Without this change, this code is technically in violation of the
unsafe.Pointer rules since the conversion from unsafe.Pointer to uintptr has
to happen when calling into the syscall6 assembly implementation.

Change-Id: I4821f5bf9788c8fa2efeb041f811ed092e07ae74
Reviewed-on: https://go-review.googlesource.com/c/go/+/340949
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-08-16 16:58:24 +00:00
Keith Randall
5a40100141 cmd/compile: fix dictionaries for nested closures
Capturing dictionary closure variables is ok.

Fixes #47684

Change-Id: I049c87117915e0c5a172b9665bfac2f91064b2d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/342050
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>
2021-08-16 16:55:27 +00:00
Cherry Mui
c92f5ee170 cmd/link: start at address 0 when external linking
When external linking, we are creating an object file, instead of
a executable. The absolute address is irrelevant. The external
linker will set it up. Start at address 0.

Change-Id: I3a2e0b8087b328d5c3144f29ca8ba6311aa39cba
Reviewed-on: https://go-review.googlesource.com/c/go/+/319830
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>
2021-08-16 16:20:06 +00:00
Carlos Amedee
5da2010840 doc: start draft of go1.18 release notes, move go1.17 to x/website
This template is based on CL 295209 and previous ones like it.
Continue to eagerly include often-used sections, and clarify that
the TODO is about completing the section, or removing if it turns
out not to be needed.

Move the Go 1.17 release notes to x/website, since that's the new
home for past Go release notes as of CL 291711. They're added to
x/website in CL 342089.

For #47694
Updates #44513

Change-Id: I24962eed800d1509bdf71b7d7f819a683eb96f8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/342070
Trust: Carlos Amedee <carlos@golang.org>
Run-TryBot: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-16 15:27:42 +00:00
cuiweixie
ea8298e2f5 cmd/compile/internal/ssa: delete unused code
Fixes #46186

Change-Id: Idb0674079f9484593e07cca172dfbb19be0e594d
GitHub-Last-Rev: 615fc53655
GitHub-Pull-Request: golang/go#46185
Reviewed-on: https://go-review.googlesource.com/c/go/+/320111
Reviewed-by: Ben Shi <powerman1st@163.com>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: David Chase <drchase@google.com>
2021-08-16 14:50:20 +00:00
Robert Findley
fe489c86a7 go/types: limit termlist lengths
This is a port of CL 340254 to go/types, with minor adjustments for
errors and positions.

Change-Id: I49ea1d1de8d6e27484f167b813267615d142d31c
Reviewed-on: https://go-review.googlesource.com/c/go/+/342438
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>
2021-08-16 14:27:31 +00:00
Robert Findley
b9f135d98f go/types: change types2.Union API to accept a list of Terms
This is a straightforward port of CL 340250 to go/types.

Change-Id: I8fc1c78833b5393fb39344fd248529df57870a72
Reviewed-on: https://go-review.googlesource.com/c/go/+/342437
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>
2021-08-16 14:27:24 +00:00
Robert Findley
c2b4ec8f49 go/types: add defined type to term/termlist tests
This is a port of CL 339905 to go/types.

Change-Id: I9afac9e84bde6f34bb65c7e3d726986d2c648a91
Reviewed-on: https://go-review.googlesource.com/c/go/+/342436
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>
2021-08-16 14:27:09 +00:00
Robert Findley
11a43df461 go/types: minor cleanup of writeTParamList
This is a port of CL 339903 to go/types.

Change-Id: Iaf5fe7321d907df4421128c66cf8c58129eaae8b
Reviewed-on: https://go-review.googlesource.com/c/go/+/342435
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>
2021-08-16 14:26:59 +00:00
Robert Findley
b0fba64ef4 go/types: fix make with type parameter argument
This is a port of CL 339899 to go/types. A test assertion is adjusted
to place the 'not enough arguments' error on the ')'.

Change-Id: Ia13eccc66586f9b84a8b99d462bb406d363a3288
Reviewed-on: https://go-review.googlesource.com/c/go/+/342434
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>
2021-08-16 14:26:45 +00:00
Meng Zhuo
efd206eb40 cmd/compile: intrinsify Mul64 on riscv64
According to RISCV instruction set manual v2.2 Sec 6.1
MULHU followed by MUL will be fused into one multiply by microarchitecture

Benchstat on Hifive unmatched:
name          old time/op    new time/op    delta
Hash8Bytes       245ns ± 3%     186ns ± 4%  -23.99%  (p=0.000 n=10+10)
Hash320Bytes    1.94µs ± 1%    1.31µs ± 1%  -32.38%  (p=0.000 n=9+10)
Hash1K          5.84µs ± 0%    3.84µs ± 0%  -34.20%  (p=0.000 n=10+9)
Hash8K          45.3µs ± 0%    29.4µs ± 0%  -35.04%  (p=0.000 n=10+10)

name          old speed      new speed      delta
Hash8Bytes    32.7MB/s ± 3%  43.0MB/s ± 4%  +31.61%  (p=0.000 n=10+10)
Hash320Bytes   165MB/s ± 1%   244MB/s ± 1%  +47.88%  (p=0.000 n=9+10)
Hash1K         175MB/s ± 0%   266MB/s ± 0%  +51.98%  (p=0.000 n=10+9)
Hash8K         181MB/s ± 0%   279MB/s ± 0%  +53.94%  (p=0.000 n=10+10)

Change-Id: I3561495d02a4a0ad8578e9b9819bf0a4eaca5d12
Reviewed-on: https://go-review.googlesource.com/c/go/+/329970
Reviewed-by: Joel Sing <joel@sing.id.au>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Meng Zhuo <mzh@golangcn.org>
2021-08-16 13:50:11 +00:00
Robert Findley
7b7d7d7818 go/types: fix range over exprs of type parameter type
This is a port of CL 339897 to go/types. In addition, an error message
that was adjusted in CL 274974 is ported to go/types (CL 274974 was
only considered necessary for compiler compatibility).

Change-Id: Idfe44d759c925f9fed353a2d1898d3d4d8d85452
Reviewed-on: https://go-review.googlesource.com/c/go/+/342433
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>
2021-08-16 13:39:19 +00:00
Robert Findley
02f932e173 go/types: better names for things (cleanup)
This is a port of CL 339891 to go/types.

Change-Id: If4d9bbb3ace45bec0f40082dd42ed2dd249100ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/342432
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>
2021-08-16 13:39:01 +00:00
Robert Findley
a192ef8ac4 go/types: cleanup panic calls
This is a port of CL 339969 to go/types. It differs slightly in
errors.go, due to the differing API.

Change-Id: Ie2bf84ebf312ea3872ee6706615dfc6169a32405
Reviewed-on: https://go-review.googlesource.com/c/go/+/342431
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>
2021-08-16 13:38:52 +00:00
Robert Findley
11a1f37b07 go/types: remove TestIncompleteInterfaces (cleanup)
This is a straightforward port of CL 339832 to go/types.

Change-Id: Ibcb1b130ea474bbbfe9cb5138170e27b466313cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/342430
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>
2021-08-16 13:38:44 +00:00
Robert Findley
0b61dc4577 go/types: remove unused gcCompatibilityMode flag (cleanup)
This is a port of CL 339831 to go/types.

gcCompatibilityMode is unused, and x/tools/go/types no longer exists, so
delete it.

Change-Id: I886d8c24b7aa6511934ac78549f07a88a18e950b
Reviewed-on: https://go-review.googlesource.com/c/go/+/342429
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>
2021-08-16 13:38:29 +00:00
Robert Findley
c88e3ff648 cmd/compile/internal/types2: use the underlying TypeParam in
assignableTo

In CL 338310, assignableTo was altered to walk the constituent types of
TypeParams rather than Unions, but was not also adjusted to use under
rather than optype. This manifested in the port to go/types.

Change-Id: Ie057b96ce93cef204af88b536ea49344c9bc8f12
Reviewed-on: https://go-review.googlesource.com/c/go/+/342409
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>
2021-08-16 12:54:44 +00:00
Robert Findley
d043c8ea89 go/types: implement type sets with term lists
This is a port of CL 338310 to go/types. It is superficially adjusted
for different error reporting and AST APIs. It also fixes a bug in CL
338310 that only manifests in go/types (TestFixedbugs/issue39755.go2)
due to go/types preserving untyped nil. In that CL, operand.go is
checking if optype is a TypeParam, which can never be the case. A fix
for types2 will be mailed in a separate CL.

Change-Id: Icf3394e74baec536842267d99f7511d25ab32a8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/342331
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>
2021-08-16 12:54:34 +00:00
Robert Findley
94002f6fca go/types: implement term lists
This is a straightforward port of CL 339596 to go/types, differing only
in the package declaration.

Change-Id: If5bf8fd5667bee91b04fdb797702e6045d5fba7b
Reviewed-on: https://go-review.googlesource.com/c/go/+/342330
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>
2021-08-16 12:42:58 +00:00
Joel Sing
3d679c6554 syscall: use correct type for TIOCSPGRP/TIOCGPGRP
These ioctls take a pid_t (generally a C integer aka int32) and not an int64 - we
currently get away with this on little endian 64 bit platforms, since the bytes
fall into the correct place, however this breaks on big endian 64 bit platforms
(like openbsd/mips64).

This is the same fix as CL 267605, however for libc based exec.

Updates #36435

Change-Id: I01ae4905cba5e1f8725fa6cb8c35403c511534b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/334881
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-08-16 10:46:11 +00:00
Joel Sing
fcdc3c098c runtime: make asmcgocall g0/gsignal checks consistent
In asmcgocall() we need to switch to the g0 stack if we're not already on
the g0 stack or the gsignal stack. The prefered way of doing this is to
check gsignal first, then g0, since if we are going to switch to g0 we will
need g0 handy (thus avoiding a second load).

Rewrite/reorder 386 and amd64 to check gsignal first - this shaves a few
assembly instructions off and makes the order consistent with arm, arm64,
mips64 and ppc64. Add missing gsignal checks to mips, riscv64 and s390x.

Change-Id: I1b027bf393c25e0c33e1d8eb80de67e4a0a3f561
Reviewed-on: https://go-review.googlesource.com/c/go/+/335869
Trust: Joel Sing <joel@sing.id.au>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-08-16 08:37:46 +00:00
Joel Sing
160d797260 runtime: correct mips64 asmcgocall signal stack behaviour
Do not switch to the g0 stack if we're already running on the signal
stack, otherwise all kind of fun ensues.

Updates #36435

Change-Id: I57f35d75b9ee4f92b997713b4cdd38ce881705e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/334880
Trust: Joel Sing <joel@sing.id.au>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-08-16 07:44:47 +00:00
Joel Sing
6a760d6c36 runtime: include pthread.h in defs_openbsd.go
This is required now that defs_openbsd.go has pthread related references.

Updates #36435

Change-Id: I73cdf23eef6aceea6f9b37b7702bdb3b560aa120
Reviewed-on: https://go-review.googlesource.com/c/go/+/334877
Trust: Joel Sing <joel@sing.id.au>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-08-16 07:41:07 +00:00
Tobias Klauser
7aa57a9687 runtime: remove unused getrlimit on linux/riscv64
Follow CL 94775 and CL 93655 which removed the (commented-out) usage
of this function on other platforms.

Change-Id: I28e0569d8531d0c09f3caefa7c4eb54fb5bd8a33
Reviewed-on: https://go-review.googlesource.com/c/go/+/334429
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-08-16 07:22:02 +00:00
Brad Fitzpatrick
57c115e1f6 crypto/sha{256,512}: unname result parameters for consistency
Sum224 and Sum256 didn't look the same at:

    https://golang.org/pkg/crypto/sha256/

Now they match. Likewise with sha512's funcs.

Per:
https://github.com/golang/go/wiki/CodeReviewComments#named-result-parameters

Change-Id: I6b88c8ef15141c78a6cddeb0960b3ad52db34244
Reviewed-on: https://go-review.googlesource.com/c/go/+/322329
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-08-16 03:24:20 +00:00
Robert Griesemer
717894cf80 cmd/compile/internal/types2: better error message for index syntax error (follow-up)
For #47704.

Change-Id: I09e6f638df0cd456a20a3b68ab55c47bb5b1f555
Reviewed-on: https://go-review.googlesource.com/c/go/+/342370
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>
2021-08-15 19:56:18 +00:00
Robert Griesemer
6ed9463133 cmd/compile/internal/syntax: better error message for index syntax error
Fixes #47704.

Change-Id: I1de9fd00baaa4b534c23f011ade54120f5153a9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/342369
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>
2021-08-15 19:08:56 +00:00
180909
48dfddbab3 lib/time: fix RFC 6557 url
Change-Id: I59406ee7dbab7b2a0404b62061af552b6b4ecf5f
GitHub-Last-Rev: 7cad5ae9ba
GitHub-Pull-Request: golang/go#47696
Reviewed-on: https://go-review.googlesource.com/c/go/+/342209
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-15 02:18:46 +00:00
Ian Lance Taylor
1162aae0ad time/tzdata: update links in comment
Change-Id: I141d29bb4adc957de5de1f8ed8867980fd3c8386
Reviewed-on: https://go-review.googlesource.com/c/go/+/342071
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-08-15 00:19:34 +00:00
Robert Findley
ff3469b1c2 cmd/dist: remove tests using the typeparams build tag
This stanza is no longer necessary now that the typeparams build tag is
not used.

Change-Id: I7bcc4a01e354e5130d50b00895a5b96c25c71502
Reviewed-on: https://go-review.googlesource.com/c/go/+/342153
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>
2021-08-14 22:44:35 +00:00
Jeff Wentworth
0a0a160d4d sync/atomic: fix documentation for CompareAndSwap
Fixes #47699

The documentation for CompareAndSwap atomic/value incorrectly labelled the function as CompareAndSwapPointer. This PR fixes that.

Change-Id: I6db08fdfe166570b775248fd24550f5d28e3434e
GitHub-Last-Rev: 41f7870792
GitHub-Pull-Request: golang/go#47700
Reviewed-on: https://go-review.googlesource.com/c/go/+/342210
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-14 16:56:14 +00:00
Robert Findley
49c688e45c cmd/compile/internal/types2: rename TypeParams to TParamList
The 'TypeParams' name is too easily confused with the singular
'TypeParam', and does not say anything about what type of collection it
is. We decided that TTuple was not great. TParamList seems OK for now,
though perhaps a better name will emerge.

Change-Id: I5eabdc91b1f666bb4c7ea8acdbebf7c372d19227
Reviewed-on: https://go-review.googlesource.com/c/go/+/341861
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>
2021-08-14 15:15:20 +00:00
Robert Findley
b2253c8041 cmd/compile/internal/types2: remove targs from substMap
Now that we always capture targs when constructing an instance, we no
longer need to pass them via the substMap. This simplifies the code and
resolves a TODO.

Change-Id: I592dccaeb89c7cc31ac037d919137bb762820365
Reviewed-on: https://go-review.googlesource.com/c/go/+/341859
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>
2021-08-14 15:15:06 +00:00
Rob Findley
456759b246 cmd/compile/internal/types2: use the orig object for Named.Obj
Exposing a synthetic type name for instantiated types is problematic:
there is no way to ensure that type instances are first created in the
same type checking pass, and therefore no guarantee that their
instantiation positions are the same. Even type checking a given package
with different file ordering could result in different positions being
associated with type instances. This is therefore an implementation
detail that we should not expose.

Keep the synthetic type name for accurate error reporting, but hide it
in the API.

Change-Id: I61f0e3ed322e97b157eb1ca316480f5719dcc174
Reviewed-on: https://go-review.googlesource.com/c/go/+/341858
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>
2021-08-14 15:14:57 +00:00
Rob Findley
2d250043b4 cmd/compile/internal/types2: simplify Named.under
Remove some unnecessary logic from Named.under:
 - no need to have special handling for Typ[Invalid]: this is the same
   as other cases where the underlying type is resolved.
 - use Underlying() to get the loaded and expanded underlying
 - no need for special handling of the first iteration

Change-Id: I2029711f51fa9eaaee11debadd55974a1376a980
Reviewed-on: https://go-review.googlesource.com/c/go/+/341857
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>
2021-08-14 15:14:49 +00:00
Rob Findley
50f4ebbdd3 cmd/compile/internal/types2: define Identical for instances
Instantiation of parameterized types may occur in other packages, so we
need an intrinsic notion of type identity for instances.

Add the natural definition: two instances are identical if their bases
and type arguments are identical.

Type unification was already considering type arguments, but has some
inaccurate logic with respect to objects. This will be addressed in a
follow-up CL.

Change-Id: Ib2ce67c05de65eb302ee588cc40c89c60018da50
Reviewed-on: https://go-review.googlesource.com/c/go/+/341856
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>
2021-08-14 15:14:43 +00:00
Rob Findley
fc27eb50ff cmd/compile/internal/types2: merge Instantiate and InstantiateLazy
Instantiate and InstantiateLazy have the same signature; on first
principles, if Instantiate should work for importers it should be
possible to consolidate these APIs.

This CL does this. In order to make it work, a typMap needs to be
threaded through type expansion to prevent infinite recursion in the
case that the Checker is nil.

Notably, Named types now must be expanded before returning from
Underlying(). This makes Underlying generally unsafe to call while type
checking a package, so a helper function safeUnderlying is added to
provide the previous behavior. This is probably overly conservative at
most call sites, but cleanup is deferred to a later CL.

Change-Id: I03cfb75bea0750862cd6eea4e3cdc875a7daa989
Reviewed-on: https://go-review.googlesource.com/c/go/+/341855
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>
2021-08-14 15:14:35 +00:00
hitzhangjie
7eaabae84d net: update IP.String doc to reflect RFC 5952 conformance
Fixes #44485

Change-Id: I1b1bf14245ef738342ec881ac4c99adbfc9c5b7d
GitHub-Last-Rev: ae0242c6d6
GitHub-Pull-Request: golang/go#47394
Reviewed-on: https://go-review.googlesource.com/c/go/+/337409
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2021-08-13 21:53:07 +00:00
korzhao
58490972c0 cmd/link: fix dead reference link
Change-Id: I0f53cc2b845f8a52fece2aaba1445a0ecb9cdc53
Reviewed-on: https://go-review.googlesource.com/c/go/+/341129
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-08-13 21:47:42 +00:00
Ian Lance Taylor
a95f1b51be test: change issue10441.go from "build" to "compile"
We use "build" for tests in the main package with a main function.
We use "compile" for tests that are not in the main package.

Change-Id: I9876b55a9e4672277483fd24e69058d439c66658
Reviewed-on: https://go-review.googlesource.com/c/go/+/334329
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-13 21:43:20 +00:00
180909
89a4f99640 lib/time: fix tz-link ftp url
Change-Id: Id09c01192dea6a6f26cbad7222946266587acfda
GitHub-Last-Rev: c4f99aedcd
GitHub-Pull-Request: golang/go#47639
Reviewed-on: https://go-review.googlesource.com/c/go/+/341389
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-08-13 20:51:21 +00:00
Ian Lance Taylor
2eb4d68833 runtime: don't use systemstack for BeforeFork/AfterFork
In https://golang.org/cl/140930043 syscall.BeforeFork was changed to
call beforefork via onM. This was done because at the time BeforeFork
was written in C but was called from Go. While the runtime was being
converted to Go, calls to complex C functions used onM to ensure that
enough stack space was available.

In https://golang.org/cl/172260043 the syscall.BeforeFork and
beforefork functions were rewritten into Go. In this rewrite
syscall.BeforeFork continue to call beforefork via onM, although
because both functions were now in Go that was no longer necessary.

In https://golang.org/cl/174950043 onM was renamed to systemstack,
producing essentially the code we have today.

Therefore, the use of systemstack in syscall.BeforeFork (and
syscall.AfterFork) is a historical relic.  Remove it.

Change-Id: Ia570f556b20e8405afa6c5e707bd6f4ad18fd7ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/341335
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2021-08-13 20:50:48 +00:00
Ian Lance Taylor
bad1fc1265 test: add test case for CL 340609
The first version of CL 340609 for gofrontend passed all existing tests,
but not this one.

For #42076

Change-Id: I6491e2f186091bdae140b7f7befa511806a6478a
Reviewed-on: https://go-review.googlesource.com/c/go/+/340950
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>
2021-08-13 20:49:48 +00:00
Ian Lance Taylor
641e8bc2c7 test: add test case that caused a gofrontend compiler crash
For #47131

Change-Id: Ie2d5a2bd3dceec607544c43e6dc68bd5ea353091
Reviewed-on: https://go-review.googlesource.com/c/go/+/335172
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-13 20:47:06 +00:00
Dmitri Shuralyov
98f3d7fecb all: gofmt more (but vendor, testdata, and top-level test directories)
CL 294430 made packages in std and cmd modules use Go 1.17 gofmt format,
adding //go:build lines. This change applies the same formatting to some
more packages that 'go fmt' missed (e.g., syscall/js, runtime/msan), and
everything else that is easy and safe to modify in bulk.

Consider the top-level test directory, testdata, and vendor directories
out of scope, since there are many files that don't follow strict gofmt
formatting, often for intentional and legitimate reasons (testing gofmt
itself, invalid Go programs that shouldn't crash the compiler, etc.).

That makes it easy and safe to gofmt -w the .go files that are found
with gofmt -l with aforementioned directories filtered out:

	$ gofmt -l . 2>/dev/null | \
		grep -v '^test/' | \
		grep -v '/testdata/' | \
		grep -v '/vendor/' | wc -l
	      51

None of the 51 files are generated. After this change, the same command
prints 0.

For #41184.

Change-Id: Ia96ee2a0f998d6a167d4473bcad17ad09bc1d86e
Reviewed-on: https://go-review.googlesource.com/c/go/+/341009
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-08-13 20:45:17 +00:00
Michael Pratt
20a620fd9f runtime: drop SIGPROF while in ARM < 7 kernel helpers
On Linux ARMv6 and below runtime/internal/atomic.Cas calls into a kernel
cas helper at a fixed address. If a SIGPROF arrives while executing the
kernel helper, the sigprof lostAtomic logic will miss that we are
potentially in the spinlock critical section, which could cause
a deadlock when using atomics later in sigprof.

Fixes #47505

Change-Id: If8ba0d0fc47e45d4e6c68eca98fac4c6ed4e43c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/341889
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-13 14:00:23 +00:00
Jay Conrod
4c8ffb3baa cmd/internal/str: move package from cmd/go/internal/str
This will let cmd/cgo and cmd/link use this package for argument parsing.

For golang/go#41400

Change-Id: I12ee21151bf3f00f3e8d427faaaab2453c823117
Reviewed-on: https://go-review.googlesource.com/c/go/+/334730
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/341934
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-08-13 00:20:28 +00:00
Jay Conrod
4be75faa3e cmd/go: make fewer 'go mod' commands update go.mod
'go mod graph', 'go mod vendor', 'go mod verify', and 'go mod why'
will no longer edit go.mod or go.sum.

'go mod graph', 'go mod verify', and 'go mod why' may still fetch
files and look up packages as if they were able to update
go.mod. They're useful for debugging and should still work when go.mod
is a little broken.

This is implemented in modload.setDefaultBuildMod based on command
name for now. Super gross. Sorry. This should be fixed with a larger
refactoring for #40775.

Fixes golang/go#45551

Change-Id: If5f225937180d32e9a5dd252c78d988042bbdedf
Reviewed-on: https://go-review.googlesource.com/c/go/+/336151
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/341933
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-08-13 00:19:50 +00:00
Jay Conrod
1fffeddfe9 cmd/go: add -testsum flag to update go.sum in script tests
-testsum may be set to "tidy", "listm", or "listall". When set,
TestScript runs 'go mod tidy', 'go list -m -mod=mod all', or
'go list -mod=mod all' at the beginning of each test that has a go.mod
file in its root directory. If the test passes and go.mod or go.sum
was updated, TestScript will rewrite the test file with the initial
content of go.mod and go.sum (after the above command).

This is useful for writing tests that need a working go.sum and for
fixing tests that rely on -mod=mod.

For golang/go#41302

Change-Id: I63a5667621a5082ccedfc1bff33c3969c29e8b3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/336150
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/341932
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-08-13 00:12:29 +00:00