[PATCH] D13631: [JIT/llvm-rtdyld] Don't waste cycles invalidating the Instruction cache
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 17 08:40:30 PST 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253343: [llvm-rtdyld] Don't waste cycles invalidating instruction cache. (authored by davide).
Changed prior to commit:
http://reviews.llvm.org/D13631?vs=38832&id=40397#toc
Repository:
rL LLVM
http://reviews.llvm.org/D13631
Files:
llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
Index: llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
===================================================================
--- llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
+++ llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
@@ -155,12 +155,6 @@
bool finalizeMemory(std::string *ErrMsg) override { return false; }
- // Invalidate instruction cache for sections with execute permissions.
- // Some platforms with separate data cache and instruction cache require
- // explicit cache flush, otherwise JIT code manipulations (like resolved
- // relocations) will get to the data cache but not to the instruction cache.
- virtual void invalidateInstructionCache();
-
void addDummySymbol(const std::string &Name, uint64_t Addr) {
DummyExterns[Name] = Addr;
}
@@ -244,14 +238,6 @@
return (uint8_t*)MB.base();
}
-void TrivialMemoryManager::invalidateInstructionCache() {
- for (auto &FM : FunctionMemory)
- sys::Memory::InvalidateInstructionCache(FM.base(), FM.size());
-
- for (auto &DM : DataMemory)
- sys::Memory::InvalidateInstructionCache(DM.base(), DM.size());
-}
-
static const char *ProgramName;
static void Message(const char *Type, const Twine &Msg) {
@@ -424,23 +410,21 @@
}
}
- // Resolve all the relocations we can.
- Dyld.resolveRelocations();
- // Clear instruction cache before code will be executed.
- MemMgr.invalidateInstructionCache();
-
+ // Resove all the relocations we can.
// FIXME: Error out if there are unresolved relocations.
+ Dyld.resolveRelocations();
// Get the address of the entry point (_main by default).
void *MainAddress = Dyld.getSymbolLocalAddress(EntryPoint);
if (!MainAddress)
return Error("no definition for '" + EntryPoint + "'");
// Invalidate the instruction cache for each loaded function.
for (auto &FM : MemMgr.FunctionMemory) {
+
// Make sure the memory is executable.
+ // setExecutable will call InvalidateInstructionCache.
std::string ErrorStr;
- sys::Memory::InvalidateInstructionCache(FM.base(), FM.size());
if (!sys::Memory::setExecutable(FM, &ErrorStr))
return Error("unable to mark function executable: '" + ErrorStr + "'");
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13631.40397.patch
Type: text/x-patch
Size: 2187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151117/2aa350e5/attachment.bin>
More information about the llvm-commits
mailing list