A bit cleanuppy for 1.6 maybe, but something I happened to notice.
Change-Id: I70f3b48445f4f527d67f7b202b6171195440b09f
Reviewed-on: https://go-review.googlesource.com/18550
Reviewed-by: Russ Cox <rsc@golang.org>
import "unsafe"
-// The calls to nop are to keep these functions from being inlined.
-// If they are inlined we have no guarantee that later rewrites of the
-// code by optimizers will preserve the relative order of memory accesses.
-
//go:nosplit
+//go:noinline
func Load(ptr *uint32) uint32 {
- nop()
return *ptr
}
//go:nosplit
+//go:noinline
func Loadp(ptr unsafe.Pointer) unsafe.Pointer {
- nop()
return *(*unsafe.Pointer)(ptr)
}
import "unsafe"
-// The calls to nop are to keep these functions from being inlined.
-// If they are inlined we have no guarantee that later rewrites of the
-// code by optimizers will preserve the relative order of memory accesses.
-
//go:nosplit
+//go:noinline
func Load(ptr *uint32) uint32 {
- nop()
return *ptr
}
//go:nosplit
+//go:noinline
func Loadp(ptr unsafe.Pointer) unsafe.Pointer {
- nop()
return *(*unsafe.Pointer)(ptr)
}
//go:nosplit
+//go:noinline
func Load64(ptr *uint64) uint64 {
- nop()
return *ptr
}
// NO go:noescape annotation; see atomic_pointer.go.
func Casp1(ptr *unsafe.Pointer, old, new unsafe.Pointer) bool
-func nop() // call to prevent inlining of function body
-
//go:noescape
func Casuintptr(ptr *uintptr, old, new uintptr) bool