Commit 42ea2eda authored by Russ Cox's avatar Russ Cox

sync/atomic: fix unimportant assembly errors found by go vet

None of these are real bugs.
The variable name in the reference is not semantically meaningful,
except that 'go vet' will double check the offset against the name for you.

The stack sizes being corrected really are incorrect but they are also
in NOSPLIT functions so they typically don't matter.

Found by vet.

GOOS=linux GOARCH=amd64 go vet sync/atomic
GOOS=linux GOARCH=amd64p32 go vet sync/atomic
GOOS=linux GOARCH=386 go vet sync/atomic
GOOS=linux GOARCH=arm go vet sync/atomic
GOOS=freebsd GOARCH=arm go vet sync/atomic
GOOS=netbsd GOARCH=arm go vet sync/atomic

LGTM=r
R=r, bradfitz
CC=golang-codereviews
https://golang.org/cl/100500043
parent 208a1ea5
......@@ -13,7 +13,7 @@ TEXT ·SwapUint32(SB),NOSPLIT,$0-12
MOVL addr+0(FP), BP
MOVL new+4(FP), AX
XCHGL AX, 0(BP)
MOVL AX, new+8(FP)
MOVL AX, old+8(FP)
RET
TEXT ·SwapInt64(SB),NOSPLIT,$0-20
......@@ -43,8 +43,8 @@ swaploop:
// success
// return DX:AX
MOVL AX, new_lo+12(FP)
MOVL DX, new_hi+16(FP)
MOVL AX, old_lo+12(FP)
MOVL DX, old_hi+16(FP)
RET
TEXT ·SwapUintptr(SB),NOSPLIT,$0-12
......@@ -155,10 +155,10 @@ TEXT ·LoadUint32(SB),NOSPLIT,$0-8
MOVL AX, val+4(FP)
RET
TEXT ·LoadInt64(SB),NOSPLIT,$0-16
TEXT ·LoadInt64(SB),NOSPLIT,$0-12
JMP ·LoadUint64(SB)
TEXT ·LoadUint64(SB),NOSPLIT,$0-16
TEXT ·LoadUint64(SB),NOSPLIT,$0-12
MOVL addr+0(FP), AX
TESTL $7, AX
JZ 2(PC)
......@@ -186,10 +186,10 @@ TEXT ·StoreUint32(SB),NOSPLIT,$0-8
XCHGL AX, 0(BP)
RET
TEXT ·StoreInt64(SB),NOSPLIT,$0-16
TEXT ·StoreInt64(SB),NOSPLIT,$0-12
JMP ·StoreUint64(SB)
TEXT ·StoreUint64(SB),NOSPLIT,$0-16
TEXT ·StoreUint64(SB),NOSPLIT,$0-12
MOVL addr+0(FP), AX
TESTL $7, AX
JZ 2(PC)
......
......@@ -13,7 +13,7 @@ TEXT ·SwapUint32(SB),NOSPLIT,$0-20
MOVQ addr+0(FP), BP
MOVL new+8(FP), AX
XCHGL AX, 0(BP)
MOVL AX, new+16(FP)
MOVL AX, old+16(FP)
RET
TEXT ·SwapInt64(SB),NOSPLIT,$0-24
......@@ -23,7 +23,7 @@ TEXT ·SwapUint64(SB),NOSPLIT,$0-24
MOVQ addr+0(FP), BP
MOVQ new+8(FP), AX
XCHGQ AX, 0(BP)
MOVQ AX, new+16(FP)
MOVQ AX, old+16(FP)
RET
TEXT ·SwapUintptr(SB),NOSPLIT,$0-24
......
......@@ -11,7 +11,7 @@ TEXT ·SwapUint32(SB),NOSPLIT,$0-12
MOVL addr+0(FP), BX
MOVL new+4(FP), AX
XCHGL AX, 0(BX)
MOVL AX, new+8(FP)
MOVL AX, old+8(FP)
RET
TEXT ·SwapInt64(SB),NOSPLIT,$0-24
......@@ -24,13 +24,13 @@ TEXT ·SwapUint64(SB),NOSPLIT,$0-24
MOVL 0, BX // crash with nil ptr deref
MOVQ new+8(FP), AX
XCHGQ AX, 0(BX)
MOVQ AX, new+16(FP)
MOVQ AX, old+16(FP)
RET
TEXT ·SwapUintptr(SB),NOSPLIT,$0-24
TEXT ·SwapUintptr(SB),NOSPLIT,$0-12
JMP ·SwapUint32(SB)
TEXT ·SwapPointer(SB),NOSPLIT,$0-24
TEXT ·SwapPointer(SB),NOSPLIT,$0-12
JMP ·SwapUint32(SB)
TEXT ·CompareAndSwapInt32(SB),NOSPLIT,$0-17
......@@ -45,10 +45,10 @@ TEXT ·CompareAndSwapUint32(SB),NOSPLIT,$0-17
SETEQ swapped+16(FP)
RET
TEXT ·CompareAndSwapUintptr(SB),NOSPLIT,$0-25
TEXT ·CompareAndSwapUintptr(SB),NOSPLIT,$0-17
JMP ·CompareAndSwapUint32(SB)
TEXT ·CompareAndSwapPointer(SB),NOSPLIT,$0-25
TEXT ·CompareAndSwapPointer(SB),NOSPLIT,$0-17
JMP ·CompareAndSwapUint32(SB)
TEXT ·CompareAndSwapInt64(SB),NOSPLIT,$0-25
......@@ -82,7 +82,7 @@ TEXT ·AddUint32(SB),NOSPLIT,$0-12
TEXT ·AddUintptr(SB),NOSPLIT,$0-12
JMP ·AddUint32(SB)
TEXT ·AddInt64(SB),NOSPLIT,$0-12
TEXT ·AddInt64(SB),NOSPLIT,$0-24
JMP ·AddUint64(SB)
TEXT ·AddUint64(SB),NOSPLIT,$0-24
......
......@@ -42,7 +42,7 @@ casagain:
BCC cascheck
MOVW $1, R0
casret:
MOVW R0, ret+12(FP)
MOVB R0, swapped+12(FP)
RET
cascheck:
// Kernel lies; double-check.
......@@ -73,7 +73,7 @@ addloop1:
ADD R4, R1
BL cas<>(SB)
BCC addloop1
MOVW R1, ret+8(FP)
MOVW R1, new+8(FP)
RET
TEXT ·AddUintptr(SB),NOSPLIT,$0
......@@ -132,13 +132,13 @@ TEXT ·generalCAS64(SB),NOSPLIT,$20-21
BEQ 2(PC)
MOVW R1, (R1)
MOVW R0, 4(R13)
MOVW oldlo+4(FP), R1
MOVW old_lo+4(FP), R1
MOVW R1, 8(R13)
MOVW oldhi+8(FP), R1
MOVW old_hi+8(FP), R1
MOVW R1, 12(R13)
MOVW newlo+12(FP), R2
MOVW new_lo+12(FP), R2
MOVW R2, 16(R13)
MOVW newhi+16(FP), R3
MOVW new_hi+16(FP), R3
MOVW R3, 20(R13)
BL runtime·cas64(SB)
MOVB R0, ret+20(FP)
......
......@@ -4,6 +4,6 @@
package atomic
func generalCAS64(*uint64, uint64, uint64) bool
func generalCAS64(addr *uint64, old uint64, new uint64) bool
var GeneralCAS64 = generalCAS64
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment