summaryrefslogtreecommitdiffstats
path: root/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp
diff options
context:
space:
mode:
authorDavid Tweed <david.tweed@arm.com>2013-05-17 10:01:46 +0000
committerDavid Tweed <david.tweed@arm.com>2013-05-17 10:01:46 +0000
commitabb38fe8dec11b1ea7535f84fac8ad0f0af70add (patch)
tree14d65d4e61acb9acb731e953ae5ff714ca1a9c7f /unittests/ExecutionEngine/MCJIT/MCJITTest.cpp
parente91967820879b79f95b0378124c5f40d9e6d54ee (diff)
downloadexternal_llvm-abb38fe8dec11b1ea7535f84fac8ad0f0af70add.zip
external_llvm-abb38fe8dec11b1ea7535f84fac8ad0f0af70add.tar.gz
external_llvm-abb38fe8dec11b1ea7535f84fac8ad0f0af70add.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182085 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ExecutionEngine/MCJIT/MCJITTest.cpp')
-rw-r--r--unittests/ExecutionEngine/MCJIT/MCJITTest.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp b/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp
index e9cf904..43a8298 100644
--- a/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp
+++ b/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";