diff options
author | Stephen Hines <srhines@google.com> | 2014-05-29 02:49:00 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-05-29 02:49:00 -0700 |
commit | dce4a407a24b04eebc6a376f8e62b41aaa7b071f (patch) | |
tree | dcebc53f2b182f145a2e659393bf9a0472cedf23 /unittests/ExecutionEngine | |
parent | 220b921aed042f9e520c26cffd8282a94c66c3d5 (diff) | |
download | external_llvm-dce4a407a24b04eebc6a376f8e62b41aaa7b071f.zip external_llvm-dce4a407a24b04eebc6a376f8e62b41aaa7b071f.tar.gz external_llvm-dce4a407a24b04eebc6a376f8e62b41aaa7b071f.tar.bz2 |
Update LLVM for 3.5 rebase (r209712).
Change-Id: I149556c940fb7dc92d075273c87ff584f400941f
Diffstat (limited to 'unittests/ExecutionEngine')
-rw-r--r-- | unittests/ExecutionEngine/JIT/IntelJITEventListenerTest.cpp | 2 | ||||
-rw-r--r-- | unittests/ExecutionEngine/JIT/JITTest.cpp | 4 | ||||
-rw-r--r-- | unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp | 27 |
3 files changed, 30 insertions, 3 deletions
diff --git a/unittests/ExecutionEngine/JIT/IntelJITEventListenerTest.cpp b/unittests/ExecutionEngine/JIT/IntelJITEventListenerTest.cpp index d3f66a2..db90887 100644 --- a/unittests/ExecutionEngine/JIT/IntelJITEventListenerTest.cpp +++ b/unittests/ExecutionEngine/JIT/IntelJITEventListenerTest.cpp @@ -83,7 +83,7 @@ public: EXPECT_TRUE(0 != MockWrapper); Listener.reset(JITEventListener::createIntelJITEventListener( - MockWrapper.take())); + MockWrapper.release())); EXPECT_TRUE(0 != Listener); EE->RegisterJITEventListener(Listener.get()); } diff --git a/unittests/ExecutionEngine/JIT/JITTest.cpp b/unittests/ExecutionEngine/JIT/JITTest.cpp index 9e65fee..f438286 100644 --- a/unittests/ExecutionEngine/JIT/JITTest.cpp +++ b/unittests/ExecutionEngine/JIT/JITTest.cpp @@ -114,8 +114,8 @@ public: return Result; } int stubsAllocated; - virtual uint8_t *allocateStub(const GlobalValue* F, unsigned StubSize, - unsigned Alignment) { + uint8_t *allocateStub(const GlobalValue *F, unsigned StubSize, + unsigned Alignment) override { stubsAllocated++; return Base->allocateStub(F, StubSize, Alignment); } diff --git a/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp b/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp index 3813d59..20d3f13 100644 --- a/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp +++ b/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp @@ -28,6 +28,7 @@ using namespace llvm; static bool didCallAllocateCodeSection; static bool didAllocateCompactUnwindSection; +static bool didCallYield; static uint8_t *roundTripAllocateCodeSection(void *object, uintptr_t size, unsigned alignment, @@ -64,6 +65,10 @@ static void roundTripDestroy(void *object) { delete static_cast<SectionMemoryManager*>(object); } +static void yield(LLVMContextRef, void *) { + didCallYield = true; +} + namespace { // memory manager to test reserve allocation space callback @@ -142,6 +147,7 @@ protected: virtual void SetUp() { didCallAllocateCodeSection = false; didAllocateCompactUnwindSection = false; + didCallYield = false; Module = 0; Function = 0; Engine = 0; @@ -429,3 +435,24 @@ TEST_F(MCJITCAPITest, reserve_allocation_space) { EXPECT_TRUE(MM->UsedCodeSize > 0); EXPECT_TRUE(MM->UsedDataSizeRW > 0); } + +TEST_F(MCJITCAPITest, yield) { + SKIP_UNSUPPORTED_PLATFORM; + + buildSimpleFunction(); + buildMCJITOptions(); + buildMCJITEngine(); + LLVMContextRef C = LLVMGetGlobalContext(); + LLVMContextSetYieldCallback(C, yield, NULL); + buildAndRunPasses(); + + union { + void *raw; + int (*usable)(); + } functionPointer; + functionPointer.raw = LLVMGetPointerToGlobal(Engine, Function); + + EXPECT_EQ(42, functionPointer.usable()); + EXPECT_TRUE(didCallYield); +} + |