Source file src/runtime/internal/atomic/atomic_amd64x.go

Documentation: runtime/internal/atomic

     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 atomic
     8  
     9  import "unsafe"
    10  
    11  // Export some functions via linkname to assembly in sync/atomic.
    12  //go:linkname Load
    13  //go:linkname Loadp
    14  //go:linkname Load64
    15  
    16  //go:nosplit
    17  //go:noinline
    18  func Load(ptr *uint32) uint32 {
    19  	return *ptr
    20  }
    21  
    22  //go:nosplit
    23  //go:noinline
    24  func Loadp(ptr unsafe.Pointer) unsafe.Pointer {
    25  	return *(*unsafe.Pointer)(ptr)
    26  }
    27  
    28  //go:nosplit
    29  //go:noinline
    30  func Load64(ptr *uint64) uint64 {
    31  	return *ptr
    32  }
    33  
    34  //go:nosplit
    35  //go:noinline
    36  func LoadAcq(ptr *uint32) uint32 {
    37  	return *ptr
    38  }
    39  
    40  //go:noescape
    41  func Xadd(ptr *uint32, delta int32) uint32
    42  
    43  //go:noescape
    44  func Xadd64(ptr *uint64, delta int64) uint64
    45  
    46  //go:noescape
    47  func Xadduintptr(ptr *uintptr, delta uintptr) uintptr
    48  
    49  //go:noescape
    50  func Xchg(ptr *uint32, new uint32) uint32
    51  
    52  //go:noescape
    53  func Xchg64(ptr *uint64, new uint64) uint64
    54  
    55  //go:noescape
    56  func Xchguintptr(ptr *uintptr, new uintptr) uintptr
    57  
    58  //go:nosplit
    59  //go:noinline
    60  func Load8(ptr *uint8) uint8 {
    61  	return *ptr
    62  }
    63  
    64  //go:noescape
    65  func And8(ptr *uint8, val uint8)
    66  
    67  //go:noescape
    68  func Or8(ptr *uint8, val uint8)
    69  
    70  // NOTE: Do not add atomicxor8 (XOR is not idempotent).
    71  
    72  //go:noescape
    73  func Cas64(ptr *uint64, old, new uint64) bool
    74  
    75  //go:noescape
    76  func CasRel(ptr *uint32, old, new uint32) bool
    77  
    78  //go:noescape
    79  func Store(ptr *uint32, val uint32)
    80  
    81  //go:noescape
    82  func Store64(ptr *uint64, val uint64)
    83  
    84  //go:noescape
    85  func StoreRel(ptr *uint32, val uint32)
    86  
    87  // StorepNoWB performs *ptr = val atomically and without a write
    88  // barrier.
    89  //
    90  // NO go:noescape annotation; see atomic_pointer.go.
    91  func StorepNoWB(ptr unsafe.Pointer, val unsafe.Pointer)
    92  

View as plain text