Index: include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h =================================================================== --- include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h +++ include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h @@ -264,13 +264,26 @@ std::function R)>; /// Construct a compile-on-demand layer instance. - LegacyCompileOnDemandLayer(ExecutionSession &ES, BaseLayerT &BaseLayer, - SymbolResolverGetter GetSymbolResolver, - SymbolResolverSetter SetSymbolResolver, - PartitioningFtor Partition, - CompileCallbackMgrT &CallbackMgr, - IndirectStubsManagerBuilderT CreateIndirectStubsManager, - bool CloneStubsIntoPartitions = true) + LLVM_ATTRIBUTE_DEPRECATED( + LegacyCompileOnDemandLayer( + ExecutionSession &ES, BaseLayerT &BaseLayer, + SymbolResolverGetter GetSymbolResolver, + SymbolResolverSetter SetSymbolResolver, PartitioningFtor Partition, + CompileCallbackMgrT &CallbackMgr, + IndirectStubsManagerBuilderT CreateIndirectStubsManager, + bool CloneStubsIntoPartitions = true), + "ORCv1 layers (layers with the 'Legacy' prefix) are deprecated. Please " + "use " + "the ORCv2 LegacyCompileOnDemandLayer instead"); + + /// Legacy layer constructor with deprecation acknowledgement. + LegacyCompileOnDemandLayer( + ORCv1DeprecationAcknowledgement, ExecutionSession &ES, + BaseLayerT &BaseLayer, SymbolResolverGetter GetSymbolResolver, + SymbolResolverSetter SetSymbolResolver, PartitioningFtor Partition, + CompileCallbackMgrT &CallbackMgr, + IndirectStubsManagerBuilderT CreateIndirectStubsManager, + bool CloneStubsIntoPartitions = true) : ES(ES), BaseLayer(BaseLayer), GetSymbolResolver(std::move(GetSymbolResolver)), SetSymbolResolver(std::move(SetSymbolResolver)), @@ -729,8 +742,24 @@ bool CloneStubsIntoPartitions; }; -} // end namespace orc +template +LegacyCompileOnDemandLayer:: + LegacyCompileOnDemandLayer( + ExecutionSession &ES, BaseLayerT &BaseLayer, + SymbolResolverGetter GetSymbolResolver, + SymbolResolverSetter SetSymbolResolver, PartitioningFtor Partition, + CompileCallbackMgrT &CallbackMgr, + IndirectStubsManagerBuilderT CreateIndirectStubsManager, + bool CloneStubsIntoPartitions) + : ES(ES), BaseLayer(BaseLayer), + GetSymbolResolver(std::move(GetSymbolResolver)), + SetSymbolResolver(std::move(SetSymbolResolver)), + Partition(std::move(Partition)), CompileCallbackMgr(CallbackMgr), + CreateIndirectStubsManager(std::move(CreateIndirectStubsManager)), + CloneStubsIntoPartitions(CloneStubsIntoPartitions) {} +} // end namespace orc } // end namespace llvm #endif // LLVM_EXECUTIONENGINE_ORC_COMPILEONDEMANDLAYER_H Index: include/llvm/ExecutionEngine/Orc/Core.h =================================================================== --- include/llvm/ExecutionEngine/Orc/Core.h +++ include/llvm/ExecutionEngine/Orc/Core.h @@ -35,6 +35,8 @@ class JITDylib; enum class SymbolState : uint8_t; +enum ORCv1DeprecationAcknowledgement { AcknowledgeORCv1Deprecation }; + /// VModuleKey provides a unique identifier (allocated and managed by /// ExecutionSessions) for a module added to the JIT. using VModuleKey = uint64_t; Index: include/llvm/ExecutionEngine/Orc/ExecutionUtils.h =================================================================== --- include/llvm/ExecutionEngine/Orc/ExecutionUtils.h +++ include/llvm/ExecutionEngine/Orc/ExecutionUtils.h @@ -97,7 +97,14 @@ public: /// Construct a CtorDtorRunner for the given range using the given /// name mangling function. - LegacyCtorDtorRunner(std::vector CtorDtorNames, VModuleKey K) + LLVM_ATTRIBUTE_DEPRECATED( + LegacyCtorDtorRunner(std::vector CtorDtorNames, + VModuleKey K), + "ORCv1 utilities (utilities with the 'Legacy' prefix) are deprecated. " + "Please use the ORCv2 CtorDtorRunner utility instead"); + + LegacyCtorDtorRunner(ORCv1DeprecationAcknowledgement, + std::vector CtorDtorNames, VModuleKey K) : CtorDtorNames(std::move(CtorDtorNames)), K(K) {} /// Run the recorded constructors/destructors through the given JIT @@ -128,6 +135,11 @@ orc::VModuleKey K; }; +template +LegacyCtorDtorRunner::LegacyCtorDtorRunner( + std::vector CtorDtorNames, VModuleKey K) + : CtorDtorNames(std::move(CtorDtorNames)), K(K) {} + class CtorDtorRunner { public: CtorDtorRunner(JITDylib &JD) : JD(JD) {} @@ -180,7 +192,14 @@ public: /// Create a runtime-overrides class. template - LegacyLocalCXXRuntimeOverrides(const MangleFtorT &Mangle) { + LLVM_ATTRIBUTE_DEPRECATED( + LegacyLocalCXXRuntimeOverrides(const MangleFtorT &Mangle), + "ORCv1 utilities (utilities with the 'Legacy' prefix) are deprecated. " + "Please use the ORCv2 LocalCXXRuntimeOverrides utility instead"); + + template + LegacyLocalCXXRuntimeOverrides(ORCv1DeprecationAcknowledgement, + const MangleFtorT &Mangle) { addOverride(Mangle("__dso_handle"), toTargetAddress(&DSOHandleOverride)); addOverride(Mangle("__cxa_atexit"), toTargetAddress(&CXAAtExitOverride)); } @@ -201,6 +220,13 @@ StringMap CXXRuntimeOverrides; }; +template +LegacyLocalCXXRuntimeOverrides::LegacyLocalCXXRuntimeOverrides( + const MangleFtorT &Mangle) { + addOverride(Mangle("__dso_handle"), toTargetAddress(&DSOHandleOverride)); + addOverride(Mangle("__cxa_atexit"), toTargetAddress(&CXAAtExitOverride)); +} + class LocalCXXRuntimeOverrides : public LocalCXXRuntimeOverridesBase { public: Error enable(JITDylib &JD, MangleAndInterner &Mangler); Index: include/llvm/ExecutionEngine/Orc/IRCompileLayer.h =================================================================== --- include/llvm/ExecutionEngine/Orc/IRCompileLayer.h +++ include/llvm/ExecutionEngine/Orc/IRCompileLayer.h @@ -63,8 +63,18 @@ /// Construct an LegacyIRCompileLayer with the given BaseLayer, which must /// implement the ObjectLayer concept. + LLVM_ATTRIBUTE_DEPRECATED( + LegacyIRCompileLayer( + BaseLayerT &BaseLayer, CompileFtor Compile, + NotifyCompiledCallback NotifyCompiled = NotifyCompiledCallback()), + "ORCv1 layers (layers with the 'Legacy' prefix) are deprecated. Please " + "use " + "the ORCv2 IRCompileLayer instead"); + + /// Legacy layer constructor with deprecation acknowledgement. LegacyIRCompileLayer( - BaseLayerT &BaseLayer, CompileFtor Compile, + ORCv1DeprecationAcknowledgement, BaseLayerT &BaseLayer, + CompileFtor Compile, NotifyCompiledCallback NotifyCompiled = NotifyCompiledCallback()) : BaseLayer(BaseLayer), Compile(std::move(Compile)), NotifyCompiled(std::move(NotifyCompiled)) {} @@ -122,8 +132,14 @@ NotifyCompiledCallback NotifyCompiled; }; -} // end namespace orc +template +LegacyIRCompileLayer::LegacyIRCompileLayer( + BaseLayerT &BaseLayer, CompileFtor Compile, + NotifyCompiledCallback NotifyCompiled) + : BaseLayer(BaseLayer), Compile(std::move(Compile)), + NotifyCompiled(std::move(NotifyCompiled)) {} +} // end namespace orc } // end namespace llvm #endif // LLVM_EXECUTIONENGINE_ORC_IRCOMPILINGLAYER_H Index: include/llvm/ExecutionEngine/Orc/IRTransformLayer.h =================================================================== --- include/llvm/ExecutionEngine/Orc/IRTransformLayer.h +++ include/llvm/ExecutionEngine/Orc/IRTransformLayer.h @@ -56,9 +56,17 @@ public: /// Construct an LegacyIRTransformLayer with the given BaseLayer - LegacyIRTransformLayer(BaseLayerT &BaseLayer, - TransformFtor Transform = TransformFtor()) - : BaseLayer(BaseLayer), Transform(std::move(Transform)) {} + LLVM_ATTRIBUTE_DEPRECATED( + LegacyIRTransformLayer(BaseLayerT &BaseLayer, + TransformFtor Transform = TransformFtor()), + "ORCv1 layers (layers with the 'Legacy' prefix) are deprecated. Please " + "use " + "the ORCv2 IRTransformLayer instead"); + + /// Legacy layer constructor with deprecation acknowledgement. + LegacyIRTransformLayer(ORCv1DeprecationAcknowledgement, BaseLayerT &BaseLayer, + TransformFtor Transform = TransformFtor()) + : BaseLayer(BaseLayer), Transform(std::move(Transform)) {} /// Apply the transform functor to the module, then add the module to /// the layer below, along with the memory manager and symbol resolver. @@ -108,6 +116,11 @@ TransformFtor Transform; }; +template +LegacyIRTransformLayer::LegacyIRTransformLayer( + BaseLayerT &BaseLayer, TransformFtor Transform) + : BaseLayer(BaseLayer), Transform(std::move(Transform)) {} + } // end namespace orc } // end namespace llvm Index: include/llvm/ExecutionEngine/Orc/LambdaResolver.h =================================================================== --- include/llvm/ExecutionEngine/Orc/LambdaResolver.h +++ include/llvm/ExecutionEngine/Orc/LambdaResolver.h @@ -24,7 +24,15 @@ template class LambdaResolver : public LegacyJITSymbolResolver { public: - LambdaResolver(DylibLookupFtorT DylibLookupFtor, + LLVM_ATTRIBUTE_DEPRECATED( + LambdaResolver(DylibLookupFtorT DylibLookupFtor, + ExternalLookupFtorT ExternalLookupFtor), + "ORCv1 utilities (including resolvers) are deprecated and will be " + "removed " + "in the next release. Please use ORCv2 (see docs/ORCv2.rst)"); + + LambdaResolver(ORCv1DeprecationAcknowledgement, + DylibLookupFtorT DylibLookupFtor, ExternalLookupFtorT ExternalLookupFtor) : DylibLookupFtor(DylibLookupFtor), ExternalLookupFtor(ExternalLookupFtor) {} @@ -42,6 +50,12 @@ ExternalLookupFtorT ExternalLookupFtor; }; +template +LambdaResolver::LambdaResolver( + DylibLookupFtorT DylibLookupFtor, ExternalLookupFtorT ExternalLookupFtor) + : DylibLookupFtor(DylibLookupFtor), ExternalLookupFtor(ExternalLookupFtor) { +} + template std::shared_ptr> @@ -52,6 +66,17 @@ std::move(ExternalLookupFtor)); } +template +std::shared_ptr> +createLambdaResolver(ORCv1DeprecationAcknowledgement, + DylibLookupFtorT DylibLookupFtor, + ExternalLookupFtorT ExternalLookupFtor) { + using LR = LambdaResolver; + return make_unique(AcknowledgeORCv1Deprecation, + std::move(DylibLookupFtor), + std::move(ExternalLookupFtor)); +} + } // end namespace orc } // end namespace llvm Index: include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h =================================================================== --- include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h +++ include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h @@ -196,7 +196,14 @@ public: /// Construct a lazy emitting layer. - LazyEmittingLayer(BaseLayerT &BaseLayer) : BaseLayer(BaseLayer) {} + LLVM_ATTRIBUTE_DEPRECATED( + LazyEmittingLayer(BaseLayerT &BaseLayer), + "ORCv1 layers (including LazyEmittingLayer) are deprecated. Please use " + "ORCv2, where lazy emission is the default"); + + /// Construct a lazy emitting layer. + LazyEmittingLayer(ORCv1DeprecationAcknowledgement, BaseLayerT &BaseLayer) + : BaseLayer(BaseLayer) {} /// Add the given module to the lazy emitting layer. Error addModule(VModuleKey K, std::unique_ptr M) { @@ -254,6 +261,10 @@ } }; +template +LazyEmittingLayer::LazyEmittingLayer(BaseLayerT &BaseLayer) + : BaseLayer(BaseLayer) {} + } // end namespace orc } // end namespace llvm Index: include/llvm/ExecutionEngine/Orc/ObjectTransformLayer.h =================================================================== --- include/llvm/ExecutionEngine/Orc/ObjectTransformLayer.h +++ include/llvm/ExecutionEngine/Orc/ObjectTransformLayer.h @@ -48,7 +48,16 @@ class LegacyObjectTransformLayer { public: /// Construct an ObjectTransformLayer with the given BaseLayer - LegacyObjectTransformLayer(BaseLayerT &BaseLayer, + LLVM_ATTRIBUTE_DEPRECATED( + LegacyObjectTransformLayer(BaseLayerT &BaseLayer, + TransformFtor Transform = TransformFtor()), + "ORCv1 layers (layers with the 'Legacy' prefix) are deprecated. Please " + "use " + "the ORCv2 ObjectTransformLayer instead"); + + /// Legacy layer constructor with deprecation acknowledgement. + LegacyObjectTransformLayer(ORCv1DeprecationAcknowledgement, + BaseLayerT &BaseLayer, TransformFtor Transform = TransformFtor()) : BaseLayer(BaseLayer), Transform(std::move(Transform)) {} @@ -107,6 +116,11 @@ TransformFtor Transform; }; +template +LegacyObjectTransformLayer:: + LegacyObjectTransformLayer(BaseLayerT &BaseLayer, TransformFtor Transform) + : BaseLayer(BaseLayer), Transform(std::move(Transform)) {} + } // end namespace orc } // end namespace llvm Index: include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h =================================================================== --- include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h +++ include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h @@ -353,17 +353,27 @@ /// Construct an ObjectLinkingLayer with the given NotifyLoaded, /// and NotifyFinalized functors. + LLVM_ATTRIBUTE_DEPRECATED( + LegacyRTDyldObjectLinkingLayer( + ExecutionSession &ES, ResourcesGetter GetResources, + NotifyLoadedFtor NotifyLoaded = NotifyLoadedFtor(), + NotifyFinalizedFtor NotifyFinalized = NotifyFinalizedFtor(), + NotifyFreedFtor NotifyFreed = NotifyFreedFtor()), + "ORCv1 layers (layers with the 'Legacy' prefix) are deprecated. Please " + "use " + "ORCv2 (see docs/ORCv2.rst)"); + + // Legacy layer constructor with deprecation acknowledgement. LegacyRTDyldObjectLinkingLayer( - ExecutionSession &ES, ResourcesGetter GetResources, + ORCv1DeprecationAcknowledgement, ExecutionSession &ES, + ResourcesGetter GetResources, NotifyLoadedFtor NotifyLoaded = NotifyLoadedFtor(), NotifyFinalizedFtor NotifyFinalized = NotifyFinalizedFtor(), NotifyFreedFtor NotifyFreed = NotifyFreedFtor()) : ES(ES), GetResources(std::move(GetResources)), NotifyLoaded(std::move(NotifyLoaded)), NotifyFinalized(std::move(NotifyFinalized)), - NotifyFreed(std::move(NotifyFreed)), - ProcessAllSections(false) { - } + NotifyFreed(std::move(NotifyFreed)), ProcessAllSections(false) {} /// Set the 'ProcessAllSections' flag. /// Index: include/llvm/ExecutionEngine/Orc/RemoteObjectLayer.h =================================================================== --- include/llvm/ExecutionEngine/Orc/RemoteObjectLayer.h +++ include/llvm/ExecutionEngine/Orc/RemoteObjectLayer.h @@ -13,9 +13,10 @@ #ifndef LLVM_EXECUTIONENGINE_ORC_REMOTEOBJECTLAYER_H #define LLVM_EXECUTIONENGINE_ORC_REMOTEOBJECTLAYER_H +#include "llvm/ExecutionEngine/Orc/Core.h" +#include "llvm/ExecutionEngine/Orc/LambdaResolver.h" #include "llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h" #include "llvm/Object/ObjectFile.h" -#include "llvm/ExecutionEngine/Orc/LambdaResolver.h" #include namespace llvm { @@ -312,7 +313,14 @@ /// /// The ReportError functor can be used locally log errors that are intended /// to be sent sent - RemoteObjectClientLayer(RPCEndpoint &Remote, + LLVM_ATTRIBUTE_DEPRECATED( + RemoteObjectClientLayer(RPCEndpoint &Remote, + std::function ReportError), + "ORCv1 layers (including RemoteObjectClientLayer) are deprecated. Please " + "use " + "ORCv2 (see docs/ORCv2.rst)"); + + RemoteObjectClientLayer(ORCv1DeprecationAcknowledgement, RPCEndpoint &Remote, std::function ReportError) : RemoteObjectLayer(Remote, std::move(ReportError)) { using ThisT = RemoteObjectClientLayer; @@ -417,11 +425,18 @@ /// Create a RemoteObjectServerLayer with the given base layer (which must be /// an object layer), RPC endpoint, and error reporter function. - RemoteObjectServerLayer(BaseLayerT &BaseLayer, - RPCEndpoint &Remote, + LLVM_ATTRIBUTE_DEPRECATED( + RemoteObjectServerLayer(BaseLayerT &BaseLayer, RPCEndpoint &Remote, + std::function ReportError), + "ORCv1 layers (including RemoteObjectServerLayer) are deprecated. Please " + "use " + "ORCv2 (see docs/ORCv2.rst)"); + + RemoteObjectServerLayer(ORCv1DeprecationAcknowledgement, + BaseLayerT &BaseLayer, RPCEndpoint &Remote, std::function ReportError) - : RemoteObjectLayer(Remote, std::move(ReportError)), - BaseLayer(BaseLayer), HandleIdMgr(1) { + : RemoteObjectLayer(Remote, std::move(ReportError)), + BaseLayer(BaseLayer), HandleIdMgr(1) { using ThisT = RemoteObjectServerLayer; Remote.template addHandler(*this, &ThisT::addObject); @@ -462,6 +477,7 @@ assert(!BaseLayerHandles.count(Id) && "Id already in use?"); auto Resolver = createLambdaResolver( + AcknowledgeORCv1Deprecation, [this, Id](const std::string &Name) { return lookup(Id, Name); }, [this, Id](const std::string &Name) { return lookupInLogicalDylib(Id, Name); @@ -522,6 +538,31 @@ std::map BaseLayerHandles; }; +template +RemoteObjectClientLayer::RemoteObjectClientLayer( + RPCEndpoint &Remote, std::function ReportError) + : RemoteObjectLayer(Remote, std::move(ReportError)) { + using ThisT = RemoteObjectClientLayer; + Remote.template addHandler(*this, &ThisT::lookup); + Remote.template addHandler( + *this, &ThisT::lookupInLogicalDylib); +} + +template +RemoteObjectServerLayer::RemoteObjectServerLayer( + BaseLayerT &BaseLayer, RPCEndpoint &Remote, + std::function ReportError) + : RemoteObjectLayer(Remote, std::move(ReportError)), + BaseLayer(BaseLayer), HandleIdMgr(1) { + using ThisT = RemoteObjectServerLayer; + + Remote.template addHandler(*this, &ThisT::addObject); + Remote.template addHandler(*this, &ThisT::removeObject); + Remote.template addHandler(*this, &ThisT::findSymbol); + Remote.template addHandler(*this, &ThisT::findSymbolIn); + Remote.template addHandler(*this, &ThisT::emitAndFinalize); +} + } // end namespace orc } // end namespace llvm Index: lib/ExecutionEngine/Orc/OrcCBindingsStack.h =================================================================== --- lib/ExecutionEngine/Orc/OrcCBindingsStack.h +++ lib/ExecutionEngine/Orc/OrcCBindingsStack.h @@ -211,28 +211,31 @@ IndirectStubsManagerBuilder IndirectStubsMgrBuilder) : CCMgr(createCompileCallbackManager(TM, ES)), DL(TM.createDataLayout()), IndirectStubsMgr(IndirectStubsMgrBuilder()), - ObjectLayer(ES, - [this](orc::VModuleKey K) { - auto ResolverI = Resolvers.find(K); - assert(ResolverI != Resolvers.end() && - "No resolver for module K"); - auto Resolver = std::move(ResolverI->second); - Resolvers.erase(ResolverI); - return ObjLayerT::Resources{ - std::make_shared(), Resolver}; - }, - nullptr, - [this](orc::VModuleKey K, const object::ObjectFile &Obj, - const RuntimeDyld::LoadedObjectInfo &LoadedObjInfo) { - this->notifyFinalized(K, Obj, LoadedObjInfo); - }, - [this](orc::VModuleKey K, const object::ObjectFile &Obj) { - this->notifyFreed(K, Obj); - }), - CompileLayer(ObjectLayer, orc::SimpleCompiler(TM)), + ObjectLayer( + orc::AcknowledgeORCv1Deprecation, ES, + [this](orc::VModuleKey K) { + auto ResolverI = Resolvers.find(K); + assert(ResolverI != Resolvers.end() && + "No resolver for module K"); + auto Resolver = std::move(ResolverI->second); + Resolvers.erase(ResolverI); + return ObjLayerT::Resources{ + std::make_shared(), Resolver}; + }, + nullptr, + [this](orc::VModuleKey K, const object::ObjectFile &Obj, + const RuntimeDyld::LoadedObjectInfo &LoadedObjInfo) { + this->notifyFinalized(K, Obj, LoadedObjInfo); + }, + [this](orc::VModuleKey K, const object::ObjectFile &Obj) { + this->notifyFreed(K, Obj); + }), + CompileLayer(orc::AcknowledgeORCv1Deprecation, ObjectLayer, + orc::SimpleCompiler(TM)), CODLayer(createCODLayer(ES, CompileLayer, CCMgr.get(), std::move(IndirectStubsMgrBuilder), Resolvers)), CXXRuntimeOverrides( + orc::AcknowledgeORCv1Deprecation, [this](const std::string &S) { return mangle(S); }) {} Error shutdown() { @@ -308,7 +311,8 @@ // Run the static constructors, and save the static destructor runner for // execution when the JIT is torn down. - orc::LegacyCtorDtorRunner CtorRunner(std::move(CtorNames), K); + orc::LegacyCtorDtorRunner CtorRunner( + orc::AcknowledgeORCv1Deprecation, std::move(CtorNames), K); if (auto Err = CtorRunner.runViaLayer(*this)) return std::move(Err); @@ -465,7 +469,7 @@ return nullptr; return llvm::make_unique( - ES, CompileLayer, + orc::AcknowledgeORCv1Deprecation, ES, CompileLayer, [&Resolvers](orc::VModuleKey K) { auto ResolverI = Resolvers.find(K); assert(ResolverI != Resolvers.end() && "No resolver for module K"); Index: lib/ExecutionEngine/Orc/OrcMCJITReplacement.h =================================================================== --- lib/ExecutionEngine/Orc/OrcMCJITReplacement.h +++ lib/ExecutionEngine/Orc/OrcMCJITReplacement.h @@ -232,24 +232,24 @@ OrcMCJITReplacement(std::shared_ptr MemMgr, std::shared_ptr ClientResolver, std::unique_ptr TM) - : ExecutionEngine(TM->createDataLayout()), - TM(std::move(TM)), + : ExecutionEngine(TM->createDataLayout()), TM(std::move(TM)), MemMgr( std::make_shared(*this, std::move(MemMgr))), Resolver(std::make_shared(*this)), ClientResolver(std::move(ClientResolver)), NotifyObjectLoaded(*this), NotifyFinalized(*this), ObjectLayer( - ES, + AcknowledgeORCv1Deprecation, ES, [this](VModuleKey K) { return ObjectLayerT::Resources{this->MemMgr, this->Resolver}; }, NotifyObjectLoaded, NotifyFinalized), - CompileLayer(ObjectLayer, SimpleCompiler(*this->TM), + CompileLayer(AcknowledgeORCv1Deprecation, ObjectLayer, + SimpleCompiler(*this->TM), [this](VModuleKey K, std::unique_ptr M) { Modules.push_back(std::move(M)); }), - LazyEmitLayer(CompileLayer) {} + LazyEmitLayer(AcknowledgeORCv1Deprecation, CompileLayer) {} static void Register() { OrcMCJITReplacementCtor = createOrcMCJITReplacement; Index: lib/ExecutionEngine/Orc/OrcMCJITReplacement.cpp =================================================================== --- lib/ExecutionEngine/Orc/OrcMCJITReplacement.cpp +++ lib/ExecutionEngine/Orc/OrcMCJITReplacement.cpp @@ -127,7 +127,8 @@ auto &CtorDtorsMap = isDtors ? UnexecutedDestructors : UnexecutedConstructors; for (auto &KV : CtorDtorsMap) - cantFail(LegacyCtorDtorRunner(std::move(KV.second), KV.first) + cantFail(LegacyCtorDtorRunner( + AcknowledgeORCv1Deprecation, std::move(KV.second), KV.first) .runViaLayer(LazyEmitLayer)); CtorDtorsMap.clear(); Index: lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp =================================================================== --- lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp +++ lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp @@ -207,5 +207,14 @@ NotifyEmitted(K, std::move(ObjBuffer)); } +LegacyRTDyldObjectLinkingLayer::LegacyRTDyldObjectLinkingLayer( + ExecutionSession &ES, ResourcesGetter GetResources, + NotifyLoadedFtor NotifyLoaded, NotifyFinalizedFtor NotifyFinalized, + NotifyFreedFtor NotifyFreed) + : ES(ES), GetResources(std::move(GetResources)), + NotifyLoaded(std::move(NotifyLoaded)), + NotifyFinalized(std::move(NotifyFinalized)), + NotifyFreed(std::move(NotifyFreed)), ProcessAllSections(false) {} + } // End namespace orc. } // End namespace llvm. Index: tools/lli/lli.cpp =================================================================== --- tools/lli/lli.cpp +++ tools/lli/lli.cpp @@ -665,6 +665,7 @@ // Forward MCJIT's symbol resolution calls to the remote. static_cast(RTDyldMM)->setResolver( orc::createLambdaResolver( + orc::AcknowledgeORCv1Deprecation, [](const std::string &Name) { return nullptr; }, [&](const std::string &Name) { if (auto Addr = ExitOnErr(R->getSymbolAddress(Name))) Index: unittests/ExecutionEngine/Orc/LazyEmittingLayerTest.cpp =================================================================== --- unittests/ExecutionEngine/Orc/LazyEmittingLayerTest.cpp +++ unittests/ExecutionEngine/Orc/LazyEmittingLayerTest.cpp @@ -22,7 +22,8 @@ TEST(LazyEmittingLayerTest, Empty) { MockBaseLayer M; - llvm::orc::LazyEmittingLayer L(M); + llvm::orc::LazyEmittingLayer L( + llvm::orc::AcknowledgeORCv1Deprecation, M); cantFail( L.addModule(llvm::orc::VModuleKey(), std::unique_ptr())); } Index: unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp =================================================================== --- unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp +++ unittests/ExecutionEngine/Orc/LegacyCompileOnDemandLayerTest.cpp @@ -76,7 +76,7 @@ }; llvm::orc::LegacyCompileOnDemandLayer COD( - ES, TestBaseLayer, GetResolver, SetResolver, + AcknowledgeORCv1Deprecation, ES, TestBaseLayer, GetResolver, SetResolver, [](Function &F) { return std::set{&F}; }, CallbackMgr, [] { return llvm::make_unique(); }, true); Index: unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp =================================================================== --- unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp +++ unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp @@ -68,10 +68,11 @@ ExecutionSession ES; - LegacyRTDyldObjectLinkingLayer ObjLayer(ES, [&MM](VModuleKey) { - return LegacyRTDyldObjectLinkingLayer::Resources{ - MM, std::make_shared()}; - }); + LegacyRTDyldObjectLinkingLayer ObjLayer( + AcknowledgeORCv1Deprecation, ES, [&MM](VModuleKey) { + return LegacyRTDyldObjectLinkingLayer::Resources{ + MM, std::make_shared()}; + }); LLVMContext Context; auto M = llvm::make_unique("", Context); @@ -130,13 +131,14 @@ std::map> Resolvers; - LegacyRTDyldObjectLinkingLayer ObjLayer(ES, [&](VModuleKey K) { - auto I = Resolvers.find(K); - assert(I != Resolvers.end() && "Missing resolver"); - auto R = std::move(I->second); - Resolvers.erase(I); - return LegacyRTDyldObjectLinkingLayer::Resources{MM, std::move(R)}; - }); + LegacyRTDyldObjectLinkingLayer ObjLayer( + AcknowledgeORCv1Deprecation, ES, [&](VModuleKey K) { + auto I = Resolvers.find(K); + assert(I != Resolvers.end() && "Missing resolver"); + auto R = std::move(I->second); + Resolvers.erase(I); + return LegacyRTDyldObjectLinkingLayer::Resources{MM, std::move(R)}; + }); SimpleCompiler Compile(*TM); // Create a pair of modules that will trigger recursive finalization: @@ -217,10 +219,11 @@ auto MM = std::make_shared(); - LegacyRTDyldObjectLinkingLayer ObjLayer(ES, [&MM](VModuleKey K) { - return LegacyRTDyldObjectLinkingLayer::Resources{ - MM, std::make_shared()}; - }); + LegacyRTDyldObjectLinkingLayer ObjLayer( + AcknowledgeORCv1Deprecation, ES, [&MM](VModuleKey K) { + return LegacyRTDyldObjectLinkingLayer::Resources{ + MM, std::make_shared()}; + }); SimpleCompiler Compile(*TM); // Create a pair of unrelated modules: @@ -278,7 +281,7 @@ TEST_F(LegacyRTDyldObjectLinkingLayerExecutionTest, TestNotifyLoadedSignature) { ExecutionSession ES; LegacyRTDyldObjectLinkingLayer ObjLayer( - ES, + AcknowledgeORCv1Deprecation, ES, [](VModuleKey) { return LegacyRTDyldObjectLinkingLayer::Resources{ nullptr, std::make_shared()}; Index: unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp =================================================================== --- unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp +++ unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp @@ -182,17 +182,19 @@ // Create one object transform layer using a transform (as a functor) // that allocates new objects, and deals in unique pointers. - LegacyObjectTransformLayer T1(M); + LegacyObjectTransformLayer T1( + AcknowledgeORCv1Deprecation, M); // Create a second object transform layer using a transform (as a lambda) // that mutates objects in place, and deals in naked pointers LegacyObjectTransformLayer( - std::shared_ptr)>> - T2(M, [](std::shared_ptr Obj) { - ++(*Obj); - return Obj; - }); + std::function( + std::shared_ptr)>> + T2(AcknowledgeORCv1Deprecation, M, + [](std::shared_ptr Obj) { + ++(*Obj); + return Obj; + }); // Test addObject with T1 (allocating) auto K1 = ES.allocateVModule(); @@ -281,22 +283,23 @@ }; // Construct the jit layers. - LegacyRTDyldObjectLinkingLayer BaseLayer(ES, [](VModuleKey) { - return LegacyRTDyldObjectLinkingLayer::Resources{ - std::make_shared(), - std::make_shared()}; - }); + LegacyRTDyldObjectLinkingLayer BaseLayer( + AcknowledgeORCv1Deprecation, ES, [](VModuleKey) { + return LegacyRTDyldObjectLinkingLayer::Resources{ + std::make_shared(), + std::make_shared()}; + }); auto IdentityTransform = [](std::unique_ptr Obj) { return Obj; }; LegacyObjectTransformLayer - TransformLayer(BaseLayer, IdentityTransform); + TransformLayer(AcknowledgeORCv1Deprecation, BaseLayer, IdentityTransform); auto NullCompiler = [](llvm::Module &) { return std::unique_ptr(nullptr); }; LegacyIRCompileLayer - CompileLayer(TransformLayer, NullCompiler); + CompileLayer(AcknowledgeORCv1Deprecation, TransformLayer, NullCompiler); // Make sure that the calls from LegacyIRCompileLayer to LegacyObjectTransformLayer // compile. Index: unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp =================================================================== --- unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp +++ unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp @@ -127,7 +127,8 @@ std::copy(ObjBytes.begin(), ObjBytes.end(), ObjContents.begin()); RPCEndpoint ClientEP(*Channels.first, true); - RemoteObjectClientLayer Client(ClientEP, ReportError); + RemoteObjectClientLayer Client(AcknowledgeORCv1Deprecation, + ClientEP, ReportError); RPCEndpoint ServerEP(*Channels.second, true); MockObjectLayer BaseLayer( @@ -144,9 +145,8 @@ return 1; }); - RemoteObjectServerLayer Server(BaseLayer, - ServerEP, - ReportError); + RemoteObjectServerLayer Server( + AcknowledgeORCv1Deprecation, BaseLayer, ServerEP, ReportError); bool Finished = false; ServerEP.addHandler( @@ -181,7 +181,8 @@ }; RPCEndpoint ClientEP(*Channels.first, true); - RemoteObjectClientLayer Client(ClientEP, ReportError); + RemoteObjectClientLayer Client(AcknowledgeORCv1Deprecation, + ClientEP, ReportError); RPCEndpoint ServerEP(*Channels.second, true); MockObjectLayer BaseLayer( @@ -191,9 +192,8 @@ return make_error("AddObjectFailure - Test Message", inconvertibleErrorCode()); }); - RemoteObjectServerLayer Server(BaseLayer, - ServerEP, - ReportError); + RemoteObjectServerLayer Server( + AcknowledgeORCv1Deprecation, BaseLayer, ServerEP, ReportError); bool Finished = false; ServerEP.addHandler( @@ -233,7 +233,8 @@ }; RPCEndpoint ClientEP(*Channels.first, true); - RemoteObjectClientLayer Client(ClientEP, ReportError); + RemoteObjectClientLayer Client(AcknowledgeORCv1Deprecation, + ClientEP, ReportError); RPCEndpoint ServerEP(*Channels.second, true); @@ -243,9 +244,8 @@ SymTab[1] = MockObjectLayer::LookupFn(); return 1; }); - RemoteObjectServerLayer Server(BaseLayer, - ServerEP, - ReportError); + RemoteObjectServerLayer Server( + AcknowledgeORCv1Deprecation, BaseLayer, ServerEP, ReportError); bool Finished = false; ServerEP.addHandler( @@ -283,7 +283,8 @@ }; RPCEndpoint ClientEP(*Channels.first, true); - RemoteObjectClientLayer Client(ClientEP, ReportError); + RemoteObjectClientLayer Client(AcknowledgeORCv1Deprecation, + ClientEP, ReportError); RPCEndpoint ServerEP(*Channels.second, true); @@ -294,9 +295,8 @@ MockObjectLayer::SymbolLookupTable &SymTab) { return 42; }); - RemoteObjectServerLayer Server(BaseLayer, - ServerEP, - ReportError); + RemoteObjectServerLayer Server( + AcknowledgeORCv1Deprecation, BaseLayer, ServerEP, ReportError); bool Finished = false; ServerEP.addHandler( @@ -339,7 +339,8 @@ }; RPCEndpoint ClientEP(*Channels.first, true); - RemoteObjectClientLayer Client(ClientEP, ReportError); + RemoteObjectClientLayer Client(AcknowledgeORCv1Deprecation, + ClientEP, ReportError); RPCEndpoint ServerEP(*Channels.second, true); @@ -358,9 +359,8 @@ }; return 42; }); - RemoteObjectServerLayer Server(BaseLayer, - ServerEP, - ReportError); + RemoteObjectServerLayer Server( + AcknowledgeORCv1Deprecation, BaseLayer, ServerEP, ReportError); bool Finished = false; ServerEP.addHandler( @@ -421,7 +421,8 @@ }; RPCEndpoint ClientEP(*Channels.first, true); - RemoteObjectClientLayer Client(ClientEP, ReportError); + RemoteObjectClientLayer Client(AcknowledgeORCv1Deprecation, + ClientEP, ReportError); RPCEndpoint ServerEP(*Channels.second, true); @@ -447,9 +448,8 @@ return 42; }); - RemoteObjectServerLayer Server(BaseLayer, - ServerEP, - ReportError); + RemoteObjectServerLayer Server( + AcknowledgeORCv1Deprecation, BaseLayer, ServerEP, ReportError); bool Finished = false; ServerEP.addHandler( @@ -496,7 +496,8 @@ }; RPCEndpoint ClientEP(*Channels.first, true); - RemoteObjectClientLayer Client(ClientEP, ReportError); + RemoteObjectClientLayer Client(AcknowledgeORCv1Deprecation, + ClientEP, ReportError); RPCEndpoint ServerEP(*Channels.second, true); @@ -506,9 +507,8 @@ SymTab[1] = MockObjectLayer::LookupFn(); return 1; }); - RemoteObjectServerLayer Server(BaseLayer, - ServerEP, - ReportError); + RemoteObjectServerLayer Server( + AcknowledgeORCv1Deprecation, BaseLayer, ServerEP, ReportError); bool Finished = false; ServerEP.addHandler( @@ -547,7 +547,8 @@ }; RPCEndpoint ClientEP(*Channels.first, true); - RemoteObjectClientLayer Client(ClientEP, ReportError); + RemoteObjectClientLayer Client(AcknowledgeORCv1Deprecation, + ClientEP, ReportError); RPCEndpoint ServerEP(*Channels.second, true); @@ -556,9 +557,8 @@ MockObjectLayer::SymbolLookupTable &SymTab) { return 1; }); - RemoteObjectServerLayer Server(BaseLayer, - ServerEP, - ReportError); + RemoteObjectServerLayer Server( + AcknowledgeORCv1Deprecation, BaseLayer, ServerEP, ReportError); bool Finished = false; ServerEP.addHandler(