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

45619 Commits

Author SHA1 Message Date
Tobias Klauser
9dc2350d8c doc/go1.16: add time/tzdata release note for CL 261877
For #40700

Change-Id: I056cef20a5f071977d0ae589c7a50d5f69af3283
Reviewed-on: https://go-review.googlesource.com/c/go/+/273166
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-11-25 16:36:14 +00:00
Elias Naur
b9365488f0 cmd/internal/objabi: assume GOARM=7 on Android
CL 34641 changed the Go runtime to assume GOARM=7 support on Android.
This change completes that by assuming GOARM=7 in the toolchain, fixing
the gotcha of inexplicably slow performance on non-arm64 Android devices.

There is already code in cmd/dist to force GOARM to 7 on GOOS=android. However,
dist is most likely run with GOOS != android.

Change-Id: I5e2bf11c3ecd0f6c193229eaa8ddc570722799d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/272846
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Elias Naur <mail@eliasnaur.com>
2020-11-25 16:10:37 +00:00
Daniel S Fava
df68e01b68 runtime: check channel's elemsize before calling race detector
When c.elemsize==0 we call raceacquire() and racerelease()
as opposed to calling racereleaseacquire()

The reason for this change is that, when elemsize==0, we don't
allocate a full buffer for the channel.  Instead of individual
buffer entries, the race detector uses the c.buf as the only
buffer entry.  This simplification prevents us following the
memory model's happens-before rules implemented in racereleaseacquire().
So, instead of calling racereleaseacquire(), we accumulate
happens-before information in the synchronization object associated
with c.buf.

The functionality in this change is implemented in a new function
called racenotify()

Fixes #42598

Change-Id: I75b92708633fdfde658dc52e06264e2171824e51
Reviewed-on: https://go-review.googlesource.com/c/go/+/271987
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
2020-11-25 15:59:35 +00:00
Tom Payne
1d3baf20dc regexp/syntax: add note about Unicode character classes
As proposed on golang-nuts:
https://groups.google.com/g/golang-nuts/c/M3lmSUptExQ/m/hRySV9GsCAAJ

Includes the latest updates from re2's mksyntaxgo:
https://code.googlesource.com/re2/+/refs/heads/master/doc/mksyntaxgo

Change-Id: Ib7b79aa6531f473feabd0a7f1d263cd65c4388e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/264678
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2020-11-25 15:10:09 +00:00
Robert Griesemer
750b3729dc go/constant: MakeFloat64(0) must return a value of Float kind
Fixes #42641.

Change-Id: I10fdc7c90054b37ab5b303999015262691c12927
Reviewed-on: https://go-review.googlesource.com/c/go/+/273126
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-11-25 04:48:23 +00:00
eric fang
1308f11897 cmd/link: add relocation type R_AARCH64_LDST16_ABS_LO12_NC for arm64
The linker already has R_AARCH64_LDST{8,32,64,128}_ABS_LO12_NC, some cgo tests require
 R_AARCH64_LDST16_ABS_LO12_NC, this CL adds this relocation type.

Fixes #42660

Change-Id: I9a5120cd872f5095c61175cb602427c6ab3225cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/271017
Reviewed-by: eric fang <eric.fang@arm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: eric fang <eric.fang@arm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: eric fang <eric.fang@arm.com>
Trust: Benny Siegert <bsiegert@gmail.com>
2020-11-25 02:51:30 +00:00
Robert Griesemer
f6dcc975f7 go/constant: make constant.Make produce "smallest" const representation
Fixes #42640.

Change-Id: I22b8142b0a47a0f957d1bda28cdfdbb8388cffc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/273086
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-11-25 02:18:15 +00:00
Austin Clements
e8de596f04 runtime: use inlined function name for traceback elision
Currently, gentraceback decides which frames to print or elide when
unwinding inlined frames using only the name of the outermost
function. If the outermost function should be elided, then inlined
functions will also be elided, even if they shouldn't be.

This happens in practice in at least one situation. As of CL 258938,
exported Go functions (and functions they call) can now be inlined
into the generated _cgoexp_HASH_FN function. The runtime elides
_cgoexp_HASH_FN from tracebacks because it doesn't contain a ".".
Because of this bug, it also elides anything that was inlined into it.

This CL fixes this by synthesizing a funcInfo for the inlined
functions to pass to showframe.

Fixes #42754.

Change-Id: Ie6c663a4a1ac7f0d4beb1aa60bc26fc8cddd0f9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/272131
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>
2020-11-24 21:47:44 +00:00
Austin Clements
ba2adc21e8 runtime/testdata/testprogcgo: refactor CrashTraceback
This moves the C part of the CrashTraceback test into its own file in
preparation for adding a test that transitions back into Go.

Change-Id: I9560dcfd80bf8a1d30809fd360f958f5261ebb01
Reviewed-on: https://go-review.googlesource.com/c/go/+/272130
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-11-24 21:47:20 +00:00
Dmitri Shuralyov
65dcd15c72 doc/go1.16: fill in Go 1.16 release note TODOs using relnote
The additions were generated using golang.org/x/build/cmd/relnote
at CL 272907. It was modified to find previously-missed entries
by querying the Gerrit API in addition to the maintner corpus.

For #40700.
Updates #41849.

Change-Id: If575984fe40e0133ad5e8fc5411ea5063457250d
Reviewed-on: https://go-review.googlesource.com/c/go/+/272871
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2020-11-24 19:53:18 +00:00
Alex Brainman
6965b01ea2 runtime: allow for usleep2HighRes to run without TLS setup
This change adjusts usleep2HighRes so it does not crash when TLS is
not configured. When g is not available, usleep2HighRes just calls
usleep2 instead.

Updates #8687

Change-Id: Idbb80f7b71d1da350a6a7df7c49154eb1ffe29a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/271907
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Simon Rozman <simon@rozman.si>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
2020-11-24 07:07:06 +00:00
Cuong Manh Le
7dc5d909fb cmd/compile: set OpLoad argument type interface{} correctly
CL 271906 allows loading single field of typed-interface{} OpIData, but
it does not update the corresponding selector type. So the generated
OpLoad has the named type instead, prevent it from being lowered by
lower pass.

Fixes #42784

Change-Id: Idf32e4f711731be09d508dd712b60bc8c58309bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/272466
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: Cherry Zhang <cherryyz@google.com>
2020-11-24 03:06:15 +00:00
Robert Griesemer
762eda346a go/types: fix incorrect string(int) conversion (regression)
The bug was introduced by https://golang.org/cl/220844.

Fixes #42790.

Change-Id: I44d619a1a4d3f2aee1c5575d5cfddcc4ba10895f
Reviewed-on: https://go-review.googlesource.com/c/go/+/272666
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-11-24 00:50:11 +00:00
Michael Anthony Knyszek
48a1a51898 runtime/metrics: tweak wording of stack and unused memory metrics
This change tweaks and simplifies the descriptions of a couple metrics
to make them easier to parse (for humans).

Change-Id: I852654c7e7042c662ebdfa6334e3baf49ca4b33c
Reviewed-on: https://go-review.googlesource.com/c/go/+/272566
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-11-23 19:58:25 +00:00
Martin Möhrmann
d902791b50 sync: use 386 instead of x86-32 to refer to the 32 bit x86 architecture
This aligns the naming with GOARCH using 386 as a build target for
this architecture and makes it more easily found when searching
for documentation related to the build target.

Change-Id: I393bb89dd2f71e568124107b13e1b288fbd0c76a
Reviewed-on: https://go-review.googlesource.com/c/go/+/271988
Trust: Martin Möhrmann <moehrmann@google.com>
Run-TryBot: Martin Möhrmann <martisch@uos.de>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-11-23 05:57:35 +00:00
Keith Randall
9ea6364a5e cmd/compile: add test for 42753
This issue was already fixed at tip. Just adding the test that
failed on 1.14/1.15.

Update #42753

Change-Id: I00d13ade476b9c17190d762d7fdcb30cf6c83954
Reviewed-on: https://go-review.googlesource.com/c/go/+/272029
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2020-11-21 16:46:05 +00:00
Jason A. Donenfeld
f7342596da syscall: add DLLError.Unwrap function
Because we're expecting for future functions to be unavailable, we
should add an Unwrap() function to the DLLError struct, so that people
can test for this situation easily via:

    if errors.Is(err, syscall.ERROR_PROC_NOT_FOUND) { ... }

DLLError already was wrapping the underlying Errno error, but never got
the Go 1.13 helper method.

Fixes golang/go#42584

Change-Id: I0f32a5146946b1b37a30897ba825a56faefc792c
Reviewed-on: https://go-review.googlesource.com/c/go/+/269761
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
2020-11-21 07:37:02 +00:00
Bryan C. Mills
f93ef07b11 cmd/go/internal/modload: remove the Reqs function
The Reqs function returns an mvs.Reqs implemention for the global
build list. The API that it presents assumes that the build list is
globally consistent (problematic for #40775) and readily available
(problematic for #36460).

Fortunately, it is no longer used outside of the modload package.
We can instead use individual instances of the unexported mvsReqs
struct, making the dependency on the global build list more explicit.

For #36460
For #40775

Change-Id: I8674442f2a86416b0bf9c3395cb591c1e724c9d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/272129
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>
2020-11-21 03:29:37 +00:00
Bryan C. Mills
3f5a97514b cmd/go/internal/modload: remove a stale comment for EditBuildList
For #36460
Updates #37438

Change-Id: I1626d40e78b110035a893b1b80dbd2279bf50ffe
Reviewed-on: https://go-review.googlesource.com/c/go/+/272128
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>
2020-11-21 03:28:08 +00:00
Michael Matloob
78e59bb1f7 cmd/go: support the -overlay flag for go mod commands
Move the declaration of the -overlay flag to base.AddModCommonFlags,
where other flags that are needed for go mod commands and for builds
are declared. The flag's already initialized in modload.Init so
there's no additional work needed to be done to support it in the go
mod commands.

For #39958

Change-Id: I70725d620cc69cb820f6ed923d626f4fe041b1c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/272126
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-11-20 23:58:48 +00:00
Ian Lance Taylor
c47eac7db0 cmd/cgo, cmd/internal/pkgpath: support gofrontend mangler v3
The gofrontend mangling scheme used by gccgo and GoLLVM has changed again.
Support the new version. This is a port of the relevant parts of
https://golang.org/cl/271726.

For #41862

Change-Id: I9c961c8e17ec960a83a23e1d49ea900962b63393
Reviewed-on: https://go-review.googlesource.com/c/go/+/272127
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-11-20 21:45:57 +00:00
Hollow Man
3fd4917472 doc: fix misspelling of “initialization” in diagnostics.html
initilization -> initialization

Change-Id: Ie5edd30559941f2d044280d8d586c2c2692d5b69
GitHub-Last-Rev: 7495a8c722
GitHub-Pull-Request: golang/go#42749
Reviewed-on: https://go-review.googlesource.com/c/go/+/272026
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Ian Lance Taylor <iant@golang.org>
2020-11-20 20:02:47 +00:00
Michael Matloob
676f0a45ed cmd/go: support overlaying go.mod files
This change updates the lockedfile package to open files using the
new fsys.OpenFile function. The logic of fsys.Open has been moved into
fsys.OpenFile, and fsys.Open is now just a light wrapper around it.

For #39958

Change-Id: I552f1a45ac00ac06b5812008d17a61e610b4b113
Reviewed-on: https://go-review.googlesource.com/c/go/+/266797
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-11-20 18:29:46 +00:00
Jay Conrod
a19c925eda cmd/go: recommend 'go get' command to switch from retracted versions
This CL restores a message unintentionally removed in CL 270858.

For #24031

Change-Id: I957c5c59e624df98e72dfff351298bfc5bf9a9e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/272066
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-11-20 17:35:55 +00:00
Cuong Manh Le
c306fd6d0b cmd/compile: allow loading single field of typed-interface{} OpIData
Same reason as CL 270057, but for OpLoad.

Fixes #42727

Change-Id: Iebb1a8110f29427a0aed3b5e3e84f0540de3d1b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/271906
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: David Chase <drchase@google.com>
2020-11-20 17:31:50 +00:00
Jay Conrod
5e58ae43be cmd/go: report changes and resolved versions in 'go get'
Fixes #33284

Change-Id: I33daa5eb518985bc7308f29655e04c57e244b479
Reviewed-on: https://go-review.googlesource.com/c/go/+/269018
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-11-20 16:42:46 +00:00
Jay Conrod
012efc67f2 cmd/go/internal/modload: ignore selected version in checkRetractions
Fixes #42601

Change-Id: I58d817ed34ccbd39591326c4bc23569f94028412
Reviewed-on: https://go-review.googlesource.com/c/go/+/272006
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
2020-11-20 16:23:19 +00:00
Jay Conrod
9264067a41 cmd/go: remove ListModules call in runGet
ListModules was used to download .info files so that 'go list -m all'
would succeed later when offline. However, 'go list -m all' may
already fail when offline after 'go mod tidy', so it doesn't make
sense to add complexity to 'go get'.

Instead, remove the ListModules call and fix the test that
accidentally depended on it.

For #42723

Change-Id: I692597cf5ca15c23fa6fc9d2bac4b6e044299482
Reviewed-on: https://go-review.googlesource.com/c/go/+/271577
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-11-20 15:37:42 +00:00
Bryan C. Mills
cb3f84ad25 cmd/go/internal/modload: eliminate LoadedModules
As of CL 271646, all external callers have been eliminated. Replace
the remaining internal caller with a direct reference to the buildList
variable and remove the exported function to prevent backsliding.

For #36460

Change-Id: Iea82df1e3e604ada602dda3e830c06d441eee2a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/271647
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-11-20 15:19:17 +00:00
Bryan C. Mills
8bbd8294d0 cmd/go/internal/work: remove a redundant call to modload.LoadedModules
The modload.EditBuildList call added in CL 270980 already ensures that
installMod does not require a newer version of itself, so the condition
that this loop is checking for is redundant.

(I had meant for this change to be included in CL 270980, but
apparently somehow reverted it prior to mailing.)

For #36460

Change-Id: I4dd746b927f7012d950187cac9c510cd6fec8fd9
Reviewed-on: https://go-review.googlesource.com/c/go/+/271646
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
2020-11-20 15:19:09 +00:00
Ian Lance Taylor
66c0264506 net, internal/poll: reset value before adding in minor kernel version
Fixes #42733

Change-Id: I5446aeb5de13cd70212755fb12c9bc484f343c74
Reviewed-on: https://go-review.googlesource.com/c/go/+/271846
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-11-20 04:21:00 +00:00
Robert Griesemer
0dcc7d6ea8 go/types: use correct error position
Follow-up on https://golang.org/cl/271706 .

Change-Id: I90339987aed88b0de3ee7ebe7d413282055c260c
Reviewed-on: https://go-review.googlesource.com/c/go/+/271789
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>
2020-11-20 02:27:53 +00:00
Robert Griesemer
c72a448881 go/types: fix error message for consistency
Follow-up on https://golang.org/cl/271706 .
(Missed a review comment.)

Change-Id: Ibff542f43d721600a2452907c0a20941961e793f
Reviewed-on: https://go-review.googlesource.com/c/go/+/271766
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>
2020-11-20 00:54:43 +00:00
Robert Griesemer
7eed73f36f go/types, go/constant: handle infinities as unknown values
With this change, constant literals (and results of constant
operations) that internally become infinities are represented
externally (to go/constant) as "unknown" values.

The language has no provisions to deal with infinite constants,
and producing unknown values allows the typechecker to report
errors and avoid invalid operations (such as multiplication of
zero with infinity).

Fixes #20583.

Change-Id: I12f36a17d262ff7957b0d3880241b5a8b2984777
Reviewed-on: https://go-review.googlesource.com/c/go/+/271706
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>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-11-20 00:09:05 +00:00
fzipp
f3ce010b33 io/fs: make WalkDirFunc parameter name consistent with doc comment
The the DirEntry parameter of WalkDirFunc is referred to as `d` in the doc comment.

Change-Id: Ibfcf7908eaa0ef1309898150e8fd71101e7de09b
GitHub-Last-Rev: e858c52d81
GitHub-Pull-Request: golang/go#42447
Reviewed-on: https://go-review.googlesource.com/c/go/+/268277
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2020-11-19 21:51:34 +00:00
Michael Anthony Knyszek
59f5fdac5d runtime/metrics: clarify Read's documentation
Change-Id: Idbcbc304f1568399a82af9dcd51e511393ed5ee0
Reviewed-on: https://go-review.googlesource.com/c/go/+/271558
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2020-11-19 20:37:38 +00:00
Michael Anthony Knyszek
add45938b5 runtime/metrics: clarify memory and GC metrics documentation
Change-Id: I8940990a591a808ddd4b8613531f52453f85bde1
Reviewed-on: https://go-review.googlesource.com/c/go/+/271557
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2020-11-19 19:35:35 +00:00
Bryan C. Mills
498d8d5371 cmd/go/internal/work: avoid modload.Selected in 'go install pkg@version'
At this point in installOutsideModule the build list is empty, so
Selected trivially returns "none" for all modules.

(This change could have been made in CL 266657, but it was a bit
simpler to update the QueryPattern call sites mechanically to ensure
that there would be no unintentional semantic drift.)

For #36460

Change-Id: I44fb73794985bfeebb1dde0c092313f319c2945a
Reviewed-on: https://go-review.googlesource.com/c/go/+/271419
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>
2020-11-19 19:31:07 +00:00
Bryan C. Mills
e73697b710 cmd/go: fix failing gccgo cases in TestScript/build_overlay
The 'go install' command does not support the -gccgo flag.
(I'm not sure why, but it doesn't.)

gccgo also uses system-native assembly syntax instead of cmd/compile's
Plan 9 derivative. I've added an assembly file that seems to work on
Linux, but I haven't tested it on other platforms; if it fails on
other platforms, we can refine the test as needed.

Fixes #42688

Change-Id: I0693a6a9eb58975f20cdc4160ef5f9a948563c88
Reviewed-on: https://go-review.googlesource.com/c/go/+/270978
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2020-11-19 19:30:38 +00:00
Paul E. Murphy
cb674b5c13 cmd/compile,cmd/asm: fix function pointer call perf regression on ppc64
by inserting hint when using bclrl.

Using this instruction as subroutine call is not the expected
default behavior, and as a result confuses the branch predictor.

The default expected behavior is a conditional return from a
subroutine.

We can change this assumption by encoding a hint this is not a
subroutine return.

The regex benchmarks are a pretty good example of how much this
hint can help generic ppc64le code on a power9 machine:

name                          old time/op    new time/op     delta
Find                             606ns ± 0%      447ns ± 0%  -26.27%
FindAllNoMatches                 309ns ± 0%      205ns ± 0%  -33.72%
FindString                       609ns ± 0%      451ns ± 0%  -26.04%
FindSubmatch                     734ns ± 0%      594ns ± 0%  -19.07%
FindStringSubmatch               706ns ± 0%      574ns ± 0%  -18.83%
Literal                          177ns ± 0%      136ns ± 0%  -22.89%
NotLiteral                      4.69µs ± 0%     2.34µs ± 0%  -50.14%
MatchClass                      6.05µs ± 0%     3.26µs ± 0%  -46.08%
MatchClass_InRange              5.93µs ± 0%     3.15µs ± 0%  -46.86%
ReplaceAll                      3.15µs ± 0%     2.18µs ± 0%  -30.77%
AnchoredLiteralShortNonMatch     156ns ± 0%      109ns ± 0%  -30.61%
AnchoredLiteralLongNonMatch      192ns ± 0%      136ns ± 0%  -29.34%
AnchoredShortMatch               268ns ± 0%      209ns ± 0%  -22.00%
AnchoredLongMatch                472ns ± 0%      357ns ± 0%  -24.30%
OnePassShortA                   1.16µs ± 0%     0.87µs ± 0%  -25.03%
NotOnePassShortA                1.34µs ± 0%     1.20µs ± 0%  -10.63%
OnePassShortB                    940ns ± 0%      655ns ± 0%  -30.29%
NotOnePassShortB                 873ns ± 0%      703ns ± 0%  -19.52%
OnePassLongPrefix                258ns ± 0%      155ns ± 0%  -40.13%
OnePassLongNotPrefix             943ns ± 0%      529ns ± 0%  -43.89%
MatchParallelShared              591ns ± 0%      436ns ± 0%  -26.31%
MatchParallelCopied              596ns ± 0%      435ns ± 0%  -27.10%
QuoteMetaAll                     186ns ± 0%      186ns ± 0%   -0.16%
QuoteMetaNone                   55.9ns ± 0%     55.9ns ± 0%   +0.02%
Compile/Onepass                 9.64µs ± 0%     9.26µs ± 0%   -3.97%
Compile/Medium                  21.7µs ± 0%     20.6µs ± 0%   -4.90%
Compile/Hard                     174µs ± 0%      174µs ± 0%   +0.07%
Match/Easy0/16                  7.35ns ± 0%     7.34ns ± 0%   -0.11%
Match/Easy0/32                   116ns ± 0%       97ns ± 0%  -16.27%
Match/Easy0/1K                   592ns ± 0%      562ns ± 0%   -5.04%
Match/Easy0/32K                 12.6µs ± 0%     12.5µs ± 0%   -0.64%
Match/Easy0/1M                   556µs ± 0%      556µs ± 0%   -0.00%
Match/Easy0/32M                 17.7ms ± 0%     17.7ms ± 0%   +0.05%
Match/Easy0i/16                 7.34ns ± 0%     7.35ns ± 0%   +0.10%
Match/Easy0i/32                 2.82µs ± 0%     1.64µs ± 0%  -41.71%
Match/Easy0i/1K                 83.2µs ± 0%     48.2µs ± 0%  -42.06%
Match/Easy0i/32K                2.13ms ± 0%     1.80ms ± 0%  -15.34%
Match/Easy0i/1M                 68.1ms ± 0%     57.6ms ± 0%  -15.31%
Match/Easy0i/32M                 2.18s ± 0%      1.80s ± 0%  -17.52%
Match/Easy1/16                  7.36ns ± 0%     7.34ns ± 0%   -0.24%
Match/Easy1/32                   118ns ± 0%       96ns ± 0%  -18.72%
Match/Easy1/1K                  2.46µs ± 0%     1.58µs ± 0%  -35.65%
Match/Easy1/32K                 80.2µs ± 0%     54.6µs ± 0%  -31.92%
Match/Easy1/1M                  2.75ms ± 0%     1.88ms ± 0%  -31.66%
Match/Easy1/32M                 87.5ms ± 0%     59.8ms ± 0%  -31.62%
Match/Medium/16                 7.34ns ± 0%     7.34ns ± 0%   +0.01%
Match/Medium/32                 2.60µs ± 0%     1.50µs ± 0%  -42.61%
Match/Medium/1K                 78.1µs ± 0%     43.7µs ± 0%  -44.06%
Match/Medium/32K                2.08ms ± 0%     1.52ms ± 0%  -27.11%
Match/Medium/1M                 66.5ms ± 0%     48.6ms ± 0%  -26.96%
Match/Medium/32M                 2.14s ± 0%      1.60s ± 0%  -25.18%
Match/Hard/16                   7.35ns ± 0%     7.35ns ± 0%   +0.03%
Match/Hard/32                   3.58µs ± 0%     2.44µs ± 0%  -31.82%
Match/Hard/1K                    108µs ± 0%       75µs ± 0%  -31.04%
Match/Hard/32K                  2.79ms ± 0%     2.25ms ± 0%  -19.30%
Match/Hard/1M                   89.4ms ± 0%     72.2ms ± 0%  -19.26%
Match/Hard/32M                   2.91s ± 0%      2.37s ± 0%  -18.60%
Match/Hard1/16                  11.1µs ± 0%      8.3µs ± 0%  -25.07%
Match/Hard1/32                  21.4µs ± 0%     16.1µs ± 0%  -24.85%
Match/Hard1/1K                   658µs ± 0%      498µs ± 0%  -24.27%
Match/Hard1/32K                 12.2ms ± 0%     11.7ms ± 0%   -4.60%
Match/Hard1/1M                   391ms ± 0%      374ms ± 0%   -4.40%
Match/Hard1/32M                  12.6s ± 0%      12.0s ± 0%   -4.68%
Match_onepass_regex/16           870ns ± 0%      611ns ± 0%  -29.79%
Match_onepass_regex/32          1.58µs ± 0%     1.08µs ± 0%  -31.48%
Match_onepass_regex/1K          45.7µs ± 0%     30.3µs ± 0%  -33.58%
Match_onepass_regex/32K         1.45ms ± 0%     0.97ms ± 0%  -33.20%
Match_onepass_regex/1M          46.2ms ± 0%     30.9ms ± 0%  -33.01%
Match_onepass_regex/32M          1.46s ± 0%      0.99s ± 0%  -32.02%

name                          old alloc/op   new alloc/op    delta
Find                             0.00B           0.00B         0.00%
FindAllNoMatches                 0.00B           0.00B         0.00%
FindString                       0.00B           0.00B         0.00%
FindSubmatch                     48.0B ± 0%      48.0B ± 0%    0.00%
FindStringSubmatch               32.0B ± 0%      32.0B ± 0%    0.00%
Compile/Onepass                 4.02kB ± 0%     4.02kB ± 0%    0.00%
Compile/Medium                  9.39kB ± 0%     9.39kB ± 0%    0.00%
Compile/Hard                    84.7kB ± 0%     84.7kB ± 0%    0.00%
Match_onepass_regex/16           0.00B           0.00B         0.00%
Match_onepass_regex/32           0.00B           0.00B         0.00%
Match_onepass_regex/1K           0.00B           0.00B         0.00%
Match_onepass_regex/32K          0.00B           0.00B         0.00%
Match_onepass_regex/1M           5.00B ± 0%      3.00B ± 0%  -40.00%
Match_onepass_regex/32M           136B ± 0%        68B ± 0%  -50.00%

name                          old allocs/op  new allocs/op   delta
Find                              0.00            0.00         0.00%
FindAllNoMatches                  0.00            0.00         0.00%
FindString                        0.00            0.00         0.00%
FindSubmatch                      1.00 ± 0%       1.00 ± 0%    0.00%
FindStringSubmatch                1.00 ± 0%       1.00 ± 0%    0.00%
Compile/Onepass                   52.0 ± 0%       52.0 ± 0%    0.00%
Compile/Medium                     112 ± 0%        112 ± 0%    0.00%
Compile/Hard                       424 ± 0%        424 ± 0%    0.00%
Match_onepass_regex/16            0.00            0.00         0.00%
Match_onepass_regex/32            0.00            0.00         0.00%
Match_onepass_regex/1K            0.00            0.00         0.00%
Match_onepass_regex/32K           0.00            0.00         0.00%
Match_onepass_regex/1M            0.00            0.00         0.00%
Match_onepass_regex/32M           2.00 ± 0%       1.00 ± 0%  -50.00%

name                          old speed      new speed       delta
QuoteMetaAll                  75.2MB/s ± 0%   75.3MB/s ± 0%   +0.15%
QuoteMetaNone                  465MB/s ± 0%    465MB/s ± 0%   -0.02%
Match/Easy0/16                2.18GB/s ± 0%   2.18GB/s ± 0%   +0.10%
Match/Easy0/32                 276MB/s ± 0%    330MB/s ± 0%  +19.46%
Match/Easy0/1K                1.73GB/s ± 0%   1.82GB/s ± 0%   +5.29%
Match/Easy0/32K               2.60GB/s ± 0%   2.62GB/s ± 0%   +0.64%
Match/Easy0/1M                1.89GB/s ± 0%   1.89GB/s ± 0%   +0.00%
Match/Easy0/32M               1.89GB/s ± 0%   1.89GB/s ± 0%   -0.05%
Match/Easy0i/16               2.18GB/s ± 0%   2.18GB/s ± 0%   -0.10%
Match/Easy0i/32               11.4MB/s ± 0%   19.5MB/s ± 0%  +71.48%
Match/Easy0i/1K               12.3MB/s ± 0%   21.2MB/s ± 0%  +72.62%
Match/Easy0i/32K              15.4MB/s ± 0%   18.2MB/s ± 0%  +18.12%
Match/Easy0i/1M               15.4MB/s ± 0%   18.2MB/s ± 0%  +18.12%
Match/Easy0i/32M              15.4MB/s ± 0%   18.6MB/s ± 0%  +21.21%
Match/Easy1/16                2.17GB/s ± 0%   2.18GB/s ± 0%   +0.24%
Match/Easy1/32                 271MB/s ± 0%    333MB/s ± 0%  +23.07%
Match/Easy1/1K                 417MB/s ± 0%    648MB/s ± 0%  +55.38%
Match/Easy1/32K                409MB/s ± 0%    600MB/s ± 0%  +46.88%
Match/Easy1/1M                 381MB/s ± 0%    558MB/s ± 0%  +46.33%
Match/Easy1/32M                383MB/s ± 0%    561MB/s ± 0%  +46.25%
Match/Medium/16               2.18GB/s ± 0%   2.18GB/s ± 0%   -0.01%
Match/Medium/32               12.3MB/s ± 0%   21.4MB/s ± 0%  +74.13%
Match/Medium/1K               13.1MB/s ± 0%   23.4MB/s ± 0%  +78.73%
Match/Medium/32K              15.7MB/s ± 0%   21.6MB/s ± 0%  +37.23%
Match/Medium/1M               15.8MB/s ± 0%   21.6MB/s ± 0%  +36.93%
Match/Medium/32M              15.7MB/s ± 0%   21.0MB/s ± 0%  +33.67%
Match/Hard/16                 2.18GB/s ± 0%   2.18GB/s ± 0%   -0.03%
Match/Hard/32                 8.93MB/s ± 0%  13.10MB/s ± 0%  +46.70%
Match/Hard/1K                 9.48MB/s ± 0%  13.74MB/s ± 0%  +44.94%
Match/Hard/32K                11.7MB/s ± 0%   14.5MB/s ± 0%  +23.87%
Match/Hard/1M                 11.7MB/s ± 0%   14.5MB/s ± 0%  +23.87%
Match/Hard/32M                11.6MB/s ± 0%   14.2MB/s ± 0%  +22.86%
Match/Hard1/16                1.44MB/s ± 0%   1.93MB/s ± 0%  +34.03%
Match/Hard1/32                1.49MB/s ± 0%   1.99MB/s ± 0%  +33.56%
Match/Hard1/1K                1.56MB/s ± 0%   2.05MB/s ± 0%  +31.41%
Match/Hard1/32K               2.68MB/s ± 0%   2.80MB/s ± 0%   +4.48%
Match/Hard1/1M                2.68MB/s ± 0%   2.80MB/s ± 0%   +4.48%
Match/Hard1/32M               2.66MB/s ± 0%   2.79MB/s ± 0%   +4.89%
Match_onepass_regex/16        18.4MB/s ± 0%   26.2MB/s ± 0%  +42.41%
Match_onepass_regex/32        20.2MB/s ± 0%   29.5MB/s ± 0%  +45.92%
Match_onepass_regex/1K        22.4MB/s ± 0%   33.8MB/s ± 0%  +50.54%
Match_onepass_regex/32K       22.6MB/s ± 0%   33.9MB/s ± 0%  +49.67%
Match_onepass_regex/1M        22.7MB/s ± 0%   33.9MB/s ± 0%  +49.27%
Match_onepass_regex/32M       23.0MB/s ± 0%   33.9MB/s ± 0%  +47.14%

Fixes #42709

Change-Id: Ice07fec2de4c5b1302febf8c2978ae8c1e4fd3e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/271337
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
Trust: Carlos Eduardo Seo <carlos.seo@linaro.org>
2020-11-19 18:23:23 +00:00
Dan Scales
c31540364c cmd/compile: flag "-d=dumpptrs" to print Node ptrs in Dump output
The printing of the ptr values can mean that two dump outputs can't easily be
compared for the identical structure, so adding the "-d=dumpptrs" option to make
printing of Node pointer values be an option.

Change-Id: I0e92b02f069e9de2e6fa036a7841645d13cdd7a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/271339
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-11-19 17:28:05 +00:00
Jason A. Donenfeld
4d048194cd runtime: support new callbackasm1 calling convention on windows/arm
This updates the callbacks implementation on windows/arm for the
changes made in CL 258938. At the time, that was left as a TODO.

At the same time, it also extends the previous support for only 4
arguments to also support additional arguments on the stack. This is
required for functions like SetWinEventHook, which take 7 arguments. It
does this by pushing r0-r3 onto the stack before the normal prologue,
and then pointing the args struct to that location.

This is derived from CL 270077 and CL 270078.

Updates #40724.
Fixes #42591.

Change-Id: Icc199e7f2c24205e41be4e00015283c7e2a9b797
Reviewed-on: https://go-review.googlesource.com/c/go/+/271178
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Austin Clements <austin@google.com>
2020-11-19 13:34:29 +00:00
Bryan C. Mills
5ba1c3f290 cmd/go/internal/modload: remove SetBuildList
For the last remaining call site (in cmd/go/internal/work, added for
the new 'go install pkg@version' codepath in CL 254365), use
EditBuildList instead.

SetBuildList assumes that the caller has enough information to produce
a complete, coherent build list. With lazy loading, producing a
complete, coherent build list is no longer quite so trivial.

In CL 263267, I rewrote the main caller of SetBuildList (the 'go get'
command), and in the process added a more targeted modload hook
(EditBuildList). That hook also suffices for 'go install pkg@version'.
The resulting error messages are perhaps not as smooth as they ought
to be, but if they are too awkward we should probably fix them for
'go get' too, and the commands can continue to share the edit hook.

For #36460
Updates #40276

Change-Id: I698a9dcd2efe6378a4d91f21362880aa8e50001b
Reviewed-on: https://go-review.googlesource.com/c/go/+/270980
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>
2020-11-19 04:02:59 +00:00
Bryan C. Mills
ff2824d4b3 cmd/go/internal/modcmd: eliminate a call to modload.LoadedModules
modload.LoadedModules reveals more information than necessary about
whether modules have been loaded lazily. The 'vendor' subcommand
doesn't actually need that much information: it has all of the
information that it needs from prior calls to LoadPackages and
ModFile.

For #36460

Change-Id: If08733cca930b2b80616b037b63985ecfd6a320b
Reviewed-on: https://go-review.googlesource.com/c/go/+/270979
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>
2020-11-19 04:02:42 +00:00
Hanlin Shi
0bb6115dd6 internal/fmtsort: sort the unsafe pointers in map
Currently storing keys that contain unsafe.
Pointer in a map could result inruntime panic when printing the map.
The root cause is that unsafe.Pointer is not comparable.

Fixes #42622.

Change-Id: Ie3bae7ee4945041843b66514de6227212a3da73e
GitHub-Last-Rev: d12d41302e
GitHub-Pull-Request: golang/go#42623
Reviewed-on: https://go-review.googlesource.com/c/go/+/270277
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-11-19 02:17:10 +00:00
Robert Griesemer
96b943a483 go/types: report an error for invalid constant values
The parser reports syntactic errors in constant literals.
The go/constant package produces an "unknown" value for
syntactically correct numeric constants that are too small
or too large. Check for the unknown value and report an
error rather than silently continuing.

Fixes #42695.

Change-Id: I414214559a285d67ed50184dc750f106960b5620
Reviewed-on: https://go-review.googlesource.com/c/go/+/271377
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-11-19 01:27:31 +00:00
Matthew Dempsky
35693d037f cmd/compile: fix miscompilation during inlining
When inlining a function call expression, it's possible that the
function callee subexpression has side effects that need to be
preserved. This used to not be an issue, because inlining wouldn't
recognize these as inlinable anyway. But golang.org/cl/266199 extended
the inlining logic to recognize more cases, but did not notice that
the actual inlining code was discarding side effects.

Issue identified by danscales@.

Fixes #42703.

Change-Id: I95f8fc076b6ca4e9362e80ec26dad9d87a5bc44a
Reviewed-on: https://go-review.googlesource.com/c/go/+/271219
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Dan Scales <danscales@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
2020-11-18 22:24:21 +00:00
Matthew Dempsky
5b0ec1a6ac cmd/compile: fix panic in field tracking logic
Within the frontend, we generally don't guarantee uniqueness of
anonymous types. For example, each struct type literal gets
represented by its own types.Type instance.

However, the field tracking code was using the struct type as a map
key. This broke in golang.org/cl/256457, because that CL started
changing the inlined parameter variables from using the types.Type of
the declared parameter to that of the call site argument. These are
always identical types (e.g., types.Identical would report true), but
they can be different pointer values, causing the map lookup to fail.

The easiest fix is to simply get rid of the map and instead use
Node.Opt for tracking the types.Field. To mitigate against more latent
field tracking failures (e.g., if any other code were to start trying
to use Opt on ODOT/ODOTPTR fields), we store this field
unconditionally. I also expect having the types.Field will be useful
to other frontend code in the future.

Finally, to make it easier to test field tracking without having to
run make.bash with GOEXPERIMENT=fieldtrack, this commit adds a
-d=fieldtrack flag as an alternative way to enable field tracking
within the compiler. See also #42681.

Fixes #42686.

Change-Id: I6923d206d5e2cab1e6798cba36cae96c1eeaea55
Reviewed-on: https://go-review.googlesource.com/c/go/+/271217
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
2020-11-18 22:12:57 +00:00
Michael Pratt
b4f3d52f6a sync: document RWMutex race semantics
RWMutex provides explicit acquire/release synchronization events to the
race detector to model the mutex. It disables sync events within the
methods to avoid e.g., the atomics from adding false synchronization
events, which could cause false negatives in the race detector.

Change-Id: I5126ce2efaab151811ac264864aab1fa025a4aaf
Reviewed-on: https://go-review.googlesource.com/c/go/+/270865
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Trust: Michael Pratt <mpratt@google.com>
2020-11-18 20:12:03 +00:00
Michael Pratt
b63db7f724 runtime: give test child time to block
The child in TestPanicSystemstack prints "x\n" and then blocks on a
lock. Receiving those bytes only indicates that the child is _about to
block_. Since we don't have a way to know when it is fully blocked,
sleep a bit to give it time to block. This makes us less likely to lose
the race and signal before the child blocks, which will fail the test as
the stack trace cannot be read from a running G.

Fixes #33626

Change-Id: I8a27b1b114bf75e1e5bcb2a7a33aa69cdbc22f40
Reviewed-on: https://go-review.googlesource.com/c/go/+/268578
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2020-11-18 19:58:48 +00:00