aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_darwin_amd64.s
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2019-06-19 17:48:33 +0000
committerIan Lance Taylor <iant@golang.org>2019-06-21 04:42:51 +0000
commit1130cc745d45bc7248a2e133a609732a14486f01 (patch)
tree4642fd40818af671c6efef5fee2e6a6e5de3ce5f /src/runtime/sys_darwin_amd64.s
parentb5a8dcb0d2e8e2a58f0fdd9743eae9b3a2b39786 (diff)
downloadgo-1130cc745d45bc7248a2e133a609732a14486f01.tar.gz
go-1130cc745d45bc7248a2e133a609732a14486f01.zip
Revert "runtime: use dispatch semaphores on Darwin"
This reverts https://golang.org/cl/182258. The new code caused unpredictable crashes that are not understood. The old code was occasionally flaky but still better than this approach. Fixes #32655 Updates #31264 Change-Id: I2e9d27d6052e84bf75106d8b844549ba4f571695 Reviewed-on: https://go-review.googlesource.com/c/go/+/182880 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/sys_darwin_amd64.s')
-rw-r--r--src/runtime/sys_darwin_amd64.s62
1 files changed, 41 insertions, 21 deletions
diff --git a/src/runtime/sys_darwin_amd64.s b/src/runtime/sys_darwin_amd64.s
index 95ba496cbc..bbe6bc14bf 100644
--- a/src/runtime/sys_darwin_amd64.s
+++ b/src/runtime/sys_darwin_amd64.s
@@ -482,44 +482,64 @@ TEXT runtime·raise_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·dispatch_semaphore_create_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_mutex_init_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
- MOVQ DI, BX
- MOVQ 0(BX), DI // arg 1 value
- CALL libc_dispatch_semaphore_create(SB)
- MOVQ AX, 8(BX) // result sema
+ MOVQ 8(DI), SI // arg 2 attr
+ MOVQ 0(DI), DI // arg 1 mutex
+ CALL libc_pthread_mutex_init(SB)
POPQ BP
RET
-TEXT runtime·dispatch_semaphore_wait_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_mutex_lock_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
- MOVQ 8(DI), SI // arg 2 timeout
- MOVQ 0(DI), DI // arg 1 sema
- CALL libc_dispatch_semaphore_wait(SB)
- TESTQ AX, AX // For safety convert 64-bit result to int32 0 or 1.
- JEQ 2(PC)
- MOVL $1, AX
+ MOVQ 0(DI), DI // arg 1 mutex
+ CALL libc_pthread_mutex_lock(SB)
POPQ BP
RET
-TEXT runtime·dispatch_semaphore_signal_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_mutex_unlock_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
- MOVQ 0(DI), DI // arg 1 sema
- CALL libc_dispatch_semaphore_signal(SB)
+ MOVQ 0(DI), DI // arg 1 mutex
+ CALL libc_pthread_mutex_unlock(SB)
POPQ BP
RET
-TEXT runtime·dispatch_time_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_cond_init_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
- MOVQ DI, BX
- MOVQ 0(BX), DI // arg 1 base
- MOVQ 8(BX), SI // arg 2 delta
- CALL libc_dispatch_time(SB)
- MOVQ AX, 16(BX)
+ MOVQ 8(DI), SI // arg 2 attr
+ MOVQ 0(DI), DI // arg 1 cond
+ CALL libc_pthread_cond_init(SB)
+ POPQ BP
+ RET
+
+TEXT runtime·pthread_cond_wait_trampoline(SB),NOSPLIT,$0
+ PUSHQ BP
+ MOVQ SP, BP
+ MOVQ 8(DI), SI // arg 2 mutex
+ MOVQ 0(DI), DI // arg 1 cond
+ CALL libc_pthread_cond_wait(SB)
+ POPQ BP
+ RET
+
+TEXT runtime·pthread_cond_timedwait_relative_np_trampoline(SB),NOSPLIT,$0
+ PUSHQ BP
+ MOVQ SP, BP
+ MOVQ 8(DI), SI // arg 2 mutex
+ MOVQ 16(DI), DX // arg 3 timeout
+ MOVQ 0(DI), DI // arg 1 cond
+ CALL libc_pthread_cond_timedwait_relative_np(SB)
+ POPQ BP
+ RET
+
+TEXT runtime·pthread_cond_signal_trampoline(SB),NOSPLIT,$0
+ PUSHQ BP
+ MOVQ SP, BP
+ MOVQ 0(DI), DI // arg 1 cond
+ CALL libc_pthread_cond_signal(SB)
POPQ BP
RET