[llvm] r345078 - Revert r345077 "[ORC] Change how non-exported symbols are matched during lookup."
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 23 15:34:06 PDT 2018
Hi Reid,
It could be a C++14 thing.
I wondered about that, but turning C++14 on locally doesn't yield the same
issue.
All the failing builders that I see are running MSVC, except for one that
is running clang-8.0.0. Is it possible that this is a regression? That
seems unlikely, but I want to make sure I rule it out before I move on.
FWIW: It's the ArrayRef<JITDylib*> overload that should be getting knocked
out, and I would not have expected any c++14 or standard library changes to
affect that.
In the mean time I will spell out the types to remove the ambiguity.
Cheers,
Lang.
On Tue, Oct 23, 2018 at 2:39 PM Reid Kleckner <rnk at google.com> wrote:
> I think the diagnostic explains it: The initializer list used as the first
> argument to lookup() is ambiguous between ArrayRef and JITDylibSearchList.
> It could be a C++14 thing.
>
> I'm using clang from a few weeks ago.
>
> One major difference is that on Windows, we already have some C++14 and
> newer library features, so maybe things are more easily constructed from
> initializer lists.
>
> On Tue, Oct 23, 2018 at 2:34 PM Lang Hames <lhames at gmail.com> wrote:
>
>> Hi Reid,
>>
>> Thanks for that. I will update the unit tests to remove the ambiguity.
>>
>> I'm not seeing these issues locally though: Out of curiosity do you know
>> if this is due to an older clang, or are clang's resolution rules different
>> on Windows?
>>
>> Cheers,
>> Lang.
>>
>> On Tue, Oct 23, 2018 at 1:56 PM Reid Kleckner via llvm-commits <
>> llvm-commits at lists.llvm.org> wrote:
>>
>>> Author: rnk
>>> Date: Tue Oct 23 13:54:43 2018
>>> New Revision: 345078
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=345078&view=rev
>>> Log:
>>> Revert r345077 "[ORC] Change how non-exported symbols are matched during
>>> lookup."
>>>
>>> Doesn't build on Windows. The call to 'lookup' is ambiguous. Clang and
>>> MSVC agree, anyway.
>>>
>>> http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/787
>>> C:\b\slave\clang-x64-windows-msvc\build\llvm.src\unittests\ExecutionEngine\Orc\CoreAPIsTest.cpp(315):
>>> error C2668: 'llvm::orc::ExecutionSession::lookup': ambiguous call to
>>> overloaded function
>>> C:\b\slave\clang-x64-windows-msvc\build\llvm.src\include\llvm/ExecutionEngine/Orc/Core.h(823):
>>> note: could be 'llvm::Expected<llvm::JITEvaluatedSymbol>
>>> llvm::orc::ExecutionSession::lookup(llvm::ArrayRef<llvm::orc::JITDylib
>>> *>,llvm::orc::SymbolStringPtr)'
>>> C:\b\slave\clang-x64-windows-msvc\build\llvm.src\include\llvm/ExecutionEngine/Orc/Core.h(817):
>>> note: or 'llvm::Expected<llvm::JITEvaluatedSymbol>
>>> llvm::orc::ExecutionSession::lookup(const llvm::orc::JITDylibSearchList
>>> &,llvm::orc::SymbolStringPtr)'
>>> C:\b\slave\clang-x64-windows-msvc\build\llvm.src\unittests\ExecutionEngine\Orc\CoreAPIsTest.cpp(315):
>>> note: while trying to match the argument list '(initializer list,
>>> llvm::orc::SymbolStringPtr)'
>>>
>>> Removed:
>>> llvm/trunk/test/ExecutionEngine/OrcLazy/Inputs/hidden-definitions.ll
>>> llvm/trunk/test/ExecutionEngine/OrcLazy/hidden-visibility.ll
>>> Modified:
>>> llvm/trunk/include/llvm/ExecutionEngine/JITSymbol.h
>>> llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h
>>> llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h
>>> llvm/trunk/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
>>> llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp
>>> llvm/trunk/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
>>> llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
>>> llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp
>>> llvm/trunk/lib/ExecutionEngine/Orc/LazyReexports.cpp
>>> llvm/trunk/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
>>> llvm/trunk/tools/lli/lli.cpp
>>> llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
>>>
>>> llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
>>>
>>> Modified: llvm/trunk/include/llvm/ExecutionEngine/JITSymbol.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/JITSymbol.h?rev=345078&r1=345077&r2=345078&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/include/llvm/ExecutionEngine/JITSymbol.h (original)
>>> +++ llvm/trunk/include/llvm/ExecutionEngine/JITSymbol.h Tue Oct 23
>>> 13:54:43 2018
>>> @@ -40,18 +40,6 @@ class SymbolRef;
>>> /// Represents an address in the target process's address space.
>>> using JITTargetAddress = uint64_t;
>>>
>>> -/// Convert a JITTargetAddress to a pointer.
>>> -template <typename T> T jitTargetAddressToPointer(JITTargetAddress
>>> Addr) {
>>> - static_assert(std::is_pointer<T>::value, "T must be a pointer type");
>>> - uintptr_t IntPtr = static_cast<uintptr_t>(Addr);
>>> - assert(IntPtr == Addr && "JITTargetAddress value out of range for
>>> uintptr_t");
>>> - return reinterpret_cast<T>(IntPtr);
>>> -}
>>> -
>>> -template <typename T> JITTargetAddress pointerToJITTargetAddress(T
>>> *Ptr) {
>>> - return
>>> static_cast<JITTargetAddress>(reinterpret_cast<uintptr_t>(Ptr));
>>> -}
>>> -
>>> /// Flags for symbols in the JIT.
>>> class JITSymbolFlags {
>>> public:
>>>
>>> Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h?rev=345078&r1=345077&r2=345078&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h (original)
>>> +++ llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h Tue Oct 23
>>> 13:54:43 2018
>>> @@ -54,8 +54,8 @@ using SymbolFlagsMap = DenseMap<SymbolSt
>>> /// symbols to be obtained for logging.
>>> using SymbolDependenceMap = DenseMap<JITDylib *, SymbolNameSet>;
>>>
>>> -/// A list of (JITDylib*, bool) pairs.
>>> -using JITDylibSearchList = std::vector<std::pair<JITDylib *, bool>>;
>>> +/// A list of JITDylib pointers.
>>> +using JITDylibList = std::vector<JITDylib *>;
>>>
>>> /// Render a SymbolStringPtr.
>>> raw_ostream &operator<<(raw_ostream &OS, const SymbolStringPtr &Sym);
>>> @@ -85,8 +85,8 @@ raw_ostream &operator<<(raw_ostream &OS,
>>> /// Render a MaterializationUnit.
>>> raw_ostream &operator<<(raw_ostream &OS, const MaterializationUnit &MU);
>>>
>>> -/// Render a JITDylibSearchList.
>>> -raw_ostream &operator<<(raw_ostream &OS, const JITDylibSearchList &JDs);
>>> +/// Render a JITDylibList.
>>> +raw_ostream &operator<<(raw_ostream &OS, const JITDylibList &JDs);
>>>
>>> /// Callback to notify client that symbols have been resolved.
>>> using SymbolsResolvedCallback =
>>> std::function<void(Expected<SymbolMap>)>;
>>> @@ -351,15 +351,14 @@ using SymbolAliasMap = DenseMap<SymbolSt
>>> class ReExportsMaterializationUnit : public MaterializationUnit {
>>> public:
>>> /// SourceJD is allowed to be nullptr, in which case the source
>>> JITDylib is
>>> - /// taken to be whatever JITDylib these definitions are materialized
>>> in (and
>>> - /// MatchNonExported has no effect). This is useful for defining
>>> aliases
>>> - /// within a JITDylib.
>>> + /// taken to be whatever JITDylib these definitions are materialized
>>> in. This
>>> + /// is useful for defining aliases within a JITDylib.
>>> ///
>>> /// Note: Care must be taken that no sets of aliases form a cycle, as
>>> such
>>> /// a cycle will result in a deadlock when any symbol in the
>>> cycle is
>>> /// resolved.
>>> - ReExportsMaterializationUnit(JITDylib *SourceJD, bool
>>> MatchNonExported,
>>> - SymbolAliasMap Aliases, VModuleKey K);
>>> + ReExportsMaterializationUnit(JITDylib *SourceJD, SymbolAliasMap
>>> Aliases,
>>> + VModuleKey K);
>>>
>>> StringRef getName() const override;
>>>
>>> @@ -369,7 +368,6 @@ private:
>>> static SymbolFlagsMap extractFlags(const SymbolAliasMap &Aliases);
>>>
>>> JITDylib *SourceJD = nullptr;
>>> - bool MatchNonExported = false;
>>> SymbolAliasMap Aliases;
>>> };
>>>
>>> @@ -387,19 +385,16 @@ private:
>>> inline std::unique_ptr<ReExportsMaterializationUnit>
>>> symbolAliases(SymbolAliasMap Aliases, VModuleKey K = VModuleKey()) {
>>> return llvm::make_unique<ReExportsMaterializationUnit>(
>>> - nullptr, true, std::move(Aliases), std::move(K));
>>> + nullptr, std::move(Aliases), std::move(K));
>>> }
>>>
>>> /// Create a materialization unit for re-exporting symbols from another
>>> JITDylib
>>> /// with alternative names/flags.
>>> -/// If MatchNonExported is true then non-exported symbols from SourceJD
>>> can be
>>> -/// re-exported. If it is false, attempts to re-export a non-exported
>>> symbol
>>> -/// will result in a "symbol not found" error.
>>> inline std::unique_ptr<ReExportsMaterializationUnit>
>>> reexports(JITDylib &SourceJD, SymbolAliasMap Aliases,
>>> - bool MatchNonExported = false, VModuleKey K = VModuleKey()) {
>>> + VModuleKey K = VModuleKey()) {
>>> return llvm::make_unique<ReExportsMaterializationUnit>(
>>> - &SourceJD, MatchNonExported, std::move(Aliases), std::move(K));
>>> + &SourceJD, std::move(Aliases), std::move(K));
>>> }
>>>
>>> /// Build a SymbolAliasMap for the common case where you want to
>>> re-export
>>> @@ -416,14 +411,13 @@ public:
>>> /// Create a reexports generator. If an Allow predicate is passed,
>>> only
>>> /// symbols for which the predicate returns true will be reexported.
>>> If no
>>> /// Allow predicate is passed, all symbols will be exported.
>>> - ReexportsGenerator(JITDylib &SourceJD, bool MatchNonExported = false,
>>> + ReexportsGenerator(JITDylib &SourceJD,
>>> SymbolPredicate Allow = SymbolPredicate());
>>>
>>> SymbolNameSet operator()(JITDylib &JD, const SymbolNameSet &Names);
>>>
>>> private:
>>> JITDylib &SourceJD;
>>> - bool MatchNonExported = false;
>>> SymbolPredicate Allow;
>>> };
>>>
>>> @@ -542,18 +536,16 @@ public:
>>> /// as the first in the search order (instead of this dylib) ensures
>>> that
>>> /// definitions within this dylib resolve to the lazy-compiling stubs,
>>> /// rather than immediately materializing the definitions in this
>>> dylib.
>>> - void setSearchOrder(JITDylibSearchList NewSearchOrder,
>>> - bool SearchThisJITDylibFirst = true,
>>> - bool MatchNonExportedInThisDylib = true);
>>> + void setSearchOrder(JITDylibList NewSearchOrder,
>>> + bool SearchThisJITDylibFirst = true);
>>>
>>> /// Add the given JITDylib to the search order for definitions in this
>>> /// JITDylib.
>>> - void addToSearchOrder(JITDylib &JD, bool MatcNonExported = false);
>>> + void addToSearchOrder(JITDylib &JD);
>>>
>>> /// Replace OldJD with NewJD in the search order if OldJD is present.
>>> /// Otherwise this operation is a no-op.
>>> - void replaceInSearchOrder(JITDylib &OldJD, JITDylib &NewJD,
>>> - bool MatchNonExported = false);
>>> + void replaceInSearchOrder(JITDylib &OldJD, JITDylib &NewJD);
>>>
>>> /// Remove the given JITDylib from the search order for this JITDylib
>>> if it is
>>> /// present. Otherwise this operation is a no-op.
>>> @@ -562,7 +554,7 @@ public:
>>> /// Do something with the search order (run under the session lock).
>>> template <typename Func>
>>> auto withSearchOrderDo(Func &&F)
>>> - -> decltype(F(std::declval<const JITDylibSearchList &>()));
>>> + -> decltype(F(std::declval<const JITDylibList &>()));
>>>
>>> /// Define all symbols provided by the materialization unit to be
>>> part of this
>>> /// JITDylib.
>>> @@ -650,12 +642,12 @@ private:
>>> const SymbolNameSet &Names);
>>>
>>> void lodgeQuery(std::shared_ptr<AsynchronousSymbolQuery> &Q,
>>> - SymbolNameSet &Unresolved, bool MatchNonExported,
>>> - MaterializationUnitList &MUs);
>>> + SymbolNameSet &Unresolved, JITDylib
>>> *MatchNonExportedInJD,
>>> + bool MatchNonExported, MaterializationUnitList &MUs);
>>>
>>> void lodgeQueryImpl(std::shared_ptr<AsynchronousSymbolQuery> &Q,
>>> - SymbolNameSet &Unresolved, bool MatchNonExported,
>>> - MaterializationUnitList &MUs);
>>> + SymbolNameSet &Unresolved, JITDylib
>>> *MatchNonExportedInJD,
>>> + bool MatchNonExported, MaterializationUnitList
>>> &MUs);
>>>
>>> LookupImplActionFlags
>>> lookupImpl(std::shared_ptr<AsynchronousSymbolQuery> &Q,
>>> @@ -690,7 +682,7 @@ private:
>>> UnmaterializedInfosMap UnmaterializedInfos;
>>> MaterializingInfosMap MaterializingInfos;
>>> GeneratorFunction DefGenerator;
>>> - JITDylibSearchList SearchOrder;
>>> + JITDylibList SearchOrder;
>>> };
>>>
>>> /// An ExecutionSession represents a running JIT program.
>>> @@ -774,10 +766,6 @@ public:
>>>
>>> /// Search the given JITDylib list for the given symbols.
>>> ///
>>> - /// SearchOrder lists the JITDylibs to search. For each dylib, the
>>> associated
>>> - /// boolean indicates whether the search should match against
>>> non-exported
>>> - /// (hidden visibility) symbols in that dylib (true means match
>>> against
>>> - /// non-exported symbols, false means do not match).
>>> ///
>>> /// The OnResolve callback will be called once all requested symbols
>>> are
>>> /// resolved, or if an error occurs prior to resolution.
>>> @@ -794,9 +782,19 @@ public:
>>> /// dependenant symbols for this query (e.g. it is being made by a
>>> top level
>>> /// client to get an address to call) then the value
>>> NoDependenciesToRegister
>>> /// can be used.
>>> - void lookup(const JITDylibSearchList &SearchOrder, SymbolNameSet
>>> Symbols,
>>> + ///
>>> + /// If the MatchNonExportedInJD pointer is non-null, then the lookup
>>> will find
>>> + /// non-exported symbols defined in the JITDylib pointed to by
>>> + /// MatchNonExportedInJD.
>>> + /// If MatchNonExported is true the lookup will find non-exported
>>> symbols in
>>> + /// any JITDylib (setting MatchNonExportedInJD is redundant in such
>>> cases).
>>> + /// If MatchNonExported is false and MatchNonExportedInJD is null,
>>> + /// non-exported symbols will never be found.
>>> + void lookup(const JITDylibList &JDs, SymbolNameSet Symbols,
>>> SymbolsResolvedCallback OnResolve, SymbolsReadyCallback
>>> OnReady,
>>> - RegisterDependenciesFunction RegisterDependencies);
>>> + RegisterDependenciesFunction RegisterDependencies,
>>> + JITDylib *MatchNonExportedInJD = nullptr,
>>> + bool MatchNonExported = false);
>>>
>>> /// Blocking version of lookup above. Returns the resolved symbol map.
>>> /// If WaitUntilReady is true (the default), will not return until all
>>> @@ -805,29 +803,24 @@ public:
>>> /// or an error occurs. If WaitUntilReady is false and an error occurs
>>> /// after resolution, the function will return a success value, but
>>> the
>>> /// error will be reported via reportErrors.
>>> - Expected<SymbolMap> lookup(const JITDylibSearchList &SearchOrder,
>>> + Expected<SymbolMap> lookup(const JITDylibList &JDs,
>>> const SymbolNameSet &Symbols,
>>> RegisterDependenciesFunction
>>> RegisterDependencies =
>>> NoDependenciesToRegister,
>>> - bool WaitUntilReady = true);
>>> -
>>> - /// Convenience version of blocking lookup.
>>> - /// Searches each of the JITDylibs in the search order in turn for
>>> the given
>>> - /// symbol.
>>> - Expected<JITEvaluatedSymbol> lookup(const JITDylibSearchList
>>> &SearchOrder,
>>> - SymbolStringPtr Symbol);
>>> + bool WaitUntilReady = true,
>>> + JITDylib *MatchNonExportedInJD = nullptr,
>>> + bool MatchNonExported = false);
>>>
>>> /// Convenience version of blocking lookup.
>>> - /// Searches each of the JITDylibs in the search order in turn for
>>> the given
>>> - /// symbol. The search will not find non-exported symbols.
>>> - Expected<JITEvaluatedSymbol> lookup(ArrayRef<JITDylib *> SearchOrder,
>>> - SymbolStringPtr Symbol);
>>> + /// Performs a single-symbol lookup.
>>> + Expected<JITEvaluatedSymbol> lookup(const JITDylibList &JDs,
>>> + SymbolStringPtr Symbol,
>>> + bool MatchNonExported = false);
>>>
>>> /// Convenience version of blocking lookup.
>>> - /// Searches each of the JITDylibs in the search order in turn for
>>> the given
>>> - /// symbol. The search will not find non-exported symbols.
>>> - Expected<JITEvaluatedSymbol> lookup(ArrayRef<JITDylib *> SearchOrder,
>>> - StringRef Symbol);
>>> + /// Performs a single-symbol lookup, auto-interning the given symbol
>>> name.
>>> + Expected<JITEvaluatedSymbol> lookup(const JITDylibList &JDs,
>>> StringRef Symbol,
>>> + bool MatchNonExported = false);
>>>
>>> /// Materialize the given unit.
>>> void dispatchMaterialization(JITDylib &JD,
>>> @@ -873,7 +866,7 @@ private:
>>>
>>> template <typename Func>
>>> auto JITDylib::withSearchOrderDo(Func &&F)
>>> - -> decltype(F(std::declval<const JITDylibSearchList &>())) {
>>> + -> decltype(F(std::declval<const JITDylibList &>())) {
>>> return ES.runSessionLocked([&]() { return F(SearchOrder); });
>>> }
>>>
>>>
>>> Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h?rev=345078&r1=345077&r2=345078&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h (original)
>>> +++ llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h Tue Oct 23
>>> 13:54:43 2018
>>> @@ -144,7 +144,7 @@ public:
>>> /// LLLazyJIT with the given number of compile threads.
>>> static Expected<std::unique_ptr<LLLazyJIT>>
>>> Create(JITTargetMachineBuilder JTMB, DataLayout DL,
>>> - JITTargetAddress ErrorAddr, unsigned NumCompileThreads = 0);
>>> + unsigned NumCompileThreads = 0);
>>>
>>> /// Set an IR transform (e.g. pass manager pipeline) to run on each
>>> function
>>> /// when it is compiled.
>>>
>>> Modified: llvm/trunk/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp?rev=345078&r1=345077&r2=345078&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
>>> (original)
>>> +++ llvm/trunk/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp Tue Oct
>>> 23 13:54:43 2018
>>> @@ -157,7 +157,7 @@ void CompileOnDemandLayer::emit(Material
>>> return;
>>> }
>>>
>>> - R.replace(reexports(PDR.getImplDylib(), std::move(NonCallables),
>>> true));
>>> + R.replace(reexports(PDR.getImplDylib(), std::move(NonCallables)));
>>> R.replace(lazyReexports(LCTMgr, PDR.getISManager(),
>>> PDR.getImplDylib(),
>>> std::move(Callables)));
>>> }
>>> @@ -166,17 +166,10 @@ CompileOnDemandLayer::PerDylibResources
>>> CompileOnDemandLayer::getPerDylibResources(JITDylib &TargetD) {
>>> auto I = DylibResources.find(&TargetD);
>>> if (I == DylibResources.end()) {
>>> - auto &ImplD = getExecutionSession().createJITDylib(
>>> - TargetD.getName() + ".impl", false);
>>> - TargetD.withSearchOrderDo([&](const JITDylibSearchList
>>> &TargetSearchOrder) {
>>> - auto NewSearchOrder = TargetSearchOrder;
>>> - assert(!NewSearchOrder.empty() &&
>>> - NewSearchOrder.front().first == &TargetD &&
>>> - NewSearchOrder.front().second == true &&
>>> - "TargetD must be at the front of its own search order and
>>> match "
>>> - "non-exported symbol");
>>> - NewSearchOrder.insert(std::next(NewSearchOrder.begin()), {&ImplD,
>>> true});
>>> - ImplD.setSearchOrder(std::move(NewSearchOrder), false);
>>> + auto &ImplD =
>>> + getExecutionSession().createJITDylib(TargetD.getName() +
>>> ".impl");
>>> + TargetD.withSearchOrderDo([&](const JITDylibList
>>> &TargetSearchOrder) {
>>> + ImplD.setSearchOrder(TargetSearchOrder, false);
>>> });
>>> PerDylibResources PDR(ImplD, BuildIndirectStubsManager());
>>> I = DylibResources.insert(std::make_pair(&TargetD,
>>> std::move(PDR))).first;
>>>
>>> Modified: llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp?rev=345078&r1=345077&r2=345078&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp (original)
>>> +++ llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp Tue Oct 23 13:54:43 2018
>>> @@ -205,16 +205,14 @@ raw_ostream &operator<<(raw_ostream &OS,
>>> return OS << ")";
>>> }
>>>
>>> -raw_ostream &operator<<(raw_ostream &OS, const JITDylibSearchList &JDs)
>>> {
>>> +raw_ostream &operator<<(raw_ostream &OS, const JITDylibList &JDs) {
>>> OS << "[";
>>> if (!JDs.empty()) {
>>> - assert(JDs.front().first && "JITDylibList entries must not be
>>> null");
>>> - OS << " (\"" << JDs.front().first->getName() << "\", "
>>> - << (JDs.front().second ? "true" : "false") << ")";
>>> - for (auto &KV : make_range(std::next(JDs.begin()), JDs.end())) {
>>> - assert(KV.first && "JITDylibList entries must not be null");
>>> - OS << ", (\"" << KV.first->getName() << "\", "
>>> - << (KV.second ? "true" : "false") << ")";
>>> + assert(JDs.front() && "JITDylibList entries must not be null");
>>> + OS << " " << JDs.front()->getName();
>>> + for (auto *JD : make_range(std::next(JDs.begin()), JDs.end())) {
>>> + assert(JD && "JITDylibList entries must not be null");
>>> + OS << ", " << JD->getName();
>>> }
>>> }
>>> OS << " ]";
>>> @@ -528,11 +526,9 @@ AbsoluteSymbolsMaterializationUnit::extr
>>> }
>>>
>>> ReExportsMaterializationUnit::ReExportsMaterializationUnit(
>>> - JITDylib *SourceJD, bool MatchNonExported, SymbolAliasMap Aliases,
>>> - VModuleKey K)
>>> + JITDylib *SourceJD, SymbolAliasMap Aliases, VModuleKey K)
>>> : MaterializationUnit(extractFlags(Aliases), std::move(K)),
>>> - SourceJD(SourceJD), MatchNonExported(MatchNonExported),
>>> - Aliases(std::move(Aliases)) {}
>>> + SourceJD(SourceJD), Aliases(std::move(Aliases)) {}
>>>
>>> StringRef ReExportsMaterializationUnit::getName() const {
>>> return "<Reexports>";
>>> @@ -560,7 +556,7 @@ void ReExportsMaterializationUnit::mater
>>>
>>> if (!Aliases.empty()) {
>>> if (SourceJD)
>>> - R.replace(reexports(*SourceJD, std::move(Aliases),
>>> MatchNonExported));
>>> + R.replace(reexports(*SourceJD, std::move(Aliases)));
>>> else
>>> R.replace(symbolAliases(std::move(Aliases)));
>>> }
>>> @@ -660,8 +656,8 @@ void ReExportsMaterializationUnit::mater
>>>
>>> auto OnReady = [&ES](Error Err) { ES.reportError(std::move(Err)); };
>>>
>>> - ES.lookup({{&SrcJD, MatchNonExported}}, QuerySymbols,
>>> std::move(OnResolve),
>>> - std::move(OnReady), std::move(RegisterDependencies));
>>> + ES.lookup({&SrcJD}, QuerySymbols, std::move(OnResolve),
>>> std::move(OnReady),
>>> + std::move(RegisterDependencies), nullptr, true);
>>> }
>>> }
>>>
>>> @@ -702,10 +698,8 @@ buildSimpleReexportsAliasMap(JITDylib &S
>>> }
>>>
>>> ReexportsGenerator::ReexportsGenerator(JITDylib &SourceJD,
>>> - bool MatchNonExported,
>>> SymbolPredicate Allow)
>>> - : SourceJD(SourceJD), MatchNonExported(MatchNonExported),
>>> - Allow(std::move(Allow)) {}
>>> + : SourceJD(SourceJD), Allow(std::move(Allow)) {}
>>>
>>> SymbolNameSet ReexportsGenerator::operator()(JITDylib &JD,
>>> const SymbolNameSet
>>> &Names) {
>>> @@ -722,7 +716,7 @@ SymbolNameSet ReexportsGenerator::operat
>>> }
>>>
>>> if (!Added.empty())
>>> - cantFail(JD.define(reexports(SourceJD, AliasMap,
>>> MatchNonExported)));
>>> + cantFail(JD.define(reexports(SourceJD, AliasMap)));
>>>
>>> return Added;
>>> }
>>> @@ -1047,41 +1041,30 @@ void JITDylib::notifyFailed(const Symbol
>>> Q->handleFailed(make_error<FailedToMaterialize>(FailedSymbols));
>>> }
>>>
>>> -void JITDylib::setSearchOrder(JITDylibSearchList NewSearchOrder,
>>> - bool SearchThisJITDylibFirst,
>>> - bool MatchNonExportedInThisDylib) {
>>> - if (SearchThisJITDylibFirst && NewSearchOrder.front().first != this)
>>> - NewSearchOrder.insert(NewSearchOrder.begin(),
>>> - {this, MatchNonExportedInThisDylib});
>>> +void JITDylib::setSearchOrder(JITDylibList NewSearchOrder,
>>> + bool SearchThisJITDylibFirst) {
>>> + if (SearchThisJITDylibFirst && NewSearchOrder.front() != this)
>>> + NewSearchOrder.insert(NewSearchOrder.begin(), this);
>>>
>>> ES.runSessionLocked([&]() { SearchOrder = std::move(NewSearchOrder);
>>> });
>>> }
>>>
>>> -void JITDylib::addToSearchOrder(JITDylib &JD, bool MatchNonExported) {
>>> - ES.runSessionLocked([&]() {
>>> - SearchOrder.push_back({&JD, MatchNonExported});
>>> - });
>>> +void JITDylib::addToSearchOrder(JITDylib &JD) {
>>> + ES.runSessionLocked([&]() { SearchOrder.push_back(&JD); });
>>> }
>>>
>>> -void JITDylib::replaceInSearchOrder(JITDylib &OldJD, JITDylib &NewJD,
>>> - bool MatchNonExported) {
>>> +void JITDylib::replaceInSearchOrder(JITDylib &OldJD, JITDylib &NewJD) {
>>> ES.runSessionLocked([&]() {
>>> - auto I = std::find_if(SearchOrder.begin(), SearchOrder.end(),
>>> - [&](const JITDylibSearchList::value_type &KV)
>>> {
>>> - return KV.first == &OldJD;
>>> - });
>>> + auto I = std::find(SearchOrder.begin(), SearchOrder.end(), &OldJD);
>>>
>>> if (I != SearchOrder.end())
>>> - *I = {&NewJD, MatchNonExported};
>>> + *I = &NewJD;
>>> });
>>> }
>>>
>>> void JITDylib::removeFromSearchOrder(JITDylib &JD) {
>>> ES.runSessionLocked([&]() {
>>> - auto I = std::find_if(SearchOrder.begin(), SearchOrder.end(),
>>> - [&](const JITDylibSearchList::value_type &KV)
>>> {
>>> - return KV.first == &JD;
>>> - });
>>> + auto I = std::find(SearchOrder.begin(), SearchOrder.end(), &JD);
>>> if (I != SearchOrder.end())
>>> SearchOrder.erase(I);
>>> });
>>> @@ -1178,17 +1161,18 @@ SymbolNameSet JITDylib::lookupFlagsImpl(
>>> }
>>>
>>> void JITDylib::lodgeQuery(std::shared_ptr<AsynchronousSymbolQuery> &Q,
>>> - SymbolNameSet &Unresolved, bool
>>> MatchNonExported,
>>> + SymbolNameSet &Unresolved,
>>> + JITDylib *MatchNonExportedInJD, bool
>>> MatchNonExported,
>>> MaterializationUnitList &MUs) {
>>> assert(Q && "Query can not be null");
>>>
>>> - lodgeQueryImpl(Q, Unresolved, MatchNonExported, MUs);
>>> + lodgeQueryImpl(Q, Unresolved, MatchNonExportedInJD, MatchNonExported,
>>> MUs);
>>> if (DefGenerator && !Unresolved.empty()) {
>>> auto NewDefs = DefGenerator(*this, Unresolved);
>>> if (!NewDefs.empty()) {
>>> for (auto &D : NewDefs)
>>> Unresolved.erase(D);
>>> - lodgeQueryImpl(Q, NewDefs, MatchNonExported, MUs);
>>> + lodgeQueryImpl(Q, NewDefs, MatchNonExportedInJD,
>>> MatchNonExported, MUs);
>>> assert(NewDefs.empty() &&
>>> "All fallback defs should have been found by lookupImpl");
>>> }
>>> @@ -1197,7 +1181,7 @@ void JITDylib::lodgeQuery(std::shared_pt
>>>
>>> void JITDylib::lodgeQueryImpl(
>>> std::shared_ptr<AsynchronousSymbolQuery> &Q, SymbolNameSet
>>> &Unresolved,
>>> - bool MatchNonExported,
>>> + JITDylib *MatchNonExportedInJD, bool MatchNonExported,
>>> std::vector<std::unique_ptr<MaterializationUnit>> &MUs) {
>>>
>>> std::vector<SymbolStringPtr> ToRemove;
>>> @@ -1207,9 +1191,12 @@ void JITDylib::lodgeQueryImpl(
>>> if (SymI == Symbols.end())
>>> continue;
>>>
>>> - // If this is a non exported symbol and we're skipping those then
>>> skip it.
>>> - if (!SymI->second.getFlags().isExported() && !MatchNonExported)
>>> - continue;
>>> + // If this is a non-exported symbol, then check the values of
>>> + // MatchNonExportedInJD and MatchNonExported. Skip if we should not
>>> match
>>> + // against this symbol.
>>> + if (!SymI->second.getFlags().isExported())
>>> + if (!MatchNonExported && MatchNonExportedInJD != this)
>>> + continue;
>>>
>>> // If we matched against Name in JD, mark it to be removed from the
>>> Unresolved
>>> // set.
>>> @@ -1395,9 +1382,8 @@ void JITDylib::dump(raw_ostream &OS) {
>>> << "\" (ES: " << format("0x%016x",
>>> reinterpret_cast<uintptr_t>(&ES))
>>> << "):\n"
>>> << "Search order: [";
>>> - for (auto &KV : SearchOrder)
>>> - OS << " (\"" << KV.first->getName() << "\", "
>>> - << (KV.second ? "all" : "exported only") << ")";
>>> + for (auto *JD : SearchOrder)
>>> + OS << " \"" << JD->getName() << "\"";
>>> OS << " ]\n"
>>> << "Symbol table:\n";
>>>
>>> @@ -1445,7 +1431,7 @@ void JITDylib::dump(raw_ostream &OS) {
>>>
>>> JITDylib::JITDylib(ExecutionSession &ES, std::string Name)
>>> : ES(ES), JITDylibName(std::move(Name)) {
>>> - SearchOrder.push_back({this, true});
>>> + SearchOrder.push_back(this);
>>> }
>>>
>>> Error JITDylib::defineImpl(MaterializationUnit &MU) {
>>> @@ -1738,10 +1724,12 @@ Expected<SymbolMap> ExecutionSession::le
>>> #endif
>>> }
>>>
>>> -void ExecutionSession::lookup(
>>> - const JITDylibSearchList &SearchOrder, SymbolNameSet Symbols,
>>> - SymbolsResolvedCallback OnResolve, SymbolsReadyCallback OnReady,
>>> - RegisterDependenciesFunction RegisterDependencies) {
>>> +void ExecutionSession::lookup(const JITDylibList &JDs, SymbolNameSet
>>> Symbols,
>>> + SymbolsResolvedCallback OnResolve,
>>> + SymbolsReadyCallback OnReady,
>>> + RegisterDependenciesFunction
>>> RegisterDependencies,
>>> + JITDylib *MatchNonExportedInJD,
>>> + bool MatchNonExported) {
>>>
>>> // lookup can be re-entered recursively if running on a single
>>> thread. Run any
>>> // outstanding MUs in case this query depends on them, otherwise this
>>> lookup
>>> @@ -1757,14 +1745,12 @@ void ExecutionSession::lookup(
>>> bool QueryFailed = false;
>>>
>>> runSessionLocked([&]() {
>>> - for (auto &KV : SearchOrder) {
>>> - assert(KV.first && "JITDylibList entries must not be null");
>>> - assert(!CollectedMUsMap.count(KV.first) &&
>>> + for (auto *JD : JDs) {
>>> + assert(JD && "JITDylibList entries must not be null");
>>> + assert(!CollectedMUsMap.count(JD) &&
>>> "JITDylibList should not contain duplicate entries");
>>> -
>>> - auto &JD = *KV.first;
>>> - auto MatchNonExported = KV.second;
>>> - JD.lodgeQuery(Q, Unresolved, MatchNonExported,
>>> CollectedMUsMap[&JD]);
>>> + JD->lodgeQuery(Q, Unresolved, MatchNonExportedInJD,
>>> MatchNonExported,
>>> + CollectedMUsMap[JD]);
>>> }
>>>
>>> if (Unresolved.empty()) {
>>> @@ -1815,9 +1801,11 @@ void ExecutionSession::lookup(
>>> runOutstandingMUs();
>>> }
>>>
>>> -Expected<SymbolMap> ExecutionSession::lookup(
>>> - const JITDylibSearchList &SearchOrder, const SymbolNameSet &Symbols,
>>> - RegisterDependenciesFunction RegisterDependencies, bool
>>> WaitUntilReady) {
>>> +Expected<SymbolMap>
>>> +ExecutionSession::lookup(const JITDylibList &JDs, const SymbolNameSet
>>> &Symbols,
>>> + RegisterDependenciesFunction
>>> RegisterDependencies,
>>> + bool WaitUntilReady, JITDylib
>>> *MatchNonExportedInJD,
>>> + bool MatchNonExported) {
>>> #if LLVM_ENABLE_THREADS
>>> // In the threaded case we use promises to return the results.
>>> std::promise<SymbolMap> PromisedResult;
>>> @@ -1884,7 +1872,8 @@ Expected<SymbolMap> ExecutionSession::lo
>>> #endif
>>>
>>> // Perform the asynchronous lookup.
>>> - lookup(SearchOrder, Symbols, OnResolve, OnReady,
>>> RegisterDependencies);
>>> + lookup(JDs, Symbols, OnResolve, OnReady, RegisterDependencies,
>>> + MatchNonExportedInJD, MatchNonExported);
>>>
>>> #if LLVM_ENABLE_THREADS
>>> auto ResultFuture = PromisedResult.get_future();
>>> @@ -1927,13 +1916,14 @@ Expected<SymbolMap> ExecutionSession::lo
>>> #endif
>>> }
>>>
>>> -Expected<JITEvaluatedSymbol>
>>> -ExecutionSession::lookup(const JITDylibSearchList &SearchOrder,
>>> - SymbolStringPtr Name) {
>>> +/// Look up a symbol by searching a list of JDs.
>>> +Expected<JITEvaluatedSymbol> ExecutionSession::lookup(const
>>> JITDylibList &JDs,
>>> + SymbolStringPtr
>>> Name,
>>> + bool
>>> MatchNonExported) {
>>> SymbolNameSet Names({Name});
>>>
>>> - if (auto ResultMap = lookup(SearchOrder, std::move(Names),
>>> - NoDependenciesToRegister, true)) {
>>> + if (auto ResultMap = lookup(JDs, std::move(Names),
>>> NoDependenciesToRegister,
>>> + true, nullptr, MatchNonExported)) {
>>> assert(ResultMap->size() == 1 && "Unexpected number of results");
>>> assert(ResultMap->count(Name) && "Missing result for symbol");
>>> return std::move(ResultMap->begin()->second);
>>> @@ -1941,21 +1931,10 @@ ExecutionSession::lookup(const JITDylibS
>>> return ResultMap.takeError();
>>> }
>>>
>>> -Expected<JITEvaluatedSymbol>
>>> -ExecutionSession::lookup(ArrayRef<JITDylib *> SearchOrder,
>>> - SymbolStringPtr Name) {
>>> - SymbolNameSet Names({Name});
>>> -
>>> - JITDylibSearchList FullSearchOrder(SearchOrder.size());
>>> - for (auto *JD : SearchOrder)
>>> - FullSearchOrder.push_back({JD, false});
>>> -
>>> - return lookup(FullSearchOrder, Name);
>>> -}
>>> -
>>> -Expected<JITEvaluatedSymbol>
>>> -ExecutionSession::lookup(ArrayRef<JITDylib *> SearchOrder, StringRef
>>> Name) {
>>> - return lookup(SearchOrder, intern(Name));
>>> +Expected<JITEvaluatedSymbol> ExecutionSession::lookup(const
>>> JITDylibList &JDs,
>>> + StringRef Name,
>>> + bool
>>> MatchNonExported) {
>>> + return lookup(JDs, intern(Name), MatchNonExported);
>>> }
>>>
>>> void ExecutionSession::dump(raw_ostream &OS) {
>>>
>>> Modified: llvm/trunk/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/ExecutionUtils.cpp?rev=345078&r1=345077&r2=345078&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/ExecutionEngine/Orc/ExecutionUtils.cpp (original)
>>> +++ llvm/trunk/lib/ExecutionEngine/Orc/ExecutionUtils.cpp Tue Oct 23
>>> 13:54:43 2018
>>> @@ -129,8 +129,9 @@ Error CtorDtorRunner::run() {
>>> }
>>>
>>> auto &ES = JD.getExecutionSession();
>>> - if (auto CtorDtorMap = ES.lookup({{&JD, true}}, std::move(Names),
>>> - NoDependenciesToRegister, true)) {
>>> + if (auto CtorDtorMap =
>>> + ES.lookup({&JD}, std::move(Names), NoDependenciesToRegister,
>>> true,
>>> + nullptr, true)) {
>>> for (auto &KV : CtorDtorsByPriority) {
>>> for (auto &Name : KV.second) {
>>> assert(CtorDtorMap->count(Name) && "No entry for Name");
>>>
>>> Modified: llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp?rev=345078&r1=345077&r2=345078&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp (original)
>>> +++ llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp Tue Oct 23
>>> 13:54:43 2018
>>> @@ -101,7 +101,7 @@ JITTargetAddress JITCompileCallbackManag
>>> Name = I->second;
>>> }
>>>
>>> - if (auto Sym = ES.lookup({{&CallbacksJD, true}}, Name))
>>> + if (auto Sym = ES.lookup({&CallbacksJD}, Name, true))
>>> return Sym->getAddress();
>>> else {
>>> llvm::dbgs() << "Didn't find callback.\n";
>>>
>>> Modified: llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp?rev=345078&r1=345077&r2=345078&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp (original)
>>> +++ llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp Tue Oct 23 13:54:43 2018
>>> @@ -76,7 +76,7 @@ Error LLJIT::addObjectFile(JITDylib &JD,
>>>
>>> Expected<JITEvaluatedSymbol> LLJIT::lookupLinkerMangled(JITDylib &JD,
>>> StringRef Name)
>>> {
>>> - return ES->lookup({{&JD, true}}, ES->intern(Name));
>>> + return ES->lookup({&JD}, ES->intern(Name));
>>> }
>>>
>>> LLJIT::LLJIT(std::unique_ptr<ExecutionSession> ES,
>>> @@ -144,13 +144,13 @@ void LLJIT::recordCtorDtors(Module &M) {
>>> }
>>>
>>> Expected<std::unique_ptr<LLLazyJIT>>
>>> -LLLazyJIT::Create(JITTargetMachineBuilder JTMB, DataLayout DL,
>>> - JITTargetAddress ErrorAddr, unsigned
>>> NumCompileThreads) {
>>> + LLLazyJIT::Create(JITTargetMachineBuilder JTMB, DataLayout DL,
>>> + unsigned NumCompileThreads) {
>>> auto ES = llvm::make_unique<ExecutionSession>();
>>>
>>> const Triple &TT = JTMB.getTargetTriple();
>>>
>>> - auto LCTMgr = createLocalLazyCallThroughManager(TT, *ES, ErrorAddr);
>>> + auto LCTMgr = createLocalLazyCallThroughManager(TT, *ES, 0);
>>> if (!LCTMgr)
>>> return LCTMgr.takeError();
>>>
>>>
>>> Modified: llvm/trunk/lib/ExecutionEngine/Orc/LazyReexports.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/LazyReexports.cpp?rev=345078&r1=345077&r2=345078&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/ExecutionEngine/Orc/LazyReexports.cpp (original)
>>> +++ llvm/trunk/lib/ExecutionEngine/Orc/LazyReexports.cpp Tue Oct 23
>>> 13:54:43 2018
>>> @@ -52,8 +52,8 @@ LazyCallThroughManager::callThroughToSym
>>> SymbolName = I->second.second;
>>> }
>>>
>>> - auto LookupResult = ES.lookup({{SourceJD, true}}, {SymbolName},
>>> - NoDependenciesToRegister, true);
>>> + auto LookupResult = ES.lookup({SourceJD}, {SymbolName},
>>> + NoDependenciesToRegister, true,
>>> nullptr, true);
>>>
>>> if (!LookupResult) {
>>> ES.reportError(LookupResult.takeError());
>>>
>>> Modified: llvm/trunk/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp?rev=345078&r1=345077&r2=345078&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
>>> (original)
>>> +++ llvm/trunk/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp Tue
>>> Oct 23 13:54:43 2018
>>> @@ -50,11 +50,10 @@ public:
>>> MR.addDependenciesForAll(Deps);
>>> };
>>>
>>> - JITDylibSearchList SearchOrder;
>>> - MR.getTargetJITDylib().withSearchOrderDo(
>>> - [&](const JITDylibSearchList &JDs) { SearchOrder = JDs; });
>>> - ES.lookup(SearchOrder, InternedSymbols, OnResolvedWithUnwrap,
>>> OnReady,
>>> - RegisterDependencies);
>>> + MR.getTargetJITDylib().withSearchOrderDo([&](const JITDylibList
>>> &JDs) {
>>> + ES.lookup(JDs, InternedSymbols, OnResolvedWithUnwrap, OnReady,
>>> + RegisterDependencies, &MR.getTargetJITDylib());
>>> + });
>>> }
>>>
>>> Expected<LookupSet> getResponsibilitySet(const LookupSet &Symbols) {
>>>
>>> Removed:
>>> llvm/trunk/test/ExecutionEngine/OrcLazy/Inputs/hidden-definitions.ll
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/OrcLazy/Inputs/hidden-definitions.ll?rev=345077&view=auto
>>>
>>> ==============================================================================
>>> --- llvm/trunk/test/ExecutionEngine/OrcLazy/Inputs/hidden-definitions.ll
>>> (original)
>>> +++ llvm/trunk/test/ExecutionEngine/OrcLazy/Inputs/hidden-definitions.ll
>>> (removed)
>>> @@ -1,6 +0,0 @@
>>> - at bar = hidden global i32 0
>>> -
>>> -define hidden i32 @foo() {
>>> -entry:
>>> - ret i32 0
>>> -}
>>>
>>> Removed: llvm/trunk/test/ExecutionEngine/OrcLazy/hidden-visibility.ll
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/OrcLazy/hidden-visibility.ll?rev=345077&view=auto
>>>
>>> ==============================================================================
>>> --- llvm/trunk/test/ExecutionEngine/OrcLazy/hidden-visibility.ll
>>> (original)
>>> +++ llvm/trunk/test/ExecutionEngine/OrcLazy/hidden-visibility.ll
>>> (removed)
>>> @@ -1,17 +0,0 @@
>>> -; RUN: lli -jit-kind=orc-lazy -extra-module
>>> %p/Inputs/hidden-definitions.ll %s
>>> -; RUN: not lli -jit-kind=orc-lazy -jd libFoo -extra-module
>>> %p/Inputs/hidden-definitions.ll %s
>>> -;
>>> -; Check that hidden symbols in another module are visible when the
>>> module is
>>> -; added to the same JITDylib, and not visible if it is added to a
>>> different
>>> -; JITDylib.
>>> -
>>> - at bar = external global i32
>>> -declare i32 @foo()
>>> -
>>> -define i32 @main(i32 %argc, i8** nocapture readnone %argv) {
>>> -entry:
>>> - %0 = call i32() @foo()
>>> - %1 = load i32, i32* @bar
>>> - %2 = add i32 %0, %1
>>> - ret i32 %2
>>> -}
>>>
>>> Modified: llvm/trunk/tools/lli/lli.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=345078&r1=345077&r2=345078&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/tools/lli/lli.cpp (original)
>>> +++ llvm/trunk/tools/lli/lli.cpp Tue Oct 23 13:54:43 2018
>>> @@ -115,11 +115,6 @@ namespace {
>>> "rather than individual functions"),
>>> cl::init(false));
>>>
>>> - cl::list<std::string>
>>> - JITDylibs("jd",
>>> - cl::desc("Specifies the JITDylib to be used for any
>>> subsequent "
>>> - "-extra-module arguments."));
>>> -
>>> // The MCJIT supports building for a target address space separate
>>> from
>>> // the JIT compilation process. Use a forked process and a copying
>>> // memory manager with IPC to execute using this functionality.
>>> @@ -754,8 +749,6 @@ static orc::IRTransformLayer::TransformF
>>> llvm_unreachable("Unknown DumpKind");
>>> }
>>>
>>> -static void exitOnLazyCallThroughFailure() { exit(1); }
>>> -
>>> int runOrcLazyJIT(const char *ProgName) {
>>> // Start setting up the JIT environment.
>>>
>>> @@ -785,11 +778,7 @@ int runOrcLazyJIT(const char *ProgName)
>>> : None);
>>>
>>> DataLayout DL = ExitOnErr(JTMB.getDefaultDataLayoutForTarget());
>>> -
>>> - auto J = ExitOnErr(orc::LLLazyJIT::Create(
>>> - std::move(JTMB), DL,
>>> - pointerToJITTargetAddress(exitOnLazyCallThroughFailure),
>>> - LazyJITCompileThreads));
>>> + auto J = ExitOnErr(orc::LLLazyJIT::Create(std::move(JTMB), DL,
>>> LazyJITCompileThreads));
>>>
>>> if (PerModuleLazy)
>>>
>>> J->setPartitionFunction(orc::CompileOnDemandLayer::compileWholeModule);
>>> @@ -814,32 +803,13 @@ int runOrcLazyJIT(const char *ProgName)
>>> // Add the main module.
>>> ExitOnErr(J->addLazyIRModule(std::move(MainModule)));
>>>
>>> - // Create JITDylibs and add any extra modules.
>>> - {
>>> - // Create JITDylibs, keep a map from argument index to dylib. We
>>> will use
>>> - // -extra-module argument indexes to determine what dylib to use
>>> for each
>>> - // -extra-module.
>>> - std::map<unsigned, orc::JITDylib *> IdxToDylib;
>>> - IdxToDylib[0] = &J->getMainJITDylib();
>>> - for (auto JDItr = JITDylibs.begin(), JDEnd = JITDylibs.end();
>>> - JDItr != JDEnd; ++JDItr) {
>>> - IdxToDylib[JITDylibs.getPosition(JDItr - JITDylibs.begin())] =
>>> - &J->createJITDylib(*JDItr);
>>> - }
>>> + // Add any extra modules.
>>> + for (auto &ModulePath : ExtraModules) {
>>> + auto M = parseIRFile(ModulePath, Err, *TSCtx.getContext());
>>> + if (!M)
>>> + reportError(Err, ProgName);
>>>
>>> - for (auto EMItr = ExtraModules.begin(), EMEnd = ExtraModules.end();
>>> - EMItr != EMEnd; ++EMItr) {
>>> - auto M = parseIRFile(*EMItr, Err, *TSCtx.getContext());
>>> - if (!M)
>>> - reportError(Err, ProgName);
>>> -
>>> - auto EMIdx = ExtraModules.getPosition(EMItr -
>>> ExtraModules.begin());
>>> - assert(EMIdx != 0 && "ExtraModule should have index > 0");
>>> - auto JDItr = std::prev(IdxToDylib.lower_bound(EMIdx));
>>> - auto &JD = *JDItr->second;
>>> - ExitOnErr(
>>> - J->addLazyIRModule(JD, orc::ThreadSafeModule(std::move(M),
>>> TSCtx)));
>>> - }
>>> + ExitOnErr(J->addLazyIRModule(orc::ThreadSafeModule(std::move(M),
>>> TSCtx)));
>>> }
>>>
>>> // Add the objects.
>>> @@ -867,8 +837,6 @@ int runOrcLazyJIT(const char *ProgName)
>>> AltEntryThreads.push_back(std::thread([EntryPoint]() {
>>> EntryPoint(); }));
>>> }
>>>
>>> - J->getExecutionSession().dump(llvm::dbgs());
>>> -
>>> // Run main.
>>> auto MainSym = ExitOnErr(J->lookup("main"));
>>> typedef int (*MainFnPtr)(int, const char *[]);
>>>
>>> Modified: llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp?rev=345078&r1=345077&r2=345078&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp (original)
>>> +++ llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp Tue Oct 23
>>> 13:54:43 2018
>>> @@ -48,8 +48,7 @@ TEST_F(CoreAPIsStandardTest, BasicSucces
>>> FooMR =
>>> std::make_shared<MaterializationResponsibility>(std::move(R));
>>> })));
>>>
>>> - ES.lookup({{&JD, false}}, {Foo}, OnResolution, OnReady,
>>> - NoDependenciesToRegister);
>>> + ES.lookup({&JD}, {Foo}, OnResolution, OnReady,
>>> NoDependenciesToRegister);
>>>
>>> EXPECT_FALSE(OnResolutionRun) << "Should not have been resolved yet";
>>> EXPECT_FALSE(OnReadyRun) << "Should not have been marked ready yet";
>>> @@ -102,8 +101,7 @@ TEST_F(CoreAPIsStandardTest, EmptyLookup
>>> OnReadyRun = true;
>>> };
>>>
>>> - ES.lookup({{&JD, false}}, {}, OnResolution, OnReady,
>>> - NoDependenciesToRegister);
>>> + ES.lookup({&JD}, {}, OnResolution, OnReady, NoDependenciesToRegister);
>>>
>>> EXPECT_TRUE(OnResolvedRun) << "OnResolved was not run for empty
>>> query";
>>> EXPECT_TRUE(OnReadyRun) << "OnReady was not run for empty query";
>>> @@ -150,7 +148,7 @@ TEST_F(CoreAPIsStandardTest, RemoveSymbo
>>>
>>> bool OnResolvedRun = false;
>>> bool OnReadyRun = false;
>>> - ES.lookup({{&JD, false}}, {Foo, Baz},
>>> + ES.lookup({&JD}, {Foo, Baz},
>>> [&](Expected<SymbolMap> Result) {
>>> EXPECT_TRUE(!!Result) << "OnResolved failed unexpectedly";
>>> consumeError(Result.takeError());
>>> @@ -231,8 +229,7 @@ TEST_F(CoreAPIsStandardTest, LookupWithH
>>> auto &JD2 = ES.createJITDylib("JD2");
>>> cantFail(JD2.define(absoluteSymbols({{Bar, QuxSym}})));
>>>
>>> - /// Try a blocking lookup.
>>> - auto Result = cantFail(ES.lookup({{&JD, false}, {&JD2, false}}, {Foo,
>>> Bar}));
>>> + auto Result = cantFail(ES.lookup({&JD, &JD2}, {Foo, Bar}));
>>>
>>> EXPECT_EQ(Result.size(), 2U) << "Unexpected number of results";
>>> EXPECT_EQ(Result.count(Foo), 1U) << "Missing result for \"Foo\"";
>>> @@ -278,7 +275,7 @@ TEST_F(CoreAPIsStandardTest, TestBasicAl
>>> {Qux, {Bar,
>>> JITSymbolFlags::Weak}}})));
>>> cantFail(JD.define(absoluteSymbols({{Qux, QuxSym}})));
>>>
>>> - auto Result = ES.lookup({{&JD, false}}, {Baz, Qux});
>>> + auto Result = ES.lookup({&JD}, {Baz, Qux});
>>> EXPECT_TRUE(!!Result) << "Unexpected lookup failure";
>>> EXPECT_EQ(Result->count(Baz), 1U) << "No result for \"baz\"";
>>> EXPECT_EQ(Result->count(Qux), 1U) << "No result for \"qux\"";
>>> @@ -293,7 +290,7 @@ TEST_F(CoreAPIsStandardTest, TestChained
>>> cantFail(JD.define(symbolAliases(
>>> {{Baz, {Bar, BazSym.getFlags()}}, {Bar, {Foo,
>>> BarSym.getFlags()}}})));
>>>
>>> - auto Result = ES.lookup({{&JD, false}}, {Bar, Baz});
>>> + auto Result = ES.lookup({&JD}, {Bar, Baz});
>>> EXPECT_TRUE(!!Result) << "Unexpected lookup failure";
>>> EXPECT_EQ(Result->count(Bar), 1U) << "No result for \"bar\"";
>>> EXPECT_EQ(Result->count(Baz), 1U) << "No result for \"baz\"";
>>> @@ -312,7 +309,7 @@ TEST_F(CoreAPIsStandardTest, TestBasicRe
>>>
>>> cantFail(JD2.define(reexports(JD, {{Bar, {Foo,
>>> BarSym.getFlags()}}})));
>>>
>>> - auto Result = cantFail(ES.lookup({{&JD2, false}}, Bar));
>>> + auto Result = cantFail(ES.lookup({&JD2}, Bar));
>>> EXPECT_EQ(Result.getAddress(), FooSym.getAddress())
>>> << "Re-export Bar for symbol Foo should match FooSym's address";
>>> }
>>> @@ -338,7 +335,7 @@ TEST_F(CoreAPIsStandardTest, TestThatReE
>>> cantFail(JD2.define(reexports(
>>> JD, {{Baz, {Foo, BazSym.getFlags()}}, {Qux, {Bar,
>>> QuxSym.getFlags()}}})));
>>>
>>> - auto Result = cantFail(ES.lookup({{&JD2, false}}, Baz));
>>> + auto Result = cantFail(ES.lookup({&JD2}, Baz));
>>> EXPECT_EQ(Result.getAddress(), FooSym.getAddress())
>>> << "Re-export Baz for symbol Foo should match FooSym's address";
>>>
>>> @@ -353,13 +350,13 @@ TEST_F(CoreAPIsStandardTest, TestReexpor
>>>
>>> auto Filter = [this](SymbolStringPtr Name) { return Name != Bar; };
>>>
>>> - JD.setGenerator(ReexportsGenerator(JD2, false, Filter));
>>> + JD.setGenerator(ReexportsGenerator(JD2, Filter));
>>>
>>> auto Flags = JD.lookupFlags({Foo, Bar, Baz});
>>> EXPECT_EQ(Flags.size(), 1U) << "Unexpected number of results";
>>> EXPECT_EQ(Flags[Foo], FooSym.getFlags()) << "Unexpected flags for
>>> Foo";
>>>
>>> - auto Result = cantFail(ES.lookup({{&JD, false}}, Foo));
>>> + auto Result = cantFail(ES.lookup({&JD}, Foo));
>>>
>>> EXPECT_EQ(Result.getAddress(), FooSym.getAddress())
>>> << "Incorrect reexported symbol address";
>>> @@ -380,7 +377,7 @@ TEST_F(CoreAPIsStandardTest, TestTrivial
>>> FooReady = true;
>>> };
>>>
>>> - ES.lookup({{&JD, false}}, {Foo}, std::move(OnResolution),
>>> std::move(OnReady),
>>> + ES.lookup({&JD}, {Foo}, std::move(OnResolution), std::move(OnReady),
>>> NoDependenciesToRegister);
>>>
>>> FooR->resolve({{Foo, FooSym}});
>>> @@ -437,8 +434,8 @@ TEST_F(CoreAPIsStandardTest, TestCircula
>>>
>>> // Issue a lookup for Foo. Use NoDependenciesToRegister: We're going
>>> to add
>>> // the dependencies manually below.
>>> - ES.lookup({{&JD, false}}, {Foo}, std::move(OnFooResolution),
>>> - std::move(OnFooReady), NoDependenciesToRegister);
>>> + ES.lookup({&JD}, {Foo}, std::move(OnFooResolution),
>>> std::move(OnFooReady),
>>> + NoDependenciesToRegister);
>>>
>>> bool BarResolved = false;
>>> bool BarReady = false;
>>> @@ -452,8 +449,8 @@ TEST_F(CoreAPIsStandardTest, TestCircula
>>> BarReady = true;
>>> };
>>>
>>> - ES.lookup({{&JD, false}}, {Bar}, std::move(OnBarResolution),
>>> - std::move(OnBarReady), NoDependenciesToRegister);
>>> + ES.lookup({&JD}, {Bar}, std::move(OnBarResolution),
>>> std::move(OnBarReady),
>>> + NoDependenciesToRegister);
>>>
>>> bool BazResolved = false;
>>> bool BazReady = false;
>>> @@ -468,8 +465,8 @@ TEST_F(CoreAPIsStandardTest, TestCircula
>>> BazReady = true;
>>> };
>>>
>>> - ES.lookup({{&JD, false}}, {Baz}, std::move(OnBazResolution),
>>> - std::move(OnBazReady), NoDependenciesToRegister);
>>> + ES.lookup({&JD}, {Baz}, std::move(OnBazResolution),
>>> std::move(OnBazReady),
>>> + NoDependenciesToRegister);
>>>
>>> // Add a circular dependency: Foo -> Bar, Bar -> Baz, Baz -> Foo.
>>> FooR->addDependenciesForAll({{&JD, SymbolNameSet({Bar})}});
>>> @@ -591,7 +588,7 @@ TEST_F(CoreAPIsStandardTest, AddAndMater
>>> OnReadyRun = true;
>>> };
>>>
>>> - ES.lookup({{&JD, false}}, Names, std::move(OnResolution),
>>> std::move(OnReady),
>>> + ES.lookup({&JD}, Names, std::move(OnResolution), std::move(OnReady),
>>> NoDependenciesToRegister);
>>>
>>> EXPECT_TRUE(FooMaterialized) << "Foo was not materialized";
>>> @@ -640,7 +637,7 @@ TEST_F(CoreAPIsStandardTest, TestBasicWe
>>> OnReadyRun = true;
>>> };
>>>
>>> - ES.lookup({{&JD, false}}, {Bar}, std::move(OnResolution),
>>> std::move(OnReady),
>>> + ES.lookup({&JD}, {Bar}, std::move(OnResolution), std::move(OnReady),
>>> NoDependenciesToRegister);
>>>
>>> EXPECT_TRUE(OnResolvedRun) << "OnResolved not run";
>>> @@ -669,13 +666,13 @@ TEST_F(CoreAPIsStandardTest, DefineMater
>>> });
>>>
>>> cantFail(JD.define(MU));
>>> - cantFail(ES.lookup({{&JD, false}}, Foo));
>>> + cantFail(ES.lookup({&JD}, Foo));
>>>
>>> // Assert that materialization is complete by now.
>>> ExpectNoMoreMaterialization = true;
>>>
>>> // Look up bar to verify that no further materialization happens.
>>> - auto BarResult = cantFail(ES.lookup({{&JD, false}}, Bar));
>>> + auto BarResult = cantFail(ES.lookup({&JD}, Bar));
>>> EXPECT_EQ(BarResult.getAddress(), BarSym.getAddress())
>>> << "Expected Bar == BarSym";
>>> }
>>> @@ -688,7 +685,7 @@ TEST_F(CoreAPIsStandardTest, GeneratorTe
>>> return SymbolNameSet({Bar});
>>> });
>>>
>>> - auto Result = cantFail(ES.lookup({{&JD, false}}, {Foo, Bar}));
>>> + auto Result = cantFail(ES.lookup({&JD}, {Foo, Bar}));
>>>
>>> EXPECT_EQ(Result.count(Bar), 1U) << "Expected to find fallback def
>>> for 'bar'";
>>> EXPECT_EQ(Result[Bar].getAddress(), BarSym.getAddress())
>>> @@ -704,7 +701,7 @@ TEST_F(CoreAPIsStandardTest, FailResolut
>>> cantFail(JD.define(MU));
>>>
>>> SymbolNameSet Names({Foo, Bar});
>>> - auto Result = ES.lookup({{&JD, false}}, Names);
>>> + auto Result = ES.lookup({&JD}, Names);
>>>
>>> EXPECT_FALSE(!!Result) << "Expected failure";
>>> if (!Result) {
>>> @@ -736,7 +733,7 @@ TEST_F(CoreAPIsStandardTest, TestLookupW
>>>
>>> cantFail(JD.define(MU));
>>>
>>> - auto FooLookupResult = cantFail(ES.lookup({{&JD, false}}, Foo));
>>> + auto FooLookupResult = cantFail(ES.lookup({&JD}, Foo));
>>>
>>> EXPECT_EQ(FooLookupResult.getAddress(), FooSym.getAddress())
>>> << "lookup returned an incorrect address";
>>> @@ -757,7 +754,7 @@ TEST_F(CoreAPIsStandardTest, TestLookupW
>>>
>>> cantFail(JD.define(absoluteSymbols({{Foo, FooSym}})));
>>>
>>> - auto FooLookupResult = cantFail(ES.lookup({{&JD, false}}, Foo));
>>> + auto FooLookupResult = cantFail(ES.lookup({&JD}, Foo));
>>>
>>> EXPECT_EQ(FooLookupResult.getAddress(), FooSym.getAddress())
>>> << "lookup returned an incorrect address";
>>> @@ -805,14 +802,14 @@ TEST_F(CoreAPIsStandardTest, TestGetRequ
>>> EXPECT_FALSE(FooMaterialized) << "Foo should not be materialized yet";
>>> EXPECT_FALSE(BarMaterialized) << "Bar should not be materialized yet";
>>>
>>> - auto FooSymResult = cantFail(ES.lookup({{&JD, false}}, Foo));
>>> + auto FooSymResult = cantFail(ES.lookup({&JD}, Foo));
>>> EXPECT_EQ(FooSymResult.getAddress(), FooSym.getAddress())
>>> << "Address mismatch for Foo";
>>>
>>> EXPECT_TRUE(FooMaterialized) << "Foo should be materialized now";
>>> EXPECT_FALSE(BarMaterialized) << "Bar still should not be
>>> materialized";
>>>
>>> - auto BarSymResult = cantFail(ES.lookup({{&JD, false}}, Bar));
>>> + auto BarSymResult = cantFail(ES.lookup({&JD}, Bar));
>>> EXPECT_EQ(BarSymResult.getAddress(), BarSym.getAddress())
>>> << "Address mismatch for Bar";
>>> EXPECT_TRUE(BarMaterialized) << "Bar should be materialized now";
>>> @@ -832,7 +829,7 @@ TEST_F(CoreAPIsStandardTest, TestMateria
>>>
>>> cantFail(JD.define(MU));
>>>
>>> - auto Result = ES.lookup({{&JD, false}}, {Foo, Bar});
>>> + auto Result = ES.lookup({&JD}, {Foo, Bar});
>>>
>>> EXPECT_TRUE(!!Result) << "Result should be a success value";
>>> EXPECT_EQ(Result->count(Foo), 1U) << "\"Foo\" entry missing";
>>> @@ -864,7 +861,7 @@ TEST_F(CoreAPIsStandardTest, TestMateria
>>>
>>> auto OnReady = [](Error Err) { cantFail(std::move(Err)); };
>>>
>>> - ES.lookup({{&JD, false}}, {Foo}, std::move(OnResolution),
>>> std::move(OnReady),
>>> + ES.lookup({&JD}, {Foo}, std::move(OnResolution), std::move(OnReady),
>>> NoDependenciesToRegister);
>>>
>>> auto MU2 = llvm::make_unique<SimpleMaterializationUnit>(
>>>
>>> Modified:
>>> llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp?rev=345078&r1=345077&r2=345078&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
>>> (original)
>>> +++
>>> llvm/trunk/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
>>> Tue Oct 23 13:54:43 2018
>>> @@ -66,7 +66,7 @@ static bool testSetProcessAllSections(st
>>>
>>> ObjLayer.setProcessAllSections(ProcessAllSections);
>>> cantFail(ObjLayer.add(JD, std::move(Obj), ES.allocateVModule()));
>>> - ES.lookup({{&JD, false}}, {Foo}, OnResolveDoNothing, OnReadyDoNothing,
>>> + ES.lookup({&JD}, {Foo}, OnResolveDoNothing, OnReadyDoNothing,
>>> NoDependenciesToRegister);
>>> return DebugSectionSeen;
>>> }
>>> @@ -157,8 +157,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestO
>>> ObjLayer.setOverrideObjectFlagsWithResponsibilityFlags(true);
>>>
>>> cantFail(CompileLayer.add(JD, std::move(M), ES.allocateVModule()));
>>> - ES.lookup({{&JD, false}}, {Foo},
>>> - [](Expected<SymbolMap> R) { cantFail(std::move(R)); },
>>> + ES.lookup({&JD}, {Foo}, [](Expected<SymbolMap> R) {
>>> cantFail(std::move(R)); },
>>> [](Error Err) { cantFail(std::move(Err)); },
>>> NoDependenciesToRegister);
>>> }
>>> @@ -220,8 +219,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestA
>>> ObjLayer.setAutoClaimResponsibilityForObjectSymbols(true);
>>>
>>> cantFail(CompileLayer.add(JD, std::move(M), ES.allocateVModule()));
>>> - ES.lookup({{&JD, false}}, {Foo},
>>> - [](Expected<SymbolMap> R) { cantFail(std::move(R)); },
>>> + ES.lookup({&JD}, {Foo}, [](Expected<SymbolMap> R) {
>>> cantFail(std::move(R)); },
>>> [](Error Err) { cantFail(std::move(Err)); },
>>> NoDependenciesToRegister);
>>> }
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181023/b9bd6219/attachment.html>
More information about the llvm-commits
mailing list