Skip to content

Commit

Permalink
runtime: remove unused xchgp/xchgp1
Browse files Browse the repository at this point in the history
I noticed that they were unimplemented on arm64 but then that they were
in fact not used at all.

Change-Id: Iee579feda2a5e374fa571bcc8c89e4ef607d50f6
Reviewed-on: https://go-review.googlesource.com/13951
Run-TryBot: Minux Ma <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
mwhudson authored and ianlancetaylor committed Aug 27, 2015
1 parent b9e4867 commit d497eeb
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 54 deletions.
7 changes: 0 additions & 7 deletions src/runtime/asm_386.s
Original file line number Diff line number Diff line change
Expand Up @@ -551,13 +551,6 @@ TEXT runtime·xchg(SB), NOSPLIT, $0-12
MOVL AX, ret+8(FP)
RET

TEXT runtime·xchgp1(SB), NOSPLIT, $0-12
MOVL ptr+0(FP), BX
MOVL new+4(FP), AX
XCHGL AX, 0(BX)
MOVL AX, ret+8(FP)
RET

TEXT runtime·xchguintptr(SB), NOSPLIT, $0-12
JMP runtime·xchg(SB)

Expand Down
7 changes: 0 additions & 7 deletions src/runtime/asm_amd64.s
Original file line number Diff line number Diff line change
Expand Up @@ -563,13 +563,6 @@ TEXT runtime·xchg64(SB), NOSPLIT, $0-24
MOVQ AX, ret+16(FP)
RET

TEXT runtime·xchgp1(SB), NOSPLIT, $0-24
MOVQ ptr+0(FP), BX
MOVQ new+8(FP), AX
XCHGQ AX, 0(BX)
MOVQ AX, ret+16(FP)
RET

TEXT runtime·xchguintptr(SB), NOSPLIT, $0-24
JMP runtime·xchg64(SB)

Expand Down
7 changes: 0 additions & 7 deletions src/runtime/asm_amd64p32.s
Original file line number Diff line number Diff line change
Expand Up @@ -517,13 +517,6 @@ TEXT runtime·xchg64(SB), NOSPLIT, $0-24
MOVQ AX, ret+16(FP)
RET

TEXT runtime·xchgp1(SB), NOSPLIT, $0-12
MOVL ptr+0(FP), BX
MOVL new+4(FP), AX
XCHGL AX, 0(BX)
MOVL AX, ret+8(FP)
RET

TEXT runtime·xchguintptr(SB), NOSPLIT, $0-12
JMP runtime·xchg(SB)

Expand Down
3 changes: 0 additions & 3 deletions src/runtime/asm_ppc64x.s
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,6 @@ TEXT runtime·xchg64(SB), NOSPLIT, $0-24
MOVD R3, ret+16(FP)
RET

TEXT runtime·xchgp1(SB), NOSPLIT, $0-24
BR runtime·xchg64(SB)

TEXT runtime·xchguintptr(SB), NOSPLIT, $0-24
BR runtime·xchg64(SB)

Expand Down
3 changes: 0 additions & 3 deletions src/runtime/atomic_386.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ func xadd(ptr *uint32, delta int32) uint32
//go:noescape
func xchg(ptr *uint32, new uint32) uint32

// NO go:noescape annotation; see atomic_pointer.go.
func xchgp1(ptr unsafe.Pointer, new unsafe.Pointer) unsafe.Pointer

//go:noescape
func xchguintptr(ptr *uintptr, new uintptr) uintptr

Expand Down
3 changes: 0 additions & 3 deletions src/runtime/atomic_amd64x.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ func xchg(ptr *uint32, new uint32) uint32
//go:noescape
func xchg64(ptr *uint64, new uint64) uint64

// NO go:noescape annotation; see atomic_pointer.go.
func xchgp1(ptr unsafe.Pointer, new unsafe.Pointer) unsafe.Pointer

//go:noescape
func xchguintptr(ptr *uintptr, new uintptr) uintptr

Expand Down
10 changes: 0 additions & 10 deletions src/runtime/atomic_arm.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@ func xchg(addr *uint32, v uint32) uint32 {
}
}

//go:nosplit
func xchgp1(addr unsafe.Pointer, v unsafe.Pointer) unsafe.Pointer {
for {
old := *(*unsafe.Pointer)(addr)
if casp1((*unsafe.Pointer)(addr), old, v) {
return old
}
}
}

//go:nosplit
func xchguintptr(addr *uintptr, v uintptr) uintptr {
return uintptr(xchg((*uint32)(unsafe.Pointer(addr)), uint32(v)))
Expand Down
3 changes: 0 additions & 3 deletions src/runtime/atomic_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ func xchg(ptr *uint32, new uint32) uint32
//go:noescape
func xchg64(ptr *uint64, new uint64) uint64

// NO go:noescape annotation; see atomic_pointer.go.
func xchgp1(ptr unsafe.Pointer, new unsafe.Pointer) unsafe.Pointer

//go:noescape
func xchguintptr(ptr *uintptr, new uintptr) uintptr

Expand Down
9 changes: 1 addition & 8 deletions src/runtime/atomic_pointer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "unsafe"
// because while ptr does not escape, new does.
// If new is marked as not escaping, the compiler will make incorrect
// escape analysis decisions about the pointer value being stored.
// Instead, these are wrappers around the actual atomics (xchgp1 and so on)
// Instead, these are wrappers around the actual atomics (casp1 and so on)
// that use noescape to convey which arguments do not escape.
//
// Additionally, these functions must update the shadow heap for
Expand All @@ -22,13 +22,6 @@ func atomicstorep(ptr unsafe.Pointer, new unsafe.Pointer) {
writebarrierptr_nostore((*uintptr)(ptr), uintptr(new))
}

//go:nosplit
func xchgp(ptr unsafe.Pointer, new unsafe.Pointer) unsafe.Pointer {
old := xchgp1(noescape(ptr), new)
writebarrierptr_nostore((*uintptr)(ptr), uintptr(new))
return old
}

//go:nosplit
func casp(ptr *unsafe.Pointer, old, new unsafe.Pointer) bool {
if !casp1((*unsafe.Pointer)(noescape(unsafe.Pointer(ptr))), noescape(old), new) {
Expand Down
3 changes: 0 additions & 3 deletions src/runtime/atomic_ppc64x.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ func xchg(ptr *uint32, new uint32) uint32
//go:noescape
func xchg64(ptr *uint64, new uint64) uint64

// NO go:noescape annotation; see atomic_pointer.go.
func xchgp1(ptr unsafe.Pointer, new unsafe.Pointer) unsafe.Pointer

//go:noescape
func xchguintptr(ptr *uintptr, new uintptr) uintptr

Expand Down

0 comments on commit d497eeb

Please sign in to comment.