1
0
mirror of https://github.com/golang/go synced 2024-09-29 12:14:28 -06:00
Commit Graph

49732 Commits

Author SHA1 Message Date
Robert Griesemer
41bb7446dc cmd/compile/internal/types2: don't panic if targs don't match tparams when substituting
This is a clean port of CL 351337 from go/types to types2.

Change-Id: I974bf79fcc1ec0016c38e4c0b361d05f7b44e649
Reviewed-on: https://go-review.googlesource.com/c/go/+/351466
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-09-22 20:53:48 +00:00
Cherry Mui
5b75a9b2c3 cmd/compile: update comments with ABI aliases/wrappers
ABI aliases are gone.

Change-Id: I0f5676d8730cac14b7495dd6c0c1e08ca85a1c77
Reviewed-on: https://go-review.googlesource.com/c/go/+/351531
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-09-22 19:37:42 +00:00
Robert Griesemer
1e57748892 cmd/compile, go/types: allow any anywhere (as a type)
Adjust types2 and go/types and some test cases.

Because `any` is not treated specially anymore in constraint
position we get additional errors in constraints if `any` is
used before Go1.18 (in addition to the error that type parameter
lists are not permitted before Go1.18).

Fixes #33232.

Change-Id: I85590c6094b07c3e494fef319e3a38d0217cf6f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/351456
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-09-22 19:19:49 +00:00
Roland Shoemaker
7a03ca65b3 internal/fuzz,cmd/compile: don't add race instrumentation to counters
Don't add race detector instrumentation to the fuzzing counters,
allowing usage of -race without immediately triggering the
detector. Also fixes a minor race in contextReader.Read.

Fixes #48307

Change-Id: Idb2cfeaa4283f8a74473b4bac6cd68eed577e943
Reviewed-on: https://go-review.googlesource.com/c/go/+/351453
Trust: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-09-22 18:44:36 +00:00
Cherry Mui
ccfc41eee0 cmd/compile: check out-of-range shifts on ARM and ARM64
When encoding ARM or ARM64 shifted register operand, check that
the shift is in range.

Change-Id: If0014933bfd0a1b8eaaa01e0220a6eeb17ab9f40
Reviewed-on: https://go-review.googlesource.com/c/go/+/351530
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-09-22 18:32:21 +00:00
Elias Naur
635e49388b cmd/cgo: add go:notinheap annotation to Windows handle types
Fixes #42018

Change-Id: I6a40f3effe860e67a45fca2e8ab86f3e9887ffee
Reviewed-on: https://go-review.googlesource.com/c/go/+/350070
Trust: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
2021-09-22 18:10:24 +00:00
Archana R
e128749be8 hash/crc32: improve performance of ppc64SlicingUpdateBy8 on ppc64le
Reduce the number of instructions in the short loop of
ppc64SlicingUpdateBy8 function by combining MOVWZ and SRD into a SRD
with appropriate parameters performing the same operation and remove
MOVWZ R7,R7 from the loop
This change produces the following improvements on POWER9. None of the
other tests regress. Improvments on other POWERPC platforms similar.

name                                     old time/op    new time/op
delta

CRC32/poly=IEEE/size=15/align=0            80.5ns ± 0%    70.6ns ± 0%
-12%
CRC32/poly=IEEE/size=15/align=1            80.5ns ± 0%    70.6ns ± 0%
-12%
CRC32/poly=IEEE/size=512/align=1            151ns ± 0%     139ns ± 0%
-7%
CRC32/poly=IEEE/size=1kB/align=1            167ns ± 0%     155ns ± 0%
-7%
CRC32/poly=Castagnoli/size=15/align=0      80.2ns ± 0%    70.5ns ± 0%
-12%
CRC32/poly=Castagnoli/size=15/align=1      80.2ns ± 0%    70.5ns ± 0%
-12%
CRC32/poly=Castagnoli/size=512/align=1      150ns ± 0%     139ns ± 0%
-7%
CRC32/poly=Castagnoli/size=1kB/align=1      166ns ± 0%     155ns ± 0%
-6%

Change-Id: I424709041c30d1c637b595d0845e3ae78dc3e0a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/350989
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-09-22 16:53:49 +00:00
Cherry Mui
74ba70be68 cmd/link: use keyed literal for AbiSymKindToSymKind
The correspondence is clearer. Also avoid accidental mismatch.

Change-Id: Ibd9a31cfcd7c2301614f3496cac67cbae99972a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/351334
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-09-22 16:24:17 +00:00
Cherry Mui
55d22f7490 cmd/link: remove ABI aliases
It is now gone.

Change-Id: I59f68b324af706476695de2f291dd3aa5734e192
Reviewed-on: https://go-review.googlesource.com/c/go/+/351332
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-09-22 15:49:52 +00:00
Cherry Mui
a630783ba0 cmd/internal/obj: remove ABI aliases from object file
Change-Id: I8a51f054e017e0116dee4e435b60c08d72e998e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/351331
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-09-22 15:49:42 +00:00
Bryan C. Mills
5ee32ff252 cmd/go: proceed with GOPATH unset if the command doesn't use it
For #43938

Change-Id: I0937b9bb6de3d29d7242ee61f053d4803277dc0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/351329
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-09-22 15:46:33 +00:00
Roland Shoemaker
ccf140f3d7 internal/fuzz: allocate memory for mutated strings
Rather than directly pointing at the underlying scratch slice, allocate
memory for strings. This prevents mutation of previous values we've
passed to the fuzz function, which may be retained by something that
expects them to be immutable.

Fixes golang/go#48308

Change-Id: Iee9bed1a536fdc4188180e8e7c1c722f641271d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/351312
Trust: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-09-22 15:38:34 +00:00
Cherry Mui
91c2318e67 runtime: call cgocallbackg indirectly on PPC64
This is CL 312669, for PPC64.

cgocallback calls cgocallbackg after switching the stack. Call it
indirectly to bypass the linker's nosplit check. The nosplit check
fails after CL 351271, which removes ABI aliases. It would have
been failing before but the linker's nosplit check didn't resolve
ABI alias (it should) so it didn't catch that. Removing the ABI
aliases exposes it. For this partuclar case it is benign as there
is actually a stack switch in between.

Should fix PPC64 build.

Change-Id: I49617aea55270663a9ee4692c54c070c5ab85470
Reviewed-on: https://go-review.googlesource.com/c/go/+/351469
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2021-09-22 15:00:53 +00:00
Katie Hockman
dc5b1d31c8 [dev.fuzz] internal/fuzz: more fuzzing output adjustments
This change also makes it so that non-recoverable errors (which should
be pretty rare) will no longer be minimized as these failures can be
flakier and harder to minimize successfully.

Updates golang/go#48132

Change-Id: I991d837993ea1fb0304b3ec491cc725ef5265652
Reviewed-on: https://go-review.googlesource.com/c/go/+/351273
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-09-22 14:28:57 +00:00
Lynn Boger
09d3df0183 cmd/compile/internal/ppc64: add initial spill support
This adds some initial support for spilling and reloading
registers in the new ABI for PPC64.
- Code has been added to allow argument registers
to be spilled around the morestack call in the prolog.
- Functions for loadRegResult and spillRegArg have been
added and set in the arch config for PPC64.

Change-Id: I4ede3c61468857aaf06f804b5e7c3dd9da9cf36b
Reviewed-on: https://go-review.googlesource.com/c/go/+/351189
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-09-22 13:55:47 +00:00
Cherry Mui
98989f2a74 cmd/compile, cmd/link: avoid ABI aliases
In the past we introduced ABI aliases, in preparation for ABI
wrappers. Now that we have ABI wrappers implemented, we don't
need ABI aliases. If ABI wrappers are not enabled, ABI0 and
ABIInternal are actually identical, so we can resolve symbol
references without distinguish them. This CL does so by
normalizing ABIInternal to ABI0 at link time. This way, we no
longer need to generate ABI aliases.

This CL doesn't clean up everything related to ABI aliases, which
will be done in followup CLs.

Change-Id: I5b5db43370d29b8ad153078c70a853e3263ae6f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/351271
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-09-22 13:50:24 +00:00
Robert Findley
e925c4640d go/types: add a test for argument error unwrapping
Add a sanity-check test that ArgumentErrors unwrap their inner Err.

Change-Id: I5a670a490deeabc03a64e42b3843f79d622ba958
Reviewed-on: https://go-review.googlesource.com/c/go/+/351338
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-09-22 13:30:35 +00:00
Robert Findley
7158ae4e32 go/types: don't panic if targs don't match tparams when substituting
Invalid code may produce instances where the number of type arguments
does not match the number of type parameters. Such code will cause an
error, but should not cause a panic when substituting in those invalid
instances.

Fixes #48529

Change-Id: Ie5ff5ace55921540a7224cc5022ef9ff7649361a
Reviewed-on: https://go-review.googlesource.com/c/go/+/351337
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-09-22 13:29:32 +00:00
jiahua wang
051df0d722 io: fix spelling in documentation for writerFunc
Change-Id: I9f55188859944e1b2b140d3547bcfcb335c5ff50
Reviewed-on: https://go-review.googlesource.com/c/go/+/351370
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Robert Griesemer <gri@golang.org>
2021-09-22 03:45:00 +00:00
Cuong Manh Le
085c609a70 cmd/go: fix go command fails to perform concurrent compilation
CL 344909 fixed the bug in the order of passing gcflags from cmd/go to
cmd/compile. In that process, we merged the flags passed by cmd/go and
the flags specified by "-gcflags" to one variable. That causes the
gcBackendConcurrency function fails to detect concurrency level, since
when it expects only the latter flags.

To fix this, just don't merge those two variables, so we can now
correctly detect the concurrency level and passing the right -c to
the compiler.

Fixes #48490

Change-Id: I1293a7d6b946b7fccdd5cd34a38452bf6306e115
Reviewed-on: https://go-review.googlesource.com/c/go/+/351049
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: Bryan C. Mills <bcmills@google.com>
2021-09-22 03:36:42 +00:00
Robert Findley
3664950ef6 go/types: tweaks to ArgumentError to be more idiomatic
This CL makes a few changes to the new ArgumentError type to be more
idiomatic:
 - Use a pointer receiver for methods.
 - Export fields, similarly to Error. ArgumentError has a clear meaning
   (an error associated with an index), so there is no need to hide its
   representation.
 - Add an Unwrap method to access the underlying error.
 - Say explicitly that the error returned from Instantiate may wrap
   *ArgumentError. There is no need to commit to an API that always
   returns an error with dynamic type *ArgumentError.

Updates #47916

Change-Id: Ib1a43e921f247794e7155280ccbf5a6775ed3978
Reviewed-on: https://go-review.googlesource.com/c/go/+/351335
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-09-22 01:41:09 +00:00
Matthew Dempsky
04572fa29b cmd/compile: use BMI1 instructions for GOAMD64=v3 and higher
BMI1 includes four instructions (ANDN, BLSI, BLSMSK, BLSR) that are
easy to peephole optimize, and which GCC always seems to favor using
when available and applicable.

Updates #45453.

Change-Id: I0274184057058f5c579e5bc3ea9c414396d3cf46
Reviewed-on: https://go-review.googlesource.com/c/go/+/351130
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-09-22 00:15:27 +00:00
Kir Kolyshkin
30faf968b1 os/user: implement go native GroupIds
Currently, GroupIds (a method that returns supplementary group IDs
for a user) is not implemented when cgo is not available, or osusergo
build tag is set, or the underlying OS lacks getgrouplist(3).

This adds a native Go implementation of GroupIds (which parses
/etc/group) for such cases, together with some tests.

This implementation is used:
 - when cgo is not available;
 - when osusergo build tag is set;
 - on AIX (which lacks getgrouplist(3));
 - on Illumos (which only recently added getgrouplist(3)).

This commit moves listgroups_unix.go to cgo_listgroups_unix.go, and adds
listgroups_unix.go which implements the feature.

NOTE the +build equivalent of go:build expression in listgroups_unix.go
is not provided as it is going to be bulky. Go 1.17 already prefers
go:build over +build, and no longer fail if a file contains go:build
without +build, so the absence of +build is not a problem even with Go
1.17, and this code is targeted for Go 1.18.

Updates #14709
Updates #30563

Change-Id: Icc95cda97ee3bcb03ef028b16eab7d3faba9ffab
Reviewed-on: https://go-review.googlesource.com/c/go/+/330753
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-09-21 23:11:47 +00:00
Dan Scales
48cf96c256 cmd/compile: don't create or instantiate methods on shape types
We should never use or need methods on non-interface shape types. We do
have corresponding functions instantiated with the appropriate
shape types that take the dictionary and the shape-based receiver as the
first two arguments. Each such function has the same name as what the
corresponding method would be, so it's best not to create the methods
(which would create confusion for import/export). This fixes issue
48414, which happened because of the confusion between these two
functions/methods.

Fixes #48414

Change-Id: I401fbdad791bdb5792617449cad68aa8df1d9911
Reviewed-on: https://go-review.googlesource.com/c/go/+/351114
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>
2021-09-21 20:39:31 +00:00
Robert Griesemer
f6f6621312 go/types: make ptrRecv a method hasPtrRecv of Func
This is a clean port of CL 351310 from types2 to go/types
with the necessary changes to methodset.go which doesn't
exist in types2.

Change-Id: Ifdac820d3be14c7bfa778b7bca3f6ba58d220b2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/351311
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-09-21 20:29:00 +00:00
Robert Griesemer
5efa8ff340 cmd/compile/internal/types2: make ptrRecv a method hasPtrRecv of Func
Reading the Func.hasPtrRecv field directly (without consulting a
possibly existing signature) caused some issues in an earlier CL.
The function ptrRecv (in lookup.go) does the right thing but is
not easily discoverable.

Rename ptrRecv to hasPtrRecv and make it a method of Func; rename
Func.hasPtrRecv field to Func.hasPtrRecv_ to avoid name collisions.
Make it clear in field comment that it must not be read through the
hasPtrRecv method.

Change-Id: Ida9856c4789e499538eb34377be781655958fd5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/351310
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-09-21 20:28:55 +00:00
Robert Griesemer
2fc7df93fe cmd/compile/internal/importer: remove // UNREVIEWED comments from tests
The importer tests are exact copies of the corresponding test files in
$GOROOT/src/go/internal/gcimporter/testdata/. With these changes, diff
applied recursively doesn't show any differences anymore among the
existing files between the directories

	src/cmd/compile/internal/importer/testdata
	src/go/internal/gcimporter/testdata

Change-Id: I1fdd70a3d4d5e55f1fc580892d1d38cabbdab81b
Reviewed-on: https://go-review.googlesource.com/c/go/+/351309
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-09-21 20:28:50 +00:00
Robert Griesemer
ebc6ce40ce go/types: return typeHash value without blanks
This is an adjusted port of CL 349990 from types2 to go/types:
typeHash remains unexported but is adjusted to not contain blanks.

Change-Id: I37fa826b8a185e3c275ae9bea29a3b0ed386d2c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/351171
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-09-21 20:28:43 +00:00
Robert Griesemer
7dfe686a91 cmd/compile/internal/types2: export Named.Orig as Named.Origin
This is a slightly adjusted port of CL 350996 from go/types to types2.

Change-Id: I8f5902ecb20a4b4d2a5ef0d3641d857bc3a618e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/351170
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-09-21 20:28:38 +00:00
Robert Griesemer
1367a60b06 cmd/compile/internal/types2: remove report parameter from infer and inferB
This is a clean port of CL 350049 from go/types to types2.

Change-Id: Ifc8551a772535f7b8e943bfbd9febbb78333fa68
Reviewed-on: https://go-review.googlesource.com/c/go/+/351169
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-09-21 20:28:32 +00:00
Jay Conrod
2f70ce36d7 internal/fuzz: temporarily work around test failures after dev.fuzz merge
- Skip test_fuzz_cache and test_fuzz_seed_corpus on 386.
- Skip worker benchmarks when race mode is enabled.
- Stub coverage function on platforms we haven't tested yet. It's
  causing package initialization to panic on aix/ppc64.

For #48504

Change-Id: I79318b52b11a33fca66476b5050445d07422ef36
Reviewed-on: https://go-review.googlesource.com/c/go/+/351117
Trust: Jay Conrod <jayconrod@google.com>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-09-21 20:13:48 +00:00
Robert Findley
fdf2053d52 go/types: remove the report parameter from infer and inferB
The report parameter is now always true, so we can simplify these
functions.

Change-Id: I851adad3011beef9c83172210ff5e93c624372cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/350049
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-09-21 20:13:22 +00:00
Robert Findley
6097ebe627 go/types: record all instances, not just inferred instances
This change modifies the way we record instance information. It changes
the Info.Inferred map to use the instantiated *ast.Ident as its key, and
record information for all instances, not just those that were produced
via function type inference. Accordingly, Info.Inferred is renamed to
Info.Instances, and the Inferred type is renamed to Instance, with its
Sig field changed to Type.

This was largely motivated by suggestions from mdempsky on the go/types
API proposal (#47916). In our analysis, always using the *ast.Ident as
key and recording all instances makes the API easier to understand and
use.

Instance.TArgs is also renamed to TypeArgs, consistent with other name
changes.

Updates #47916

Change-Id: Ic25ad0cfd65fee6b05e513843c3866ee7a77cfe3
Reviewed-on: https://go-review.googlesource.com/c/go/+/349629
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-09-21 18:08:25 +00:00
Jay Conrod
cc85bd07cc testing, cmd/go: clarify documentation
This CL removes 'go help fuzz' but expands the testing package
documentation with much of the same information. It also removes
documentation for the unimplemented -keepfuzzing flag and makes a
number of other clarifications.

Addressing comments in CL 348469.

Updates #46629

Change-Id: I12ab5971c900c2e43f2c2d83c6705e8cd642388b
Reviewed-on: https://go-review.googlesource.com/c/go/+/351113
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Katie Hockman <katie@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>
2021-09-21 17:53:09 +00:00
Keith Randall
fa5c5043bc encoding/xml: truncate generic type names
xml names can't have any of '[],' in them, which might appear in
generic type names. Truncate at the first '[' so the names are still valid.

Fixes #48318

Change-Id: I110ff4269f763089467e7cf84b0f0c5075fb44b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/349349
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2021-09-21 17:25:35 +00:00
Josh Bleecher Snyder
13aa0d8f57 runtime: fix output for bad pcHeader
With print, the output all runs together.
Take this opportunity to clean up and label all the fields.
Print pluginpath unilaterally; no reason not to.
Wrap long lines. Remove pointless newline from throw.

Change-Id: I37af15dc8fcb3dbdbc6da8bbea2c0ceaf7b5b889
Reviewed-on: https://go-review.googlesource.com/c/go/+/350734
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-09-21 16:34:59 +00:00
Josh Bleecher Snyder
901ac46df8 cmd/link: document generator symbols more
And make the existing docs easier to parse.

In particular, document the interaction with relocations.

Change-Id: I97579f88d9248c12e64af723a946959b88d4b674
Reviewed-on: https://go-review.googlesource.com/c/go/+/351112
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-09-21 16:34:40 +00:00
Jay Conrod
d542765896 cmd/go: disable gofuzzbeta build tag by default
It was enabled by default on the dev.fuzz branch so that users could
check in fuzz targets without breaking their builds.

Now that dev.fuzz is merged to master, users should switch to a go1.18
release constraint instead.

For #47037

Change-Id: I0475368eb4570fe0c7027a3ae8f6950449c1a9ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/351118
Trust: Jay Conrod <jayconrod@google.com>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-09-21 16:25:51 +00:00
Josh Bleecher Snyder
9ab6af9837 runtime, cmd/link: fix comment typos
Change-Id: I33a10417939bfcfec117d6ad49c42312731ac30f
Reviewed-on: https://go-review.googlesource.com/c/go/+/350733
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-09-21 15:38:11 +00:00
Russ Cox
7d67f8d435 text/template: implement short-circuit and, or
Making the builtin and and or functions use short-circuit
evaluation was accepted as a proposal in April 2019,
but we never got around to implementing it. Do that.

Fixes #31103.

Change-Id: Ia43d4a9a6b0ab814f2dd3471ebaca3e7bb1505cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/321490
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2021-09-21 14:02:52 +00:00
Bryan C. Mills
39e08c6cd7 io: relax documented Seeker invariants that do not hold in practice
Use “or” instead of “and” to describe error behavior.
On error, nearly all Seeker implementations in the Go repo return
0 instead of “the new offset”. (Arguably on error “the new offset”
is the same as the previous offset, but some Seeker implementations
don't have that offset readily available.)

Don't claim that “any positive offsite is legal”.
In practice, most of the Seeker implementations within the Go standard
library do not allow “[s]eeking to any [arbitrary] positive offset”:
some reject all out-of-bounds offsets, and some reject only a subset
that happen to overflow some underlying representation. Since some
positive offsets may be rejected, we cannot claim that seeking to
those offsets “is legal”. However, to avoid invalidating existing
Seeker implemetations we must not require an implementation to reject
invalid positive offsets either.

This is technically a breaking change, since callers of Seek are no
longer allowed to assume that a Seek resulting in an arbitrary
positive offset will succeed. However, since basically none of the
existing implementations actually conformed to the documented behavior
I believe this falls under the “specification errors” exception to the
Go 1 compatibility policy.

Fixes #48316

Change-Id: Ib1b478599b20ad5361bcc97fe8ceb84f74e6d971
Reviewed-on: https://go-review.googlesource.com/c/go/+/349054
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2021-09-21 13:18:09 +00:00
Lynn Boger
9cbdc1d48f internal/abi: define PPC64 register ABI constants
Add the PPC64 register ABI constants, and allow
GOEXPERIMENT regabi values to be set for PPC64.

Change-Id: I1c9562ae6669c604db69a7b8ad935d1bc117c899
Reviewed-on: https://go-review.googlesource.com/c/go/+/343870
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
2021-09-21 12:51:45 +00:00
Lynn Boger
cceadf8527 cmd/compile/internal: add ABI register information for ppc64
This adds the defines for ABI registers on PPC64. Other changes
will need to be in place before they are enabled.

Updates #40724

Change-Id: Ia6ead140719eda9aa99b99c48afafff684c33039
Reviewed-on: https://go-review.googlesource.com/c/go/+/351110
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
2021-09-21 12:47:07 +00:00
Robert Griesemer
c7543e5db9 go/types: fixes for pointer receivers of instantiated methods
Backported changes from CL 349998 that were not already in go/types.

Change-Id: I0341f76c080b4e73567b3e917a4cbbe2e82d3703
Reviewed-on: https://go-review.googlesource.com/c/go/+/351149
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-09-21 03:15:20 +00:00
Robert Griesemer
986f8ea6b4 cmd/compile/internal/types2: minor cleanup of instantiation
This is a clean port of CL 349429 from go/types to types2
with minor adjustments for types2 names.

Change-Id: Ie6a39a01f074acb9e6565ffacb34c94666ae9a95
Reviewed-on: https://go-review.googlesource.com/c/go/+/349999
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-09-21 00:59:42 +00:00
Robert Griesemer
d1fd3eb40e cmd/compile/internal/types2: instantiate methods when instantiating Named types
This is a port of CL 349412 from go/types to types2 with
minor adjustments for types2 names, plus CL 350143 (slightly
simplified) to make sure we always get a new signature in
instantiated methods, plus CL 350810 to take care of pointer
receivers. It also contains adjustments to the compiler (provided
by Dan Scales) make it work with the types2 changes.

Change-Id: Ia683a3a8adba3c369701c411d786092f02e77efe
Reviewed-on: https://go-review.googlesource.com/c/go/+/349998
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-09-21 00:59:39 +00:00
Robert Griesemer
2f87b9c942 go/types, types2: remove duplicate resolve call
Change-Id: I8afe8bf6304b6a3645bbd8d4d19f152862c58725
Reviewed-on: https://go-review.googlesource.com/c/go/+/351119
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-09-21 00:26:53 +00:00
Matthew Dempsky
d7e3e442fe internal/buildcfg: fix test for GOAMD64=v3 ./all.bash
If GOAMD64 is set to a bogus value, goamd64() will return the default
value, which may not necessarily be 1. Instead, just test that it sets
Error.

Change-Id: Ibbc26608c1ae24e645c7753ef5765b9c2fdc089e
Reviewed-on: https://go-review.googlesource.com/c/go/+/351129
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-09-20 23:04:13 +00:00
Ian Lance Taylor
ba1c52d7d7 text/template: initialize template before locking it
For #39807
Fixes #48436

Change-Id: I75f82fd8738dd2f11f0c69b1230e1be1abc36024
Reviewed-on: https://go-review.googlesource.com/c/go/+/350730
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2021-09-20 23:00:47 +00:00
Jay Conrod
6e81f78c0f [dev.fuzz] Merge remote-tracking branch 'origin/dev.fuzz' into merge-fuzz
Change-Id: I3976e624fe2817d06b708005c994f6832f6d4357
2021-09-20 15:14:47 -07:00