X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=unittests%2FExecutionEngine%2FJIT%2FMultiJITTest.cpp;h=f530e0de5d51f1186cb8b4f2633679596dc50cdb;hp=183936cb3a332d6af0c7d7bff5ece857da7b4874;hb=b177041dfaaabbbb8f97e256572125c42d35bbff;hpb=bc65a8d518ebe0408deb15d9314fd2ff5cbd0686 diff --git a/unittests/ExecutionEngine/JIT/MultiJITTest.cpp b/unittests/ExecutionEngine/JIT/MultiJITTest.cpp index 183936cb3a3..f530e0de5d5 100644 --- a/unittests/ExecutionEngine/JIT/MultiJITTest.cpp +++ b/unittests/ExecutionEngine/JIT/MultiJITTest.cpp @@ -21,12 +21,13 @@ using namespace llvm; namespace { // ARM, PowerPC and SystemZ tests disabled pending fix for PR10783. -#if !defined(__arm__) && !defined(__powerpc__) && !defined(__s390__) +#if !defined(__arm__) && !defined(__powerpc__) && !defined(__s390__) \ + && !defined(__aarch64__) bool LoadAssemblyInto(Module *M, const char *assembly) { SMDiagnostic Error; bool success = - NULL != ParseAssemblyString(assembly, M, Error, M->getContext()); + nullptr != ParseAssemblyString(assembly, M, Error, M->getContext()); std::string errMsg; raw_string_ostream os(errMsg); Error.print("", os); @@ -70,19 +71,19 @@ void createModule2(LLVMContext &Context2, Module *&M2, Function *&FooF2) { TEST(MultiJitTest, EagerMode) { LLVMContext Context1; - Module *M1 = 0; - Function *FooF1 = 0; + Module *M1 = nullptr; + Function *FooF1 = nullptr; createModule1(Context1, M1, FooF1); LLVMContext Context2; - Module *M2 = 0; - Function *FooF2 = 0; + Module *M2 = nullptr; + Function *FooF2 = nullptr; createModule2(Context2, M2, FooF2); // Now we create the JIT in eager mode - OwningPtr EE1(EngineBuilder(M1).create()); + std::unique_ptr EE1(EngineBuilder(M1).create()); EE1->DisableLazyCompilation(true); - OwningPtr EE2(EngineBuilder(M2).create()); + std::unique_ptr EE2(EngineBuilder(M2).create()); EE2->DisableLazyCompilation(true); // Call the `foo' function with no arguments: @@ -100,19 +101,19 @@ TEST(MultiJitTest, EagerMode) { TEST(MultiJitTest, LazyMode) { LLVMContext Context1; - Module *M1 = 0; - Function *FooF1 = 0; + Module *M1 = nullptr; + Function *FooF1 = nullptr; createModule1(Context1, M1, FooF1); LLVMContext Context2; - Module *M2 = 0; - Function *FooF2 = 0; + Module *M2 = nullptr; + Function *FooF2 = nullptr; createModule2(Context2, M2, FooF2); // Now we create the JIT in lazy mode - OwningPtr EE1(EngineBuilder(M1).create()); + std::unique_ptr EE1(EngineBuilder(M1).create()); EE1->DisableLazyCompilation(false); - OwningPtr EE2(EngineBuilder(M2).create()); + std::unique_ptr EE2(EngineBuilder(M2).create()); EE2->DisableLazyCompilation(false); // Call the `foo' function with no arguments: @@ -134,18 +135,18 @@ extern "C" { TEST(MultiJitTest, JitPool) { LLVMContext Context1; - Module *M1 = 0; - Function *FooF1 = 0; + Module *M1 = nullptr; + Function *FooF1 = nullptr; createModule1(Context1, M1, FooF1); LLVMContext Context2; - Module *M2 = 0; - Function *FooF2 = 0; + Module *M2 = nullptr; + Function *FooF2 = nullptr; createModule2(Context2, M2, FooF2); // Now we create two JITs - OwningPtr EE1(EngineBuilder(M1).create()); - OwningPtr EE2(EngineBuilder(M2).create()); + std::unique_ptr EE1(EngineBuilder(M1).create()); + std::unique_ptr EE2(EngineBuilder(M2).create()); Function *F1 = EE1->FindFunctionNamed("foo1"); void *foo1 = EE1->getPointerToFunction(F1); @@ -173,6 +174,14 @@ TEST(MultiJitTest, JitPool) { EXPECT_TRUE(fa != 0); fa = *(intptr_t *)fa; // Bound value of IAT } +#elif defined(__x86_64__) + // getPointerToNamedFunction might be indirect jump + // on Win32 x64 --enable-shared. + // FF 25 : jmp *(RIP + pointer to IAT) + if (sa != fa && memcmp((char *)fa, "\xFF\x25", 2) == 0) { + fa += *(int32_t *)(fa + 2) + 6; // Address to IAT(RIP) + fa = *(intptr_t *)fa; // Bound value of IAT + } #endif EXPECT_TRUE(sa == fa); }