package runtime
import (
"internal/goexperiment"
"runtime/internal/atomic"
"unsafe"
)
func atomicwb (ptr *unsafe .Pointer , new unsafe .Pointer ) {
slot := (*uintptr )(unsafe .Pointer (ptr ))
buf := getg ().m .p .ptr ().wbBuf .get2 ()
buf [0 ] = *slot
buf [1 ] = uintptr (new )
}
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 )
}
func atomic_storePointer (ptr *unsafe .Pointer , new unsafe .Pointer ) {
atomicstorep (unsafe .Pointer (ptr ), new )
}
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 )
}
func sync_atomic_StoreUintptr (ptr *uintptr , new uintptr )
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 ))
}
func sync_atomic_SwapUintptr (ptr *uintptr , new uintptr ) uintptr
func sync_atomic_SwapPointer (ptr *unsafe .Pointer , new unsafe .Pointer ) unsafe .Pointer {
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
}
func sync_atomic_CompareAndSwapUintptr (ptr *uintptr , old , new uintptr ) bool
func sync_atomic_CompareAndSwapPointer (ptr *unsafe .Pointer , old , new unsafe .Pointer ) bool {
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 ))
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .