diff options
-rw-r--r-- | llvm/examples/SpeculativeJIT/SpeculativeJIT.cpp | 4 | ||||
-rw-r--r-- | llvm/include/llvm/Support/ThreadPool.h | 3 | ||||
-rw-r--r-- | llvm/lib/ExecutionEngine/Orc/LLJIT.cpp | 4 |
3 files changed, 7 insertions, 4 deletions
diff --git a/llvm/examples/SpeculativeJIT/SpeculativeJIT.cpp b/llvm/examples/SpeculativeJIT/SpeculativeJIT.cpp index 647413cc9c2..1fd1fc92a73 100644 --- a/llvm/examples/SpeculativeJIT/SpeculativeJIT.cpp +++ b/llvm/examples/SpeculativeJIT/SpeculativeJIT.cpp @@ -114,7 +114,9 @@ private: this->ES->setDispatchMaterialization( [this](JITDylib &JD, std::unique_ptr<MaterializationUnit> MU) { - auto Work = [MU = std::move(MU), &JD] { MU->doMaterialize(JD); }; + // FIXME: Switch to move capture once we have C++14. + auto SharedMU = std::shared_ptr<MaterializationUnit>(std::move(MU)); + auto Work = [SharedMU, &JD]() { SharedMU->doMaterialize(JD); }; CompileThreads.async(std::move(Work)); }); ExitOnErr(S.addSpeculationRuntime(this->ES->getMainJITDylib(), Mangle)); diff --git a/llvm/include/llvm/Support/ThreadPool.h b/llvm/include/llvm/Support/ThreadPool.h index 32f88124ee5..4bcbaa3142f 100644 --- a/llvm/include/llvm/Support/ThreadPool.h +++ b/llvm/include/llvm/Support/ThreadPool.h @@ -13,7 +13,6 @@ #ifndef LLVM_SUPPORT_THREAD_POOL_H #define LLVM_SUPPORT_THREAD_POOL_H -#include "llvm/ADT/FunctionExtras.h" #include "llvm/Config/llvm-config.h" #include "llvm/Support/thread.h" @@ -36,7 +35,7 @@ namespace llvm { /// for some work to become available. class ThreadPool { public: - using TaskTy = unique_function<void()>; + using TaskTy = std::function<void()>; using PackagedTaskTy = std::packaged_task<void()>; /// Construct a pool with the number of threads found by diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp index c6532c60fb8..a80f78afe80 100644 --- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp +++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp @@ -132,7 +132,9 @@ LLJIT::LLJIT(LLJITBuilderState &S, Error &Err) CompileThreads = std::make_unique<ThreadPool>(S.NumCompileThreads); ES->setDispatchMaterialization( [this](JITDylib &JD, std::unique_ptr<MaterializationUnit> MU) { - auto Work = [MU = std::move(MU), &JD] { MU->doMaterialize(JD); }; + // FIXME: Switch to move capture once we have c++14. + auto SharedMU = std::shared_ptr<MaterializationUnit>(std::move(MU)); + auto Work = [SharedMU, &JD]() { SharedMU->doMaterialize(JD); }; CompileThreads->async(std::move(Work)); }); } |