summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2019-06-13 20:11:23 +0000
committerLang Hames <lhames@gmail.com>2019-06-13 20:11:23 +0000
commit2f8c6f93626ece59af259e36fa3dbff33bfe24e5 (patch)
tree558271c41e74dfe82c3d3813c49c31917155463f /llvm
parent6b936d88a46b716977445966e124af9e3d300f52 (diff)
downloadbcm5719-llvm-2f8c6f93626ece59af259e36fa3dbff33bfe24e5.tar.gz
bcm5719-llvm-2f8c6f93626ece59af259e36fa3dbff33bfe24e5.zip
[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. llvm-svn: 363322
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/ExecutionEngine/Orc/Core.h4
-rw-r--r--llvm/lib/ExecutionEngine/Orc/Core.cpp17
-rw-r--r--llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp4
-rw-r--r--llvm/lib/ExecutionEngine/Orc/LazyReexports.cpp4
-rw-r--r--llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp4
-rw-r--r--llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp4
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp68
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/LazyCallThroughAndReexportsTest.cpp4
8 files changed, 55 insertions, 54 deletions
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Core.h b/llvm/include/llvm/ExecutionEngine/Orc/Core.h
index c0c54ef5566..016fd829bf9 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Core.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Core.h
@@ -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.
diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp
index e7e8f5caa39..dac37e030e0 100644
--- a/llvm/lib/ExecutionEngine/Orc/Core.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp
@@ -367,9 +367,10 @@ SymbolNameSet MaterializationResponsibility::getRequestedSymbols() const {
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::resolve(const SymbolMap &Symbols) {
JD.resolve(Symbols);
}
-void MaterializationResponsibility::emit() {
+void MaterializationResponsibility::notifyEmitted() {
LLVM_DEBUG({
dbgs() << "In " << JD.getName() << " emitting " << SymbolFlags << "\n";
@@ -484,8 +485,8 @@ StringRef AbsoluteSymbolsMaterializationUnit::getName() const {
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::materialize(
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());
diff --git a/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
index 0b52ba813ab..cc3656fe5dc 100644
--- a/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
@@ -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 {
diff --git a/llvm/lib/ExecutionEngine/Orc/LazyReexports.cpp b/llvm/lib/ExecutionEngine/Orc/LazyReexports.cpp
index b12ef4044fe..fc820584565 100644
--- a/llvm/lib/ExecutionEngine/Orc/LazyReexports.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LazyReexports.cpp
@@ -178,8 +178,8 @@ void LazyReexportsMaterializationUnit::materialize(
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,
diff --git a/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp b/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
index c7abce99002..640d1d922c7 100644
--- a/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
@@ -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 {
diff --git a/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp b/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
index 1a5917ea5ab..054a2a74290 100644
--- a/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp
@@ -184,7 +184,7 @@ Error RTDyldObjectLinkingLayer::onObjLoad(
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));
diff --git a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
index 6f9dd1fb481..fb55c4b98ef 100644
--- a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
@@ -48,11 +48,11 @@ TEST_F(CoreAPIsStandardTest, BasicSuccessfulLookup) {
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, RemoveSymbolsTest) {
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, RemoveSymbolsTest) {
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, TestThatReExportsDontUnnecessarilyMaterialize) {
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, TestTrivialCircularDependency) {
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, TestCircularDependenceInOneJITDylib) {
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, TestCircularDependenceInOneJITDylib) {
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, TestCircularDependenceInOneJITDylib) {
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, AddAndMaterializeLazySymbol) {
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, TestBasicWeakSymbolMaterialization) {
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, DefineMaterializingSymbol) {
[&](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, FailEmissionEarly) {
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, TestLookupWithUnthreadedMaterialization) {
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, TestGetRequestedSymbolsAndReplace) {
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, TestMaterializationResponsibilityDelegation) {
[&](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, TestMaterializeWeakSymbol) {
<< "Expected a duplicate definition error";
consumeError(std::move(Err));
- FooResponsibility->resolve(SymbolMap({{Foo, FooSym}}));
- FooResponsibility->emit();
+ FooResponsibility->notifyResolved(SymbolMap({{Foo, FooSym}}));
+ FooResponsibility->notifyEmitted();
}
} // namespace
diff --git a/llvm/unittests/ExecutionEngine/Orc/LazyCallThroughAndReexportsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/LazyCallThroughAndReexportsTest.cpp
index ebe99d48352..87d582b3c27 100644
--- a/llvm/unittests/ExecutionEngine/Orc/LazyCallThroughAndReexportsTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/LazyCallThroughAndReexportsTest.cpp
@@ -41,12 +41,12 @@ TEST_F(LazyReexportsTest, BasicLocalCallThroughManagerOperation) {
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;
OpenPOWER on IntegriCloud