diff options
Diffstat (limited to 'src/runtime/testdata')
| -rw-r--r-- | src/runtime/testdata/testprog/preempt.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/runtime/testdata/testprog/preempt.go b/src/runtime/testdata/testprog/preempt.go index cf004fcb28..c08b29b65a 100644 --- a/src/runtime/testdata/testprog/preempt.go +++ b/src/runtime/testdata/testprog/preempt.go @@ -22,16 +22,23 @@ func AsyncPreempt() { debug.SetGCPercent(-1) // Start a goroutine with no sync safe-points. - var ready uint32 + var ready, ready2 uint32 go func() { for { atomic.StoreUint32(&ready, 1) } }() + // Also start one with a frameless function. + // This is an especially interesting case for + // LR machines. + go func() { + atomic.StoreUint32(&ready2, 1) + frameless() + }() // Wait for the goroutine to stop passing through sync // safe-points. - for atomic.LoadUint32(&ready) == 0 { + for atomic.LoadUint32(&ready) == 0 || atomic.LoadUint32(&ready2) == 0 { runtime.Gosched() } @@ -42,3 +49,12 @@ func AsyncPreempt() { println("OK") } + +//go:noinline +func frameless() { + for i := int64(0); i < 1<<62; i++ { + out += i + } +} + +var out int64 |
