1
0
mirror of https://github.com/golang/go synced 2024-11-23 20:00:04 -07:00

runtime/internal/atomic: rename Storep1 to StorepNoWB

Make it clear that the point of this function stores a pointer
*without* a write barrier.

sed -i -e 's/Storep1/StorepNoWB/' $(git grep -l Storep1)

Updates #15270.

Change-Id: Ifad7e17815e51a738070655fe3b178afdadaecf6
Reviewed-on: https://go-review.googlesource.com/21994
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
Austin Clements 2016-04-13 11:22:42 -04:00
parent da6205b67e
commit 4721ea6abc
15 changed files with 20 additions and 17 deletions

View File

@ -20,7 +20,7 @@ import (
//
//go:nosplit
func atomicstorep(ptr unsafe.Pointer, new unsafe.Pointer) {
atomic.Storep1(noescape(ptr), new)
atomic.StorepNoWB(noescape(ptr), new)
writebarrierptr_nostore((*uintptr)(ptr), uintptr(new))
}
@ -44,7 +44,7 @@ func sync_atomic_StoreUintptr(ptr *uintptr, new uintptr)
//go:nosplit
func sync_atomic_StorePointer(ptr *unsafe.Pointer, new unsafe.Pointer) {
sync_atomic_StoreUintptr((*uintptr)(unsafe.Pointer(ptr)), uintptr(new))
atomic.Storep1(noescape(unsafe.Pointer(ptr)), new)
atomic.StorepNoWB(noescape(unsafe.Pointer(ptr)), new)
writebarrierptr_nostore((*uintptr)(unsafe.Pointer(ptr)), uintptr(new))
}

View File

@ -1075,8 +1075,8 @@ func mapzero(t *_type) {
throw("map element too large")
}
}
atomic.Storep1(unsafe.Pointer(&zeroptr), persistentalloc(cursize, 64, &memstats.other_sys))
atomic.Storep1(unsafe.Pointer(&zerosize), unsafe.Pointer(zerosize))
atomic.StorepNoWB(unsafe.Pointer(&zeroptr), persistentalloc(cursize, 64, &memstats.other_sys))
atomic.StorepNoWB(unsafe.Pointer(&zerosize), unsafe.Pointer(zerosize))
}
unlock(&zerolock)
}

View File

@ -102,7 +102,7 @@ TEXT runtimeinternalatomic·Xchguintptr(SB), NOSPLIT, $0-12
JMP runtimeinternalatomic·Xchg(SB)
TEXT runtimeinternalatomic·Storep1(SB), NOSPLIT, $0-8
TEXT runtimeinternalatomic·StorepNoWB(SB), NOSPLIT, $0-8
MOVL ptr+0(FP), BX
MOVL val+4(FP), AX
XCHGL AX, 0(BX)

View File

@ -115,7 +115,7 @@ TEXT runtimeinternalatomic·Xchg64(SB), NOSPLIT, $0-24
TEXT runtimeinternalatomic·Xchguintptr(SB), NOSPLIT, $0-24
JMP runtimeinternalatomic·Xchg64(SB)
TEXT runtimeinternalatomic·Storep1(SB), NOSPLIT, $0-16
TEXT runtimeinternalatomic·StorepNoWB(SB), NOSPLIT, $0-16
MOVQ ptr+0(FP), BX
MOVQ val+8(FP), AX
XCHGQ AX, 0(BX)

View File

@ -115,7 +115,7 @@ TEXT runtimeinternalatomic·Xchg64(SB), NOSPLIT, $0-24
TEXT runtimeinternalatomic·Xchguintptr(SB), NOSPLIT, $0-12
JMP runtimeinternalatomic·Xchg(SB)
TEXT runtimeinternalatomic·Storep1(SB), NOSPLIT, $0-8
TEXT runtimeinternalatomic·StorepNoWB(SB), NOSPLIT, $0-8
MOVL ptr+0(FP), BX
MOVL val+4(FP), AX
XCHGL AX, 0(BX)

View File

@ -155,7 +155,7 @@ TEXT ·Xchg64(SB), NOSPLIT, $0-24
TEXT ·Xchguintptr(SB), NOSPLIT, $0-24
JMP ·Xchg64(SB)
TEXT ·Storep1(SB), NOSPLIT, $0-16
TEXT ·StorepNoWB(SB), NOSPLIT, $0-16
JMP ·Store64(SB)
TEXT ·Store(SB), NOSPLIT, $0-12

View File

@ -150,7 +150,7 @@ TEXT runtimeinternalatomic·Xchguintptr(SB), NOSPLIT, $0-24
BR runtimeinternalatomic·Xchg64(SB)
TEXT runtimeinternalatomic·Storep1(SB), NOSPLIT, $0-16
TEXT runtimeinternalatomic·StorepNoWB(SB), NOSPLIT, $0-16
BR runtimeinternalatomic·Store64(SB)
TEXT runtimeinternalatomic·Store(SB), NOSPLIT, $0-12

View File

@ -73,4 +73,4 @@ func Store(ptr *uint32, val uint32)
func Store64(ptr *uint64, val uint64)
// NO go:noescape annotation; see atomic_pointer.go.
func Storep1(ptr unsafe.Pointer, val unsafe.Pointer)
func StorepNoWB(ptr unsafe.Pointer, val unsafe.Pointer)

View File

@ -61,5 +61,8 @@ func Store(ptr *uint32, val uint32)
//go:noescape
func Store64(ptr *uint64, val uint64)
// StorepNoWB performs *ptr = val atomically and without a write
// barrier.
//
// NO go:noescape annotation; see atomic_pointer.go.
func Storep1(ptr unsafe.Pointer, val unsafe.Pointer)
func StorepNoWB(ptr unsafe.Pointer, val unsafe.Pointer)

View File

@ -85,7 +85,7 @@ func Loadp(addr unsafe.Pointer) unsafe.Pointer {
}
//go:nosplit
func Storep1(addr unsafe.Pointer, v unsafe.Pointer) {
func StorepNoWB(addr unsafe.Pointer, v unsafe.Pointer) {
for {
old := *(*unsafe.Pointer)(addr)
if Casp1((*unsafe.Pointer)(addr), old, v) {

View File

@ -77,4 +77,4 @@ func Store(ptr *uint32, val uint32)
func Store64(ptr *uint64, val uint64)
// NO go:noescape annotation; see atomic_pointer.go.
func Storep1(ptr unsafe.Pointer, val unsafe.Pointer)
func StorepNoWB(ptr unsafe.Pointer, val unsafe.Pointer)

View File

@ -25,7 +25,7 @@ TEXT ·Loadp(SB),NOSPLIT,$-8-16
MOVD R0, ret+8(FP)
RET
TEXT runtimeinternalatomic·Storep1(SB), NOSPLIT, $0-16
TEXT runtimeinternalatomic·StorepNoWB(SB), NOSPLIT, $0-16
B runtimeinternalatomic·Store64(SB)
TEXT runtimeinternalatomic·Store(SB), NOSPLIT, $0-12

View File

@ -53,4 +53,4 @@ func Store(ptr *uint32, val uint32)
func Store64(ptr *uint64, val uint64)
// NO go:noescape annotation; see atomic_pointer.go.
func Storep1(ptr unsafe.Pointer, val unsafe.Pointer)
func StorepNoWB(ptr unsafe.Pointer, val unsafe.Pointer)

View File

@ -53,4 +53,4 @@ func Store(ptr *uint32, val uint32)
func Store64(ptr *uint64, val uint64)
// NO go:noescape annotation; see atomic_pointer.go.
func Storep1(ptr unsafe.Pointer, val unsafe.Pointer)
func StorepNoWB(ptr unsafe.Pointer, val unsafe.Pointer)

View File

@ -39,7 +39,7 @@ func Store64(ptr *uint64, val uint64) {
// NO go:noescape annotation; see atomic_pointer.go.
//go:noinline
//go:nosplit
func Storep1(ptr unsafe.Pointer, val unsafe.Pointer) {
func StorepNoWB(ptr unsafe.Pointer, val unsafe.Pointer) {
*(*uintptr)(ptr) = uintptr(val)
}