From 67faca7d9c54b367aee5fdeef2d5dd609fcf99d0 Mon Sep 17 00:00:00 2001 From: Michael Matloob Date: Mon, 2 Nov 2015 14:09:24 -0500 Subject: runtime: break atomics out into package runtime/internal/atomic This change breaks out most of the atomics functions in the runtime into package runtime/internal/atomic. It adds some basic support in the toolchain for runtime packages, and also modifies linux/arm atomics to remove the dependency on the runtime's mutex. The mutexes have been replaced with spinlocks. all trybots are happy! In addition to the trybots, I've tested on the darwin/arm64 builder, on the darwin/arm builder, and on a ppc64le machine. Change-Id: I6698c8e3cf3834f55ce5824059f44d00dc8e3c2f Reviewed-on: https://go-review.googlesource.com/14204 Run-TryBot: Michael Matloob Reviewed-by: Russ Cox --- src/runtime/asm_arm64.s | 46 +--------------------------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) (limited to 'src/runtime/asm_arm64.s') diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s index 80309868f4..33755b35c0 100644 --- a/src/runtime/asm_arm64.s +++ b/src/runtime/asm_arm64.s @@ -453,40 +453,6 @@ CALLFN(·call268435456, 268435464 ) CALLFN(·call536870912, 536870920 ) CALLFN(·call1073741824, 1073741832 ) -// bool cas(uint32 *ptr, uint32 old, uint32 new) -// Atomically: -// if(*val == old){ -// *val = new; -// return 1; -// } else -// return 0; -TEXT runtime·cas(SB), NOSPLIT, $0-17 - MOVD ptr+0(FP), R0 - MOVW old+8(FP), R1 - MOVW new+12(FP), R2 -again: - LDAXRW (R0), R3 - CMPW R1, R3 - BNE ok - STLXRW R2, (R0), R3 - CBNZ R3, again -ok: - CSET EQ, R0 - MOVB R0, ret+16(FP) - RET - -TEXT runtime·casuintptr(SB), NOSPLIT, $0-25 - B runtime·cas64(SB) - -TEXT runtime·atomicloaduintptr(SB), NOSPLIT, $-8-16 - B runtime·atomicload64(SB) - -TEXT runtime·atomicloaduint(SB), NOSPLIT, $-8-16 - B runtime·atomicload64(SB) - -TEXT runtime·atomicstoreuintptr(SB), NOSPLIT, $0-16 - B runtime·atomicstore64(SB) - // AES hashing not implemented for ARM64, issue #10109. TEXT runtime·aeshash(SB),NOSPLIT,$-8-0 MOVW $0, R0 @@ -500,17 +466,7 @@ TEXT runtime·aeshash64(SB),NOSPLIT,$-8-0 TEXT runtime·aeshashstr(SB),NOSPLIT,$-8-0 MOVW $0, R0 MOVW (R0), R1 - -// bool casp(void **val, void *old, void *new) -// Atomically: -// if(*val == old){ -// *val = new; -// return 1; -// } else -// return 0; -TEXT runtime·casp1(SB), NOSPLIT, $0-25 - B runtime·cas64(SB) - + TEXT runtime·procyield(SB),NOSPLIT,$0-0 MOVWU cycles+0(FP), R0 again: -- cgit v1.3-5-g9baa