diff options
author | David Tweed <david.tweed@arm.com> | 2013-05-17 10:01:46 +0000 |
---|---|---|
committer | David Tweed <david.tweed@arm.com> | 2013-05-17 10:01:46 +0000 |
commit | 2e7efedd39bcafb2b6c22557b9eccd5243f1cc1c (patch) | |
tree | 38315153dd4a02300d8f4e1069ca6ede714680ba /llvm/unittests/ExecutionEngine | |
parent | b7be72df5bb3d06be9d5315f74d5c83909f6c5ae (diff) | |
download | bcm5719-llvm-2e7efedd39bcafb2b6c22557b9eccd5243f1cc1c.tar.gz bcm5719-llvm-2e7efedd39bcafb2b6c22557b9eccd5243f1cc1c.zip |
Minor changes to the MCJITTest unittests to use the correct API for finalizing
the JIT object (including XFAIL an ARM test that now needs fixing). Also renames
internal function for consistency.
llvm-svn: 182085
Diffstat (limited to 'llvm/unittests/ExecutionEngine')
4 files changed, 18 insertions, 16 deletions
diff --git a/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp b/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp index cf995aac7a1..f8d9da27550 100644 --- a/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp +++ b/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp @@ -127,7 +127,7 @@ public: unsigned SectionID) { return Base->allocateCodeSection(Size, Alignment, SectionID); } - virtual bool applyPermissions(std::string *ErrMsg) { return false; } + virtual bool finalizeMemory(std::string *ErrMsg) { return false; } virtual uint8_t *allocateSpace(intptr_t Size, unsigned Alignment) { return Base->allocateSpace(Size, Alignment); } diff --git a/llvm/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp b/llvm/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp index ab09acad0d3..9e0b35395e5 100644 --- a/llvm/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp +++ b/llvm/unittests/ExecutionEngine/MCJIT/MCJITMemoryManagerTest.cpp @@ -46,7 +46,7 @@ TEST(MCJITMemoryManagerTest, BasicAllocations) { }
std::string Error;
- EXPECT_FALSE(MemMgr->applyPermissions(&Error));
+ EXPECT_FALSE(MemMgr->finalizeMemory(&Error));
}
TEST(MCJITMemoryManagerTest, LargeAllocations) {
@@ -79,7 +79,7 @@ TEST(MCJITMemoryManagerTest, LargeAllocations) { }
std::string Error;
- EXPECT_FALSE(MemMgr->applyPermissions(&Error));
+ EXPECT_FALSE(MemMgr->finalizeMemory(&Error));
}
TEST(MCJITMemoryManagerTest, ManyAllocations) {
@@ -114,7 +114,7 @@ TEST(MCJITMemoryManagerTest, ManyAllocations) { }
std::string Error;
- EXPECT_FALSE(MemMgr->applyPermissions(&Error));
+ EXPECT_FALSE(MemMgr->finalizeMemory(&Error));
}
TEST(MCJITMemoryManagerTest, ManyVariedAllocations) {
diff --git a/llvm/unittests/ExecutionEngine/MCJIT/MCJITObjectCacheTest.cpp b/llvm/unittests/ExecutionEngine/MCJIT/MCJITObjectCacheTest.cpp index abe8be450ae..32fc292496c 100644 --- a/llvm/unittests/ExecutionEngine/MCJIT/MCJITObjectCacheTest.cpp +++ b/llvm/unittests/ExecutionEngine/MCJIT/MCJITObjectCacheTest.cpp @@ -101,11 +101,10 @@ protected: ASSERT_TRUE(TheJIT.isValid()); ASSERT_TRUE(0 != Main); + // We may be using a null cache, so ensure compilation is valid. TheJIT->finalizeObject(); void *vPtr = TheJIT->getPointerToFunction(Main); - static_cast<SectionMemoryManager*>(MM)->invalidateInstructionCache(); - EXPECT_TRUE(0 != vPtr) << "Unable to get pointer to main() from JIT"; diff --git a/llvm/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp b/llvm/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp index e9cf904b181..43a82984c45 100644 --- a/llvm/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp +++ b/llvm/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp @@ -34,6 +34,7 @@ namespace { /* TEST_F(MCJITTest, empty_module) { createJIT(M.take()); + TheJIT->finalizeObject(); //EXPECT_NE(0, TheJIT->getObjectImage()) // << "Unable to generate executable loaded object image"; } @@ -46,8 +47,7 @@ TEST_F(MCJITTest, global_variable) { GlobalValue *Global = insertGlobalInt32(M.get(), "test_global", initialValue); createJIT(M.take()); void *globalPtr = TheJIT->getPointerToGlobal(Global); - MM->applyPermissions(); - static_cast<SectionMemoryManager*>(MM)->invalidateInstructionCache(); + TheJIT->finalizeObject(); EXPECT_TRUE(0 != globalPtr) << "Unable to get pointer to global value from JIT"; @@ -61,8 +61,7 @@ TEST_F(MCJITTest, add_function) { Function *F = insertAddFunction(M.get()); createJIT(M.take()); void *addPtr = TheJIT->getPointerToFunction(F); - MM->applyPermissions(); - static_cast<SectionMemoryManager*>(MM)->invalidateInstructionCache(); + TheJIT->finalizeObject(); EXPECT_TRUE(0 != addPtr) << "Unable to get pointer to function from JIT"; @@ -79,8 +78,7 @@ TEST_F(MCJITTest, run_main) { Function *Main = insertMainFunction(M.get(), 6); createJIT(M.take()); void *vPtr = TheJIT->getPointerToFunction(Main); - MM->applyPermissions(); - static_cast<SectionMemoryManager*>(MM)->invalidateInstructionCache(); + TheJIT->finalizeObject(); EXPECT_TRUE(0 != vPtr) << "Unable to get pointer to main() from JIT"; @@ -102,8 +100,7 @@ TEST_F(MCJITTest, return_global) { createJIT(M.take()); void *rgvPtr = TheJIT->getPointerToFunction(ReturnGlobal); - MM->applyPermissions(); - static_cast<SectionMemoryManager*>(MM)->invalidateInstructionCache(); + TheJIT->finalizeObject(); EXPECT_TRUE(0 != rgvPtr); int32_t(*FuncPtr)(void) = (int32_t(*)(void))(intptr_t)rgvPtr; @@ -134,6 +131,7 @@ TEST_F(MCJITTest, increment_global) { createJIT(M.take()); void *gvPtr = TheJIT->getPointerToGlobal(GV); + TheJIT->finalizeObject(); EXPECT_EQ(initialNum, *(int32_t*)gvPtr); void *vPtr = TheJIT->getPointerToFunction(IncrementGlobal); @@ -150,6 +148,9 @@ TEST_F(MCJITTest, increment_global) { } */ +// PR16013: XFAIL this test on ARM, which currently can't handle multiple relocations. +#if !defined(__arm__) + TEST_F(MCJITTest, multiple_functions) { SKIP_UNSUPPORTED_PLATFORM; @@ -172,8 +173,7 @@ TEST_F(MCJITTest, multiple_functions) { createJIT(M.take()); void *vPtr = TheJIT->getPointerToFunction(Outer); - MM->applyPermissions(); - static_cast<SectionMemoryManager*>(MM)->invalidateInstructionCache(); + TheJIT->finalizeObject(); EXPECT_TRUE(0 != vPtr) << "Unable to get pointer to outer function from JIT"; @@ -182,6 +182,8 @@ TEST_F(MCJITTest, multiple_functions) { << "Incorrect result returned from function"; } +#endif /*!defined(__arm__)*/ + // FIXME: ExecutionEngine has no support empty modules /* TEST_F(MCJITTest, multiple_empty_modules) { @@ -219,6 +221,7 @@ TEST_F(MCJITTest, multiple_modules) { // get a function pointer in a module that was not used in EE construction void *vPtr = TheJIT->getPointerToFunction(Caller); + TheJIT->finalizeObject(); EXPECT_NE(0, vPtr) << "Unable to get pointer to caller function from JIT"; |