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

55268 Commits

Author SHA1 Message Date
Keith Randall
c75b10be0b runtime/race: add GOAMD64=v3 version of linux race .syso
Makes -race mode faster, in the 15% speedup range.

Update #53743

Change-Id: I735eb71902b41c924c9f885ded8f7a350a56b751
Reviewed-on: https://go-review.googlesource.com/c/go/+/444396
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-10-21 05:28:30 +00:00
Ian Lance Taylor
4c61e079c0 encoding/gob: support large slices in slice decode helpers
The slice decode helpers weren't aware of partially allocated slices.

Also add large slice support for []byte.

Change-Id: I5044587e917508887c7721f8059d364189831693
Reviewed-on: https://go-review.googlesource.com/c/go/+/443777
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-20 23:11:47 +00:00
Cherry Mui
4725c71b73 cmd/compile: copy blank parameter node when substituting function type
When a function type is copied (e.g. for substituting type
parameters), we make copies of its parameter ir.Name nodes, so
they are not shared with the old function type. But currently a
blank (_) identifier is not copied but shared. The parameter
node's frame offset is assigned (in ABI analysis) and then used in
the concurrent backend. Shared node can cause a data race. Make a
new blank parameter node to avoid sharing. (Unified IR does already
not have this problem. This fixes non-unified-IR mode.)

This seems to fix #55357.

Change-Id: Ie27f08e5589ac7d5d3f0d0d5de1a21e4fd2765c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/443158
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2022-10-20 22:16:41 +00:00
Keith Randall
8415ec8c98 cmd/compile: in compiler errors, print more digits for floats close to an int
Error messages currently print floats with %.6g, which means that if
you tried to convert something close to, but not quite, an integer, to
an integer, the error you get looks like "cannot convert 1 to type
int", when really you want "cannot convert 0.9999999 to type int".

Add more digits to floats when printing them, to make it clear that they
aren't quite integers. This helps for errors which are the result of not
being an integer. For other errors, it won't hurt much.

Fixes #56220

Change-Id: I7f5873af5993114a61460ef399d15316925a15a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/442935
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
2022-10-20 21:52:09 +00:00
qmuntal
160bb0e66b runtime: fix TestVectoredHandlerExceptionInNonGoThread
This test is failing on the windows-arm64-10 builder
https://build.golang.org/log/c161c86be1af83c349ee02c1b12eff5828818f50.

It is not failing on windows-arm64-11, so I guess it has something to
do with the compiler.

This CL simplifies the test so is easier to build.

Change-Id: I6e0e1cf237277628f8ebf892c70ab54cd0077680
Reviewed-on: https://go-review.googlesource.com/c/go/+/444438
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-10-20 18:45:28 +00:00
Joe Tsai
72c58fb771 time: implement strict RFC 3339 during marshal and unmarshal
We add strict checking to marshal and unmarshal methods,
rather than Parse to maintain compatibility in Parse behavior.
Also, the Time.Format method has no ability to report errors.

The Time.Marshal{Text,JSON} and Time.Unmarshal{Time,JSON} methods
are already documented as complying with RFC 3339, but have
edge cases on both marshal and unmarshal where it is incorrect.
The Marshal methods already have at least one check to comply
with RFC 3339, so it seems sensible to expand this to cover
all known violations of the specification.
This commit fixes all known edge cases for full compliance.

Two optimizations are folded into this change:

	1. parseRFC3339 is made generic so that it can operate
	   directly on a []byte as well as string.
	   This avoids allocating or redundant copying
	   when converting from string to []byte.

	2. When marshaling, we verify for correctness based
	   on the serialized output, rather than calling
	   attribute methods on the Time type. For example,
	   it is faster to check that the 5th byte is '-'
	   rather than check that Time.Year is within [0,9999],
	   since Year is a relatively expensive operation.

Performance:

	name            old time/op  new time/op  delta
	MarshalJSON     109ns ± 2%    99ns ± 1%   -9.43%  (p=0.000 n=10+10)
	UnmarshalText   158ns ± 4%   143ns ± 1%   -9.17%  (p=0.000 n=9+9)

Updates #54580
Updates #54568
Updates #54571

Change-Id: I1222e45a7625d1ffd0629be5738670a84188d301
Reviewed-on: https://go-review.googlesource.com/c/go/+/444277
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-20 16:29:38 +00:00
Joel Sing
c0f27eb3d5 cmd/compile/internal/ssa: wire up late lower block function
Currently, the lowerBlock function is reused with lateLowerValue, meaning
that any block rewriting rules in the late lower pass are silently ignored.
Change the late lower pass to actually use the lateLowerBlock function with
the lateLowerValue function.

Change-Id: Iaac1c2955bb27078378cac50cde3716e79a7d9f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/444335
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-20 16:13:20 +00:00
Bryan C. Mills
3e6ca3a506 cmd/go/internal/modload: update TestQueryImport to pass with tagged versions of x/net
For #48523.

Change-Id: Ied35d15462cbae1002e1db1e6e119a6c9f8323da
Reviewed-on: https://go-review.googlesource.com/c/go/+/444156
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
2022-10-20 15:29:06 +00:00
Mikael Urankar
0e56c31b85 runtime: Add vdso on freebsd/riscv64
Use rdtime to retrieve the timecounter, same as the FreeBSD libc.

Updates #53466

Change-Id: I48816e9100036f1ef483e4d3afcf10db0d3b85f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/443036
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Yuval Pavel Zholkover <paulzhol@gmail.com>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
2022-10-20 15:14:38 +00:00
Daniel Martí
4b5558ef01 go/build: remove stale reference to ioutil.ReadDir
The package moved away from the deprecated ioutil API some time ago.

Change-Id: Iecb1baa9285af1f721a04eb40f8dafdd72474c4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/438515
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-20 14:18:30 +00:00
Robert Griesemer
8190876240 go/types, types2: replace typecheck with mustTypecheck almost everywhere (cleanup)
Replace even in places where before we have a specific error message
or different control-flow (except in TestTypeString or TestObjectString)
because failing to type-check in virtually all cases represents an error
in the test itself.

Change-Id: I9f1e6d25bddd92c168353409b281b5a3f29a747c
Reviewed-on: https://go-review.googlesource.com/c/go/+/443915
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-10-19 22:02:15 +00:00
Robert Griesemer
27f094b17c go/types, types2: consolidate helper functions for tests (cleanup)
Instead of having various inconsistent helper functions, rely on
4 helper functions with consistent naming and parameters:

- parse and mustParse
- typecheck and mustTypecheck

Panic rather than call t.Fatal in the mustX functions to simplify
their use.

Use the new functions in tests consistently.

Change-Id: Ib19dc5cc470b51512c23c09df32c379dc3eb8f4b
Reviewed-on: https://go-review.googlesource.com/c/go/+/443757
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-10-19 22:01:11 +00:00
Robert Griesemer
35e54da996 go/types, types2: simplify test setup in a couple of places (cleanup)
Change-Id: I4e7a0ffad49f1c3b50520648d66f18dd4c9bde55
Reviewed-on: https://go-review.googlesource.com/c/go/+/443779
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-10-19 21:48:42 +00:00
Robert Griesemer
8265683dda go/types: remove special handling for .go1 files in tests
All but local tests are now shared and reside in internal/types;
and there are no .go1 files anymore.

Change-Id: I3f8374e85639348de3cb8b568a7a05df5f9c2a38
Reviewed-on: https://go-review.googlesource.com/c/go/+/444276
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-10-19 21:47:37 +00:00
Robert Griesemer
bfcc3a755c go/types, types2: remove global goVersion flag (cleanup)
Now that we have an easy mechanism to set the Go version with a comment
line directly in test files, we don't need this flag anymore.

Change-Id: Ic1f1a6fdf2c6c692512bff49650916ec43645aee
Reviewed-on: https://go-review.googlesource.com/c/go/+/444275
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2022-10-19 21:46:46 +00:00
qmuntal
6fe3ccd74c runtime: ignore exceptions from non-Go threads on windows arm/arm64
If there is no current G while handling an exception it means
the exception was originated in a non-Go thread.

The best we can do is ignore the exception and let it flow
through other vectored and structured error handlers.

I've removed badsignal2 from sigtramp because we can't really know
if the signal is bad or not, it might be handled later in the chain.

Fixes #50877
Updates #56082

Change-Id: Ica159eb843629986d1fb5482f0b59a9c1ed91698
Reviewed-on: https://go-review.googlesource.com/c/go/+/442896
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
2022-10-19 20:21:26 +00:00
Bryan C. Mills
4a164a44de go/internal/gcimporter,cmd/compile/internal/importer: use testenv.MustHaveGoBuild directly
These tests previously had a “skipSpecialPlatforms” function, added in
CL 8611 to skip tests on (apparently) NaCL and iOS. The iOS builders
no longer match the condition (GOOS=ios is its own thing now), and the
NaCL port no longer exists.

The name of the function also isn't very evocative, since it doesn't
say what is “special” about the platforms to cause them to be
skipped.m

Since the check is intending to run the tests only on platforms where
gc export data is available, and to a first approximation
“gc export data is available” on exactly the platforms that can run
“go build” to produce that export data, we can use the testenv function
instead of a one-off.

Updates #38485.

Change-Id: I8f38b9604300d165147f8942e945ab762419fad7
Reviewed-on: https://go-review.googlesource.com/c/go/+/444155
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-10-19 19:25:56 +00:00
Bryan C. Mills
6b22572e70 go/internal/gcimporter,cmd/compile/internal/importer: skip tests that need 'go list' on js/wasm
js/wasm doesn't support os.Exec, so it can't run 'go list' to locate
export data for packages in the standard library.

This fixes js/wasm test failures introduced in CL 442303.

For #47257.

Change-Id: I39289f376691493aa6fb447b3329f6508ab48d58
Reviewed-on: https://go-review.googlesource.com/c/go/+/444015
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-19 16:30:38 +00:00
Michael Pratt
1f068f0dc7 runtime: throw in unreachable exitThread
Several OSes don't ever reach exitThread, On AIX, Plan9, Solaris, and
Windows, we throw if this function is accidentally reached. Do the same
on Darwin and OpenBSD for consistency.

Change-Id: Icd189b11179755a28b3ec48b267349c57facbf24
Reviewed-on: https://go-review.googlesource.com/c/go/+/443717
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
2022-10-18 20:58:37 +00:00
Michael Pratt
e252dcf9d3 runtime: always keep global reference to mp until mexit completes
Ms are allocated via standard heap allocation (`new(m)`), which means we
must keep them alive (i.e., reachable by the GC) until we are completely
done using them.

Ms are primarily reachable through runtime.allm. However, runtime.mexit
drops the M from allm fairly early, long before it is done using the M
structure. If that was the last reference to the M, it is now at risk of
being freed by the GC and used for some other allocation, leading to
memory corruption.

Ms with a Go-allocated stack coincidentally already keep a reference to
the M in sched.freem, so that the stack can be freed lazily. This
reference has the side effect of keeping this Ms reachable. However, Ms
with an OS stack skip this and are at risk of corruption.

Fix this lifetime by extending sched.freem use to all Ms, with the value
of mp.freeWait determining whether the stack needs to be freed or not.

Fixes #56243.

Change-Id: Ic0c01684775f5646970df507111c9abaac0ba52e
Reviewed-on: https://go-review.googlesource.com/c/go/+/443716
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-10-18 20:57:24 +00:00
Robert Griesemer
a8e4b8c2a7 go/types: remove pkgForMode in favor of pkgFor (cleanup)
The mode is always 0.

Change-Id: I6566383c7724b26f070729041bce203a5afa0989
Reviewed-on: https://go-review.googlesource.com/c/go/+/443776
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-18 20:53:00 +00:00
Robert Griesemer
54ad7f33e4 go/types, types2: add test verifying types/values of type parameter "constants"
Fixes #51093.

Change-Id: Ida4025a125243159a2107dcc064a0d9addf0a675
Reviewed-on: https://go-review.googlesource.com/c/go/+/443756
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-10-18 20:45:51 +00:00
Michael Matloob
4ac413ae22 go/types: migrate importer usage in tests
To use an importer that knows where to find stdlib .a files based on
their new locations once the checked-in .a files are removed.

Change-Id: I981812306b3512380d58cb0f599a9a61b27ba0d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/442695
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-18 20:41:52 +00:00
Michael Matloob
7ea0520234 go,cmd,internal: update to anticipate missing targets and .a files
go/build and cmd/go will stop returing Targets for stdlib .a files, and
stop producing the .a files is pkg/GOOS_GOARCH. update tests to
anticipate that and to pass in importcfgs instead of expecting the
compiler can find .a files in their old locations.

Adds code to determine locations of .a files to internal/goroot. Also
adds internal/goroot to dist's bootstrap directories and changes
internal/goroot to build with a bootstrap version of Go.

Change-Id: Ie81e51105bddb3f0e374cbf47e81c23edfb67fa5
Reviewed-on: https://go-review.googlesource.com/c/go/+/442303
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-10-18 20:41:45 +00:00
Russ Cox
b6e1a563fc cmd/go: fix longtest builder after runtime/internal/atomic
Loosen test to accept staleness in any runtime/internal package.
Fixes longtest builder.

Change-Id: Iffda9c1d1816f76c782aecc4d53c0ea3e6580587
Reviewed-on: https://go-review.googlesource.com/c/go/+/443755
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
2022-10-18 19:19:27 +00:00
Than McIntosh
4fb35d6cee cmd/compile: special case coverage vars in pkg init order
When computing package initialization order, special case the counter
variables inserted by "cmd/cover" for coverage instrumentation, since
their presence can perturb the order in which variables are
initialized in ways that are user-visible and incorrect with respect
to the original (uninstrumented) program.

Fixes #56293.

Change-Id: Ieec9239ded4f8e2503ff9bbe0fe171afb771b335
Reviewed-on: https://go-review.googlesource.com/c/go/+/443715
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-18 18:14:15 +00:00
Youlin Feng
7ae652b7c0 runtime: replace all uses of CtzXX with TrailingZerosXX
Replace all uses of Ctz64/32/8 with TrailingZeros64/32/8, because they
are the same and maybe duplicated. Also renamed CtzXX functions in 386
assembly code.

Change-Id: I19290204858083750f4be589bb0923393950ae6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/438935
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
2022-10-18 18:06:27 +00:00
Michael Pratt
c45ebef05e runtime: avoid unsafe.{Slice,String} in debuglog
CL 428157 and CL 428759 switched debuglog to using unsafe.String and
unsafe.Slice, which broke the build with -tags=debuglog because this is
a no write barrier context, but runtime.unsafeString and unsafeSlice can
panic, which includes write barriers.

We could add a panicCheck1 path to these functions to reallow write
barriers, but it is a big mess to pass around the caller PC,
particularly since the compiler generates calls. It is much simpler to
just avoid unsafe.String and Slice.

Also add a basic test to build the runtime with -tags=debuglog to help
avoid future regressions.

For #54854.

Change-Id: I702418b986fbf189664e9aa4f40bc7de4d9e7781
Reviewed-on: https://go-review.googlesource.com/c/go/+/443380
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-10-18 16:59:26 +00:00
Russ Cox
7cf06f070e math/rand: refactor to delay allocation of global source
This sets up for delaying the decision of which seed to use,
but this CL still keeps the original global Seed(1) semantics.

Preparation for #54880.

Change-Id: Ibfa9d50ec9023aa755a83852e55168fa7d24b115
Reviewed-on: https://go-review.googlesource.com/c/go/+/443057
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2022-10-18 14:49:46 +00:00
Russ Cox
8dc08394f0 internal/godebug: remove dependency on os
The immediate reason is that we want to use godebug from math/rand,
and math/rand importing godebug importing os causes an import cycle
in package testing.

More generally, the new approach to backward compatibility outlined
in discussion #55090 will require using this package from other similarly
sensitive places, perhaps even package os itself. Best to remove all
dependencies.

Preparation for #54880.

Change-Id: Ia01657a2d90e707a8121a336c9db3b7247c0198f
Reviewed-on: https://go-review.googlesource.com/c/go/+/439418
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-18 14:49:44 +00:00
Russ Cox
9fedc481ea runtime/internal/atomic: add write barrier-enabled pointer atomics
UnsafePointer.Store, UnsafePointer.CompareAndSwap were missing,
although .StoreNoWB and .CompareAndSwapNoWB existed.
Same for Pointer[T}.

Do the linkname tricks necessary to add those methods.

Change-Id: I925ee27673288accb15ebe93898f9eb01ab46a98
Reviewed-on: https://go-review.googlesource.com/c/go/+/443379
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-18 14:48:54 +00:00
fangguizhen
26b4844256 errors: add test for Join
Change-Id: I77c61211a488c66f1d445c0bf01e35aaf4f83565
GitHub-Last-Rev: c411a56a3b
GitHub-Pull-Request: golang/go#56279
Reviewed-on: https://go-review.googlesource.com/c/go/+/443316
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-17 21:48:12 +00:00
Russ Cox
834858fa5f cmd/go: fix TestScript/test_fuzz_mutate_crash for shorter fuzz names
Fixes longtest builders.

Change-Id: I8b375bcfc91695d5810493b972801df82c6c1b7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/443381
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-10-17 20:42:20 +00:00
Russ Cox
07c57aff5d all: use Go 1.17.13 for bootstrap
Previously we used Go 1.17, but we realized thanks to tickling
a pre-Go1.17.3 bug that if we are going to change the bootstrap
toolchain that we should default to the latest available point release
at the time we make the switch, not the initial major release, so as
to avoid bugs that were fixed in the point releases.

This CL updates the default search locations and the release notes.

Users who run make.bash and depend on finding $HOME/sdk/go1.17
may need to run

	go install golang.org/dl/go1.17.13@latest
	go1.17.13 download

to provide a Go 1.17.13 toolchain to their builds.

Change-Id: I3a2511f088cf852470a7216a5a41ae775fb561b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/439419
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-17 19:46:59 +00:00
Russ Cox
b65e259e56 internal/fuzz: write shorter testdata corpus file names
The only purpose of using the SHA256 in the file name is
collision avoidance. Using just the first 64 bits (16 hex digits)
will be more than enough, unless people start storing billions
of test cases in their corpora.

The shorter names are nicer for just about everything:
command lines, repository listings, and so on.

Change-Id: I67c760023bed85ba3ffd4f8058f86ef778322ba7
Reviewed-on: https://go-review.googlesource.com/c/go/+/443335
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
2022-10-17 18:38:43 +00:00
ezz-no
d5ba1d8d6f cmd/compile: fix a typo in comment
Change-Id: I9b18b29e14a47765dc09ac401989e0439fbf7d03
GitHub-Last-Rev: 7d9792ccb9
GitHub-Pull-Request: golang/go#56267
Reviewed-on: https://go-review.googlesource.com/c/go/+/443296
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
2022-10-17 18:34:19 +00:00
Than McIntosh
3e100a22e5 runtime/coverage: skip more tests in short mode
Add more skips if short mode testing, since some of these tests
still seem to be timing out on smaller and more underpowered
builders.

Updates #56197.

Change-Id: I469d9fd3a6be5602243234562fa3fe6263968b56
Reviewed-on: https://go-review.googlesource.com/c/go/+/443376
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
2022-10-17 18:22:06 +00:00
David Chase
da6042e82e cmd/compile: fix position of fake receivers; be more careful in logopt
The src.NoXPos in fake receivers was leaking, through a series of
mishaps, all the way to logopt.  If done just so, this can lead to
a compiler crash.  This makes logopt crash-proof and eliminates the
root cause as well.

I'm reluctant to write a test for this because it's kinda slow
and involved; my working test is "compile something that mentions
the flag package with -json=0,$TMPDIR flag, then be sure that
$TMPDIR/flag/__unnamed__.json was not created".

Change-Id: I384b717c0e7522953d22d61f7e06319e11192d7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/443156
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-10-17 15:59:12 +00:00
Ian Lance Taylor
c83d4fba07 os/signal: pass *int32 to ioctl that expects pid_t
Fixes #56233

Change-Id: I1cf176bc2f39c5e41d5a390ec6893426cdd39be0
Reviewed-on: https://go-review.googlesource.com/c/go/+/443175
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-10-17 15:26:00 +00:00
Austin Clements
1e9a7550a8 misc/cgo/fortran: convert to Go test
Currently, the entry-point to this test is a Bash script that smoke
tests the FORTRAN compiler and then runs a FORTRAN-containing Go test.
This CL rearranges things so a pure Go Go test smoke tests the FORTRAN
compiler and then runs a non-test FORTRAN-containing Go binary.

While we're here, we fix a discrepancy when the host is GOARCH=amd64,
but the target is GOARCH=386. Previously, we would pick the wrong
libgfortran path because we didn't account for the cross-compilation,
causing the link to fail. Except for some reason this was ignored and
the test nevertheless "passed". In the new test we're a little more
strict, so this build failure will cause the test to fail, so we add a
little logic to account for cross-compilation with the host toolchain.

For #37486.

Change-Id: Ie6f70066885d6fbb4e1b5a2b1e13b85dee5b359b
Reviewed-on: https://go-review.googlesource.com/c/go/+/443069
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Austin Clements <austin@google.com>
2022-10-17 15:15:37 +00:00
Austin Clements
03272d14ed runtime: run TestCgoSigfwd on all Unix platforms
This test was originally Linux-only, but there doesn't seem to be
anything Linux-specific in it.

Change-Id: I0f8519eff5dbed97f5e21e1c8e5ab0d747d51df3
Reviewed-on: https://go-review.googlesource.com/c/go/+/443073
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-17 15:15:36 +00:00
Austin Clements
a81da928b4 runtime: improve coverage of TestCgoSigfwd
Currently, TestCgoSigfwd will pass incorrectly if the SIGSEGV that
originates in Go mistakenly goes to the C SIGSEGV handler. Fix this by
adding a signal-atomic variable that tracks what the expected behavior
is.

Change-Id: Id2a9fa3b209299dccf90bb60720b89ad96838a9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/443072
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-17 15:15:34 +00:00
Austin Clements
dacf88e40a misc/cgo/testsigfwd: move to runtime/testprog/testprogcgo
This migrates testsigfwd, which uses some one-off build
infrastructure, to be part of the runtime's testprogcgo.

The test is largely unchanged. Because it's part of a larger binary,
this CL renames a few things and gates the constructor-time signal
handler registration on an environment variable. This CL also replaces
an errant fmt.Errorf with fmt.Fprintf.

For #37486, since it eliminates a non-go-test from dist.

Change-Id: I0efd146ea0a0a3f0b361431349a419af0f0ecc61
Reviewed-on: https://go-review.googlesource.com/c/go/+/443068
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-17 15:15:33 +00:00
Austin Clements
abd592b3d7 misc/cgo/testsigfwd: delete unused code
This code was introduced in CL 17903 but has never executed. It's also
fundamentally non-deterministic. Delete it.

Simplification for #37486.

Change-Id: I049564123fb4fba401154e2ea0fc429e552d4749
Reviewed-on: https://go-review.googlesource.com/c/go/+/431258
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-10-17 15:15:31 +00:00
Wayne Zuo
44563340cc cmd/compile: move {SHL,SHR,SAR}X rules to late lower pass
This can reduce a bunch of rules.

Change-Id: Id7d644307c295a0ed16eb837b3755d1117a4fbf7
Reviewed-on: https://go-review.googlesource.com/c/go/+/440036
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-17 15:11:32 +00:00
Wayne Zuo
1c783f7c68 cmd/compile: split 3 operand LEA in late lower pass
On newer amd64 cpus 3 operand LEA instructions are slow, CL 114655 split
them to 2 LEA instructions in genssa.

This CL make late lower pass run after addressing modes, and split 3
operand LEA in late lower pass so that we can do common-subexpression
elimination for splited LEAs.

Updates #21735

Change-Id: Ied49139c7abab655e1a14a6fd793bdf9f987d1f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/440035
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
2022-10-17 15:11:16 +00:00
hopehook
7ffc1e47b4 reflect: panic when Value.Equal using two non-comparable values
Assuming the two values are valid and non-comparable, Equal should panic.

	x := reflect.ValueOf([]int{1, 2, 3})
	x.Equal(x) // can not report false, should panic

Assuming one of them is non-comparable and the other is invalid, it should
always report false.

	x := reflect.ValueOf([]int{1, 2, 3})
	y := reflect.ValueOf(nil)
	x.Equal(y) // should report false

For #46746.

Change-Id: Ifecd77ca0b3de3019fae2be39048f9277831676c
Reviewed-on: https://go-review.googlesource.com/c/go/+/440037
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-17 14:53:58 +00:00
Zamicol
9abcc487f8 flag: remove "// BUG" comment
Remove a vestigial " // BUG" comment as there is no bug in the relevant code section and comment predated other changes.  Also removed a needless allocation and conformed to the "v, ok := a[x]" standard convention.  Tests are passing.

Change-Id: Id28ad1baf77447052b54b341f018e573bac0c11a
GitHub-Last-Rev: 26084698bf
GitHub-Pull-Request: golang/go#56210
Reviewed-on: https://go-review.googlesource.com/c/go/+/442815
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-17 14:50:31 +00:00
cuiweixie
3d92205ef5 cmd/link/internal/s390: return comparison directly
Change-Id: I171905d5cd7a121de549827ef4d5968510aa3efc
Reviewed-on: https://go-review.googlesource.com/c/go/+/436705
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: hopehook <hopehook@golangcn.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Run-TryBot: xie cui <523516579@qq.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2022-10-17 09:05:55 +00:00
Dan Kortschak
85b02de083 runtime: remove redundant conversion
This appears to have been left over from a C cast during the rewrite of
malloc into Go in https://golang.org/cl/108840046.

Change-Id: I88f212089c2bcf79d5881b3e8bf3f94f343331d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/443235
Run-TryBot: Dan Kortschak <dan@kortschak.io>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-10-17 04:41:37 +00:00