mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[examples] Fix the SpeculativeJIT and ThinLtoJIT examples for 41379f1ec46.
This commit is contained in:
parent
9a7711e874
commit
b54957fa0b
@ -112,12 +112,15 @@ private:
|
||||
MainJD.addGenerator(std::move(ProcessSymbolsGenerator));
|
||||
this->CODLayer.setImplMap(&Imps);
|
||||
this->ES->setDispatchMaterialization(
|
||||
|
||||
[this](JITDylib &JD, std::unique_ptr<MaterializationUnit> MU) {
|
||||
[this](std::unique_ptr<MaterializationUnit> MU,
|
||||
MaterializationResponsibility MR) {
|
||||
// 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));
|
||||
auto SharedMR =
|
||||
std::make_shared<MaterializationResponsibility>(std::move(MR));
|
||||
CompileThreads.async([SharedMU, SharedMR]() {
|
||||
SharedMU->materialize(std::move(*SharedMR));
|
||||
});
|
||||
});
|
||||
ExitOnErr(S.addSpeculationRuntime(MainJD, Mangle));
|
||||
LocalCXXRuntimeOverrides CXXRuntimeoverrides;
|
||||
|
@ -266,16 +266,21 @@ void ThinLtoJIT::setupLayers(JITTargetMachineBuilder JTMB,
|
||||
CompileThreads = std::make_unique<ThreadPool>(
|
||||
llvm::hardware_concurrency(NumCompileThreads));
|
||||
ES.setDispatchMaterialization(
|
||||
[this](JITDylib &JD, std::unique_ptr<MaterializationUnit> MU) {
|
||||
[this](std::unique_ptr<MaterializationUnit> MU,
|
||||
MaterializationResponsibility MR) {
|
||||
if (IsTrivialModule(MU.get())) {
|
||||
// This should be quick and we may save a few session locks.
|
||||
MU->doMaterialize(JD);
|
||||
MU->materialize(std::move(MR));
|
||||
} else {
|
||||
// FIXME: Drop the std::shared_ptr workaround once ThreadPool::async()
|
||||
// accepts llvm::unique_function to define jobs.
|
||||
auto SharedMU = std::shared_ptr<MaterializationUnit>(std::move(MU));
|
||||
auto SharedMR =
|
||||
std::make_shared<MaterializationResponsibility>(std::move(MR));
|
||||
CompileThreads->async(
|
||||
[MU = std::move(SharedMU), &JD]() { MU->doMaterialize(JD); });
|
||||
[MU = std::move(SharedMU), MR = std::move(SharedMR)]() {
|
||||
MU->materialize(std::move(*MR));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user