summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2018-10-16 20:13:06 +0000
committerLang Hames <lhames@gmail.com>2018-10-16 20:13:06 +0000
commit8b94274f22d8c346103c5682e7899e8b43db16d7 (patch)
treeab087f3142915bbc8d445561570f4ee30385227d /llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
parent4084df00402bc9b69b15b56cbdd8f5f8be81cc0a (diff)
downloadbcm5719-llvm-8b94274f22d8c346103c5682e7899e8b43db16d7.tar.gz
bcm5719-llvm-8b94274f22d8c346103c5682e7899e8b43db16d7.zip
[ORC] Make the VModuleKey optional, propagate it via MaterializationUnit and
MaterializationResponsibility. VModuleKeys are intended to enable selective removal of modules from a JIT session, however for a wide variety of use cases selective removal is not needed and introduces unnecessary overhead. As of this commit, the default constructed VModuleKey value is reserved as a "do not track" value, and becomes the default when adding a new module to the JIT. This commit also changes the propagation of VModuleKeys. They were passed alongside the MaterializationResponsibity instance in XXLayer::emit methods, but are now propagated as part of the MaterializationResponsibility instance itself (and as part of MaterializationUnit when stored in a JITDylib). Associating VModuleKeys with MaterializationUnits in this way should allow for a thread-safe module removal mechanism in the future, even when a module is in the process of being compiled, by having the MaterializationResponsibility object check in on its VModuleKey's state before commiting its results to the JITDylib. llvm-svn: 344643
Diffstat (limited to 'llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp')
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
index 75ccfc9ab0d..1660670ae63 100644
--- a/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
@@ -54,7 +54,7 @@ static bool testSetProcessAllSections(std::unique_ptr<MemoryBuffer> Obj,
auto &JD = ES.createJITDylib("main");
auto Foo = ES.intern("foo");
- RTDyldObjectLinkingLayer ObjLayer(ES, [&DebugSectionSeen](VModuleKey) {
+ RTDyldObjectLinkingLayer ObjLayer(ES, [&DebugSectionSeen]() {
return llvm::make_unique<MemoryManagerWrapper>(DebugSectionSeen);
});
@@ -65,8 +65,7 @@ static bool testSetProcessAllSections(std::unique_ptr<MemoryBuffer> Obj,
auto OnReadyDoNothing = [](Error Err) { cantFail(std::move(Err)); };
ObjLayer.setProcessAllSections(ProcessAllSections);
- auto K = ES.allocateVModule();
- cantFail(ObjLayer.add(JD, K, std::move(Obj)));
+ cantFail(ObjLayer.add(JD, std::move(Obj), ES.allocateVModule()));
ES.lookup({&JD}, {Foo}, OnResolveDoNothing, OnReadyDoNothing,
NoDependenciesToRegister);
return DebugSectionSeen;
@@ -152,12 +151,12 @@ TEST(RTDyldObjectLinkingLayerTest, TestOverrideObjectFlags) {
auto &JD = ES.createJITDylib("main");
auto Foo = ES.intern("foo");
RTDyldObjectLinkingLayer ObjLayer(
- ES, [](VModuleKey) { return llvm::make_unique<SectionMemoryManager>(); });
+ ES, []() { return llvm::make_unique<SectionMemoryManager>(); });
IRCompileLayer CompileLayer(ES, ObjLayer, FunkySimpleCompiler(*TM));
ObjLayer.setOverrideObjectFlagsWithResponsibilityFlags(true);
- cantFail(CompileLayer.add(JD, ES.allocateVModule(), std::move(M)));
+ cantFail(CompileLayer.add(JD, std::move(M), ES.allocateVModule()));
ES.lookup({&JD}, {Foo}, [](Expected<SymbolMap> R) { cantFail(std::move(R)); },
[](Error Err) { cantFail(std::move(Err)); },
NoDependenciesToRegister);
@@ -214,12 +213,12 @@ TEST(RTDyldObjectLinkingLayerTest, TestAutoClaimResponsibilityForSymbols) {
auto &JD = ES.createJITDylib("main");
auto Foo = ES.intern("foo");
RTDyldObjectLinkingLayer ObjLayer(
- ES, [](VModuleKey) { return llvm::make_unique<SectionMemoryManager>(); });
+ ES, []() { return llvm::make_unique<SectionMemoryManager>(); });
IRCompileLayer CompileLayer(ES, ObjLayer, FunkySimpleCompiler(*TM));
ObjLayer.setAutoClaimResponsibilityForObjectSymbols(true);
- cantFail(CompileLayer.add(JD, ES.allocateVModule(), std::move(M)));
+ cantFail(CompileLayer.add(JD, std::move(M), ES.allocateVModule()));
ES.lookup({&JD}, {Foo}, [](Expected<SymbolMap> R) { cantFail(std::move(R)); },
[](Error Err) { cantFail(std::move(Err)); },
NoDependenciesToRegister);
OpenPOWER on IntegriCloud