mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1658374 - add spinning hint for aarch64 in Darwin mutexes; r=glandium
This change makes everything compile and presumably has some tiny effect on performance. We also take the opportunity to ensure that the compiler won't optimize out our inline asm by making the asm volatile and indicating that it touches memory. Differential Revision: https://phabricator.services.mozilla.com/D86594
This commit is contained in:
parent
51b1eb3e1e
commit
548da43ebd
@ -163,7 +163,14 @@ void mozilla::detail::MutexImpl::lock() {
|
||||
mutexLock();
|
||||
break;
|
||||
}
|
||||
asm("pause"); // Hint to the processor that we're spinning.
|
||||
// Hint to the processor that we're spinning.
|
||||
#ifdef __x86_64__
|
||||
# define SPIN_HINT "pause"
|
||||
#elif defined(__aarch64__)
|
||||
# define SPIN_HINT "yield"
|
||||
#endif
|
||||
asm volatile(SPIN_HINT ::: "memory");
|
||||
#undef SPIN_HINT
|
||||
count++;
|
||||
} while (!mutexTryLock());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user