[PATCH] D13545: [RuntimeDyld] Fix performance problem in resolveRelocations with many sections

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 9 22:39:01 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL249942: [RuntimeDyld] Fix performance problem in resolveRelocations with many sections (authored by kfischer).

Changed prior to commit:
  http://reviews.llvm.org/D13545?vs=36826&id=37025#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13545

Files:
  llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp

Index: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
===================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -91,18 +91,18 @@
   // First, resolve relocations associated with external symbols.
   resolveExternalSymbols();
 
-  // Just iterate over the sections we have and resolve all the relocations
-  // in them. Gross overkill, but it gets the job done.
-  for (int i = 0, e = Sections.size(); i != e; ++i) {
+  // Iterate over all outstanding relocations
+  for (auto it = Relocations.begin(), e = Relocations.end(); it != e; ++it) {
     // The Section here (Sections[i]) refers to the section in which the
     // symbol for the relocation is located.  The SectionID in the relocation
     // entry provides the section to which the relocation will be applied.
-    uint64_t Addr = Sections[i].LoadAddress;
-    DEBUG(dbgs() << "Resolving relocations Section #" << i << "\t"
+    int Idx = it->getFirst();
+    uint64_t Addr = Sections[Idx].LoadAddress;
+    DEBUG(dbgs() << "Resolving relocations Section #" << Idx << "\t"
                  << format("%p", (uintptr_t)Addr) << "\n");
-    resolveRelocationList(Relocations[i], Addr);
-    Relocations.erase(i);
+    resolveRelocationList(it->getSecond(), Addr);
   }
+  Relocations.clear();
 
   // Print out sections after relocation.
   DEBUG(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13545.37025.patch
Type: text/x-patch
Size: 1458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151010/cb5e90ff/attachment.bin>


More information about the llvm-commits mailing list