From b22ef71d46f0f583dc1401f20df809d1da8d1831 Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Fri, 3 Oct 2008 16:17:20 +0000 Subject: On Darwin ARM, memory needs special handling to do JIT. This patch expands this handling to work properly for modifying stub functions, relocations back to entry points after JIT compilation, etc.. llvm-svn: 57013 --- llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp') diff --git a/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp b/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp index 804e88df4ca..0ffc7799013 100644 --- a/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp +++ b/llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp @@ -365,6 +365,21 @@ namespace { // Finally, remove this entry from TableBlocks. TableBlocks.erase(I); } + + /// setMemoryWritable - When code generation is in progress, + /// the code pages may need permissions changed. + void setMemoryWritable(void) + { + for (unsigned i = 0, e = Blocks.size(); i != e; ++i) + sys::Memory::setWritable(Blocks[i]); + } + /// setMemoryExecutable - When code generation is done and we're ready to + /// start execution, the code pages may need permissions changed. + void setMemoryExecutable(void) + { + for (unsigned i = 0, e = Blocks.size(); i != e; ++i) + sys::Memory::setExecutable(Blocks[i]); + } }; } -- cgit v1.2.3