<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">This needs corresponding lldb build fixes.<div><br></div><div>I will try to fix shortly.  Broadly, what is the best procedure for making lldb happy when changing an llvm API that lldb uses?</div><div><br></div><div>Also, does my llvm commit privilege allow me to land build fixes in lldb?</div><div><br></div><div>(If someone needs this reverted in the meantime then I won't object.  But hopefully I can fix soon.)</div><div><br></div><div>-Filip</div><div><br></div><div><br><div><div>On Oct 1, 2013, at 5:59 PM, Filip Pizlo <<a href="mailto:fpizlo@apple.com">fpizlo@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Author: fpizlo<br>Date: Tue Oct  1 19:59:25 2013<br>New Revision: 191804<br><br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=191804&view=rev">http://llvm.org/viewvc/llvm-project?rev=191804&view=rev</a><br>Log:<br>This threads SectionName through the allocateCodeSection/allocateDataSection APIs, both in C++ and C land.  <br>It's useful for the memory managers that are allocating a section to know what the name of the section is.  <br>At a minimum, this is useful for low-level debugging - it's customary for JITs to be able to tell you what<span class="Apple-converted-space"> </span><br>memory they allocated, and as part of any such dump, they should be able to tell you some meta-data about<span class="Apple-converted-space"> </span><br>what each allocation is for.  This allows clients that supply their own memory managers to do this.  <br>Additionally, we also envision the SectionName being useful for passing meta-data from within LLVM to an LLVM<span class="Apple-converted-space"> </span><br>client.<br><br>This changes both the C and C++ APIs, and all of the clients of those APIs within LLVM.  I'm assuming that<span class="Apple-converted-space"> </span><br>it's safe to change the C++ API because that API is allowed to change.  I'm assuming that it's safe to change<span class="Apple-converted-space"> </span><br>the C API because we haven't shipped the API in a release yet (LLVM 3.3 doesn't include the MCJIT memory<span class="Apple-converted-space"> </span><br>management C API).<br><br><br>Modified:<br>   llvm/trunk/include/llvm-c/ExecutionEngine.h<br>   llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h<br>   llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h<br>   llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp<br>   llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp<br>   llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h<br>   llvm/trunk/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp<br>   llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp<br>   llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp<br>   llvm/trunk/tools/lli/RecordingMemoryManager.cpp<br>   llvm/trunk/tools/lli/RecordingMemoryManager.h<br>   llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp<br>   llvm/trunk/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp<br>   llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp<br>   llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp<br>   llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp<br><br>Modified: llvm/trunk/include/llvm-c/ExecutionEngine.h<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/ExecutionEngine.h?rev=191804&r1=191803&r2=191804&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/ExecutionEngine.h?rev=191804&r1=191803&r2=191804&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm-c/ExecutionEngine.h (original)<br>+++ llvm/trunk/include/llvm-c/ExecutionEngine.h Tue Oct  1 19:59:25 2013<br>@@ -171,13 +171,14 @@ void *LLVMGetPointerToGlobal(LLVMExecuti<br><br>/*===-- Operations on memory managers -------------------------------------===*/<br><br>-typedef uint8_t *(*LLVMMemoryManagerAllocateCodeSectionCallback)(void *Opaque,<br>-<span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-converted-space"> </span>   uintptr_t Size, unsigned Alignment,<br>-<span class="Apple-tab-span" style="white-space: pre;">   </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-converted-space"> </span>   unsigned SectionID);<br>-typedef uint8_t *(*LLVMMemoryManagerAllocateDataSectionCallback)(void *Opaque,<br>-<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-converted-space"> </span>   uintptr_t Size, unsigned Alignment,<br>-<span class="Apple-tab-span" style="white-space: pre;">   </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-converted-space"> </span>   unsigned SectionID, LLVMBool IsReadOnly);<br>-typedef LLVMBool (*LLVMMemoryManagerFinalizeMemoryCallback)(void *Opaque, char **ErrMsg);<br>+typedef uint8_t *(*LLVMMemoryManagerAllocateCodeSectionCallback)(<br>+  void *Opaque, uintptr_t Size, unsigned Alignment, unsigned SectionID,<br>+  const char *SectionName);<br>+typedef uint8_t *(*LLVMMemoryManagerAllocateDataSectionCallback)(<br>+  void *Opaque, uintptr_t Size, unsigned Alignment, unsigned SectionID,<br>+  const char *SectionName, LLVMBool IsReadOnly);<br>+typedef LLVMBool (*LLVMMemoryManagerFinalizeMemoryCallback)(<br>+  void *Opaque, char **ErrMsg);<br>typedef void (*LLVMMemoryManagerDestroyCallback)(void *Opaque);<br><br>/**<br><br>Modified: llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h?rev=191804&r1=191803&r2=191804&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h?rev=191804&r1=191803&r2=191804&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h (original)<br>+++ llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h Tue Oct  1 19:59:25 2013<br>@@ -38,14 +38,16 @@ public:<br>  /// executable code. The SectionID is a unique identifier assigned by the JIT<br>  /// engine, and optionally recorded by the memory manager to access a loaded<br>  /// section.<br>-  virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,<br>-                                       unsigned SectionID) = 0;<br>-<br>+  virtual uint8_t *allocateCodeSection(<br>+    uintptr_t Size, unsigned Alignment, unsigned SectionID,<br>+    StringRef SectionName) = 0;<br>+  <br>  /// Allocate a memory block of (at least) the given size suitable for data.<br>  /// The SectionID is a unique identifier assigned by the JIT engine, and<br>  /// optionally recorded by the memory manager to access a loaded section.<br>-  virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,<br>-                                       unsigned SectionID, bool IsReadOnly) = 0;<br>+  virtual uint8_t *allocateDataSection(<br>+    uintptr_t Size, unsigned Alignment, unsigned SectionID,<br>+    StringRef SectionName, bool IsReadOnly) = 0;<br><br>  /// Register the EH frames with the runtime so that c++ exceptions work.<br>  virtual void registerEHFrames(StringRef SectionData);<br><br>Modified: llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h?rev=191804&r1=191803&r2=191804&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h?rev=191804&r1=191803&r2=191804&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h (original)<br>+++ llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h Tue Oct  1 19:59:25 2013<br>@@ -49,7 +49,8 @@ public:<br>  /// The value of \p Alignment must be a power of two.  If \p Alignment is zero<br>  /// a default alignment of 16 will be used.<br>  virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,<br>-                                       unsigned SectionID);<br>+                                       unsigned SectionID,<br>+                                       StringRef SectionName);<br><br>  /// \brief Allocates a memory block of (at least) the given size suitable for<br>  /// executable code.<br>@@ -58,6 +59,7 @@ public:<br>  /// a default alignment of 16 will be used.<br>  virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,<br>                                       unsigned SectionID,<br>+                                       StringRef SectionName,<br>                                       bool isReadOnly);<br><br>  /// \brief Update section-specific memory permissions and other attributes.<br><br>Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp?rev=191804&r1=191803&r2=191804&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp?rev=191804&r1=191803&r2=191804&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp (original)<br>+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp Tue Oct  1 19:59:25 2013<br>@@ -351,12 +351,13 @@ public:<br>                             void *Opaque);<br>  virtual ~SimpleBindingMemoryManager();<br><br>-  virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,<br>-                                       unsigned SectionID);<br>-<br>-  virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,<br>-                                       unsigned SectionID,<br>-                                       bool isReadOnly);<br>+  virtual uint8_t *allocateCodeSection(<br>+    uintptr_t Size, unsigned Alignment, unsigned SectionID,<br>+    StringRef SectionName);<br>+<br>+  virtual uint8_t *allocateDataSection(<br>+    uintptr_t Size, unsigned Alignment, unsigned SectionID,<br>+    StringRef SectionName, bool isReadOnly);<br><br>  virtual bool finalizeMemory(std::string *ErrMsg);<br><br>@@ -384,13 +385,17 @@ SimpleBindingMemoryManager::~SimpleBindi<br>}<br><br>uint8_t *SimpleBindingMemoryManager::allocateCodeSection(<br>-  uintptr_t Size, unsigned Alignment, unsigned SectionID) {<br>-  return Functions.AllocateCodeSection(Opaque, Size, Alignment, SectionID);<br>+  uintptr_t Size, unsigned Alignment, unsigned SectionID,<br>+  StringRef SectionName) {<br>+  return Functions.AllocateCodeSection(Opaque, Size, Alignment, SectionID,<br>+                                       SectionName.str().c_str());<br>}<br><br>uint8_t *SimpleBindingMemoryManager::allocateDataSection(<br>-  uintptr_t Size, unsigned Alignment, unsigned SectionID, bool isReadOnly) {<br>+  uintptr_t Size, unsigned Alignment, unsigned SectionID,<br>+  StringRef SectionName, bool isReadOnly) {<br>  return Functions.AllocateDataSection(Opaque, Size, Alignment, SectionID,<br>+                                       SectionName.str().c_str(),<br>                                       isReadOnly);<br>}<br><br><br>Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp?rev=191804&r1=191803&r2=191804&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp?rev=191804&r1=191803&r2=191804&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp (original)<br>+++ llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp Tue Oct  1 19:59:25 2013<br>@@ -464,7 +464,7 @@ namespace {<br><br>    /// allocateCodeSection - Allocate memory for a code section.<br>    uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,<br>-                                 unsigned SectionID) {<br>+                                 unsigned SectionID, StringRef SectionName) {<br>      // Grow the required block size to account for the block header<br>      Size += sizeof(*CurBlock);<br><br>@@ -510,7 +510,8 @@ namespace {<br><br>    /// allocateDataSection - Allocate memory for a data section.<br>    uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,<br>-                                 unsigned SectionID, bool IsReadOnly) {<br>+                                 unsigned SectionID, StringRef SectionName,<br>+                                 bool IsReadOnly) {<br>      return (uint8_t*)DataAllocator.Allocate(Size, Alignment);<br>    }<br><br><br>Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h?rev=191804&r1=191803&r2=191804&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h?rev=191804&r1=191803&r2=191804&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h (original)<br>+++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h Tue Oct  1 19:59:25 2013<br>@@ -35,14 +35,15 @@ public:<br><br>  // Functions deferred to client memory manager<br>  virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,<br>-                                       unsigned SectionID) {<br>-    return ClientMM->allocateCodeSection(Size, Alignment, SectionID);<br>+                                       unsigned SectionID, StringRef SectionName) {<br>+    return ClientMM->allocateCodeSection(Size, Alignment, SectionID, SectionName);<br>  }<br><br>  virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,<br>-                                       unsigned SectionID, bool IsReadOnly) {<br>+                                       unsigned SectionID, StringRef SectionName,<br>+                                       bool IsReadOnly) {<br>    return ClientMM->allocateDataSection(Size, Alignment,<br>-                                         SectionID, IsReadOnly);<br>+                                         SectionID, SectionName, IsReadOnly);<br>  }<br><br>  virtual void registerEHFrames(StringRef SectionData) {<br><br>Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp?rev=191804&r1=191803&r2=191804&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp?rev=191804&r1=191803&r2=191804&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp (original)<br>+++ llvm/trunk/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp Tue Oct  1 19:59:25 2013<br>@@ -19,9 +19,10 @@<br>namespace llvm {<br><br>uint8_t *SectionMemoryManager::allocateDataSection(uintptr_t Size,<br>-                                                    unsigned Alignment,<br>-                                                    unsigned SectionID,<br>-                                                    bool IsReadOnly) {<br>+                                                   unsigned Alignment,<br>+                                                   unsigned SectionID,<br>+                                                   StringRef SectionName,<br>+                                                   bool IsReadOnly) {<br>  if (IsReadOnly)<br>    return allocateSection(RODataMem, Size, Alignment);<br>  return allocateSection(RWDataMem, Size, Alignment);<br>@@ -29,7 +30,8 @@ uint8_t *SectionMemoryManager::allocateD<br><br>uint8_t *SectionMemoryManager::allocateCodeSection(uintptr_t Size,<br>                                                   unsigned Alignment,<br>-                                                   unsigned SectionID) {<br>+                                                   unsigned SectionID,<br>+                                                   StringRef SectionName) {<br>  return allocateSection(CodeMem, Size, Alignment);<br>}<br><br><br>Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp?rev=191804&r1=191803&r2=191804&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp?rev=191804&r1=191803&r2=191804&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp (original)<br>+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Tue Oct  1 19:59:25 2013<br>@@ -182,8 +182,8 @@ void RuntimeDyldImpl::emitCommonSymbols(<br>                                        SymbolTableMap &SymbolTable) {<br>  // Allocate memory for the section<br>  unsigned SectionID = Sections.size();<br>-  uint8_t *Addr = MemMgr->allocateDataSection(TotalSize, sizeof(void*),<br>-                                              SectionID, false);<br>+  uint8_t *Addr = MemMgr->allocateDataSection(<br>+    TotalSize, sizeof(void*), SectionID, StringRef(), false);<br>  if (!Addr)<br>    report_fatal_error("Unable to allocate memory for common symbols!");<br>  uint64_t Offset = 0;<br>@@ -278,8 +278,9 @@ unsigned RuntimeDyldImpl::emitSection(Ob<br>  if (IsRequired) {<br>    Allocate = DataSize + StubBufSize;<br>    Addr = IsCode<br>-      ? MemMgr->allocateCodeSection(Allocate, Alignment, SectionID)<br>-      : MemMgr->allocateDataSection(Allocate, Alignment, SectionID, IsReadOnly);<br>+      ? MemMgr->allocateCodeSection(Allocate, Alignment, SectionID, Name)<br>+      : MemMgr->allocateDataSection(Allocate, Alignment, SectionID, Name,<br>+                                    IsReadOnly);<br>    if (!Addr)<br>      report_fatal_error("Unable to allocate section memory!");<br><br><br>Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp?rev=191804&r1=191803&r2=191804&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp?rev=191804&r1=191803&r2=191804&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp (original)<br>+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp Tue Oct  1 19:59:25 2013<br>@@ -1337,8 +1337,8 @@ void RuntimeDyldELF::finalizeLoad() {<br>    // Allocate memory for the section<br>    unsigned SectionID = Sections.size();<br>    size_t TotalSize = numGOTEntries * getGOTEntrySize();<br>-    uint8_t *Addr = MemMgr->allocateDataSection(TotalSize, getGOTEntrySize(),<br>-                                                SectionID, false);<br>+    uint8_t *Addr = MemMgr->allocateDataSection(<br>+      TotalSize, getGOTEntrySize(), SectionID, ".got", false);<br>    if (!Addr)<br>      report_fatal_error("Unable to allocate memory for GOT!");<br>    Sections.push_back(SectionEntry(".got", Addr, TotalSize, 0));<br><br>Modified: llvm/trunk/tools/lli/RecordingMemoryManager.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/RecordingMemoryManager.cpp?rev=191804&r1=191803&r2=191804&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/RecordingMemoryManager.cpp?rev=191804&r1=191803&r2=191804&view=diff</a><br>==============================================================================<br>--- llvm/trunk/tools/lli/RecordingMemoryManager.cpp (original)<br>+++ llvm/trunk/tools/lli/RecordingMemoryManager.cpp Tue Oct  1 19:59:25 2013<br>@@ -27,7 +27,8 @@ RecordingMemoryManager::~RecordingMemory<br>}<br><br>uint8_t *RecordingMemoryManager::<br>-allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID) {<br>+allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID,<br>+                    StringRef SectionName) {<br>  // The recording memory manager is just a local copy of the remote target.<br>  // The alignment requirement is just stored here for later use. Regular<br>  // heap storage is sufficient here, but we're using mapped memory to work<br>@@ -39,7 +40,8 @@ allocateCodeSection(uintptr_t Size, unsi<br><br>uint8_t *RecordingMemoryManager::<br>allocateDataSection(uintptr_t Size, unsigned Alignment,<br>-                    unsigned SectionID, bool IsReadOnly) {<br>+                    unsigned SectionID, StringRef SectionName,<br>+                    bool IsReadOnly) {<br>  // The recording memory manager is just a local copy of the remote target.<br>  // The alignment requirement is just stored here for later use. Regular<br>  // heap storage is sufficient here, but we're using mapped memory to work<br><br>Modified: llvm/trunk/tools/lli/RecordingMemoryManager.h<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/RecordingMemoryManager.h?rev=191804&r1=191803&r2=191804&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/RecordingMemoryManager.h?rev=191804&r1=191803&r2=191804&view=diff</a><br>==============================================================================<br>--- llvm/trunk/tools/lli/RecordingMemoryManager.h (original)<br>+++ llvm/trunk/tools/lli/RecordingMemoryManager.h Tue Oct  1 19:59:25 2013<br>@@ -50,10 +50,11 @@ public:<br>  const_code_iterator   code_end() const { return AllocatedCodeMem.end(); }<br><br>  uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,<br>-                                       unsigned SectionID);<br>+                               unsigned SectionID, StringRef SectionName);<br><br>  uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,<br>-                                       unsigned SectionID, bool IsReadOnly);<br>+                               unsigned SectionID, StringRef SectionName,<br>+                               bool IsReadOnly);<br><br>  void *getPointerToNamedFunction(const std::string &Name,<br>                                  bool AbortOnFailure = true);<br><br>Modified: llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp?rev=191804&r1=191803&r2=191804&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp?rev=191804&r1=191803&r2=191804&view=diff</a><br>==============================================================================<br>--- llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp (original)<br>+++ llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp Tue Oct  1 19:59:25 2013<br>@@ -60,9 +60,10 @@ public:<br>  SmallVector<sys::MemoryBlock, 16> DataMemory;<br><br>  uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,<br>-                               unsigned SectionID);<br>+                               unsigned SectionID, StringRef SectionName);<br>  uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,<br>-                               unsigned SectionID, bool IsReadOnly);<br>+                               unsigned SectionID, StringRef SectionName,<br>+                               bool IsReadOnly);<br><br>  virtual void *getPointerToNamedFunction(const std::string &Name,<br>                                          bool AbortOnFailure = true) {<br>@@ -80,7 +81,8 @@ public:<br><br>uint8_t *TrivialMemoryManager::allocateCodeSection(uintptr_t Size,<br>                                                   unsigned Alignment,<br>-                                                   unsigned SectionID) {<br>+                                                   unsigned SectionID,<br>+                                                   StringRef SectionName) {<br>  sys::MemoryBlock MB = sys::Memory::AllocateRWX(Size, 0, 0);<br>  FunctionMemory.push_back(MB);<br>  return (uint8_t*)MB.base();<br>@@ -89,6 +91,7 @@ uint8_t *TrivialMemoryManager::allocateC<br>uint8_t *TrivialMemoryManager::allocateDataSection(uintptr_t Size,<br>                                                   unsigned Alignment,<br>                                                   unsigned SectionID,<br>+                                                   StringRef SectionName,<br>                                                   bool IsReadOnly) {<br>  sys::MemoryBlock MB = sys::Memory::AllocateRWX(Size, 0, 0);<br>  DataMemory.push_back(MB);<br><br>Modified: llvm/trunk/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp?rev=191804&r1=191803&r2=191804&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp?rev=191804&r1=191803&r2=191804&view=diff</a><br>==============================================================================<br>--- llvm/trunk/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp (original)<br>+++ llvm/trunk/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp Tue Oct  1 19:59:25 2013<br>@@ -281,11 +281,11 @@ TEST(JITMemoryManagerTest, TestManyStubs<br>TEST(JITMemoryManagerTest, AllocateSection) {<br>  OwningPtr<JITMemoryManager> MemMgr(<br>      JITMemoryManager::CreateDefaultMemManager());<br>-  uint8_t *code1 = MemMgr->allocateCodeSection(256, 0, 1);<br>-  uint8_t *data1 = MemMgr->allocateDataSection(256, 16, 2, true);<br>-  uint8_t *code2 = MemMgr->allocateCodeSection(257, 32, 3);<br>-  uint8_t *data2 = MemMgr->allocateDataSection(256, 64, 4, false);<br>-  uint8_t *code3 = MemMgr->allocateCodeSection(258, 64, 5);<br>+  uint8_t *code1 = MemMgr->allocateCodeSection(256, 0, 1, StringRef());<br>+  uint8_t *data1 = MemMgr->allocateDataSection(256, 16, 2, StringRef(), true);<br>+  uint8_t *code2 = MemMgr->allocateCodeSection(257, 32, 3, StringRef());<br>+  uint8_t *data2 = MemMgr->allocateDataSection(256, 64, 4, StringRef(), false);<br>+  uint8_t *code3 = MemMgr->allocateCodeSection(258, 64, 5, StringRef());<br><br>  EXPECT_NE((uint8_t*)0, code1);<br>  EXPECT_NE((uint8_t*)0, code2);<br><br>Modified: llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp?rev=191804&r1=191803&r2=191804&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp?rev=191804&r1=191803&r2=191804&view=diff</a><br>==============================================================================<br>--- llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp (original)<br>+++ llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp Tue Oct  1 19:59:25 2013<br>@@ -135,13 +135,17 @@ public:<br>      EndFunctionBodyCall(F, FunctionStart, FunctionEnd));<br>    Base->endFunctionBody(F, FunctionStart, FunctionEnd);<br>  }<br>-  virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,<br>-                                       unsigned SectionID, bool IsReadOnly) {<br>-    return Base->allocateDataSection(Size, Alignment, SectionID, IsReadOnly);<br>+  virtual uint8_t *allocateDataSection(<br>+    uintptr_t Size, unsigned Alignment, unsigned SectionID,<br>+    StringRef SectionName, bool IsReadOnly) {<br>+    return Base->allocateDataSection(<br>+      Size, Alignment, SectionID, SectionName, IsReadOnly);<br>  }<br>-  virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,<br>-                                       unsigned SectionID) {<br>-    return Base->allocateCodeSection(Size, Alignment, SectionID);<br>+  virtual uint8_t *allocateCodeSection(<br>+    uintptr_t Size, unsigned Alignment, unsigned SectionID,<br>+    StringRef SectionName) {<br>+    return Base->allocateCodeSection(<br>+      Size, Alignment, SectionID, SectionName);<br>  }<br>  virtual bool finalizeMemory(std::string *ErrMsg) { return false; }<br>  virtual uint8_t *allocateSpace(intptr_t Size, unsigned Alignment) {<br><br>Modified: llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp?rev=191804&r1=191803&r2=191804&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp?rev=191804&r1=191803&r2=191804&view=diff</a><br>==============================================================================<br>--- llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp (original)<br>+++ llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp Tue Oct  1 19:59:25 2013<br>@@ -28,18 +28,20 @@ static bool didCallAllocateCodeSection;<br><br>static uint8_t *roundTripAllocateCodeSection(void *object, uintptr_t size,<br>                                             unsigned alignment,<br>-                                             unsigned sectionID) {<br>+                                             unsigned sectionID,<br>+                                             const char *sectionName) {<br>  didCallAllocateCodeSection = true;<br>  return static_cast<SectionMemoryManager*>(object)->allocateCodeSection(<br>-    size, alignment, sectionID);<br>+    size, alignment, sectionID, sectionName);<br>}<br><br>static uint8_t *roundTripAllocateDataSection(void *object, uintptr_t size,<br>                                             unsigned alignment,<br>                                             unsigned sectionID,<br>+                                             const char *sectionName,<br>                                             LLVMBool isReadOnly) {<br>  return static_cast<SectionMemoryManager*>(object)->allocateDataSection(<br>-    size, alignment, sectionID, isReadOnly);<br>+    size, alignment, sectionID, sectionName, isReadOnly);<br>}<br><br>static LLVMBool roundTripFinalizeMemory(void *object, char **errMsg) {<br><br>Modified: llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp?rev=191804&r1=191803&r2=191804&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp?rev=191804&r1=191803&r2=191804&view=diff</a><br>==============================================================================<br>--- llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp (original)<br>+++ llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp Tue Oct  1 19:59:25 2013<br>@@ -19,10 +19,10 @@ namespace {<br>TEST(MCJITMemoryManagerTest, BasicAllocations) {<br>  OwningPtr<SectionMemoryManager> MemMgr(new SectionMemoryManager());<br><br>-  uint8_t *code1 = MemMgr->allocateCodeSection(256, 0, 1);<br>-  uint8_t *data1 = MemMgr->allocateDataSection(256, 0, 2, true);<br>-  uint8_t *code2 = MemMgr->allocateCodeSection(256, 0, 3);<br>-  uint8_t *data2 = MemMgr->allocateDataSection(256, 0, 4, false);<br>+  uint8_t *code1 = MemMgr->allocateCodeSection(256, 0, 1, "");<br>+  uint8_t *data1 = MemMgr->allocateDataSection(256, 0, 2, "", true);<br>+  uint8_t *code2 = MemMgr->allocateCodeSection(256, 0, 3, "");<br>+  uint8_t *data2 = MemMgr->allocateDataSection(256, 0, 4, "", false);<br><br>  EXPECT_NE((uint8_t*)0, code1);<br>  EXPECT_NE((uint8_t*)0, code2);<br>@@ -52,10 +52,10 @@ TEST(MCJITMemoryManagerTest, BasicAlloca<br>TEST(MCJITMemoryManagerTest, LargeAllocations) {<br>  OwningPtr<SectionMemoryManager> MemMgr(new SectionMemoryManager());<br><br>-  uint8_t *code1 = MemMgr->allocateCodeSection(0x100000, 0, 1);<br>-  uint8_t *data1 = MemMgr->allocateDataSection(0x100000, 0, 2, true);<br>-  uint8_t *code2 = MemMgr->allocateCodeSection(0x100000, 0, 3);<br>-  uint8_t *data2 = MemMgr->allocateDataSection(0x100000, 0, 4, false);<br>+  uint8_t *code1 = MemMgr->allocateCodeSection(0x100000, 0, 1, "");<br>+  uint8_t *data1 = MemMgr->allocateDataSection(0x100000, 0, 2, "", true);<br>+  uint8_t *code2 = MemMgr->allocateCodeSection(0x100000, 0, 3, "");<br>+  uint8_t *data2 = MemMgr->allocateDataSection(0x100000, 0, 4, "", false);<br><br>  EXPECT_NE((uint8_t*)0, code1);<br>  EXPECT_NE((uint8_t*)0, code2);<br>@@ -91,8 +91,8 @@ TEST(MCJITMemoryManagerTest, ManyAllocat<br>  for (unsigned i = 0; i < 10000; ++i) {<br>    const bool isReadOnly = i % 2 == 0;<br><br>-    code[i] = MemMgr->allocateCodeSection(32, 0, 1);<br>-    data[i] = MemMgr->allocateDataSection(32, 0, 2, isReadOnly);<br>+    code[i] = MemMgr->allocateCodeSection(32, 0, 1, "");<br>+    data[i] = MemMgr->allocateDataSection(32, 0, 2, "", isReadOnly);<br><br>    for (unsigned j = 0; j < 32; j++) {<br>      code[i][j] = 1 + (i % 254);<br>@@ -130,8 +130,8 @@ TEST(MCJITMemoryManagerTest, ManyVariedA<br>    bool isReadOnly = i % 3 == 0;<br>    unsigned Align = 8 << (i % 4);<br><br>-    code[i] = MemMgr->allocateCodeSection(CodeSize, Align, i);<br>-    data[i] = MemMgr->allocateDataSection(DataSize, Align, i + 10000,<br>+    code[i] = MemMgr->allocateCodeSection(CodeSize, Align, i, "");<br>+    data[i] = MemMgr->allocateDataSection(DataSize, Align, i + 10000, "",<br>                                          isReadOnly);<br><br>    for (unsigned j = 0; j < CodeSize; j++) {<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></div></blockquote></div><br></div></body></html>