aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/atomic_pointer.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2022-10-25 17:58:07 -0700
committerKeith Randall <khr@golang.org>2023-02-17 22:19:26 +0000
commitd3daeb5267b626db36adf2f39c36f6caf94447e3 (patch)
tree9260d979d13b9cd790a2f1167069a34dfbedeef2 /src/runtime/atomic_pointer.go
parent209df389c215d9a1eee15ce1c1e4d82f43e026db (diff)
downloadgo-d3daeb5267b626db36adf2f39c36f6caf94447e3.tar.xz
runtime: remove the restriction that write barrier ptrs come in pairs
Future CLs will remove the invariant that pointers are always put in the write barrier in pairs. The behavior of the assembly code changes a bit, where instead of writing the pointers unconditionally and then checking for overflow, check for overflow first and then write the pointers. Also changed the write barrier flush function to not take the src/dst as arguments. Change-Id: I2ef708038367b7b82ea67cbaf505a1d5904c775c Reviewed-on: https://go-review.googlesource.com/c/go/+/447779 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Bypass: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/atomic_pointer.go')
-rw-r--r--src/runtime/atomic_pointer.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/atomic_pointer.go b/src/runtime/atomic_pointer.go
index 26dfbfc2cc..b61bf0b8b2 100644
--- a/src/runtime/atomic_pointer.go
+++ b/src/runtime/atomic_pointer.go
@@ -21,9 +21,9 @@ import (
//go:nosplit
func atomicwb(ptr *unsafe.Pointer, new unsafe.Pointer) {
slot := (*uintptr)(unsafe.Pointer(ptr))
- if !getg().m.p.ptr().wbBuf.putFast(*slot, uintptr(new)) {
- wbBufFlush()
- }
+ buf := getg().m.p.ptr().wbBuf.get2()
+ buf[0] = *slot
+ buf[1] = uintptr(new)
}
// atomicstorep performs *ptr = new atomically and invokes a write barrier.