github.com/zach-klippenstein/go@v0.0.0-20150108044943-fcfbeb3adf58/src/runtime/atomic_amd64x.go (about) 1 // Copyright 2009 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // +build amd64 amd64p32 6 7 package runtime 8 9 import "unsafe" 10 11 // The calls to nop are to keep these functions from being inlined. 12 // If they are inlined we have no guarantee that later rewrites of the 13 // code by optimizers will preserve the relative order of memory accesses. 14 15 //go:nosplit 16 func atomicload(ptr *uint32) uint32 { 17 nop() 18 return *ptr 19 } 20 21 //go:nosplit 22 func atomicloadp(ptr unsafe.Pointer) unsafe.Pointer { 23 nop() 24 return *(*unsafe.Pointer)(ptr) 25 } 26 27 //go:nosplit 28 func atomicload64(ptr *uint64) uint64 { 29 nop() 30 return *ptr 31 } 32 33 //go:noescape 34 func xadd(ptr *uint32, delta int32) uint32 35 36 //go:noescape 37 func xadd64(ptr *uint64, delta int64) uint64 38 39 //go:noescape 40 func xchg(ptr *uint32, new uint32) uint32 41 42 //go:noescape 43 func xchg64(ptr *uint64, new uint64) uint64 44 45 // NO go:noescape annotation; see atomic_pointer.go. 46 func xchgp1(ptr unsafe.Pointer, new unsafe.Pointer) unsafe.Pointer 47 48 //go:noescape 49 func xchguintptr(ptr *uintptr, new uintptr) uintptr 50 51 //go:noescape 52 func atomicor8(ptr *uint8, val uint8) 53 54 //go:noescape 55 func cas64(ptr *uint64, old, new uint64) bool 56 57 //go:noescape 58 func atomicstore(ptr *uint32, val uint32) 59 60 //go:noescape 61 func atomicstore64(ptr *uint64, val uint64) 62 63 // NO go:noescape annotation; see atomic_pointer.go. 64 func atomicstorep1(ptr unsafe.Pointer, val unsafe.Pointer)