aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/export_test.go
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2021-06-03 18:29:05 -0400
committerCherry Mui <cherryyz@google.com>2021-06-04 17:00:32 +0000
commit3298c749acc32eca0460f52866d169441eb0e076 (patch)
treeecceb1da69972419db97285f477eaf1fdf5c9cca /src/runtime/export_test.go
parent46beeed0ac4cd409554167c315861eaf8ae68c4a (diff)
downloadgo-3298c749acc32eca0460f52866d169441eb0e076.tar.gz
go-3298c749acc32eca0460f52866d169441eb0e076.zip
[dev.typeparams] runtime: undo go'd closure argument workaround
In CL 298669 we added defer/go wrapping, and, as it is not allowed for closures to escape when compiling runtime, we worked around it by rewriting go'd closures to argumentless non-capturing closures, so it is not a real closure and so not needed to escape. Previous CL removes the restriction. Now we can undo the workaround. Updates #40724. Change-Id: Ic7bf129da4aee7b7fdb7157414eca943a6a27264 Reviewed-on: https://go-review.googlesource.com/c/go/+/325110 Trust: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/runtime/export_test.go')
-rw-r--r--src/runtime/export_test.go20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go
index fa878c4946..60c06c3f10 100644
--- a/src/runtime/export_test.go
+++ b/src/runtime/export_test.go
@@ -145,40 +145,28 @@ func RunSchedLocalQueueStealTest() {
}
}
-// Temporary to enable register ABI bringup.
-// TODO(register args): convert back to local variables in RunSchedLocalQueueEmptyTest that
-// get passed to the "go" stmts there.
-var RunSchedLocalQueueEmptyState struct {
- done chan bool
- ready *uint32
- p *p
-}
-
func RunSchedLocalQueueEmptyTest(iters int) {
// Test that runq is not spuriously reported as empty.
// Runq emptiness affects scheduling decisions and spurious emptiness
// can lead to underutilization (both runnable Gs and idle Ps coexist
// for arbitrary long time).
done := make(chan bool, 1)
- RunSchedLocalQueueEmptyState.done = done
p := new(p)
- RunSchedLocalQueueEmptyState.p = p
gs := make([]g, 2)
ready := new(uint32)
- RunSchedLocalQueueEmptyState.ready = ready
for i := 0; i < iters; i++ {
*ready = 0
next0 := (i & 1) == 0
next1 := (i & 2) == 0
runqput(p, &gs[0], next0)
go func() {
- for atomic.Xadd(RunSchedLocalQueueEmptyState.ready, 1); atomic.Load(RunSchedLocalQueueEmptyState.ready) != 2; {
+ for atomic.Xadd(ready, 1); atomic.Load(ready) != 2; {
}
- if runqempty(RunSchedLocalQueueEmptyState.p) {
- //println("next:", next0, next1)
+ if runqempty(p) {
+ println("next:", next0, next1)
throw("queue is empty")
}
- RunSchedLocalQueueEmptyState.done <- true
+ done <- true
}()
for atomic.Xadd(ready, 1); atomic.Load(ready) != 2; {
}