[PATCH] D13631: [JIT/llvm-rtdyld] Don't waste cycles invalidating the Instruction cache
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 13 23:06:15 PDT 2015
lhames added inline comments.
================
Comment at: lib/Support/Unix/Memory.inc:266-282
@@ -265,16 +265,19 @@
-bool Memory::setExecutable (MemoryBlock &M, std::string *ErrMsg) {
+bool Memory::setExecutable(MemoryBlock &M, std::string *ErrMsg,
+ bool InvalidateCache) {
#if defined(__APPLE__) && (defined(__arm__) || defined(__arm64__))
if (M.Address == 0 || M.Size == 0) return false;
Memory::InvalidateInstructionCache(M.Address, M.Size);
kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)M.Address,
(vm_size_t)M.Size, 0, VM_PROT_READ | VM_PROT_EXECUTE | VM_PROT_COPY);
return KERN_SUCCESS == kr;
#elif defined(__arm__) || defined(__aarch64__)
Memory::InvalidateInstructionCache(M.Address, M.Size);
return true;
#else
+ if (InvalidateCache)
+ Memory::InvalidateInstructionCache(M.Address, M.Size);
return true;
#endif
}
----------------
Whatever we do here should be consistent for all platforms. I haven't taken a good look at the icache invalidation code - I'll have a think about this tomorrow.
Repository:
rL LLVM
http://reviews.llvm.org/D13631
More information about the llvm-commits
mailing list