From 6be63b1ea82676db10a64faeeda2b4421c38a419 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Tue, 31 Jan 2023 10:17:00 +0000 Subject: [PATCH] aal::aal_arm implements tick for apple 64 bits. (#564) --- src/snmalloc/aal/aal_arm.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/snmalloc/aal/aal_arm.h b/src/snmalloc/aal/aal_arm.h index 39bcd95..b6bae77 100644 --- a/src/snmalloc/aal/aal_arm.h +++ b/src/snmalloc/aal/aal_arm.h @@ -24,8 +24,11 @@ namespace snmalloc /** * Bitmap of AalFeature flags */ - static constexpr uint64_t aal_features = - IntegerPointers | NoCpuCycleCounters; + static constexpr uint64_t aal_features = IntegerPointers +#if defined(SNMALLOC_VA_BITS_32) || !defined(__APPLE__) + | NoCpuCycleCounters +#endif + ; static constexpr enum AalName aal_name = ARM; @@ -56,6 +59,15 @@ namespace snmalloc __asm__ volatile("pld\t[%0]" : "=r"(ptr)); #endif } + +#if defined(SNMALLOC_VA_BITS_64) && defined(__APPLE__) + static inline uint64_t tick() noexcept + { + uint64_t t; + __asm__ volatile("mrs %0, cntvct_el0" : "=r"(t)); + return t; + } +#endif }; using AAL_Arch = AAL_arm;