From e7f020cf764615e29cba57859f639aecbd6d1305 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Fri, 13 Mar 2020 15:39:49 +0000 Subject: [PATCH] implementations moved on the composer class. --- CMakeLists.txt | 4 +++- src/aal/aal.h | 12 +++++++++++- src/aal/aal_arm.h | 12 ++---------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7dc850..414417a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,7 +94,9 @@ if (WIN32) endif() if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - target_compile_options(snmalloc_lib INTERFACE -mcx16) + if (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") + target_compile_options(snmalloc_lib INTERFACE -mcx16) + endif() endif () # Have to set this globally, as can't be set on an interface target. diff --git a/src/aal/aal.h b/src/aal/aal.h index d323bfd..c1cbd02 100644 --- a/src/aal/aal.h +++ b/src/aal/aal.h @@ -2,6 +2,7 @@ #include "../ds/defines.h" #include +#include #if defined(__i386__) || defined(_M_IX86) || defined(_X86_) || \ defined(__amd64__) || defined(__x86_64__) || defined(_M_X64) || \ @@ -11,6 +12,10 @@ #if defined(__arm__) || defined(__aarch64__) # define PLATFORM_IS_ARM + /** + * on ARM cpu counters are accessible only in privileged mode + */ +# define SNMALLOC_NO_ALL_CPUCOUNTERS #endif namespace snmalloc @@ -63,7 +68,12 @@ namespace snmalloc */ static inline uint64_t tick() { -#if __has_builtin(__builtin_readcyclecounter) && \ +#if defined(SNMALLOC_NO_ALL_CPUCOUNTERS) + struct timespec n = {0, 0ul}; + clock_gettime(CLOCK_MONOTONIC, &n); + + return static_cast((n.tv_sec) * (1000000000 * n.tv_nsec)); +#elif __has_builtin(__builtin_readcyclecounter) && \ !defined(SNMALLOC_NO_AAL_BUILTINS) return __builtin_readcyclecounter(); #else diff --git a/src/aal/aal_arm.h b/src/aal/aal_arm.h index 52bb0d0..00964e4 100644 --- a/src/aal/aal_arm.h +++ b/src/aal/aal_arm.h @@ -31,21 +31,13 @@ namespace snmalloc /** * Issue a prefetch hint at the specified address. */ - static inline void prefetch(void* ptr) + static inline void prefetch(void*) { - __builtin_prefetch(ptr, 0, 1); } - /** - * Return a cycle counter value. - * on ARM cpu counters are accessible only in privileged mode - */ static inline uint64_t tick() { - struct timespec n = {0, 0ul}; - clock_gettime(CLOCK_MONOTONIC, &n); - - return static_cast((n.tv_sec) * (1000000000ul * n.tv_nsec)); + return 0ull; } };