From 578bebb04dbc9631f285860b48cee0bcee05b05d Mon Sep 17 00:00:00 2001 From: SChernykh Date: Fri, 18 Oct 2019 18:17:57 +0200 Subject: [PATCH] Prefer sys_icache_invalidate on iOS Also break compilation with error if clear cache is not available --- src/crypto/randomx/jit_compiler_a64.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/crypto/randomx/jit_compiler_a64.cpp b/src/crypto/randomx/jit_compiler_a64.cpp index f88f945a..bf790c2b 100644 --- a/src/crypto/randomx/jit_compiler_a64.cpp +++ b/src/crypto/randomx/jit_compiler_a64.cpp @@ -109,10 +109,12 @@ void sys_icache_invalidate(void *start, size_t len); static void clear_code_cache(char* p1, char* p2) { -# if defined (HAVE_BUILTIN_CLEAR_CACHE) || defined (__GNUC__) - __builtin___clear_cache(p1, p2); -# elif defined(ios_HOST_OS) || defined (darwin_HOST_OS) +# if defined(ios_HOST_OS) || defined (darwin_HOST_OS) sys_icache_invalidate(p1, static_cast(p2 - p1)); +# elif defined (HAVE_BUILTIN_CLEAR_CACHE) || defined (__GNUC__) + __builtin___clear_cache(p1, p2); +# else +# error "No clear code cache function found" # endif }