[llvm] r363322 - [ORC] Rename MaterializationResponsibility resolve and emit methods to
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 13 13:11:23 PDT 2019
Author: lhames
Date: Thu Jun 13 13:11:23 2019
New Revision: 363322
URL: http://llvm.org/viewvc/llvm-project?rev=363322&view=rev
Log:
[ORC] Rename MaterializationResponsibility resolve and emit methods to
notifyResolved/notifyEmitted.
The 'notify' prefix better describes what these methods do: they update the JIT
symbol states and notify any pending queries that the 'resolved' and 'emitted'
states have been reached (rather than actually performing the resolution or
emission themselves). Since new states are going to be introduced in the near
future (to track symbol registration/initialization) it's worth changing the
convention pre-emptively to avoid further confusion.
Modified:
llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h
llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp
llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
llvm/trunk/lib/ExecutionEngine/Orc/LazyReexports.cpp
llvm/trunk/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
llvm/trunk/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
llvm/trunk/unittests/ExecutionEngine/Orc/LazyCallThroughAndReexportsTest.cpp
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=363322&r1=363321&r2=363322&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h Thu Jun 13 13:11:23 2019
@@ -204,12 +204,12 @@ public:
/// symbols must be ones covered by this MaterializationResponsibility
/// instance. Individual calls to this method may resolve a subset of the
/// symbols, but all symbols must have been resolved prior to calling emit.
- void resolve(const SymbolMap &Symbols);
+ void notifyResolved(const SymbolMap &Symbols);
/// Notifies the target JITDylib (and any pending queries on that JITDylib)
/// that all symbols covered by this MaterializationResponsibility instance
/// have been emitted.
- void emit();
+ void notifyEmitted();
/// Adds new symbols to the JITDylib and this responsibility instance.
/// JITDylib entries start out in the materializing state.
Modified: llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp?rev=363322&r1=363321&r2=363322&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp Thu Jun 13 13:11:23 2019
@@ -367,9 +367,10 @@ SymbolNameSet MaterializationResponsibil
return JD.getRequestedSymbols(SymbolFlags);
}
-void MaterializationResponsibility::resolve(const SymbolMap &Symbols) {
- LLVM_DEBUG(
- { dbgs() << "In " << JD.getName() << " resolving " << Symbols << "\n"; });
+void MaterializationResponsibility::notifyResolved(const SymbolMap &Symbols) {
+ LLVM_DEBUG({
+ dbgs() << "In " << JD.getName() << " resolving " << Symbols << "\n";
+ });
#ifndef NDEBUG
for (auto &KV : Symbols) {
auto I = SymbolFlags.find(KV.first);
@@ -387,7 +388,7 @@ void MaterializationResponsibility::reso
JD.resolve(Symbols);
}
-void MaterializationResponsibility::emit() {
+void MaterializationResponsibility::notifyEmitted() {
LLVM_DEBUG({
dbgs() << "In " << JD.getName() << " emitting " << SymbolFlags << "\n";
@@ -484,8 +485,8 @@ StringRef AbsoluteSymbolsMaterialization
void AbsoluteSymbolsMaterializationUnit::materialize(
MaterializationResponsibility R) {
- R.resolve(Symbols);
- R.emit();
+ R.notifyResolved(Symbols);
+ R.notifyEmitted();
}
void AbsoluteSymbolsMaterializationUnit::discard(const JITDylib &JD,
@@ -632,8 +633,8 @@ void ReExportsMaterializationUnit::mater
ResolutionMap[KV.first] = JITEvaluatedSymbol(
(*Result)[KV.second.Aliasee].getAddress(), KV.second.AliasFlags);
}
- QueryInfo->R.resolve(ResolutionMap);
- QueryInfo->R.emit();
+ QueryInfo->R.notifyResolved(ResolutionMap);
+ QueryInfo->R.notifyEmitted();
} else {
auto &ES = QueryInfo->R.getTargetJITDylib().getExecutionSession();
ES.reportError(Result.takeError());
Modified: llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp?rev=363322&r1=363321&r2=363322&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp Thu Jun 13 13:11:23 2019
@@ -37,8 +37,8 @@ private:
void materialize(MaterializationResponsibility R) override {
SymbolMap Result;
Result[Name] = JITEvaluatedSymbol(Compile(), JITSymbolFlags::Exported);
- R.resolve(Result);
- R.emit();
+ R.notifyResolved(Result);
+ R.notifyEmitted();
}
void discard(const JITDylib &JD, const SymbolStringPtr &Name) override {
Modified: llvm/trunk/lib/ExecutionEngine/Orc/LazyReexports.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/LazyReexports.cpp?rev=363322&r1=363321&r2=363322&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/LazyReexports.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/LazyReexports.cpp Thu Jun 13 13:11:23 2019
@@ -178,8 +178,8 @@ void LazyReexportsMaterializationUnit::m
for (auto &Alias : RequestedAliases)
Stubs[Alias.first] = ISManager.findStub(*Alias.first, false);
- R.resolve(Stubs);
- R.emit();
+ R.notifyResolved(Stubs);
+ R.notifyEmitted();
}
void LazyReexportsMaterializationUnit::discard(const JITDylib &JD,
Modified: llvm/trunk/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp?rev=363322&r1=363321&r2=363322&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp Thu Jun 13 13:11:23 2019
@@ -127,7 +127,7 @@ public:
if (auto Err = MR.defineMaterializing(ExtraSymbolsToClaim))
return notifyFailed(std::move(Err));
- MR.resolve(InternedResult);
+ MR.notifyResolved(InternedResult);
Layer.notifyLoaded(MR);
}
@@ -141,7 +141,7 @@ public:
return;
}
- MR.emit();
+ MR.notifyEmitted();
}
AtomGraphPassFunction getMarkLivePass(const Triple &TT) const override {
Modified: llvm/trunk/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp?rev=363322&r1=363321&r2=363322&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp Thu Jun 13 13:11:23 2019
@@ -184,7 +184,7 @@ Error RTDyldObjectLinkingLayer::onObjLoa
if (auto Err = R.defineMaterializing(ExtraSymbolsToClaim))
return Err;
- R.resolve(Symbols);
+ R.notifyResolved(Symbols);
if (NotifyLoaded)
NotifyLoaded(K, Obj, *LoadedObjInfo);
@@ -201,7 +201,7 @@ void RTDyldObjectLinkingLayer::onObjEmit
return;
}
- R.emit();
+ R.notifyEmitted();
if (NotifyEmitted)
NotifyEmitted(K, std::move(ObjBuffer));
Modified: llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp?rev=363322&r1=363321&r2=363322&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp Thu Jun 13 13:11:23 2019
@@ -48,11 +48,11 @@ TEST_F(CoreAPIsStandardTest, BasicSucces
EXPECT_FALSE(OnCompletionRun) << "Should not have been resolved yet";
- FooMR->resolve({{Foo, FooSym}});
+ FooMR->notifyResolved({{Foo, FooSym}});
EXPECT_FALSE(OnCompletionRun) << "Should not be ready yet";
- FooMR->emit();
+ FooMR->notifyEmitted();
EXPECT_TRUE(OnCompletionRun) << "Should have been marked ready";
}
@@ -109,8 +109,8 @@ TEST_F(CoreAPIsStandardTest, RemoveSymbo
SymbolFlagsMap({{Bar, BarSym.getFlags()}}),
[this](MaterializationResponsibility R) {
ADD_FAILURE() << "Unexpected materialization of \"Bar\"";
- R.resolve({{Bar, BarSym}});
- R.emit();
+ R.notifyResolved({{Bar, BarSym}});
+ R.notifyEmitted();
},
[&](const JITDylib &JD, const SymbolStringPtr &Name) {
EXPECT_EQ(Name, Bar) << "Expected \"Bar\" to be discarded";
@@ -156,8 +156,8 @@ TEST_F(CoreAPIsStandardTest, RemoveSymbo
consumeError(std::move(Err));
}
- BazR->resolve({{Baz, BazSym}});
- BazR->emit();
+ BazR->notifyResolved({{Baz, BazSym}});
+ BazR->notifyEmitted();
{
// Attempt 3: Search now that all symbols are fully materialized
// (Foo, Baz), or not yet materialized (Bar).
@@ -317,8 +317,8 @@ TEST_F(CoreAPIsStandardTest, TestThatReE
SymbolFlagsMap({{Bar, BarSym.getFlags()}}),
[&](MaterializationResponsibility R) {
BarMaterialized = true;
- R.resolve({{Bar, BarSym}});
- R.emit();
+ R.notifyResolved({{Bar, BarSym}});
+ R.notifyEmitted();
});
cantFail(JD.define(BarMU));
@@ -372,8 +372,8 @@ TEST_F(CoreAPIsStandardTest, TestTrivial
ES.lookup(JITDylibSearchList({{&JD, false}}), {Foo}, SymbolState::Ready,
OnCompletion, NoDependenciesToRegister);
- FooR->resolve({{Foo, FooSym}});
- FooR->emit();
+ FooR->notifyResolved({{Foo, FooSym}});
+ FooR->notifyEmitted();
EXPECT_TRUE(FooReady)
<< "Self-dependency prevented symbol from being marked ready";
@@ -486,9 +486,9 @@ TEST_F(CoreAPIsStandardTest, TestCircula
EXPECT_FALSE(BazResolved) << "\"Baz\" should not be resolved yet";
// Resolve the symbols (but do not emit them).
- FooR->resolve({{Foo, FooSym}});
- BarR->resolve({{Bar, BarSym}});
- BazR->resolve({{Baz, BazSym}});
+ FooR->notifyResolved({{Foo, FooSym}});
+ BarR->notifyResolved({{Bar, BarSym}});
+ BazR->notifyResolved({{Baz, BazSym}});
// Verify that the symbols have been resolved, but are not ready yet.
EXPECT_TRUE(FooResolved) << "\"Foo\" should be resolved now";
@@ -500,8 +500,8 @@ TEST_F(CoreAPIsStandardTest, TestCircula
EXPECT_FALSE(BazReady) << "\"Baz\" should not be ready yet";
// Emit two of the symbols.
- FooR->emit();
- BarR->emit();
+ FooR->notifyEmitted();
+ BarR->notifyEmitted();
// Verify that nothing is ready until the circular dependence is resolved.
EXPECT_FALSE(FooReady) << "\"Foo\" still should not be ready";
@@ -509,7 +509,7 @@ TEST_F(CoreAPIsStandardTest, TestCircula
EXPECT_FALSE(BazReady) << "\"Baz\" still should not be ready";
// Emit the last symbol.
- BazR->emit();
+ BazR->notifyEmitted();
// Verify that everything becomes ready once the circular dependence resolved.
EXPECT_TRUE(FooReady) << "\"Foo\" should be ready now";
@@ -558,8 +558,8 @@ TEST_F(CoreAPIsStandardTest, AddAndMater
SymbolFlagsMap({{Foo, JITSymbolFlags::Exported}, {Bar, WeakExported}}),
[&](MaterializationResponsibility R) {
assert(BarDiscarded && "Bar should have been discarded by this point");
- R.resolve(SymbolMap({{Foo, FooSym}}));
- R.emit();
+ R.notifyResolved(SymbolMap({{Foo, FooSym}}));
+ R.notifyEmitted();
FooMaterialized = true;
},
[&](const JITDylib &JD, SymbolStringPtr Name) {
@@ -599,7 +599,7 @@ TEST_F(CoreAPIsStandardTest, TestBasicWe
auto MU1 = llvm::make_unique<SimpleMaterializationUnit>(
SymbolFlagsMap({{Foo, FooSym.getFlags()}, {Bar, BarSym.getFlags()}}),
[&](MaterializationResponsibility R) {
- R.resolve(SymbolMap({{Foo, FooSym}, {Bar, BarSym}})), R.emit();
+ R.notifyResolved(SymbolMap({{Foo, FooSym}, {Bar, BarSym}})), R.notifyEmitted();
BarMaterialized = true;
});
@@ -648,8 +648,8 @@ TEST_F(CoreAPIsStandardTest, DefineMater
[&](MaterializationResponsibility R) {
cantFail(
R.defineMaterializing(SymbolFlagsMap({{Bar, BarSym.getFlags()}})));
- R.resolve(SymbolMap({{Foo, FooSym}, {Bar, BarSym}}));
- R.emit();
+ R.notifyResolved(SymbolMap({{Foo, FooSym}, {Bar, BarSym}}));
+ R.notifyEmitted();
});
cantFail(JD.define(MU));
@@ -722,7 +722,7 @@ TEST_F(CoreAPIsStandardTest, FailEmissio
auto MU = llvm::make_unique<SimpleMaterializationUnit>(
SymbolFlagsMap({{Foo, FooSym.getFlags()}, {Bar, BarSym.getFlags()}}),
[&](MaterializationResponsibility R) {
- R.resolve(SymbolMap({{Foo, FooSym}, {Bar, BarSym}}));
+ R.notifyResolved(SymbolMap({{Foo, FooSym}, {Bar, BarSym}}));
ES.lookup(
JITDylibSearchList({{&JD, false}}), SymbolNameSet({Baz}),
@@ -754,8 +754,8 @@ TEST_F(CoreAPIsStandardTest, TestLookupW
auto MU = llvm::make_unique<SimpleMaterializationUnit>(
SymbolFlagsMap({{Foo, JITSymbolFlags::Exported}}),
[&](MaterializationResponsibility R) {
- R.resolve({{Foo, FooSym}});
- R.emit();
+ R.notifyResolved({{Foo, FooSym}});
+ R.notifyEmitted();
});
cantFail(JD.define(MU));
@@ -813,15 +813,15 @@ TEST_F(CoreAPIsStandardTest, TestGetRequ
auto NewMU = llvm::make_unique<SimpleMaterializationUnit>(
SymbolFlagsMap({{Bar, BarSym.getFlags()}}),
[&](MaterializationResponsibility R2) {
- R2.resolve(SymbolMap({{Bar, BarSym}}));
- R2.emit();
+ R2.notifyResolved(SymbolMap({{Bar, BarSym}}));
+ R2.notifyEmitted();
BarMaterialized = true;
});
R.replace(std::move(NewMU));
- R.resolve(SymbolMap({{Foo, FooSym}}));
- R.emit();
+ R.notifyResolved(SymbolMap({{Foo, FooSym}}));
+ R.notifyEmitted();
FooMaterialized = true;
});
@@ -852,10 +852,10 @@ TEST_F(CoreAPIsStandardTest, TestMateria
[&](MaterializationResponsibility R) {
auto R2 = R.delegate({Bar});
- R.resolve({{Foo, FooSym}});
- R.emit();
- R2.resolve({{Bar, BarSym}});
- R2.emit();
+ R.notifyResolved({{Foo, FooSym}});
+ R.notifyEmitted();
+ R2.notifyResolved({{Bar, BarSym}});
+ R2.notifyEmitted();
});
cantFail(JD.define(MU));
@@ -905,8 +905,8 @@ TEST_F(CoreAPIsStandardTest, TestMateria
<< "Expected a duplicate definition error";
consumeError(std::move(Err));
- FooResponsibility->resolve(SymbolMap({{Foo, FooSym}}));
- FooResponsibility->emit();
+ FooResponsibility->notifyResolved(SymbolMap({{Foo, FooSym}}));
+ FooResponsibility->notifyEmitted();
}
} // namespace
Modified: llvm/trunk/unittests/ExecutionEngine/Orc/LazyCallThroughAndReexportsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/LazyCallThroughAndReexportsTest.cpp?rev=363322&r1=363321&r2=363322&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/LazyCallThroughAndReexportsTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/LazyCallThroughAndReexportsTest.cpp Thu Jun 13 13:11:23 2019
@@ -41,12 +41,12 @@ TEST_F(LazyReexportsTest, BasicLocalCall
SymbolFlagsMap({{DummyTarget, JITSymbolFlags::Exported}}),
[&](MaterializationResponsibility R) {
DummyTargetMaterialized = true;
- R.resolve(
+ R.notifyResolved(
{{DummyTarget,
JITEvaluatedSymbol(static_cast<JITTargetAddress>(
reinterpret_cast<uintptr_t>(&dummyTarget)),
JITSymbolFlags::Exported)}});
- R.emit();
+ R.notifyEmitted();
})));
unsigned NotifyResolvedCount = 0;
More information about the llvm-commits
mailing list