diff options
author | Lang Hames <lhames@gmail.com> | 2018-05-16 22:24:30 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2018-05-16 22:24:30 +0000 |
commit | d261e1258c2d72911f278aa85298b4d6b5393731 (patch) | |
tree | 80fa599b4f87270a9369f8f6b8ae18fa2b63d2c2 /llvm/lib/ExecutionEngine/Orc/Legacy.cpp | |
parent | 2dc00a64a29a951961f88f00c2f222972b72ada6 (diff) | |
download | bcm5719-llvm-d261e1258c2d72911f278aa85298b4d6b5393731.tar.gz bcm5719-llvm-d261e1258c2d72911f278aa85298b4d6b5393731.zip |
[ORC] Rewrite the VSO symbol table yet again. Update related utilities.
VSOs now track dependencies for materializing symbols. Each symbol must have its
dependencies registered with the VSO prior to finalization. Usually this will
involve registering the dependencies returned in
AsynchronousSymbolQuery::ResolutionResults for queries made while linking the
symbols being materialized.
Queries against symbols are notified that a symbol is ready once it and all of
its transitive dependencies are finalized, allowing compilation work to be
broken up and moved between threads without queries returning until their
symbols fully safe to access / execute.
Related utilities (VSO, MaterializationUnit, MaterializationResponsibility) are
updated to support dependence tracking and more explicitly track responsibility
for symbols from the point of definition until they are finalized.
llvm-svn: 332541
Diffstat (limited to 'llvm/lib/ExecutionEngine/Orc/Legacy.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/Orc/Legacy.cpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/Legacy.cpp b/llvm/lib/ExecutionEngine/Orc/Legacy.cpp index a2413703f13..f7487b3a737 100644 --- a/llvm/lib/ExecutionEngine/Orc/Legacy.cpp +++ b/llvm/lib/ExecutionEngine/Orc/Legacy.cpp @@ -12,9 +12,9 @@ namespace llvm { namespace orc { -JITSymbolResolverAdapter::JITSymbolResolverAdapter(ExecutionSession &ES, - SymbolResolver &R) - : ES(ES), R(R) {} +JITSymbolResolverAdapter::JITSymbolResolverAdapter( + ExecutionSession &ES, SymbolResolver &R, MaterializationResponsibility *MR) + : ES(ES), R(R), MR(MR) {} Expected<JITSymbolResolverAdapter::LookupResult> JITSymbolResolverAdapter::lookup(const LookupSet &Symbols) { @@ -25,26 +25,28 @@ JITSymbolResolverAdapter::lookup(const LookupSet &Symbols) { for (auto &S : Symbols) InternedSymbols.insert(ES.getSymbolStringPool().intern(S)); - auto OnResolve = [&](Expected<SymbolMap> R) { - if (R) { - for (auto &KV : *R) { - ResolvedStrings.insert(KV.first); - Result[*KV.first] = KV.second; - } - } else - Err = joinErrors(std::move(Err), R.takeError()); - }; - - auto OnReady = [](Error Err) { - // FIXME: Report error to ExecutionSession. - logAllUnhandledErrors(std::move(Err), errs(), - "legacy resolver received on-ready error:\n"); - }; + auto OnResolve = + [&, this](Expected<AsynchronousSymbolQuery::ResolutionResult> RR) { + if (RR) { + // If this lookup was attached to a MaterializationResponsibility then + // record the dependencies. + if (MR) + MR->addDependencies(RR->Dependencies); + + for (auto &KV : RR->Symbols) { + ResolvedStrings.insert(KV.first); + Result[*KV.first] = KV.second; + } + } else + Err = joinErrors(std::move(Err), RR.takeError()); + }; + + auto OnReady = [this](Error Err) { ES.reportError(std::move(Err)); }; auto Query = std::make_shared<AsynchronousSymbolQuery>(InternedSymbols, OnResolve, OnReady); - auto UnresolvedSymbols = R.lookup(std::move(Query), InternedSymbols); + auto UnresolvedSymbols = R.lookup(Query, InternedSymbols); if (!UnresolvedSymbols.empty()) { std::string ErrorMsg = "Unresolved symbols: "; |