diff options
Diffstat (limited to 'unittests')
4 files changed, 32 insertions, 26 deletions
diff --git a/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp b/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp index 68ca53d..731f780 100644 --- a/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp +++ b/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp @@ -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); diff --git a/unittests/ExecutionEngine/JIT/JITTest.cpp b/unittests/ExecutionEngine/JIT/JITTest.cpp index 3b94d76..73976ab 100644 --- a/unittests/ExecutionEngine/JIT/JITTest.cpp +++ b/unittests/ExecutionEngine/JIT/JITTest.cpp @@ -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) { diff --git a/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp b/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp index c434a7c..e4197dd 100644 --- a/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp +++ b/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp @@ -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) { diff --git a/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp b/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp index f6dbf98..c24346d 100644 --- a/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp +++ b/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp @@ -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, BasicAllocations) { 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, ManyAllocations) { 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, ManyVariedAllocations) { 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++) { |