@@ -149,6 +149,10 @@ typedef enum {
149
149
#include <sys/types.h>
150
150
#include <unistd.h>
151
151
152
+ #if defined(__arm__ ) || defined(__arm64__ ) || defined(__aarch64__ )
153
+ #define PY_HAVE_INVALIDATE_ICACHE
154
+ #endif
155
+
152
156
/* The function pointer is passed as last argument. The other three arguments
153
157
* are passed in the same order as the function requires. This results in
154
158
* shorter, more efficient ASM code for trampoline.
@@ -185,6 +189,8 @@ struct trampoline_api_st {
185
189
186
190
typedef struct trampoline_api_st trampoline_api_t ;
187
191
192
+ #ifdef PY_HAVE_INVALIDATE_ICACHE
193
+
188
194
#if defined(__clang__ ) || defined(__GNUC__ )
189
195
extern void __clear_cache (void * , void * );
190
196
#endif
@@ -197,6 +203,8 @@ static void invalidate_icache(char* begin, char*end) {
197
203
#endif
198
204
}
199
205
206
+ #endif
207
+
200
208
static perf_status_t perf_status = PERF_STATUS_NO_INIT ;
201
209
static Py_ssize_t extra_code_index = -1 ;
202
210
static code_arena_t * code_arena ;
@@ -319,7 +327,7 @@ new_code_arena(void)
319
327
return -1 ;
320
328
}
321
329
322
- #if defined( __arm__ ) || defined( __arm64__ ) || defined( __aarch64__ )
330
+ #ifdef PY_HAVE_INVALIDATE_ICACHE
323
331
// Before the JIT can run a block of code that has been emitted it must invalidate
324
332
// the instruction cache on some platforms like arm and aarch64.
325
333
invalidate_icache (memory , memory + mem_size );
0 commit comments