File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,9 @@ class SpeculativeJIT {
114
114
this ->ES ->setDispatchMaterialization (
115
115
116
116
[this ](JITDylib &JD, std::unique_ptr<MaterializationUnit> MU) {
117
- auto Work = [MU = std::move (MU), &JD] { MU->doMaterialize (JD); };
117
+ // FIXME: Switch to move capture once we have C++14.
118
+ auto SharedMU = std::shared_ptr<MaterializationUnit>(std::move (MU));
119
+ auto Work = [SharedMU, &JD]() { SharedMU->doMaterialize (JD); };
118
120
CompileThreads.async (std::move (Work));
119
121
});
120
122
ExitOnErr (S.addSpeculationRuntime (this ->ES ->getMainJITDylib (), Mangle));
Original file line number Diff line number Diff line change 13
13
#ifndef LLVM_SUPPORT_THREAD_POOL_H
14
14
#define LLVM_SUPPORT_THREAD_POOL_H
15
15
16
- #include " llvm/ADT/FunctionExtras.h"
17
16
#include " llvm/Config/llvm-config.h"
18
17
#include " llvm/Support/thread.h"
19
18
@@ -36,7 +35,7 @@ namespace llvm {
36
35
// / for some work to become available.
37
36
class ThreadPool {
38
37
public:
39
- using TaskTy = unique_function <void ()>;
38
+ using TaskTy = std::function <void ()>;
40
39
using PackagedTaskTy = std::packaged_task<void ()>;
41
40
42
41
// / Construct a pool with the number of threads found by
Original file line number Diff line number Diff line change @@ -132,7 +132,9 @@ LLJIT::LLJIT(LLJITBuilderState &S, Error &Err)
132
132
CompileThreads = std::make_unique<ThreadPool>(S.NumCompileThreads );
133
133
ES->setDispatchMaterialization (
134
134
[this ](JITDylib &JD, std::unique_ptr<MaterializationUnit> MU) {
135
- auto Work = [MU = std::move (MU), &JD] { MU->doMaterialize (JD); };
135
+ // FIXME: Switch to move capture once we have c++14.
136
+ auto SharedMU = std::shared_ptr<MaterializationUnit>(std::move (MU));
137
+ auto Work = [SharedMU, &JD]() { SharedMU->doMaterialize (JD); };
136
138
CompileThreads->async (std::move (Work));
137
139
});
138
140
}
You can’t perform that action at this time.
0 commit comments