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

49060 Commits

Author SHA1 Message Date
Josh Bleecher Snyder
d9349175ad net: remove allocation from UDPConn.WriteTo
Duplicate some code to avoid an interface.

name                  old time/op    new time/op    delta
WriteToReadFromUDP-8    6.38µs ±20%    5.59µs ±10%  -12.38%  (p=0.001 n=10+9)

name                  old alloc/op   new alloc/op   delta
WriteToReadFromUDP-8     64.0B ± 0%     32.0B ± 0%  -50.00%  (p=0.000 n=10+10)

name                  old allocs/op  new allocs/op  delta
WriteToReadFromUDP-8      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)

Windows is temporarily stubbed out.

Updates #43451

Change-Id: Ied15ff92268c652cf445836e0446025eaeb60cc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/331489
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2021-08-16 23:54:32 +00:00
Cherry Mui
8ff16c1990 runtime: accept restartable sequence pcdata values in isAsyncSafePoint
If the pcdata value indicates a restartable sequence, it is okay
to asynchronously preempt (and resume at the restart PC). Accept
it in isAsyncSafePoint.

Fixes #47530.

Change-Id: I419225717c8eee5812f3235338262da5895aad0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/340011
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Austin Clements <austin@google.com>
2021-08-16 23:32:14 +00:00
Hans
df9c5d8f5d cmd/cgo: fix unused parameter warnings in generated _cgo_main.c
Applying -Werror compiler option to request warnings is an usual
way to discover potential errors. Go user may put a cgo directive
in preamble: `// #cgo CFLAGS: -Werror=unused-parameter`.

However, the directive also takes effect on the cgo generated files.
I cleaned _cgo_main.c to help Go user only concentrate on warnings
of their own file.

Fixes #43639

Change-Id: I9112f02ae5226f2fc87a8650d19faee59cddd588
GitHub-Last-Rev: f09d172f97
GitHub-Pull-Request: golang/go#46358
Reviewed-on: https://go-review.googlesource.com/c/go/+/322232
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>
2021-08-16 23:03:03 +00:00
Josh Bleecher Snyder
213e157d3a testing/fstest: allow specifying file for "." in MapFS
Prior to this commit, specifying a file for "." in MapFS
created an invalid fs.FS and caused infinite recursion in fs.WalkDir.

Fixes #46776

Change-Id: Ia9e4ae1125355a74dba9ee6b36451b7fda75a862
Reviewed-on: https://go-review.googlesource.com/c/go/+/328409
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-08-16 22:27:47 +00:00
Andy Pan
c04a32e59a net: avoid memory copy calling absDomainName
Change-Id: I8ea9bec8bc33e29b8c265fbca40871bc23667144
Reviewed-on: https://go-review.googlesource.com/c/go/+/330470
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Damien Neil <dneil@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-16 21:38:38 +00:00
Tobias Klauser
6406227d71 runtime: skip sysmon workaround on NetBSD >= 9.2
Detect the NetBSD version in osinit and only enable the workaround for
the kernel bug identified in #42515 for NetBSD versions older than 9.2.

For #42515
For #46495

Change-Id: I808846c7f8e47e5f7cc0a2f869246f4bd90d8e22
Reviewed-on: https://go-review.googlesource.com/c/go/+/324472
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-16 21:24:44 +00:00
Jay Conrod
a05a7d49a9 cmd/go: address code review comments in test cgo_path_space_quote
For CL 334732.

Change-Id: I5cb88cd7d5e4edf6006bbaeb17723dac2cdf0fd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/339590
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/341938
2021-08-16 20:23:26 +00:00
Jay Conrod
54ce8793a8 cmd: update x/tools and remove copy of txtar
golang.org/x/tools/txtar is the main location for this package. We
don't need our own copy.

For golang/go#47193

Change-Id: I480eb591f57a0d05b433a657653e2021e39354eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/337352
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/341937
2021-08-16 20:23:19 +00:00
Jay Conrod
742dcba7bb cmd: support space and quotes in CC and CXX
The CC and CXX environment variables now support spaces and quotes
(both double and single). This fixes two issues: first, if CC is a
single path that contains spaces (like 'c:\Program
Files\gcc\bin\gcc.exe'), that should now work if the space is quoted
or escaped (#41400). Second, if CC or CXX has multiple arguments (like
'gcc -O2'), they are now split correctly, and the arguments are passed
before other arguments when invoking the C compiler. Previously,
strings.Fields was used to split arguments, and the arguments were
placed later in the command line. (#43078).

Fixes golang/go#41400
Fixes golang/go#43078

NOTE: This change also includes a fix (CL 341929) for a test that was
broken by the original CL. Commit message for the fix is below.

[dev.cmdgo] cmd/link: fix TestBuildForTvOS

This test was broken in CL 334732 on darwin.

The test invokes 'go build' with a CC containing the arguments
-framework CoreFoundation. Previously, the go command split CC on
whitespace, and inserted the arguments after the command line when
running CC directly. Those arguments weren't passed to cgo though,
so cgo ran CC without -framework CoreFoundation (or any of the other
flags).

In CL 334732, we pass CC through to cgo, and cgo splits arguments
using str.SplitQuotedFields. So -framework CoreFoundation actually
gets passed to the C compiler. It appears that -framework flags are
only meant to be used in linking operations, so when cgo invokes clang
with -E (run preprocessor only), clang emits an error that -framework
is unused.

This change fixes the test by moving -framework CoreFoundation out of
CC and into CGO_LDFLAGS.

Change-Id: I2d5d89ddb19c94adef65982a8137b01f037d5c11
Reviewed-on: https://go-review.googlesource.com/c/go/+/334732
Trust: Jay Conrod <jayconrod@google.com>
Trust: Michael Matloob <matloob@golang.org>
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/+/341936
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-08-16 20:23:11 +00:00
Jay Conrod
41d991e4e1 cmd/internal/str: add utilities for quoting and splitting args
JoinAndQuoteFields does the inverse of SplitQuotedFields: it joins a
list of arguments with spaces into one string, quoting arguments that
contain spaces or quotes.

QuotedStringListFlag uses SplitQuotedFields and JoinAndQuoteFields
together to define new flags that accept lists of arguments.

For golang/go#41400

Change-Id: I4986b753cb5e6fabb5b489bf26aedab889f853f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/334731
Trust: Jay Conrod <jayconrod@google.com>
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/341935
2021-08-16 20:23:03 +00:00
180909
4466141822 cmd/go: add document -json in testflag
Fixes #47628

Change-Id: I2776fbc22d8a73ca7adc2cf7ad85669d57cc7eae
GitHub-Last-Rev: 826907b079
GitHub-Pull-Request: golang/go#47683
Reviewed-on: https://go-review.googlesource.com/c/go/+/341991
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2021-08-16 20:22:08 +00:00
Jay Conrod
8d2066177d cmd/go/internal/modfetch/codehost: refactor gitRepo.loadRefs to be harder to misuse
Previously, callers of loadRefs were expected to always
call via gitRepo.refsOnce.Do and check r.refsErr. This hasn't always
been the case.

This change makes loadRefs cache its own result with r.refsOnce and
return refs and refsErr. Callers can use it more like a normal
function.

CL 297950 is related. Previously, a commit like 0123456789ab could be
resolved to a v0.0.0 pseudo-version when tags couldn't be fetched, but
a shorter commit like 0123456 or a branch name like "master" couldn't
be resolved the same way. With this change, tags must be fetched
successfully ('git ls-remote' must succeed).

For #42751

Change-Id: I49c9346e6c72609ee4f8b10cfe1f69781e78457e
Reviewed-on: https://go-review.googlesource.com/c/go/+/338191
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-08-16 20:21:13 +00:00
Damien Neil
ec27168712 net/http: drop headers with invalid keys in Header.Write
Don't let handlers inject unexpected headers by setting keys like:
	w.Header().Set("Evil: x\r\nSmuggle", y)

Fixes #47711.

Change-Id: I459ce1c79bc273a84230a0f5b665f81c46dbc672
Reviewed-on: https://go-review.googlesource.com/c/go/+/342530
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-16 20:02:13 +00:00
Robert Findley
d35035f84e go/types: use the orig object for Named.Obj
This is a port of CL 341858 to go/types.

Change-Id: I9fba8941069aaacd641a19e3068de3a769e14e50
Reviewed-on: https://go-review.googlesource.com/c/go/+/342482
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>
2021-08-16 18:52:20 +00:00
Robert Findley
ddffe30a21 go/types: rename TypeParams to TParamList
This is a straightforward port of CL 341861 to go/types.

Change-Id: I4f21170eb2ea1e5395a6eba5132f34aa1d53bb20
Reviewed-on: https://go-review.googlesource.com/c/go/+/342481
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 18:45:07 +00:00
Robert Findley
631af58e20 go/types: remove targs from substMap
This is a straightforward port of CL 341859 to go/types.

Change-Id: I5d2508f516b5cf4d8775c3a77cc8bed5d4bec338
Reviewed-on: https://go-review.googlesource.com/c/go/+/342480
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>
2021-08-16 18:44:57 +00:00
Robert Findley
d1ba047edf go/types: simplify Named.under
This is a straighforward port of CL 341857 to go/types.

Change-Id: I3407676232b595662c1470627771a13263703061
Reviewed-on: https://go-review.googlesource.com/c/go/+/342479
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>
2021-08-16 18:44:48 +00:00
Robert Findley
56a919f17f go/types: define Identical for instances
This is a port of CL 341856 to go/types. It is adjusted to use the
NumTArgs/TArg API of go/types, which has not yet been ported to types2.

Change-Id: I6faeec027f4ae08634267001f473263703e80c5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/342478
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>
2021-08-16 18:44:38 +00:00
Robert Findley
ff36d11470 go/types: merge Instantiate and InstantiateLazy
This is a straightforward port of CL 341855 to go/types.

Change-Id: I42a74df7a54f5d03aab31ad75dfeb3d1ba775354
Reviewed-on: https://go-review.googlesource.com/c/go/+/342477
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>
2021-08-16 18:44:32 +00:00
Robert Findley
2460cf8602 go/types: remove Named.SetTArgs
This is a port of CL 341290 to go/types; SetTArgs is a potentially
error-prone API.

Change-Id: I484e62d71a0e09be1e19f8e63994912a88364eca
Reviewed-on: https://go-review.googlesource.com/c/go/+/342476
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>
2021-08-16 18:44:12 +00:00
Robert Findley
281ed619f8 go/types: parameterized functions must have a body
This is a port of CL 340911 to go/types. The new check differs slightly,
due to go/ast storing type parameters on the function type, rather than
declaration. The error was positioned on the function name for
consistency with types2 (and because that's a better position).

Change-Id: Icdfc76cd65fab215139180b710293a0d79709297
Reviewed-on: https://go-review.googlesource.com/c/go/+/342475
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>
2021-08-16 18:44:05 +00:00
Robert Findley
aab1d1fcb9 go/types: expand is only required for *Named types
This is a port of CL 340749 to go/types.

Change-Id: I2af602d357486ee2f45b91c11c4b02ec6b58ed38
Reviewed-on: https://go-review.googlesource.com/c/go/+/342474
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>
2021-08-16 18:43:57 +00:00
Robert Findley
9ff61acbd7 go/types,types2: superficial changes to align types and types2
This CL contains an assortment of superficial fixes noticed while
self-reviewing the most recent stack of ports. It also makes a couple
adjustments to termlist_test.go, in both go/types and
cmd/compile/internal/types2.

Change-Id: I64c8cda5e1704e86ac11c6ffc86d55248f44ef79
Reviewed-on: https://go-review.googlesource.com/c/go/+/342490
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 18:43:31 +00:00
Robert Findley
fda8ee8b07 go/types: make Interface.Complete a no-op
This is a partial port of CL 340255 to go/types. Of course we can't
delete Interface.Complete, but make it a no-op.

Completing interfaces is no longer necessary.

Change-Id: Ida3c84cc94713f14a646c7682f5d4ae5339a0faa
Reviewed-on: https://go-review.googlesource.com/c/go/+/342489
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 18:42:49 +00:00
Cuong Manh Le
e61d1445ab cmd/compile: fix panic with dead hidden closures
Currently, for hidden closures, we always push them to compile queue
during typechecking. If the hidden closure is discarded from the outer
function body during deadcode, any desugaring phase after deadcode won't
be applied to the closure. Thus, some un-expected OPs are passed to
downstream passes, which they can't handle, the compiler goes boom!

To fix this, we keep track of discarded hidden closures during deadcode
pass, and won't compile them then.

Fixes #47712

Change-Id: I078717d5d1f4f2fa39cbaf610cfffbb042e70ceb
Reviewed-on: https://go-review.googlesource.com/c/go/+/342350
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: Matthew Dempsky <mdempsky@google.com>
2021-08-16 18:20:12 +00:00
Matt Layher
5c7a460a1c syscall: hoist Getsockname out of NetlinkRIB loops
Calling Getsockname once to fetch the Pid field from the *SockaddrNetlink
is necessary, but this data will remain static for the rest of the netlink
socket's lifetime. Moving this call and type assertion outside of the inner
loops will remove a number of unnecessary system calls.

Change-Id: I7e7e81866af1a31fccdaaf7531efd6cc4cbb8926
Reviewed-on: https://go-review.googlesource.com/c/go/+/336369
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-08-16 17:40:17 +00:00
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