aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorRick Hudson <rlh@golang.org>2015-03-24 11:18:46 -0400
committerRick Hudson <rlh@golang.org>2015-03-24 16:42:39 +0000
commit546a54bb2e96f9561e71acf5e70df466056aefaf (patch)
tree2c017f7fdae290d1c3f470e51b39692de7df075a /src/runtime
parent9b69196958a1ba3eba7a1621894ea9aafaa91648 (diff)
downloadgo-546a54bb2e96f9561e71acf5e70df466056aefaf.tar.xz
runtime: Remove write barrier on g
There are calls to stdcall when the GC thinks the world is stopped and stdcall write a *g for the CPU profiler. This produces a write barrier but the GC is not prepared to deal with write barriers when it thinks the world is stopped. Since the g is on allg it does not need a write barrier to keep it alive so eliminate the write barrier. Change-Id: I937633409a66553d7d292d87d7d58caba1fad0b6 Reviewed-on: https://go-review.googlesource.com/7979 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Rick Hudson <rlh@golang.org>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/os1_windows.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/runtime/os1_windows.go b/src/runtime/os1_windows.go
index 561d3ce457..4ae1a8411b 100644
--- a/src/runtime/os1_windows.go
+++ b/src/runtime/os1_windows.go
@@ -359,6 +359,8 @@ func nanotime() int64 {
}
// Calling stdcall on os stack.
+// May run during STW, so write barriers are not allowed.
+//go:nowritebarrier
//go:nosplit
func stdcall(fn stdFunction) uintptr {
gp := getg()
@@ -367,7 +369,8 @@ func stdcall(fn stdFunction) uintptr {
if mp.profilehz != 0 {
// leave pc/sp for cpu profiler
- mp.libcallg = gp
+ // gp is on allg, so this WB can be eliminated.
+ setGNoWriteBarrier(&mp.libcallg, gp)
mp.libcallpc = getcallerpc(unsafe.Pointer(&fn))
// sp must be the last, because once async cpu profiler finds
// all three values to be non-zero, it will use them