From a60a3dc5bc0336bd6b499bc7e1feb459b1e4a4bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Mart=C3=AD?= Date: Mon, 5 Sep 2022 08:30:02 +0000 Subject: [PATCH] Revert "runtime: convert local var stop,ready at TestDebugCallUnsafePoint to atomic type" MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This reverts https://go.dev/cl/427135. Reason for revert: broke the test it modified on linux-amd64-noopt. --- FAIL: TestDebugCallUnsafePoint (0.00s) debug_test.go:265: want "call not at safe point", got %!s() Change-Id: I044c9720aed2d5e48b56bd7ab2781462270dcae9 Reviewed-on: https://go-review.googlesource.com/c/go/+/428395 Reviewed-by: xie cui <523516579@qq.com> Reviewed-by: Bryan Mills Run-TryBot: Daniel Martí TryBot-Result: Gopher Robot Reviewed-by: hopehook Reviewed-by: Michael Pratt --- src/runtime/debug_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/runtime/debug_test.go b/src/runtime/debug_test.go index b231be344c..75fe07ec2a 100644 --- a/src/runtime/debug_test.go +++ b/src/runtime/debug_test.go @@ -224,7 +224,7 @@ func TestDebugCallGrowStack(t *testing.T) { } //go:nosplit -func debugCallUnsafePointWorker(gpp **runtime.G, ready, stop *atomic.Bool) { +func debugCallUnsafePointWorker(gpp **runtime.G, ready, stop *uint32) { // The nosplit causes this function to not contain safe-points // except at calls. runtime.LockOSThread() @@ -232,8 +232,8 @@ func debugCallUnsafePointWorker(gpp **runtime.G, ready, stop *atomic.Bool) { *gpp = runtime.Getg() - for !stop.Load() { - ready.Store(true) + for atomic.LoadUint32(stop) == 0 { + atomic.StoreUint32(ready, 1) } } @@ -253,10 +253,10 @@ func TestDebugCallUnsafePoint(t *testing.T) { // Test that the runtime refuses call injection at unsafe points. var g *runtime.G - var ready, stop atomic.Bool - defer stop.Store(true) + var ready, stop uint32 + defer atomic.StoreUint32(&stop, 1) go debugCallUnsafePointWorker(&g, &ready, &stop) - for !ready.Load() { + for atomic.LoadUint32(&ready) == 0 { runtime.Gosched() } -- 2.50.0