aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/testdata
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2019-11-19 16:04:32 -0500
committerCherry Zhang <cherryyz@google.com>2019-11-21 16:56:47 +0000
commit37715cce695e96d3d5a8e01f5009517121241330 (patch)
treeb67c48fd56af9c13a9e1fb1cf0d5ec04845bea9d /src/runtime/testdata
parentc7e73ef60af9c91b8c2c2909d5f6de040218597d (diff)
downloadgo-37715cce695e96d3d5a8e01f5009517121241330.tar.xz
runtime: relax TestAsyncPreempt
In TestAsyncPreempt, the function being tested for preemption, although still asynchronously preemptible, may have only samll ranges of PCs that are preemtible. In an unlucky run, it may take quite a while to have a signal that lands on a preemptible instruction. The test case is kind of an extreme. Relax it to make it more preemptible. In the original version, the first closure has more work to do, and it is not a leaf function, and the second test case is a frameless leaf function. In the current version, the first one is also a frameless leaf function (the atomic is intrinsified). Add some calls to it. It is still not preemptible without async preemption. Fixes #35608. Change-Id: Ia4f857f2afc55501c6568d7507b517e3b4db191c Reviewed-on: https://go-review.googlesource.com/c/go/+/208221 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/testdata')
-rw-r--r--src/runtime/testdata/testprog/preempt.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/runtime/testdata/testprog/preempt.go b/src/runtime/testdata/testprog/preempt.go
index c08b29b65a..1454095cde 100644
--- a/src/runtime/testdata/testprog/preempt.go
+++ b/src/runtime/testdata/testprog/preempt.go
@@ -26,6 +26,8 @@ func AsyncPreempt() {
go func() {
for {
atomic.StoreUint32(&ready, 1)
+ dummy()
+ dummy()
}
}()
// Also start one with a frameless function.
@@ -53,8 +55,11 @@ func AsyncPreempt() {
//go:noinline
func frameless() {
for i := int64(0); i < 1<<62; i++ {
- out += i
+ out += i * i * i * i * i * 12345
}
}
var out int64
+
+//go:noinline
+func dummy() {}