summaryrefslogtreecommitdiff
path: root/yjit.c
diff options
context:
space:
mode:
Diffstat (limited to 'yjit.c')
-rw-r--r--yjit.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/yjit.c b/yjit.c
index 70b98d4844..a834191070 100644
--- a/yjit.c
+++ b/yjit.c
@@ -78,11 +78,17 @@ rb_yjit_mark_executable(void *mem_block, uint32_t mem_size)
rb_bug("Couldn't make JIT page (%p, %lu bytes) executable, errno: %s\n",
mem_block, (unsigned long)mem_size, strerror(errno));
}
+}
+// `start` is inclusive and `end` is exclusive.
+void
+rb_yjit_icache_invalidate(void *start, void *end)
+{
// Clear/invalidate the instruction cache. Compiles to nothing on x86_64
- // but required on ARM. On Darwin it's the same as calling sys_icache_invalidate().
+ // but required on ARM before running freshly written code.
+ // On Darwin it's the same as calling sys_icache_invalidate().
#ifdef __GNUC__
- __builtin___clear_cache(mem_block, (char *)mem_block + mem_size);
+ __builtin___clear_cache(start, end);
#endif
}