diff options
Diffstat (limited to 'src/runtime/atomic_pointer.go')
| -rw-r--r-- | src/runtime/atomic_pointer.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/runtime/atomic_pointer.go b/src/runtime/atomic_pointer.go index 25e0e651b4..26dfbfc2cc 100644 --- a/src/runtime/atomic_pointer.go +++ b/src/runtime/atomic_pointer.go @@ -5,6 +5,7 @@ package runtime import ( + "internal/goexperiment" "runtime/internal/atomic" "unsafe" ) @@ -21,7 +22,7 @@ import ( func atomicwb(ptr *unsafe.Pointer, new unsafe.Pointer) { slot := (*uintptr)(unsafe.Pointer(ptr)) if !getg().m.p.ptr().wbBuf.putFast(*slot, uintptr(new)) { - wbBufFlush(slot, uintptr(new)) + wbBufFlush() } } @@ -32,6 +33,9 @@ func atomicstorep(ptr unsafe.Pointer, new unsafe.Pointer) { if writeBarrier.enabled { atomicwb((*unsafe.Pointer)(ptr), new) } + if goexperiment.CgoCheck2 { + cgoCheckPtrWrite((*unsafe.Pointer)(ptr), new) + } atomic.StorepNoWB(noescape(ptr), new) } @@ -53,6 +57,9 @@ func atomic_casPointer(ptr *unsafe.Pointer, old, new unsafe.Pointer) bool { if writeBarrier.enabled { atomicwb(ptr, new) } + if goexperiment.CgoCheck2 { + cgoCheckPtrWrite(ptr, new) + } return atomic.Casp1(ptr, old, new) } @@ -69,6 +76,9 @@ func sync_atomic_StorePointer(ptr *unsafe.Pointer, new unsafe.Pointer) { if writeBarrier.enabled { atomicwb(ptr, new) } + if goexperiment.CgoCheck2 { + cgoCheckPtrWrite(ptr, new) + } sync_atomic_StoreUintptr((*uintptr)(unsafe.Pointer(ptr)), uintptr(new)) } @@ -81,6 +91,9 @@ func sync_atomic_SwapPointer(ptr *unsafe.Pointer, new unsafe.Pointer) unsafe.Poi if writeBarrier.enabled { atomicwb(ptr, new) } + if goexperiment.CgoCheck2 { + cgoCheckPtrWrite(ptr, new) + } old := unsafe.Pointer(sync_atomic_SwapUintptr((*uintptr)(noescape(unsafe.Pointer(ptr))), uintptr(new))) return old } @@ -94,5 +107,8 @@ func sync_atomic_CompareAndSwapPointer(ptr *unsafe.Pointer, old, new unsafe.Poin if writeBarrier.enabled { atomicwb(ptr, new) } + if goexperiment.CgoCheck2 { + cgoCheckPtrWrite(ptr, new) + } return sync_atomic_CompareAndSwapUintptr((*uintptr)(noescape(unsafe.Pointer(ptr))), uintptr(old), uintptr(new)) } |
