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

47994 Commits

Author SHA1 Message Date
David Chase
a690a5d75f cmd/compile: ensure spills of int/float reg args land in abi slots
We noticed a while ago that register argument spills were not always
landing where they should.

Updates #40724.

Change-Id: I0b7c3279a2f6270577481c252bae4568cbb6e796
Reviewed-on: https://go-review.googlesource.com/c/go/+/308510
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-04-09 14:33:44 +00:00
David Chase
d138ee2cfb test/abi: disable test on windows for now
This tickles some other bug, do this to clear builders.

Updates #40724.
Updates #45465.

Change-Id: Id51efbcf474865da231fcbc6216e5d604f99c296
Reviewed-on: https://go-review.googlesource.com/c/go/+/308889
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-04-09 14:31:01 +00:00
Bryan C. Mills
dcc801ef81 cmd/go/internal/modload: actually set the depth field passed to newRequirements
This was missed in CL 308515, and didn't show up in testing because so
few codepaths (and tests) actually depend on this behavior so far.

For #36460

Change-Id: I98b1962eb64d371884e15a3356c95f7ea80c7d21
Reviewed-on: https://go-review.googlesource.com/c/go/+/308810
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-04-09 13:19:10 +00:00
Jason A. Donenfeld
c432917061 cmd/link: link libgcc archive after mingw archives
When compiling with the race detector using modern mingw, this prevents:

    libgcc(.text): relocation target ___chkstk_ms not defined

Change-Id: I2095ad09a535505b54f9ff2d3075fd20ac85e515
Reviewed-on: https://go-review.googlesource.com/c/go/+/295910
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2021-04-09 13:10:36 +00:00
Dan Scales
519f223aa2 cmd/compile: reduce overhead of RParams in types.Type
Changed RParams in types.Type to be a pointer to a slice, rather than a
slice itself, in order to reduce it from three words to one words, since
the large majority of types will not be generic or instantiated from a
generic type.

Additional cleanup: remove operation OTYPEINST, which we don't have need
of, since all type instantiations are either handled by types2 or happen
automatically during some form of stenciling.

Both of these are useful cleanups before the Go 1.17 freeze.

Change-Id: I61ad56b3c698b30d2cb5a2cdd12263202c54f49c
Reviewed-on: https://go-review.googlesource.com/c/go/+/308770
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
2021-04-09 12:56:04 +00:00
Manlio Perillo
4d7d7a4c50 os: replace os.MkdirTemp with T.TempDir
Updates #45402

Change-Id: Ib8e62a13ddff884e4d34b3a0fdc9a10db2b68da6
Reviewed-on: https://go-review.googlesource.com/c/go/+/308109
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-04-09 09:01:07 +00:00
ian woolf
8518aac314 crypto/x509: replace os.MkdirTemp with T.TempDir
Updates #45402

Change-Id: Ifb1fa5232a0fa1be62e886643cec9deaa3b312ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/308409
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-04-09 04:03:50 +00:00
Cherry Zhang
d25c4fbe05 test: do not run softfloat test with regabiargs
Softfloat mode with register ABI is not implemented yet. In
particular, we did not rewrite the float types in AuxCalls to
integer types, so arguments are still passed in floating point
registers, which do not exist in softfloat mode. To make it work
I think we may want to reorder softfloat pass with expand_calls
pass. We also need to rewrite the OpArgFloatRegs for the spilling
of non-SSA-able arguments, which may involve renumbering interger
arguments. Maybe in softfloat mode we want to just define the
ABI with 0 float registers. They are not fundamentally hard, but
may be not worth doing for the moment, as we don't use softfloat
mode on AMD64 anyway.

Run the test with noregabiargs. Also in the compiler reject
-d=softfloat if regabiargs is enabled.

Change-Id: I8cc0c2cfa88a138bc1338ed8710670245f1bd2cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/308710
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-04-09 00:11:25 +00:00
Cherry Zhang
19034fa855 cmd/objdump: update test with register ABI
With register ABI, the disassembly of the function may not
contain a "movq" instruction (which used to be e.g. storing
arguments to stack). Look for "jmp" instruction instead. This is
also in consistent with the test for Go assembly syntax.

Change-Id: Ifc9e48bbc4f85c4e4aace5981b3a0f8ae925f6d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/308652
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-04-09 00:09:47 +00:00
Jay Conrod
5811605df9 cmd/go: fix mod_list_update_nolatest on windows
Fixes #45456

Change-Id: I7d313d7fbe29813f2abb062b6feec43280c2d283
Reviewed-on: https://go-review.googlesource.com/c/go/+/308653
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-04-08 22:45:16 +00:00
Manlio Perillo
d67e739989 os/exec: replace os.MkdirTemp with T.TempDir
Updates #45402

Change-Id: Idbd8067759d58bc57c52ede4ddccc98ab0ae18fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/308129
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
2021-04-08 21:58:35 +00:00
Cherry Zhang
ec367e5b05 cmd/compile: adjust interface conversion function selection with 0-sized fields
0-sized fields do not affect how arguments are passed under the
register ABI. But it does affect the size and alignment of the
type, and may affect the choice of interface conversion function.
Specifically, struct { a [0]int32; b [4]byte } should be passed in
memory, therefore should not use convT32.

Change-Id: Idfa21af79b81c196b50253b0be1fa4edecd12b45
Reviewed-on: https://go-review.googlesource.com/c/go/+/308651
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-04-08 21:26:36 +00:00
Cherry Zhang
6c98ecda10 cmd/compile: don't use fast32/64 map functions for aggregates
Under register ABI, aggregates like [2]uint32 is passed
differently than a uint64. For now, don't use the fast version
of the map functions for non-trivial aggregates.

GOEXPERIMENT=regabi,regabiargs can now pass make.bash, modulo
staleness checks.

TODO: maybe find some way to use the fast functions. Maybe
unsafe-cast to uint32/64 then call the map function. But need to
make the type checker happy.

Change-Id: If42717280dde12636fb970798cf1ca8fb29a3d06
Reviewed-on: https://go-review.googlesource.com/c/go/+/308650
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
2021-04-08 21:02:58 +00:00
David Chase
a9e475a15a cmd/compile: add recursive-invalidate Value method, use in expand_calls
This removes more unused values during transformation.
Leaving them in the tree can create type conflicts in OpArg* references.

Updates #40724.
Updates #44816.
Fixes #45417.

Change-Id: I07dcb7b4b2bf8d79e22e0543cb2fb52c2ececb96
Reviewed-on: https://go-review.googlesource.com/c/go/+/308589
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-04-08 20:26:47 +00:00
Ian Lance Taylor
7e583806d8 runtime/cgo: clarify Handle documentation
Fixes #45427

Change-Id: Ic67630a5f39d8789a4a30c6b4ee30946bc50382e
Reviewed-on: https://go-review.googlesource.com/c/go/+/308230
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ainar Garipov <gugl.zadolbal@gmail.com>
Reviewed-by: Changkun Ou <euryugasaki@gmail.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-04-08 20:24:09 +00:00
Than McIntosh
bb76193a7f cmd/compile: fix buglet in walk convert phase relating to convF32/64
The helper function used by the compiler's walk phase to determine
whether a param can be passed in a single float register wasn't quite
correct (didn't allow for the possibility of struct with two fields,
first zero size and second float). Fix up the helper to take this
case into account.

Updates #40724.

Change-Id: I55b42a1b17ea86de1d696788f029ad3aae4a179c
Reviewed-on: https://go-review.googlesource.com/c/go/+/308689
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-04-08 19:58:50 +00:00
Austin Clements
793844207d cmd/go: strip GOEXPERIMENT from hash salt
The go command salts cache hashes using runtime.Version() (the Go
version the go command was built with) in order to separate objects
built with different versions of Go.

CL 307820 added the active GOEXPERIMENTs to the result of
runtime.Version, which affected cmd/go's hash salt. Since dist builds
go_bootstrap with all GOEXPERIMENTs disabled, but then go_bootstrap
builds the final go binary with the GOEXPERIMENTs passed to make.bash,
if any GOEXPERIMENTs were passed, go_bootstrap and the final go binary
produce different cache hashes. At the very end of dist, it uses the
final go binary to check the hashes of all packages, but these hashes
were produced by go_bootstrap, so it concludes everything is stale.

This should fix the builders that enable GOEXPERIMENTs, including the
regabi and staticlockranking builders.

Change-Id: Ie389929dff6f7b6eff2b19a2f43507e72be5f32e
Reviewed-on: https://go-review.googlesource.com/c/go/+/308591
Trust: Austin Clements <austin@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-04-08 19:52:03 +00:00
Jason A. Donenfeld
98dd205fa4 runtime: see whether gp==nil before checking preemption state
Recent we changed from using gFromTLS to using gFromSP, which apparently
sometimes returns nil. This causes crashes when dereferenced. Fix that
by not checking for preemption in the case that gFromSP returns nil.

Fixes #44679.

Change-Id: I0199ebe7cd113379c5fa35c27932d913df79092a
Reviewed-on: https://go-review.googlesource.com/c/go/+/297390
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2021-04-08 19:51:32 +00:00
Dan Scales
46ffbec1d6 cmd/compile: break out transformations of tcCompLit into transformCompLit
Create transformCompLit, which does the transformations done by
tcCompLit without the typechecking. This removes the final use of the
old typechecker in the noder2 pass.

Other changes:

 - Used the transformCompLit in stringstorunelit(), which creates an
   OCOMPLIT that needs transformation as well.

 - Fixed one place in transformIndex where we were still using
   typecheck.AssignConv, when we should be using its equivalent
   noder.assignconvfn.

The go/test tests always run with -G=3, and I also tested that the "go
test" tests continue to run correctly with -G=3.

Change-Id: I4a976534ab7311cf2a5f43841026dbf7401e62b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/308529
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-04-08 19:32:37 +00:00
Bryan C. Mills
ecca94a7d1 cmd/go/internal/modload: add a dormant depth type
This change adds the depth constants 'lazy' and 'eager', but leaves
the go117EnableLazyLoading constant set to false so that the depth in
effect is still always 'eager'.

The go117EnableLazyLoading constant can be toggled to true once the
module loader has been updated to maintain the lazy-loading invariants
in the go.mod file. In the meantime, this will allow me to
progressively replace uses of go117LazyTODO with real conditions and
locally toggle lazy-mode on to see which tests are still failing
(or which behaviors are missing test coverage).

For #36460

Change-Id: Ifd358265a3903a5000003c2072f28171f336e15c
Reviewed-on: https://go-review.googlesource.com/c/go/+/308515
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>
Reviewed-by: Michael Matloob <matloob@golang.org>
2021-04-08 19:30:34 +00:00
Cherry Zhang
96a6745088 runtime: use register ABI in panicIndex/Slice functions
runtime.panicIndex*/panicSlice* functions move the arguments in
the right place then tail calls goPanicIndex*/Slice* using
internal ABI. (It uses internal ABI to avoid wrappers, because
the callee needs to get the caller's PC, to know whether it panics
in the runtime.) This CL makes it to use the register ABI if it
is enabled.

Change-Id: Id2ebb51b4bfb3e9aa7cb66d0a9aee63fccee5ecd
Reviewed-on: https://go-review.googlesource.com/c/go/+/308649
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-04-08 18:47:17 +00:00
Than McIntosh
ca8540affd cmd/compile: fix buglet in walk convert phase relating to convT64
The function runtime.convT64 accepts a single uint64 argument, but the
compiler's rules in the walk phase for determining whether is it ok to
pass a value of type T to a call to runtime.convT64 were slightly off.
In particular the test was allowing a type T with size less than eight
bytes but with more than one internal element (e.g. a struct). This
patch tightens up the rules somewhat to prevent this from happening.

Updates #40724.

Change-Id: I3b909267534db59429b0aa73a3d73333e1bd6432
Reviewed-on: https://go-review.googlesource.com/c/go/+/308069
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-04-08 17:44:21 +00:00
David Chase
d474b6c824 test/abi: clean up test to fix builders
go.mod file was not tidy, made builders sad.

Updates #40724.

Change-Id: I28371a1093108f9ec473eb20bb4d185e35dee67d
Reviewed-on: https://go-review.googlesource.com/c/go/+/308590
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-04-08 17:43:33 +00:00
Jay Conrod
23e1d36a87 cmd/go: in 'go list -m', ignore "not found" errors loading updates
"Not found" and "no matching version" errors usually indicate the user
is offline or the proxy doesn't have a version of go.mod that could
provide retractions. 'go list -m -u' should still succeed.

We should still report unclassified errors though. Previously, we
reported most errors loading retractions but did not report errors
loading updates. This change makes those operations more consistent.

Fixes #45305

Change-Id: I2f23a566c9481bc7ff229a177f39d78f6a8aae77
Reviewed-on: https://go-review.googlesource.com/c/go/+/306572
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2021-04-08 17:18:24 +00:00
Bryan C. Mills
0e09e4143e cmd/go: assume Go 1.16 semantics uniformly for unversioned modules
However, still only trigger -mod=vendor automatically (and only apply
the more stringent Go 1.14 vendor consistency checks) if the 'go'
version is explicit. This provides maximal compatibility with Go 1.16
and earlier: Go 1.11 modules will continue not to fail vendor
consistency checks, but scripts that assume semantics up to Go 1.16
for unversioned modules will continue to work unmodified.

Fixes #44976
For #36460

Change-Id: Idb05ca320023f57249c71fc8079218e8991d1ff9
Reviewed-on: https://go-review.googlesource.com/c/go/+/308509
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-04-08 16:55:27 +00:00
Michael Anthony Knyszek
31d2556273 runtime: set up read-only dummy TLS space for needm on Windows
On Windows, TLS is uninitialized for C threads calling into Go code.
In this path, before calling into user Go code, we call into needm which
runs without an m, but whose purpose is to pick one up. While in Go
code, we may occasionally restore the G register from TLS for a number
of reasons. Rather than try to flag all these cases, given that needm
(and its callees) are already somewhat special, just set up a dummy TLS
space for it that's read-only. If it ever actually tries to write to
this space (it shouldn't), it will fail loudly. Otherwise, code that
restores the G register will simply load a zero value, but that's OK
since needm is careful never to require the G at any point, because it
doesn't yet have a valid G. Furthermore, by the time needm returns, it
will have set up TLS properly for a Windows C thread, so there's no need
to do anything extra afterwards.

For #40724.

Change-Id: I34e8095059817e4ee663505e89cda8785b634b98
Reviewed-on: https://go-review.googlesource.com/c/go/+/307872
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-04-08 16:37:24 +00:00
David Chase
283b02063b cmd/compile: sanitize before/after expansion OpSelectN references
In expand_calls, OpSelectN occurs both before and after the rewriting.
Attempting to rewrite a post-expansion OpSelectN is bad.
(The only ones rewritten in place are the ones returning mem;
others are synthesized to replace other selection chains with
register references.)

Updates #40724.
Updates #44816#issuecomment-815258897.

Change-Id: I7b6022cfb47f808d3ce6cc796c067245f36047f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/308309
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-04-08 15:03:31 +00:00
Austin Clements
1be8be4acc cmd/go: fix TestNewReleaseRebuildsStalePackagesInGOPATH
CL 307818 added a package that the runtime depends on, but didn't
update the list of runtime dependencies in this test.

This should fix the longtest builder failures.

Change-Id: I5f3be31b069652e05ac3db9b1ce84dd5dfe0f66f
Reviewed-on: https://go-review.googlesource.com/c/go/+/308469
Trust: Austin Clements <austin@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-04-08 15:02:51 +00:00
David Chase
912c4e29d3 reflect: fix typo in result-in-registers case
t is the type of the function that was called
tv is the type of the result

This fixes the failures for
GOEXPERIMENT=regabi,regabiargs go test go test text/template
GOEXPERIMENT=regabi,regabiargs go test go test html/template

Updates #40724.

Change-Id: Ic9b02d72d18ff48c9de1209987cc39da619c2241
Reviewed-on: https://go-review.googlesource.com/c/go/+/308189
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2021-04-08 14:23:47 +00:00
panchenglong01
1749f3915e sync: update misleading comment in map.go about entry type
As discussed in: https://github.com/golang/go/issues/45429,  about entry
type comments, it is possible for p == nil when m.dirty != nil, so
update the commemt about it.

Fixes #45429

Change-Id: I7ef96ee5b6948df9ac736481d177a59ab66d7d4d
GitHub-Last-Rev: 202c598a0a
GitHub-Pull-Request: golang/go#45443
Reviewed-on: https://go-review.googlesource.com/c/go/+/308292
Reviewed-by: Changkun Ou <euryugasaki@gmail.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Trust: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-04-08 14:08:29 +00:00
ianwoolf
a7e16abb22 runtime: replace os.MkdirTemp with T.TempDir
Updates #45402

Change-Id: I3aa82fc2486b4de49b45388bbab24f5ffe558f91
Reviewed-on: https://go-review.googlesource.com/c/go/+/307989
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
2021-04-08 07:33:58 +00:00
Matthew Dempsky
2123dfba65 Revert "cmd/compile/internal/noder: limit the number of goroutine"
This reverts commit c274a7c03b.

Reason for revert: this can cause a compiler deadlock, and there's
no demonstrable benefit to making the change.

Change-Id: I42325ddea68d37db16fd0061c5baaee112b755b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/308369
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-04-08 06:08:49 +00:00
Austin Clements
8752454ece cmd/internal/objabi: clarify initialization of Experiments
Currently objabi.Experiments is set via side-effect from an init
function, which makes their initialization process somewhat unclear
(indeed, I've messed this up before) and opens the possibility of
accessing them from another init function before it's initialized.

Originally, this init function set several variables, but at this
point it sets only objabi.Experiments, so switch to just using a
variable initializer to make the initialization process clear.

Change-Id: Id0d2ac76ae463824bbf37a9305e8643a275f1365
Reviewed-on: https://go-review.googlesource.com/c/go/+/307821
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-04-08 02:17:23 +00:00
Austin Clements
5159c83641 runtime,cmd/link: include GOEXPERIMENTs in runtime.Version(), "go version X"
This adds the set of GOEXPERIMENTs to the build version if it differs
from the default set of experiments. This exposes the experiment
settings via runtime.Version() and "go version <binary>".

Change-Id: I143dbbc50f66a4cf175469199974e18848075af6
Reviewed-on: https://go-review.googlesource.com/c/go/+/307820
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-04-08 02:17:22 +00:00
Austin Clements
a8e55538af cmd/internal/objabi: make GOEXPERIMENT be a diff from default experiments
Right now the rules around handling default-on experiments are
complicated and a bit inconsistent. Notably, objabi.GOEXPERIMENT is
set to a comma-separated list of enabled experiments, but this may not
be the string a user should set the GOEXPERIMENT environment variable
to get that list of experiments: if an experiment is enabled by
default but gets turned off by GOEXPERIMENT, then the string we report
needs to include "no"+experiment to capture that default override.

This complication also seeps into the version string we print for "go
tool compile -V", etc. This logic is further complicated by the fact
that it only wants to include an experiment string if the set of
experiments varies from the default.

This CL rethinks how we handle default-on experiments. Now that
experiment state is all captured in a struct, we can simplify a lot of
this logic. objabi.GOEXPERIMENT will be set based on the delta from
the default set of experiments, which reflects what a user would
actually need to pass on the command line. Likewise, we include this
delta in the "-V" output, which simplifies this logic because if
there's nothing to show in the version string, the delta will be
empty.

Change-Id: I7ed307329541fc2c9f90edd463fbaf8e0cc9e8ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/307819
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-04-08 02:17:20 +00:00
Austin Clements
89ca1ce9a8 cmd/compile,cmd/internal/objabi: abstract out object header string
Change-Id: Idbbb4cb7127b93afa34a8aa18bbdaad1f206ab6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/308090
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-04-08 02:17:19 +00:00
Austin Clements
b675e52e95 internal/goexperiment: consolidate experiment-enabled constants
Currently, we have boolean and integral constants for GOEXPERIMENTs in
various places. Consolidate these into automatically generated
constants in the internal/goexperiment package.

Change-Id: I42a49aba2a3b4c722fedea23a613162cd8a67bee
Reviewed-on: https://go-review.googlesource.com/c/go/+/307818
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-04-08 02:17:18 +00:00
Austin Clements
6304b401e4 internal/goexperiment,cmd: consolidate GOEXPERIMENTs into a new package
Currently there's knowledge about the list of GOEXPERIMENTs in a few
different places. This CL introduces a new package and consolidates
the list into one place: the internal/goexperiment.Flags struct type.

This package gives us a central place to document the experiments as
well as the GOEXPERIMENT environment variable itself. It will also
give us a place to put built-time constants derived from the enabled
experiments.

Now the objabi package constructs experiment names by reflecting over
this struct type rather than having a separate list of these names
(this is similar to how the compiler handles command-line flags and
debug options). We also expose a better-typed API to the toolchain for
propagating enabled experiments.

Change-Id: I06e026712b59fe2bd7cd11a869aedb48ffe5a4b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/307817
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-04-08 02:17:16 +00:00
Austin Clements
0c4a08cb74 cmd/asm,runtime: reduce spellings of GOEXPERIMENTs
Currently, the objabi.Experiment fields use Go-standard CamelCase, the
GOEXPERIMENT environment variable flags and build tags use all
lowercase, and the asm macros use upper-case with underscores.

This CL makes asm use the lowercase names for macros so there is one
less spelling, e.g., GOEXPERIMENT_regabiargs. This also makes them
consistent with the GOOS_* and GOARCH_* macros, which also use lower
case.

Change-Id: I305cd89af5e8cd1a89cc148746c034bcfd76db3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/307816
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-04-08 02:17:15 +00:00
Austin Clements
aeaa4519b5 runtime: drop haveexperiment, sys.GOEXPERIMENT
We have ways to statically access experiments now, so we don't need a
relatively clunky string-parsing dynamic way to do it.

Change-Id: I5d75480916eef4bde2c30d5fe30593180da77ff2
Reviewed-on: https://go-review.googlesource.com/c/go/+/307815
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-04-08 02:17:13 +00:00
ianwoolf
f60aa7a18c syscall: replace os.MkdirTemp with T.TempDir
Updates #45402

Change-Id: I573133d6b987e8ac23e3e2018652612af684c755
Reviewed-on: https://go-review.googlesource.com/c/go/+/307990
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-04-07 23:00:58 +00:00
Paul E. Murphy
fca51ba24a cmd/internal/obj: remove ppc64 msr support from MOV* insns
These are privileged instructions, and thus will never work with
usermode code. I don't think there is a case where this isn't
true.  The motivation is to simplify handling of MOV* opcodes.

Assembler support for recognizing the MSR as a register is
retained.

Change-Id: Ic33f021a20057b64e69df8ea125e23dd8937e38d
Reviewed-on: https://go-review.googlesource.com/c/go/+/307814
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Carlos Eduardo Seo <carlos.seo@linaro.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Trust: Carlos Eduardo Seo <carlos.seo@linaro.org>
2021-04-07 20:23:47 +00:00
Makdon
e306d06063 runtime/map: update comment for gc/reflect
update comment cause gc/reflect.go has been moved to reflectdata/reflect.go

In the commit (attach below), gc/reflect.go is moved to reflectdata/reflect.go
So the  comment referring gc/reflect.go should be updated to reflectdata/reflect.go

There maybe other places that refers gc/reflect.go that should be updated.
I would work around it soon.

commit:
de65151e50
e4895ab4c0

Change-Id: Ieed5c48049ffe6889c08e164972fc7825653ac05
GitHub-Last-Rev: eec9c2328d
GitHub-Pull-Request: golang/go#45421
Reviewed-on: https://go-review.googlesource.com/c/go/+/307930
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2021-04-07 18:44:30 +00:00
Robert Griesemer
b3064b66d0 cmd/compile/internal/types2: combine two loops (cleanup of TODO)
Follow-up on https://golang.org/cl/306170.

Change-Id: I71b451382b6780101a0c94174ebe579e8a0684c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/307949
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-04-07 16:57:40 +00:00
Tobias Klauser
4520da486b cmd/pack: use testing.T.TempDir in tests
Change-Id: I7371259cf5d64f04698ae1477c3de1255664178d
Reviewed-on: https://go-review.googlesource.com/c/go/+/307969
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Than McIntosh <thanm@google.com>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-04-07 13:24:10 +00:00
Cherry Zhang
b55d900529 cmd/compile: correct argument area size for typedmemmove/typedmemclr
When the write barrier pass emits typedmemmove/typedmemclr calls,
even the arguments are in registers, we still need to leave space
for the spill slots. Count that space. Otherwise when the callee
spills arguments it may clobber locals on the caller's frame.

Change-Id: I5326943427feaf66cab7658a5bef55b3baf5d345
Reviewed-on: https://go-review.googlesource.com/c/go/+/307824
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
2021-04-07 13:14:57 +00:00
徐志伟
d6aa162f30 embed, testing/fstest: small optimization for ReadDir
Change-Id: If8dc6d917b55119b5662ce5b0b87328d220d684d
GitHub-Last-Rev: cc9a1d5a7e
GitHub-Pull-Request: golang/go#45388
Reviewed-on: https://go-review.googlesource.com/c/go/+/307250
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
2021-04-07 09:59:58 +00:00
ianwoolf
5d5f779db4 net/http: replace os.MkdirTemp with T.TempDir
Updates: #45402
Change-Id: Ia61f422d058bf57fc3688abc25597d6cc1692c51
Reviewed-on: https://go-review.googlesource.com/c/go/+/307653
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-04-07 06:53:34 +00:00
Robert Griesemer
4bbe046aad cmd/compile/internal/syntax: add "~" operator
Change-Id: I7991103d97b97260d9615b7f5baf7ec75ad87d1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/307370
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-04-07 05:19:41 +00:00
Robert Griesemer
836356bdaa cmd/compile/internal/types2: process errors in src order during testing
Follow-up on https://golang.org/cl/305573.
As a consequence, re-enable test case that caused problems with that CL.

Change-Id: Ibffee3f016f4885a55b8e527a5680dd437322209
Reviewed-on: https://go-review.googlesource.com/c/go/+/307216
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-04-07 05:19:36 +00:00