[llvm] r191804 - This threads SectionName through the allocateCodeSection/allocateDataSection APIs, both in C++ and C land.
Filip Pizlo
fpizlo at apple.com
Tue Oct 1 18:30:15 PDT 2013
Yup, working on a fix. The main delay is that I'm building lldb for the first time, ever; the fix itself is trivial.
Is it better in situations like this to roll out and then reland once a fix is in place? Or is hurrying with a fix, like I'm doing, an acceptable approach?
-Filip
On Oct 1, 2013, at 6:27 PM, Eric Christopher <echristo at gmail.com> wrote:
> FWIW this appears to have broken lldb.
>
> http://lab.llvm.org:8011/builders/lldb-x86_64-debian-clang/builds/7750
>
> -eric
>
> On Tue, Oct 1, 2013 at 5:59 PM, Filip Pizlo <fpizlo at apple.com> wrote:
>> Author: fpizlo
>> Date: Tue Oct 1 19:59:25 2013
>> New Revision: 191804
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=191804&view=rev
>> Log:
>> This threads SectionName through the allocateCodeSection/allocateDataSection APIs, both in C++ and C land.
>> It's useful for the memory managers that are allocating a section to know what the name of the section is.
>> At a minimum, this is useful for low-level debugging - it's customary for JITs to be able to tell you what
>> memory they allocated, and as part of any such dump, they should be able to tell you some meta-data about
>> what each allocation is for. This allows clients that supply their own memory managers to do this.
>> Additionally, we also envision the SectionName being useful for passing meta-data from within LLVM to an LLVM
>> client.
>>
>> This changes both the C and C++ APIs, and all of the clients of those APIs within LLVM. I'm assuming that
>> it's safe to change the C++ API because that API is allowed to change. I'm assuming that it's safe to change
>> the C API because we haven't shipped the API in a release yet (LLVM 3.3 doesn't include the MCJIT memory
>> management C API).
>>
>>
>> Modified:
>> llvm/trunk/include/llvm-c/ExecutionEngine.h
>> llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h
>> llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h
>> llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp
>> llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
>> llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h
>> llvm/trunk/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp
>> llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
>> llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
>> llvm/trunk/tools/lli/RecordingMemoryManager.cpp
>> llvm/trunk/tools/lli/RecordingMemoryManager.h
>> llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
>> llvm/trunk/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp
>> llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp
>> llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp
>> llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp
>>
>> Modified: llvm/trunk/include/llvm-c/ExecutionEngine.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/ExecutionEngine.h?rev=191804&r1=191803&r2=191804&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm-c/ExecutionEngine.h (original)
>> +++ llvm/trunk/include/llvm-c/ExecutionEngine.h Tue Oct 1 19:59:25 2013
>> @@ -171,13 +171,14 @@ void *LLVMGetPointerToGlobal(LLVMExecuti
>>
>> /*===-- Operations on memory managers -------------------------------------===*/
>>
>> -typedef uint8_t *(*LLVMMemoryManagerAllocateCodeSectionCallback)(void *Opaque,
>> - uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID);
>> -typedef uint8_t *(*LLVMMemoryManagerAllocateDataSectionCallback)(void *Opaque,
>> - uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID, LLVMBool IsReadOnly);
>> -typedef LLVMBool (*LLVMMemoryManagerFinalizeMemoryCallback)(void *Opaque, char **ErrMsg);
>> +typedef uint8_t *(*LLVMMemoryManagerAllocateCodeSectionCallback)(
>> + void *Opaque, uintptr_t Size, unsigned Alignment, unsigned SectionID,
>> + const char *SectionName);
>> +typedef uint8_t *(*LLVMMemoryManagerAllocateDataSectionCallback)(
>> + void *Opaque, uintptr_t Size, unsigned Alignment, unsigned SectionID,
>> + const char *SectionName, LLVMBool IsReadOnly);
>> +typedef LLVMBool (*LLVMMemoryManagerFinalizeMemoryCallback)(
>> + void *Opaque, char **ErrMsg);
>> typedef void (*LLVMMemoryManagerDestroyCallback)(void *Opaque);
>>
>> /**
>>
>> Modified: llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h?rev=191804&r1=191803&r2=191804&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h (original)
>> +++ llvm/trunk/include/llvm/ExecutionEngine/RTDyldMemoryManager.h Tue Oct 1 19:59:25 2013
>> @@ -38,14 +38,16 @@ public:
>> /// executable code. The SectionID is a unique identifier assigned by the JIT
>> /// engine, and optionally recorded by the memory manager to access a loaded
>> /// section.
>> - virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID) = 0;
>> -
>> + virtual uint8_t *allocateCodeSection(
>> + uintptr_t Size, unsigned Alignment, unsigned SectionID,
>> + StringRef SectionName) = 0;
>> +
>> /// Allocate a memory block of (at least) the given size suitable for data.
>> /// The SectionID is a unique identifier assigned by the JIT engine, and
>> /// optionally recorded by the memory manager to access a loaded section.
>> - virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID, bool IsReadOnly) = 0;
>> + virtual uint8_t *allocateDataSection(
>> + uintptr_t Size, unsigned Alignment, unsigned SectionID,
>> + StringRef SectionName, bool IsReadOnly) = 0;
>>
>> /// Register the EH frames with the runtime so that c++ exceptions work.
>> virtual void registerEHFrames(StringRef SectionData);
>>
>> Modified: llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h?rev=191804&r1=191803&r2=191804&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h (original)
>> +++ llvm/trunk/include/llvm/ExecutionEngine/SectionMemoryManager.h Tue Oct 1 19:59:25 2013
>> @@ -49,7 +49,8 @@ public:
>> /// The value of \p Alignment must be a power of two. If \p Alignment is zero
>> /// a default alignment of 16 will be used.
>> virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID);
>> + unsigned SectionID,
>> + StringRef SectionName);
>>
>> /// \brief Allocates a memory block of (at least) the given size suitable for
>> /// executable code.
>> @@ -58,6 +59,7 @@ public:
>> /// a default alignment of 16 will be used.
>> virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
>> unsigned SectionID,
>> + StringRef SectionName,
>> bool isReadOnly);
>>
>> /// \brief Update section-specific memory permissions and other attributes.
>>
>> Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp?rev=191804&r1=191803&r2=191804&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp (original)
>> +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp Tue Oct 1 19:59:25 2013
>> @@ -351,12 +351,13 @@ public:
>> void *Opaque);
>> virtual ~SimpleBindingMemoryManager();
>>
>> - virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID);
>> -
>> - virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID,
>> - bool isReadOnly);
>> + virtual uint8_t *allocateCodeSection(
>> + uintptr_t Size, unsigned Alignment, unsigned SectionID,
>> + StringRef SectionName);
>> +
>> + virtual uint8_t *allocateDataSection(
>> + uintptr_t Size, unsigned Alignment, unsigned SectionID,
>> + StringRef SectionName, bool isReadOnly);
>>
>> virtual bool finalizeMemory(std::string *ErrMsg);
>>
>> @@ -384,13 +385,17 @@ SimpleBindingMemoryManager::~SimpleBindi
>> }
>>
>> uint8_t *SimpleBindingMemoryManager::allocateCodeSection(
>> - uintptr_t Size, unsigned Alignment, unsigned SectionID) {
>> - return Functions.AllocateCodeSection(Opaque, Size, Alignment, SectionID);
>> + uintptr_t Size, unsigned Alignment, unsigned SectionID,
>> + StringRef SectionName) {
>> + return Functions.AllocateCodeSection(Opaque, Size, Alignment, SectionID,
>> + SectionName.str().c_str());
>> }
>>
>> uint8_t *SimpleBindingMemoryManager::allocateDataSection(
>> - uintptr_t Size, unsigned Alignment, unsigned SectionID, bool isReadOnly) {
>> + uintptr_t Size, unsigned Alignment, unsigned SectionID,
>> + StringRef SectionName, bool isReadOnly) {
>> return Functions.AllocateDataSection(Opaque, Size, Alignment, SectionID,
>> + SectionName.str().c_str(),
>> isReadOnly);
>> }
>>
>>
>> Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp?rev=191804&r1=191803&r2=191804&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp (original)
>> +++ llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp Tue Oct 1 19:59:25 2013
>> @@ -464,7 +464,7 @@ namespace {
>>
>> /// allocateCodeSection - Allocate memory for a code section.
>> uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID) {
>> + unsigned SectionID, StringRef SectionName) {
>> // Grow the required block size to account for the block header
>> Size += sizeof(*CurBlock);
>>
>> @@ -510,7 +510,8 @@ namespace {
>>
>> /// allocateDataSection - Allocate memory for a data section.
>> uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID, bool IsReadOnly) {
>> + unsigned SectionID, StringRef SectionName,
>> + bool IsReadOnly) {
>> return (uint8_t*)DataAllocator.Allocate(Size, Alignment);
>> }
>>
>>
>> Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h?rev=191804&r1=191803&r2=191804&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h (original)
>> +++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.h Tue Oct 1 19:59:25 2013
>> @@ -35,14 +35,15 @@ public:
>>
>> // Functions deferred to client memory manager
>> virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID) {
>> - return ClientMM->allocateCodeSection(Size, Alignment, SectionID);
>> + unsigned SectionID, StringRef SectionName) {
>> + return ClientMM->allocateCodeSection(Size, Alignment, SectionID, SectionName);
>> }
>>
>> virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID, bool IsReadOnly) {
>> + unsigned SectionID, StringRef SectionName,
>> + bool IsReadOnly) {
>> return ClientMM->allocateDataSection(Size, Alignment,
>> - SectionID, IsReadOnly);
>> + SectionID, SectionName, IsReadOnly);
>> }
>>
>> virtual void registerEHFrames(StringRef SectionData) {
>>
>> Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp?rev=191804&r1=191803&r2=191804&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp (original)
>> +++ llvm/trunk/lib/ExecutionEngine/MCJIT/SectionMemoryManager.cpp Tue Oct 1 19:59:25 2013
>> @@ -19,9 +19,10 @@
>> namespace llvm {
>>
>> uint8_t *SectionMemoryManager::allocateDataSection(uintptr_t Size,
>> - unsigned Alignment,
>> - unsigned SectionID,
>> - bool IsReadOnly) {
>> + unsigned Alignment,
>> + unsigned SectionID,
>> + StringRef SectionName,
>> + bool IsReadOnly) {
>> if (IsReadOnly)
>> return allocateSection(RODataMem, Size, Alignment);
>> return allocateSection(RWDataMem, Size, Alignment);
>> @@ -29,7 +30,8 @@ uint8_t *SectionMemoryManager::allocateD
>>
>> uint8_t *SectionMemoryManager::allocateCodeSection(uintptr_t Size,
>> unsigned Alignment,
>> - unsigned SectionID) {
>> + unsigned SectionID,
>> + StringRef SectionName) {
>> return allocateSection(CodeMem, Size, Alignment);
>> }
>>
>>
>> Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp?rev=191804&r1=191803&r2=191804&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp (original)
>> +++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Tue Oct 1 19:59:25 2013
>> @@ -182,8 +182,8 @@ void RuntimeDyldImpl::emitCommonSymbols(
>> SymbolTableMap &SymbolTable) {
>> // Allocate memory for the section
>> unsigned SectionID = Sections.size();
>> - uint8_t *Addr = MemMgr->allocateDataSection(TotalSize, sizeof(void*),
>> - SectionID, false);
>> + uint8_t *Addr = MemMgr->allocateDataSection(
>> + TotalSize, sizeof(void*), SectionID, StringRef(), false);
>> if (!Addr)
>> report_fatal_error("Unable to allocate memory for common symbols!");
>> uint64_t Offset = 0;
>> @@ -278,8 +278,9 @@ unsigned RuntimeDyldImpl::emitSection(Ob
>> if (IsRequired) {
>> Allocate = DataSize + StubBufSize;
>> Addr = IsCode
>> - ? MemMgr->allocateCodeSection(Allocate, Alignment, SectionID)
>> - : MemMgr->allocateDataSection(Allocate, Alignment, SectionID, IsReadOnly);
>> + ? MemMgr->allocateCodeSection(Allocate, Alignment, SectionID, Name)
>> + : MemMgr->allocateDataSection(Allocate, Alignment, SectionID, Name,
>> + IsReadOnly);
>> if (!Addr)
>> report_fatal_error("Unable to allocate section memory!");
>>
>>
>> Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp?rev=191804&r1=191803&r2=191804&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp (original)
>> +++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp Tue Oct 1 19:59:25 2013
>> @@ -1337,8 +1337,8 @@ void RuntimeDyldELF::finalizeLoad() {
>> // Allocate memory for the section
>> unsigned SectionID = Sections.size();
>> size_t TotalSize = numGOTEntries * getGOTEntrySize();
>> - uint8_t *Addr = MemMgr->allocateDataSection(TotalSize, getGOTEntrySize(),
>> - SectionID, false);
>> + uint8_t *Addr = MemMgr->allocateDataSection(
>> + TotalSize, getGOTEntrySize(), SectionID, ".got", false);
>> if (!Addr)
>> report_fatal_error("Unable to allocate memory for GOT!");
>> Sections.push_back(SectionEntry(".got", Addr, TotalSize, 0));
>>
>> Modified: llvm/trunk/tools/lli/RecordingMemoryManager.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/RecordingMemoryManager.cpp?rev=191804&r1=191803&r2=191804&view=diff
>> ==============================================================================
>> --- llvm/trunk/tools/lli/RecordingMemoryManager.cpp (original)
>> +++ llvm/trunk/tools/lli/RecordingMemoryManager.cpp Tue Oct 1 19:59:25 2013
>> @@ -27,7 +27,8 @@ RecordingMemoryManager::~RecordingMemory
>> }
>>
>> uint8_t *RecordingMemoryManager::
>> -allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID) {
>> +allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID,
>> + StringRef SectionName) {
>> // The recording memory manager is just a local copy of the remote target.
>> // The alignment requirement is just stored here for later use. Regular
>> // heap storage is sufficient here, but we're using mapped memory to work
>> @@ -39,7 +40,8 @@ allocateCodeSection(uintptr_t Size, unsi
>>
>> uint8_t *RecordingMemoryManager::
>> allocateDataSection(uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID, bool IsReadOnly) {
>> + unsigned SectionID, StringRef SectionName,
>> + bool IsReadOnly) {
>> // The recording memory manager is just a local copy of the remote target.
>> // The alignment requirement is just stored here for later use. Regular
>> // heap storage is sufficient here, but we're using mapped memory to work
>>
>> Modified: llvm/trunk/tools/lli/RecordingMemoryManager.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/RecordingMemoryManager.h?rev=191804&r1=191803&r2=191804&view=diff
>> ==============================================================================
>> --- llvm/trunk/tools/lli/RecordingMemoryManager.h (original)
>> +++ llvm/trunk/tools/lli/RecordingMemoryManager.h Tue Oct 1 19:59:25 2013
>> @@ -50,10 +50,11 @@ public:
>> const_code_iterator code_end() const { return AllocatedCodeMem.end(); }
>>
>> uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID);
>> + unsigned SectionID, StringRef SectionName);
>>
>> uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID, bool IsReadOnly);
>> + unsigned SectionID, StringRef SectionName,
>> + bool IsReadOnly);
>>
>> void *getPointerToNamedFunction(const std::string &Name,
>> bool AbortOnFailure = true);
>>
>> Modified: llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp?rev=191804&r1=191803&r2=191804&view=diff
>> ==============================================================================
>> --- llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp (original)
>> +++ llvm/trunk/tools/llvm-rtdyld/llvm-rtdyld.cpp Tue Oct 1 19:59:25 2013
>> @@ -60,9 +60,10 @@ public:
>> SmallVector<sys::MemoryBlock, 16> DataMemory;
>>
>> uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID);
>> + unsigned SectionID, StringRef SectionName);
>> uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID, bool IsReadOnly);
>> + unsigned SectionID, StringRef SectionName,
>> + bool IsReadOnly);
>>
>> virtual void *getPointerToNamedFunction(const std::string &Name,
>> bool AbortOnFailure = true) {
>> @@ -80,7 +81,8 @@ public:
>>
>> uint8_t *TrivialMemoryManager::allocateCodeSection(uintptr_t Size,
>> unsigned Alignment,
>> - unsigned SectionID) {
>> + unsigned SectionID,
>> + StringRef SectionName) {
>> sys::MemoryBlock MB = sys::Memory::AllocateRWX(Size, 0, 0);
>> FunctionMemory.push_back(MB);
>> return (uint8_t*)MB.base();
>> @@ -89,6 +91,7 @@ uint8_t *TrivialMemoryManager::allocateC
>> uint8_t *TrivialMemoryManager::allocateDataSection(uintptr_t Size,
>> unsigned Alignment,
>> unsigned SectionID,
>> + StringRef SectionName,
>> bool IsReadOnly) {
>> sys::MemoryBlock MB = sys::Memory::AllocateRWX(Size, 0, 0);
>> DataMemory.push_back(MB);
>>
>> Modified: llvm/trunk/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp?rev=191804&r1=191803&r2=191804&view=diff
>> ==============================================================================
>> --- llvm/trunk/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp (original)
>> +++ llvm/trunk/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp Tue Oct 1 19:59:25 2013
>> @@ -281,11 +281,11 @@ TEST(JITMemoryManagerTest, TestManyStubs
>> TEST(JITMemoryManagerTest, AllocateSection) {
>> OwningPtr<JITMemoryManager> MemMgr(
>> JITMemoryManager::CreateDefaultMemManager());
>> - uint8_t *code1 = MemMgr->allocateCodeSection(256, 0, 1);
>> - uint8_t *data1 = MemMgr->allocateDataSection(256, 16, 2, true);
>> - uint8_t *code2 = MemMgr->allocateCodeSection(257, 32, 3);
>> - uint8_t *data2 = MemMgr->allocateDataSection(256, 64, 4, false);
>> - uint8_t *code3 = MemMgr->allocateCodeSection(258, 64, 5);
>> + uint8_t *code1 = MemMgr->allocateCodeSection(256, 0, 1, StringRef());
>> + uint8_t *data1 = MemMgr->allocateDataSection(256, 16, 2, StringRef(), true);
>> + uint8_t *code2 = MemMgr->allocateCodeSection(257, 32, 3, StringRef());
>> + uint8_t *data2 = MemMgr->allocateDataSection(256, 64, 4, StringRef(), false);
>> + uint8_t *code3 = MemMgr->allocateCodeSection(258, 64, 5, StringRef());
>>
>> EXPECT_NE((uint8_t*)0, code1);
>> EXPECT_NE((uint8_t*)0, code2);
>>
>> Modified: llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp?rev=191804&r1=191803&r2=191804&view=diff
>> ==============================================================================
>> --- llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp (original)
>> +++ llvm/trunk/unittests/ExecutionEngine/JIT/JITTest.cpp Tue Oct 1 19:59:25 2013
>> @@ -135,13 +135,17 @@ public:
>> EndFunctionBodyCall(F, FunctionStart, FunctionEnd));
>> Base->endFunctionBody(F, FunctionStart, FunctionEnd);
>> }
>> - virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID, bool IsReadOnly) {
>> - return Base->allocateDataSection(Size, Alignment, SectionID, IsReadOnly);
>> + virtual uint8_t *allocateDataSection(
>> + uintptr_t Size, unsigned Alignment, unsigned SectionID,
>> + StringRef SectionName, bool IsReadOnly) {
>> + return Base->allocateDataSection(
>> + Size, Alignment, SectionID, SectionName, IsReadOnly);
>> }
>> - virtual uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
>> - unsigned SectionID) {
>> - return Base->allocateCodeSection(Size, Alignment, SectionID);
>> + virtual uint8_t *allocateCodeSection(
>> + uintptr_t Size, unsigned Alignment, unsigned SectionID,
>> + StringRef SectionName) {
>> + return Base->allocateCodeSection(
>> + Size, Alignment, SectionID, SectionName);
>> }
>> virtual bool finalizeMemory(std::string *ErrMsg) { return false; }
>> virtual uint8_t *allocateSpace(intptr_t Size, unsigned Alignment) {
>>
>> Modified: llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp?rev=191804&r1=191803&r2=191804&view=diff
>> ==============================================================================
>> --- llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp (original)
>> +++ llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp Tue Oct 1 19:59:25 2013
>> @@ -28,18 +28,20 @@ static bool didCallAllocateCodeSection;
>>
>> static uint8_t *roundTripAllocateCodeSection(void *object, uintptr_t size,
>> unsigned alignment,
>> - unsigned sectionID) {
>> + unsigned sectionID,
>> + const char *sectionName) {
>> didCallAllocateCodeSection = true;
>> return static_cast<SectionMemoryManager*>(object)->allocateCodeSection(
>> - size, alignment, sectionID);
>> + size, alignment, sectionID, sectionName);
>> }
>>
>> static uint8_t *roundTripAllocateDataSection(void *object, uintptr_t size,
>> unsigned alignment,
>> unsigned sectionID,
>> + const char *sectionName,
>> LLVMBool isReadOnly) {
>> return static_cast<SectionMemoryManager*>(object)->allocateDataSection(
>> - size, alignment, sectionID, isReadOnly);
>> + size, alignment, sectionID, sectionName, isReadOnly);
>> }
>>
>> static LLVMBool roundTripFinalizeMemory(void *object, char **errMsg) {
>>
>> Modified: llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp?rev=191804&r1=191803&r2=191804&view=diff
>> ==============================================================================
>> --- llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp (original)
>> +++ llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp Tue Oct 1 19:59:25 2013
>> @@ -19,10 +19,10 @@ namespace {
>> TEST(MCJITMemoryManagerTest, BasicAllocations) {
>> OwningPtr<SectionMemoryManager> MemMgr(new SectionMemoryManager());
>>
>> - uint8_t *code1 = MemMgr->allocateCodeSection(256, 0, 1);
>> - uint8_t *data1 = MemMgr->allocateDataSection(256, 0, 2, true);
>> - uint8_t *code2 = MemMgr->allocateCodeSection(256, 0, 3);
>> - uint8_t *data2 = MemMgr->allocateDataSection(256, 0, 4, false);
>> + uint8_t *code1 = MemMgr->allocateCodeSection(256, 0, 1, "");
>> + uint8_t *data1 = MemMgr->allocateDataSection(256, 0, 2, "", true);
>> + uint8_t *code2 = MemMgr->allocateCodeSection(256, 0, 3, "");
>> + uint8_t *data2 = MemMgr->allocateDataSection(256, 0, 4, "", false);
>>
>> EXPECT_NE((uint8_t*)0, code1);
>> EXPECT_NE((uint8_t*)0, code2);
>> @@ -52,10 +52,10 @@ TEST(MCJITMemoryManagerTest, BasicAlloca
>> TEST(MCJITMemoryManagerTest, LargeAllocations) {
>> OwningPtr<SectionMemoryManager> MemMgr(new SectionMemoryManager());
>>
>> - uint8_t *code1 = MemMgr->allocateCodeSection(0x100000, 0, 1);
>> - uint8_t *data1 = MemMgr->allocateDataSection(0x100000, 0, 2, true);
>> - uint8_t *code2 = MemMgr->allocateCodeSection(0x100000, 0, 3);
>> - uint8_t *data2 = MemMgr->allocateDataSection(0x100000, 0, 4, false);
>> + uint8_t *code1 = MemMgr->allocateCodeSection(0x100000, 0, 1, "");
>> + uint8_t *data1 = MemMgr->allocateDataSection(0x100000, 0, 2, "", true);
>> + uint8_t *code2 = MemMgr->allocateCodeSection(0x100000, 0, 3, "");
>> + uint8_t *data2 = MemMgr->allocateDataSection(0x100000, 0, 4, "", false);
>>
>> EXPECT_NE((uint8_t*)0, code1);
>> EXPECT_NE((uint8_t*)0, code2);
>> @@ -91,8 +91,8 @@ TEST(MCJITMemoryManagerTest, ManyAllocat
>> for (unsigned i = 0; i < 10000; ++i) {
>> const bool isReadOnly = i % 2 == 0;
>>
>> - code[i] = MemMgr->allocateCodeSection(32, 0, 1);
>> - data[i] = MemMgr->allocateDataSection(32, 0, 2, isReadOnly);
>> + code[i] = MemMgr->allocateCodeSection(32, 0, 1, "");
>> + data[i] = MemMgr->allocateDataSection(32, 0, 2, "", isReadOnly);
>>
>> for (unsigned j = 0; j < 32; j++) {
>> code[i][j] = 1 + (i % 254);
>> @@ -130,8 +130,8 @@ TEST(MCJITMemoryManagerTest, ManyVariedA
>> bool isReadOnly = i % 3 == 0;
>> unsigned Align = 8 << (i % 4);
>>
>> - code[i] = MemMgr->allocateCodeSection(CodeSize, Align, i);
>> - data[i] = MemMgr->allocateDataSection(DataSize, Align, i + 10000,
>> + code[i] = MemMgr->allocateCodeSection(CodeSize, Align, i, "");
>> + data[i] = MemMgr->allocateDataSection(DataSize, Align, i + 10000, "",
>> isReadOnly);
>>
>> for (unsigned j = 0; j < CodeSize; j++) {
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131001/f48f98e6/attachment.html>
More information about the llvm-commits
mailing list