<div dir="ltr">No worries. :)<div><br></div><div>- Lang.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 23, 2017 at 4:26 PM, Rafael Avila de Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Oh, sorry :-(<br>
<br>
Cheers,<br>
Rafael<br>
<div class="HOEnZb"><div class="h5"><br>
Lang Hames <<a href="mailto:lhames@gmail.com">lhames@gmail.com</a>> writes:<br>
<br>
> Ugh. Too late. ><<br>
><br>
> On Fri, Jun 23, 2017 at 4:05 PM, Lang Hames <<a href="mailto:lhames@gmail.com">lhames@gmail.com</a>> wrote:<br>
><br>
>> I've got in a fix in the works. Should be in shortly.<br>
>><br>
>> - Lang.<br>
>><br>
>><br>
>> On Fri, Jun 23, 2017 at 3:50 PM, Rafael Avila de Espindola <<br>
>> <a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>> wrote:<br>
>><br>
>>> This is causing test failures on linux. Reverting.<br>
>>><br>
>>> Cheers,<br>
>>> Rafael<br>
>>><br>
>>> Lang Hames via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> writes:<br>
>>><br>
>>> > Author: lhames<br>
>>> > Date: Fri Jun 23 16:45:29 2017<br>
>>> > New Revision: 306166<br>
>>> ><br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=306166&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=306166&view=rev</a><br>
>>> > Log:<br>
>>> > [ORC] Move ORC IR layer interface from addModuleSet to addModule and<br>
>>> fix the<br>
>>> > module type as std::shared_ptr<Module>.<br>
>>> ><br>
>>> ><br>
>>> > Modified:<br>
>>> >     llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter1/<br>
>>> KaleidoscopeJIT.h<br>
>>> >     llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter2/<br>
>>> KaleidoscopeJIT.h<br>
>>> >     llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter3/<br>
>>> KaleidoscopeJIT.h<br>
>>> >     llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter4/<br>
>>> KaleidoscopeJIT.h<br>
>>> >     llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter5/<br>
>>> KaleidoscopeJIT.h<br>
>>> >     llvm/trunk/examples/<wbr>Kaleidoscope/include/<wbr>KaleidoscopeJIT.h<br>
>>> >     llvm/trunk/include/llvm-c/<wbr>OrcBindings.h<br>
>>> >     llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>CompileOnDemandLayer.h<br>
>>> >     llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>ExecutionUtils.h<br>
>>> >     llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>IRCompileLayer.h<br>
>>> >     llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>IRTransformLayer.h<br>
>>> >     llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>LazyEmittingLayer.h<br>
>>> >     llvm/trunk/lib/<wbr>ExecutionEngine/Orc/<wbr>OrcCBindings.cpp<br>
>>> >     llvm/trunk/lib/<wbr>ExecutionEngine/Orc/<wbr>OrcCBindingsStack.h<br>
>>> >     llvm/trunk/lib/<wbr>ExecutionEngine/Orc/<wbr>OrcMCJITReplacement.h<br>
>>> >     llvm/trunk/tools/lli/<wbr>OrcLazyJIT.cpp<br>
>>> >     llvm/trunk/tools/lli/<wbr>OrcLazyJIT.h<br>
>>> >     llvm/trunk/unittests/<wbr>ExecutionEngine/Orc/<wbr>LazyEmittingLayerTest.cpp<br>
>>> >     llvm/trunk/unittests/<wbr>ExecutionEngine/Orc/<wbr>ObjectTransformLay<br>
>>> erTest.cpp<br>
>>> >     llvm/trunk/unittests/<wbr>ExecutionEngine/Orc/<wbr>OrcCAPITest.cpp<br>
>>> >     llvm/trunk/unittests/<wbr>ExecutionEngine/Orc/<wbr>OrcTestCommon.h<br>
>>> ><br>
>>> > Modified: llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter1/<br>
>>> KaleidoscopeJIT.h<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kale" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/examples/<wbr>Kale</a><br>
>>> idoscope/BuildingAJIT/<wbr>Chapter1/KaleidoscopeJIT.h?<wbr>rev=306166&<br>
>>> r1=306165&r2=306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter1/KaleidoscopeJIT.h<br>
>>> (original)<br>
>>> > +++ llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter1/KaleidoscopeJIT.h<br>
>>> Fri Jun 23 16:45:29 2017<br>
>>> > @@ -44,7 +44,7 @@ private:<br>
>>> >    IRCompileLayer<decltype(<wbr>ObjectLayer), SimpleCompiler> CompileLayer;<br>
>>> ><br>
>>> >  public:<br>
>>> > -  using ModuleHandle = decltype(CompileLayer)::<wbr>ModuleSetHandleT;<br>
>>> > +  using ModuleHandle = decltype(CompileLayer)::<wbr>ModuleHandleT;<br>
>>> ><br>
>>> >    KaleidoscopeJIT()<br>
>>> >        : TM(EngineBuilder().<wbr>selectTarget()),<br>
>>> DL(TM->createDataLayout()),<br>
>>> > @@ -72,15 +72,11 @@ public:<br>
>>> >            return JITSymbol(nullptr);<br>
>>> >          });<br>
>>> ><br>
>>> > -    // Build a singleton module set to hold our module.<br>
>>> > -    std::vector<std::unique_ptr<<wbr>Module>> Ms;<br>
>>> > -    Ms.push_back(std::move(M));<br>
>>> > -<br>
>>> >      // Add the set to the JIT with the resolver we created above and a<br>
>>> newly<br>
>>> >      // created SectionMemoryManager.<br>
>>> > -    return CompileLayer.addModuleSet(std:<wbr>:move(Ms),<br>
>>> > -                                     make_unique<SectionMemoryMana<br>
>>> ger>(),<br>
>>> > -                                     std::move(Resolver));<br>
>>> > +    return CompileLayer.addModule(std::<wbr>move(M),<br>
>>> > +                                  make_unique<<wbr>SectionMemoryManager>(),<br>
>>> > +                                  std::move(Resolver));<br>
>>> >    }<br>
>>> ><br>
>>> >    JITSymbol findSymbol(const std::string Name) {<br>
>>> > @@ -91,7 +87,7 @@ public:<br>
>>> >    }<br>
>>> ><br>
>>> >    void removeModule(ModuleHandle H) {<br>
>>> > -    CompileLayer.removeModuleSet(<wbr>H);<br>
>>> > +    CompileLayer.removeModule(H);<br>
>>> >    }<br>
>>> >  };<br>
>>> ><br>
>>> ><br>
>>> > Modified: llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter2/<br>
>>> KaleidoscopeJIT.h<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kale" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/examples/<wbr>Kale</a><br>
>>> idoscope/BuildingAJIT/<wbr>Chapter2/KaleidoscopeJIT.h?<wbr>rev=306166&<br>
>>> r1=306165&r2=306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter2/KaleidoscopeJIT.h<br>
>>> (original)<br>
>>> > +++ llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter2/KaleidoscopeJIT.h<br>
>>> Fri Jun 23 16:45:29 2017<br>
>>> > @@ -48,18 +48,18 @@ private:<br>
>>> >    IRCompileLayer<decltype(<wbr>ObjectLayer), SimpleCompiler> CompileLayer;<br>
>>> ><br>
>>> >    using OptimizeFunction =<br>
>>> > -      std::function<std::unique_ptr<<wbr>Module>(std::unique_ptr<<wbr>Module>)>;<br>
>>> > +      std::function<std::shared_ptr<<wbr>Module>(std::shared_ptr<<wbr>Module>)>;<br>
>>> ><br>
>>> >    IRTransformLayer<decltype(<wbr>CompileLayer), OptimizeFunction><br>
>>> OptimizeLayer;<br>
>>> ><br>
>>> >  public:<br>
>>> > -  using ModuleHandle = decltype(OptimizeLayer)::<wbr>ModuleSetHandleT;<br>
>>> > +  using ModuleHandle = decltype(OptimizeLayer)::<wbr>ModuleHandleT;<br>
>>> ><br>
>>> >    KaleidoscopeJIT()<br>
>>> >        : TM(EngineBuilder().<wbr>selectTarget()),<br>
>>> DL(TM->createDataLayout()),<br>
>>> >          CompileLayer(ObjectLayer, SimpleCompiler(*TM)),<br>
>>> >          OptimizeLayer(CompileLayer,<br>
>>> > -                      [this](std::unique_ptr<Module> M) {<br>
>>> > +                      [this](std::shared_ptr<Module> M) {<br>
>>> >                          return optimizeModule(std::move(M));<br>
>>> >                        }) {<br>
>>> >      llvm::sys::DynamicLibrary::<wbr>LoadLibraryPermanently(<wbr>nullptr);<br>
>>> > @@ -85,15 +85,11 @@ public:<br>
>>> >            return JITSymbol(nullptr);<br>
>>> >          });<br>
>>> ><br>
>>> > -    // Build a singleton module set to hold our module.<br>
>>> > -    std::vector<std::unique_ptr<<wbr>Module>> Ms;<br>
>>> > -    Ms.push_back(std::move(M));<br>
>>> > -<br>
>>> >      // Add the set to the JIT with the resolver we created above and a<br>
>>> newly<br>
>>> >      // created SectionMemoryManager.<br>
>>> > -    return OptimizeLayer.addModuleSet(<wbr>std::move(Ms),<br>
>>> > -                                      make_unique<SectionMemoryManag<br>
>>> er>(),<br>
>>> > -                                      std::move(Resolver));<br>
>>> > +    return OptimizeLayer.addModule(std::<wbr>move(M),<br>
>>> > +                                   make_unique<SectionMemoryMana<br>
>>> ger>(),<br>
>>> > +                                   std::move(Resolver));<br>
>>> >    }<br>
>>> ><br>
>>> >    JITSymbol findSymbol(const std::string Name) {<br>
>>> > @@ -104,11 +100,11 @@ public:<br>
>>> >    }<br>
>>> ><br>
>>> >    void removeModule(ModuleHandle H) {<br>
>>> > -    OptimizeLayer.removeModuleSet(<wbr>H);<br>
>>> > +    OptimizeLayer.removeModule(H);<br>
>>> >    }<br>
>>> ><br>
>>> >  private:<br>
>>> > -  std::unique_ptr<Module> optimizeModule(std::unique_<wbr>ptr<Module> M) {<br>
>>> > +  std::shared_ptr<Module> optimizeModule(std::shared_<wbr>ptr<Module> M) {<br>
>>> >      // Create a function pass manager.<br>
>>> >      auto FPM = llvm::make_unique<legacy::Func<br>
>>> tionPassManager>(M.get());<br>
>>> ><br>
>>> ><br>
>>> > Modified: llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter3/<br>
>>> KaleidoscopeJIT.h<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kale" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/examples/<wbr>Kale</a><br>
>>> idoscope/BuildingAJIT/<wbr>Chapter3/KaleidoscopeJIT.h?<wbr>rev=306166&<br>
>>> r1=306165&r2=306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter3/KaleidoscopeJIT.h<br>
>>> (original)<br>
>>> > +++ llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter3/KaleidoscopeJIT.h<br>
>>> Fri Jun 23 16:45:29 2017<br>
>>> > @@ -51,7 +51,7 @@ private:<br>
>>> >    IRCompileLayer<decltype(<wbr>ObjectLayer), SimpleCompiler> CompileLayer;<br>
>>> ><br>
>>> >    using OptimizeFunction =<br>
>>> > -      std::function<std::unique_ptr<<wbr>Module>(std::unique_ptr<<wbr>Module>)>;<br>
>>> > +      std::function<std::shared_ptr<<wbr>Module>(std::shared_ptr<<wbr>Module>)>;<br>
>>> ><br>
>>> >    IRTransformLayer<decltype(<wbr>CompileLayer), OptimizeFunction><br>
>>> OptimizeLayer;<br>
>>> ><br>
>>> > @@ -59,13 +59,13 @@ private:<br>
>>> >    CompileOnDemandLayer<decltype(<wbr>OptimizeLayer)> CODLayer;<br>
>>> ><br>
>>> >  public:<br>
>>> > -  using ModuleHandle = decltype(CODLayer)::<wbr>ModuleSetHandleT;<br>
>>> > +  using ModuleHandle = decltype(CODLayer)::<wbr>ModuleHandleT;<br>
>>> ><br>
>>> >    KaleidoscopeJIT()<br>
>>> >        : TM(EngineBuilder().<wbr>selectTarget()),<br>
>>> DL(TM->createDataLayout()),<br>
>>> >          CompileLayer(ObjectLayer, SimpleCompiler(*TM)),<br>
>>> >          OptimizeLayer(CompileLayer,<br>
>>> > -                      [this](std::unique_ptr<Module> M) {<br>
>>> > +                      [this](std::shared_ptr<Module> M) {<br>
>>> >                          return optimizeModule(std::move(M));<br>
>>> >                        }),<br>
>>> >          CompileCallbackManager(<br>
>>> > @@ -98,15 +98,11 @@ public:<br>
>>> >            return JITSymbol(nullptr);<br>
>>> >          });<br>
>>> ><br>
>>> > -    // Build a singleton module set to hold our module.<br>
>>> > -    std::vector<std::unique_ptr<<wbr>Module>> Ms;<br>
>>> > -    Ms.push_back(std::move(M));<br>
>>> > -<br>
>>> >      // Add the set to the JIT with the resolver we created above and a<br>
>>> newly<br>
>>> >      // created SectionMemoryManager.<br>
>>> > -    return CODLayer.addModuleSet(std::<wbr>move(Ms),<br>
>>> > -                                 make_unique<<wbr>SectionMemoryManager>(),<br>
>>> > -                                 std::move(Resolver));<br>
>>> > +    return CODLayer.addModule(std::move(<wbr>M),<br>
>>> > +                              make_unique<<wbr>SectionMemoryManager>(),<br>
>>> > +                              std::move(Resolver));<br>
>>> >    }<br>
>>> ><br>
>>> >    JITSymbol findSymbol(const std::string Name) {<br>
>>> > @@ -117,11 +113,11 @@ public:<br>
>>> >    }<br>
>>> ><br>
>>> >    void removeModule(ModuleHandle H) {<br>
>>> > -    CODLayer.removeModuleSet(H);<br>
>>> > +    CODLayer.removeModule(H);<br>
>>> >    }<br>
>>> ><br>
>>> >  private:<br>
>>> > -  std::unique_ptr<Module> optimizeModule(std::unique_<wbr>ptr<Module> M) {<br>
>>> > +  std::shared_ptr<Module> optimizeModule(std::shared_<wbr>ptr<Module> M) {<br>
>>> >      // Create a function pass manager.<br>
>>> >      auto FPM = llvm::make_unique<legacy::Func<br>
>>> tionPassManager>(M.get());<br>
>>> ><br>
>>> ><br>
>>> > Modified: llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter4/<br>
>>> KaleidoscopeJIT.h<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kale" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/examples/<wbr>Kale</a><br>
>>> idoscope/BuildingAJIT/<wbr>Chapter4/KaleidoscopeJIT.h?<wbr>rev=306166&<br>
>>> r1=306165&r2=306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter4/KaleidoscopeJIT.h<br>
>>> (original)<br>
>>> > +++ llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter4/KaleidoscopeJIT.h<br>
>>> Fri Jun 23 16:45:29 2017<br>
>>> > @@ -77,7 +77,7 @@ private:<br>
>>> >    IRCompileLayer<decltype(<wbr>ObjectLayer), SimpleCompiler> CompileLayer;<br>
>>> ><br>
>>> >    using OptimizeFunction =<br>
>>> > -      std::function<std::unique_ptr<<wbr>Module>(std::unique_ptr<<wbr>Module>)>;<br>
>>> > +      std::function<std::shared_ptr<<wbr>Module>(std::shared_ptr<<wbr>Module>)>;<br>
>>> ><br>
>>> >    IRTransformLayer<decltype(<wbr>CompileLayer), OptimizeFunction><br>
>>> OptimizeLayer;<br>
>>> ><br>
>>> > @@ -85,14 +85,14 @@ private:<br>
>>> >    std::unique_ptr<<wbr>IndirectStubsManager> IndirectStubsMgr;<br>
>>> ><br>
>>> >  public:<br>
>>> > -  using ModuleHandle = decltype(OptimizeLayer)::<wbr>ModuleSetHandleT;<br>
>>> > +  using ModuleHandle = decltype(OptimizeLayer)::<wbr>ModuleHandleT;<br>
>>> ><br>
>>> >    KaleidoscopeJIT()<br>
>>> >        : TM(EngineBuilder().<wbr>selectTarget()),<br>
>>> >          DL(TM->createDataLayout()),<br>
>>> >          CompileLayer(ObjectLayer, SimpleCompiler(*TM)),<br>
>>> >          OptimizeLayer(CompileLayer,<br>
>>> > -                      [this](std::unique_ptr<Module> M) {<br>
>>> > +                      [this](std::shared_ptr<Module> M) {<br>
>>> >                          return optimizeModule(std::move(M));<br>
>>> >                        }),<br>
>>> >          CompileCallbackMgr(<br>
>>> > @@ -125,15 +125,11 @@ public:<br>
>>> >            return JITSymbol(nullptr);<br>
>>> >          });<br>
>>> ><br>
>>> > -    // Build a singleton module set to hold our module.<br>
>>> > -    std::vector<std::unique_ptr<<wbr>Module>> Ms;<br>
>>> > -    Ms.push_back(std::move(M));<br>
>>> > -<br>
>>> >      // Add the set to the JIT with the resolver we created above and a<br>
>>> newly<br>
>>> >      // created SectionMemoryManager.<br>
>>> > -    return OptimizeLayer.addModuleSet(<wbr>std::move(Ms),<br>
>>> > -                                      make_unique<SectionMemoryManag<br>
>>> er>(),<br>
>>> > -                                      std::move(Resolver));<br>
>>> > +    return OptimizeLayer.addModule(std::<wbr>move(M),<br>
>>> > +                                   make_unique<SectionMemoryMana<br>
</div></div><div class="HOEnZb"><div class="h5">>>> ger>(),<br>
>>> > +                                   std::move(Resolver));<br>
>>> >    }<br>
>>> ><br>
>>> >    Error addFunctionAST(std::unique_<wbr>ptr<FunctionAST> FnAST) {<br>
>>> > @@ -199,7 +195,7 @@ public:<br>
>>> >    }<br>
>>> ><br>
>>> >    void removeModule(ModuleHandle H) {<br>
>>> > -    OptimizeLayer.removeModuleSet(<wbr>H);<br>
>>> > +    OptimizeLayer.removeModule(H);<br>
>>> >    }<br>
>>> ><br>
>>> >  private:<br>
>>> > @@ -210,7 +206,7 @@ private:<br>
>>> >      return MangledNameStream.str();<br>
>>> >    }<br>
>>> ><br>
>>> > -  std::unique_ptr<Module> optimizeModule(std::unique_<wbr>ptr<Module> M) {<br>
>>> > +  std::shared_ptr<Module> optimizeModule(std::shared_<wbr>ptr<Module> M) {<br>
>>> >      // Create a function pass manager.<br>
>>> >      auto FPM = llvm::make_unique<legacy::Func<br>
>>> tionPassManager>(M.get());<br>
>>> ><br>
>>> ><br>
>>> > Modified: llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter5/<br>
>>> KaleidoscopeJIT.h<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kale" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/examples/<wbr>Kale</a><br>
>>> idoscope/BuildingAJIT/<wbr>Chapter5/KaleidoscopeJIT.h?<wbr>rev=306166&<br>
>>> r1=306165&r2=306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter5/KaleidoscopeJIT.h<br>
>>> (original)<br>
>>> > +++ llvm/trunk/examples/<wbr>Kaleidoscope/BuildingAJIT/<wbr>Chapter5/KaleidoscopeJIT.h<br>
>>> Fri Jun 23 16:45:29 2017<br>
>>> > @@ -82,7 +82,7 @@ private:<br>
>>> >    IRCompileLayer<decltype(<wbr>ObjectLayer), SimpleCompiler> CompileLayer;<br>
>>> ><br>
>>> >    using OptimizeFunction =<br>
>>> > -      std::function<std::unique_ptr<<wbr>Module>(std::unique_ptr<<wbr>Module>)>;<br>
>>> > +      std::function<std::shared_ptr<<wbr>Module>(std::shared_ptr<<wbr>Module>)>;<br>
>>> ><br>
>>> >    IRTransformLayer<decltype(<wbr>CompileLayer), OptimizeFunction><br>
>>> OptimizeLayer;<br>
>>> ><br>
>>> > @@ -91,7 +91,7 @@ private:<br>
>>> >    MyRemote &Remote;<br>
>>> ><br>
>>> >  public:<br>
>>> > -  using ModuleHandle = decltype(OptimizeLayer)::<wbr>ModuleSetHandleT;<br>
>>> > +  using ModuleHandle = decltype(OptimizeLayer)::<wbr>ModuleHandleT;<br>
>>> ><br>
>>> >    KaleidoscopeJIT(MyRemote &Remote)<br>
>>> >        : TM(EngineBuilder().<wbr>selectTarget(Triple(Remote.<wbr>getTargetTriple()),<br>
>>> "",<br>
>>> > @@ -99,7 +99,7 @@ public:<br>
>>> >          DL(TM->createDataLayout()),<br>
>>> >          CompileLayer(ObjectLayer, SimpleCompiler(*TM)),<br>
>>> >          OptimizeLayer(CompileLayer,<br>
>>> > -                      [this](std::unique_ptr<Module> M) {<br>
>>> > +                      [this](std::shared_ptr<Module> M) {<br>
>>> >                          return optimizeModule(std::move(M));<br>
>>> >                        }),<br>
>>> >          Remote(Remote) {<br>
>>> > @@ -153,15 +153,11 @@ public:<br>
>>> >        exit(1);<br>
>>> >      }<br>
>>> ><br>
>>> > -    // Build a singleton module set to hold our module.<br>
>>> > -    std::vector<std::unique_ptr<<wbr>Module>> Ms;<br>
>>> > -    Ms.push_back(std::move(M));<br>
>>> > -<br>
>>> >      // Add the set to the JIT with the resolver we created above and a<br>
>>> newly<br>
>>> >      // created SectionMemoryManager.<br>
>>> > -    return OptimizeLayer.addModuleSet(<wbr>std::move(Ms),<br>
>>> > -                                      std::move(MemMgr),<br>
>>> > -                                      std::move(Resolver));<br>
>>> > +    return OptimizeLayer.addModule(std::<wbr>move(M),<br>
>>> > +                                   std::move(MemMgr),<br>
>>> > +                                   std::move(Resolver));<br>
>>> >    }<br>
>>> ><br>
>>> >    Error addFunctionAST(std::unique_<wbr>ptr<FunctionAST> FnAST) {<br>
>>> > @@ -231,7 +227,7 @@ public:<br>
>>> >    }<br>
>>> ><br>
>>> >    void removeModule(ModuleHandle H) {<br>
>>> > -    OptimizeLayer.removeModuleSet(<wbr>H);<br>
>>> > +    OptimizeLayer.removeModule(H);<br>
>>> >    }<br>
>>> ><br>
>>> >  private:<br>
>>> > @@ -242,7 +238,7 @@ private:<br>
>>> >      return MangledNameStream.str();<br>
>>> >    }<br>
>>> ><br>
>>> > -  std::unique_ptr<Module> optimizeModule(std::unique_<wbr>ptr<Module> M) {<br>
>>> > +  std::shared_ptr<Module> optimizeModule(std::shared_<wbr>ptr<Module> M) {<br>
>>> >      // Create a function pass manager.<br>
>>> >      auto FPM = llvm::make_unique<legacy::Func<br>
>>> tionPassManager>(M.get());<br>
>>> ><br>
>>> ><br>
>>> > Modified: llvm/trunk/examples/<wbr>Kaleidoscope/include/<wbr>KaleidoscopeJIT.h<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kale" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/examples/<wbr>Kale</a><br>
>>> idoscope/include/<wbr>KaleidoscopeJIT.h?rev=306166&<wbr>r1=306165&r2=<br>
>>> 306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/examples/<wbr>Kaleidoscope/include/<wbr>KaleidoscopeJIT.h<br>
>>> (original)<br>
>>> > +++ llvm/trunk/examples/<wbr>Kaleidoscope/include/<wbr>KaleidoscopeJIT.h Fri Jun<br>
>>> 23 16:45:29 2017<br>
>>> > @@ -41,7 +41,7 @@ class KaleidoscopeJIT {<br>
>>> >  public:<br>
>>> >    using ObjLayerT = RTDyldObjectLinkingLayer;<br>
>>> >    using CompileLayerT = IRCompileLayer<ObjLayerT, SimpleCompiler>;<br>
>>> > -  using ModuleHandleT = CompileLayerT::<wbr>ModuleSetHandleT;<br>
>>> > +  using ModuleHandleT = CompileLayerT::ModuleHandleT;<br>
>>> ><br>
>>> >    KaleidoscopeJIT()<br>
>>> >        : TM(EngineBuilder().<wbr>selectTarget()),<br>
>>> DL(TM->createDataLayout()),<br>
>>> > @@ -62,9 +62,9 @@ public:<br>
>>> >            return JITSymbol(nullptr);<br>
>>> >          },<br>
>>> >          [](const std::string &S) { return nullptr; });<br>
>>> > -    auto H = CompileLayer.addModuleSet(<wbr>singletonSet(std::move(M)),<br>
>>> > -                                       make_unique<SectionMemoryMana<br>
>>> ger>(),<br>
>>> > -                                       std::move(Resolver));<br>
>>> > +    auto H = CompileLayer.addModule(std::<wbr>move(M),<br>
>>> > +                                    make_unique<SectionMemoryManag<br>
>>> er>(),<br>
>>> > +                                    std::move(Resolver));<br>
>>> ><br>
>>> >      ModuleHandles.push_back(H);<br>
>>> >      return H;<br>
>>> > @@ -72,7 +72,7 @@ public:<br>
>>> ><br>
>>> >    void removeModule(ModuleHandleT H) {<br>
>>> >      ModuleHandles.erase(find(<wbr>ModuleHandles, H));<br>
>>> > -    CompileLayer.removeModuleSet(<wbr>H);<br>
>>> > +    CompileLayer.removeModule(H);<br>
>>> >    }<br>
>>> ><br>
>>> >    JITSymbol findSymbol(const std::string Name) {<br>
>>> > @@ -89,12 +89,6 @@ private:<br>
>>> >      return MangledName;<br>
>>> >    }<br>
>>> ><br>
>>> > -  template <typename T> static std::vector<T> singletonSet(T t) {<br>
>>> > -    std::vector<T> Vec;<br>
>>> > -    Vec.push_back(std::move(t));<br>
>>> > -    return Vec;<br>
>>> > -  }<br>
>>> > -<br>
>>> >    JITSymbol findMangledSymbol(const std::string &Name) {<br>
>>> >  #ifdef LLVM_ON_WIN32<br>
>>> >      // The symbol lookup of ObjectLinkingLayer uses the<br>
>>> SymbolRef::SF_Exported<br>
>>> ><br>
>>> > Modified: llvm/trunk/include/llvm-c/<wbr>OrcBindings.h<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm-</a><br>
>>> c/OrcBindings.h?rev=306166&r1=<wbr>306165&r2=306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/include/llvm-c/<wbr>OrcBindings.h (original)<br>
>>> > +++ llvm/trunk/include/llvm-c/<wbr>OrcBindings.h Fri Jun 23 16:45:29 2017<br>
>>> > @@ -29,6 +29,8 @@<br>
>>> >  extern "C" {<br>
>>> >  #endif<br>
>>> ><br>
>>> > +typedef struct LLVMOpaqueSharedModule *LLVMSharedModuleRef;<br>
>>> > +typedef struct LLVMOpaqueSharedObjectBuffer *LLVMSharedObjectBufferRef;<br>
>>> >  typedef struct LLVMOrcOpaqueJITStack *LLVMOrcJITStackRef;<br>
>>> >  typedef uint32_t LLVMOrcModuleHandle;<br>
>>> >  typedef uint64_t LLVMOrcTargetAddress;<br>
>>> > @@ -39,6 +41,45 @@ typedef uint64_t (*LLVMOrcLazyCompileCal<br>
>>> >  typedef enum { LLVMOrcErrSuccess = 0, LLVMOrcErrGeneric }<br>
>>> LLVMOrcErrorCode;<br>
>>> ><br>
>>> >  /**<br>
>>> > + * Turn an LLVMModuleRef into an LLVMSharedModuleRef.<br>
>>> > + *<br>
>>> > + * The JIT uses shared ownership for LLVM modules, since it is<br>
>>> generally<br>
>>> > + * difficult to know when the JIT will be finished with a module (and<br>
>>> the JIT<br>
>>> > + * has no way of knowing when a user may be finished with one).<br>
>>> > + *<br>
>>> > + * Calling this method with an LLVMModuleRef creates a shared-pointer<br>
>>> to the<br>
>>> > + * module, and returns a reference to this shared pointer.<br>
>>> > + *<br>
>>> > + * The shared module should be disposed when finished with by calling<br>
>>> > + * LLVMOrcDisposeSharedModule (not LLVMDisposeModule). The Module will<br>
>>> be<br>
>>> > + * deleted when the last shared pointer owner relinquishes it.<br>
>>> > + */<br>
>>> > +<br>
>>> > +LLVMSharedModuleRef LLVMOrcMakeSharedModule(<wbr>LLVMModuleRef Mod);<br>
>>> > +<br>
>>> > +/**<br>
>>> > + * Dispose of a shared module.<br>
>>> > + *<br>
>>> > + * The module should not be accessed after this call. The module will<br>
>>> be<br>
>>> > + * deleted once all clients (including the JIT itself) have released<br>
>>> their<br>
>>> > + * shared pointers.<br>
>>> > + */<br>
>>> > +<br>
>>> > +void LLVMOrcDisposeSharedModuleRef(<wbr>LLVMSharedModuleRef SharedMod);<br>
>>> > +<br>
>>> > +/**<br>
>>> > + * Get an LLVMSharedObjectBufferRef from an LLVMMemoryBufferRef.<br>
>>> > + */<br>
>>> > +LLVMSharedObjectBufferRef<br>
>>> > +<wbr>LLVMOrcMakeSharedObjectBuffer(<wbr>LLVMMemoryBufferRef ObjBuffer);<br>
>>> > +<br>
>>> > +/**<br>
>>> > + * Dispose of a shared object buffer.<br>
>>> > + */<br>
>>> > +void<br>
>>> > +<wbr>LLVMOrcDisposeSharedObjectBuff<wbr>erRef(<wbr>LLVMSharedObjectBufferRef<br>
>>> SharedObjBuffer);<br>
>>> > +<br>
>>> > +/**<br>
>>> >   * Create an ORC JIT stack.<br>
>>> >   *<br>
>>> >   * The client owns the resulting stack, and must call<br>
>>> OrcDisposeInstance(...)<br>
>>> > @@ -95,7 +136,8 @@ LLVMOrcErrorCode LLVMOrcSetIndirectStubP<br>
>>> >   * Add module to be eagerly compiled.<br>
>>> >   */<br>
>>> >  LLVMOrcModuleHandle<br>
>>> > -LLVMOrcAddEagerlyCompiledIR(<wbr>LLVMOrcJITStackRef JITStack,<br>
>>> LLVMModuleRef Mod,<br>
>>> > +LLVMOrcAddEagerlyCompiledIR(<wbr>LLVMOrcJITStackRef JITStack,<br>
>>> > +                            LLVMSharedModuleRef Mod,<br>
>>> >                              LLVMOrcSymbolResolverFn SymbolResolver,<br>
>>> >                              void *SymbolResolverCtx);<br>
>>> ><br>
>>> > @@ -103,7 +145,8 @@ LLVMOrcAddEagerlyCompiledIR(<wbr>LLVMOrcJITSt<br>
>>> >   * Add module to be lazily compiled one function at a time.<br>
>>> >   */<br>
>>> >  LLVMOrcModuleHandle<br>
>>> > -LLVMOrcAddLazilyCompiledIR(<wbr>LLVMOrcJITStackRef JITStack, LLVMModuleRef<br>
>>> Mod,<br>
>>> > +LLVMOrcAddLazilyCompiledIR(<wbr>LLVMOrcJITStackRef JITStack,<br>
>>> > +                           LLVMSharedModuleRef Mod,<br>
>>> >                             LLVMOrcSymbolResolverFn SymbolResolver,<br>
>>> >                             void *SymbolResolverCtx);<br>
>>> ><br>
>>> > @@ -111,7 +154,7 @@ LLVMOrcAddLazilyCompiledIR(<wbr>LLVMOrcJITSta<br>
>>> >   * Add an object file.<br>
>>> >   */<br>
>>> >  LLVMOrcModuleHandle LLVMOrcAddObjectFile(<wbr>LLVMOrcJITStackRef JITStack,<br>
>>> > -                                         LLVMObjectFileRef Obj,<br>
>>> > +                                         LLVMSharedObjectBufferRef Obj,<br>
>>> >                                           LLVMOrcSymbolResolverFn<br>
>>> SymbolResolver,<br>
>>> >                                           void *SymbolResolverCtx);<br>
>>> ><br>
>>> ><br>
>>> > Modified: llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>CompileOnDemandL<br>
>>> ayer.h<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/</a><br>
>>> ExecutionEngine/Orc/<wbr>CompileOnDemandLayer.h?rev=<wbr>306166&r1=<br>
>>> 306165&r2=306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>CompileOnDemandLayer.h<br>
>>> (original)<br>
>>> > +++ llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>CompileOnDemandLayer.h<br>
>>> Fri Jun 23 16:45:29 2017<br>
>>> > @@ -84,7 +84,7 @@ private:<br>
>>> >      return LambdaMaterializer<<wbr>MaterializerFtor>(std::move(M)<wbr>);<br>
>>> >    }<br>
>>> ><br>
>>> > -  using BaseLayerModuleSetHandleT = typename<br>
>>> BaseLayerT::ModuleSetHandleT;<br>
>>> > +  using BaseLayerModuleHandleT = typename BaseLayerT::ModuleHandleT;<br>
>>> ><br>
>>> >    // Provide type-erasure for the Modules and MemoryManagers.<br>
>>> >    template <typename ResourceT><br>
>>> > @@ -139,9 +139,11 @@ private:<br>
>>> >    struct LogicalDylib {<br>
>>> >      using SymbolResolverFtor = std::function<JITSymbol(const<br>
>>> std::string&)>;<br>
>>> ><br>
>>> > -    using ModuleAdderFtor = std::function<typename<br>
>>> BaseLayerT::ModuleSetHandleT(<br>
>>> > -        BaseLayerT &, std::unique_ptr<Module>,<br>
>>> > -        std::unique_ptr<<wbr>JITSymbolResolver>)>;<br>
>>> > +    using ModuleAdderFtor =<br>
>>> > +      std::function<typename BaseLayerT::ModuleHandleT(<br>
>>> > +                    BaseLayerT&,<br>
>>> > +                    std::unique_ptr<Module>,<br>
>>> > +                    std::unique_ptr<<wbr>JITSymbolResolver>)>;<br>
>>> ><br>
>>> >      struct SourceModuleEntry {<br>
>>> >        std::unique_ptr<ResourceOwner<<wbr>Module>> SourceMod;<br>
>>> > @@ -179,7 +181,7 @@ private:<br>
>>> ><br>
>>> >      void removeModulesFromBaseLayer(<wbr>BaseLayerT &BaseLayer) {<br>
>>> >        for (auto &BLH : BaseLayerHandles)<br>
>>> > -        BaseLayer.removeModuleSet(BLH)<wbr>;<br>
>>> > +        BaseLayer.removeModule(BLH);<br>
>>> >      }<br>
>>> ><br>
>>> >      std::unique_ptr<<wbr>JITSymbolResolver> ExternalSymbolResolver;<br>
>>> > @@ -188,14 +190,14 @@ private:<br>
>>> >      StaticGlobalRenamer StaticRenamer;<br>
>>> >      ModuleAdderFtor ModuleAdder;<br>
>>> >      SourceModulesList SourceModules;<br>
>>> > -    std::vector<<wbr>BaseLayerModuleSetHandleT> BaseLayerHandles;<br>
>>> > +    std::vector<<wbr>BaseLayerModuleHandleT> BaseLayerHandles;<br>
>>> >    };<br>
>>> ><br>
>>> >    using LogicalDylibList = std::list<LogicalDylib>;<br>
>>> ><br>
>>> >  public:<br>
>>> > -  /// @brief Handle to a set of loaded modules.<br>
>>> > -  using ModuleSetHandleT = typename LogicalDylibList::iterator;<br>
>>> > +  /// @brief Handle to loaded module.<br>
>>> > +  using ModuleHandleT = typename LogicalDylibList::iterator;<br>
>>> ><br>
>>> >    /// @brief Module partitioning functor.<br>
>>> >    using PartitioningFtor = std::function<std::set<Functio<br>
>>> n*>(Function&)>;<br>
>>> > @@ -216,15 +218,15 @@ public:<br>
>>> ><br>
>>> >    ~CompileOnDemandLayer() {<br>
>>> >      while (!LogicalDylibs.empty())<br>
>>> > -      removeModuleSet(LogicalDylibs.<wbr>begin());<br>
>>> > +      removeModule(LogicalDylibs.<wbr>begin());<br>
>>> >    }<br>
>>> > -<br>
>>> > +<br>
>>> >    /// @brief Add a module to the compile-on-demand layer.<br>
>>> > -  template <typename ModuleSetT, typename MemoryManagerPtrT,<br>
>>> > -            typename SymbolResolverPtrT><br>
>>> > -  ModuleSetHandleT addModuleSet(ModuleSetT Ms,<br>
>>> > -                                MemoryManagerPtrT MemMgr,<br>
>>> > -                                SymbolResolverPtrT Resolver) {<br>
>>> > +  template <typename MemoryManagerPtrT, typename SymbolResolverPtrT><br>
>>> > +  ModuleHandleT addModule(std::shared_ptr<<wbr>Module> M,<br>
>>> > +                          MemoryManagerPtrT MemMgr,<br>
>>> > +                          SymbolResolverPtrT Resolver) {<br>
>>> > +<br>
>>> >      LogicalDylibs.push_back(<wbr>LogicalDylib());<br>
>>> >      auto &LD = LogicalDylibs.back();<br>
>>> >      LD.ExternalSymbolResolver = std::move(Resolver);<br>
>>> > @@ -236,23 +238,25 @@ public:<br>
>>> >      LD.ModuleAdder =<br>
>>> >        [&MemMgrRef](BaseLayerT &B, std::unique_ptr<Module> M,<br>
>>> >                     std::unique_ptr<<wbr>JITSymbolResolver> R) {<br>
>>> > -        std::vector<std::unique_ptr<<wbr>Module>> Ms;<br>
>>> > -        Ms.push_back(std::move(M));<br>
>>> > -        return B.addModuleSet(std::move(Ms), &MemMgrRef, std::move(R));<br>
>>> > +        return B.addModule(std::move(M), &MemMgrRef, std::move(R));<br>
>>> >        };<br>
>>> ><br>
>>> >      // Process each of the modules in this module set.<br>
>>> > -    for (auto &M : Ms)<br>
>>> > -      addLogicalModule(<wbr>LogicalDylibs.back(), std::move(M));<br>
>>> > +    addLogicalModule(<wbr>LogicalDylibs.back(), std::move(M));<br>
>>> ><br>
>>> >      return std::prev(LogicalDylibs.end())<wbr>;<br>
>>> >    }<br>
>>> ><br>
>>> > +  /// @brief Add extra modules to an existing logical module.<br>
>>> > +  void addExtraModule(ModuleHandleT H, std::shared_ptr<Module> M) {<br>
>>> > +    addLogicalModule(*H, std::move(M));<br>
>>> > +  }<br>
>>> > +<br>
>>> >    /// @brief Remove the module represented by the given handle.<br>
>>> >    ///<br>
>>> >    ///   This will remove all modules in the layers below that were<br>
>>> derived from<br>
>>> >    /// the module represented by H.<br>
>>> > -  void removeModuleSet(<wbr>ModuleSetHandleT H) {<br>
>>> > +  void removeModule(ModuleHandleT H) {<br>
>>> >      H->removeModulesFromBaseLayer(<wbr>BaseLayer);<br>
>>> >      LogicalDylibs.erase(H);<br>
>>> >    }<br>
>>> > @@ -274,7 +278,7 @@ public:<br>
>>> ><br>
>>> >    /// @brief Get the address of a symbol provided by this layer, or<br>
>>> some layer<br>
>>> >    ///        below this one.<br>
>>> > -  JITSymbol findSymbolIn(ModuleSetHandleT H, const std::string &Name,<br>
>>> > +  JITSymbol findSymbolIn(ModuleHandleT H, const std::string &Name,<br>
>>> >                           bool ExportedSymbolsOnly) {<br>
>>> >      return H->findSymbol(BaseLayer, Name, ExportedSymbolsOnly);<br>
>>> >    }<br>
>>> > @@ -498,7 +502,7 @@ private:<br>
>>> >    }<br>
>>> ><br>
>>> >    template <typename PartitionT><br>
>>> > -  BaseLayerModuleSetHandleT<br>
>>> > +  BaseLayerModuleHandleT<br>
>>> >    emitPartition(LogicalDylib &LD,<br>
>>> >                  typename LogicalDylib::<wbr>SourceModuleHandle LMId,<br>
>>> >                  const PartitionT &Part) {<br>
>>> ><br>
>>> > Modified: llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>ExecutionUtils.h<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/</a><br>
>>> ExecutionEngine/Orc/<wbr>ExecutionUtils.h?rev=306166&<wbr>r1=306165&<br>
>>> r2=306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>ExecutionUtils.h<br>
>>> (original)<br>
>>> > +++ llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>ExecutionUtils.h Fri<br>
>>> Jun 23 16:45:29 2017<br>
>>> > @@ -94,7 +94,7 @@ public:<br>
>>> >    /// @brief Construct a CtorDtorRunner for the given range using the<br>
>>> given<br>
>>> >    ///        name mangling function.<br>
>>> >    CtorDtorRunner(std::vector<<wbr>std::string> CtorDtorNames,<br>
>>> > -                 typename JITLayerT::ModuleSetHandleT H)<br>
>>> > +                 typename JITLayerT::ModuleHandleT H)<br>
>>> >        : CtorDtorNames(std::move(<wbr>CtorDtorNames)), H(H) {}<br>
>>> ><br>
>>> >    /// @brief Run the recorded constructors/destructors through the<br>
>>> given JIT<br>
>>> > @@ -116,7 +116,7 @@ public:<br>
>>> ><br>
>>> >  private:<br>
>>> >    std::vector<std::string> CtorDtorNames;<br>
>>> > -  typename JITLayerT::ModuleSetHandleT H;<br>
>>> > +  typename JITLayerT::ModuleHandleT H;<br>
>>> >  };<br>
>>> ><br>
>>> >  /// @brief Support class for static dtor execution. For hosted<br>
>>> (in-process) JITs<br>
>>> ><br>
>>> > Modified: llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>IRCompileLayer.h<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/</a><br>
>>> ExecutionEngine/Orc/<wbr>IRCompileLayer.h?rev=306166&<wbr>r1=306165&<br>
>>> r2=306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>IRCompileLayer.h<br>
>>> (original)<br>
>>> > +++ llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>IRCompileLayer.h Fri<br>
>>> Jun 23 16:45:29 2017<br>
>>> > @@ -28,15 +28,15 @@ namespace orc {<br>
>>> ><br>
>>> >  /// @brief Eager IR compiling layer.<br>
>>> >  ///<br>
>>> > -///   This layer accepts sets of LLVM IR Modules (via addModuleSet). It<br>
>>> > -/// immediately compiles each IR module to an object file (each IR<br>
>>> Module is<br>
>>> > -/// compiled separately). The resulting set of object files is then<br>
>>> added to<br>
>>> > -/// the layer below, which must implement the object layer concept.<br>
>>> > +///   This layer immediately compiles each IR module added via<br>
>>> addModule to an<br>
>>> > +/// object file and adds this module file to the layer below, which<br>
>>> must<br>
>>> > +/// implement the object layer concept.<br>
>>> >  template <typename BaseLayerT, typename CompileFtor><br>
>>> >  class IRCompileLayer {<br>
>>> >  public:<br>
>>> > -  /// @brief Handle to a set of compiled modules.<br>
>>> > -  using ModuleSetHandleT = typename BaseLayerT::ObjHandleT;<br>
>>> > +<br>
>>> > +  /// @brief Handle to a compiled module.<br>
>>> > +  using ModuleHandleT = typename BaseLayerT::ObjHandleT;<br>
>>> ><br>
>>> >    /// @brief Construct an IRCompileLayer with the given BaseLayer,<br>
>>> which must<br>
>>> >    ///        implement the ObjectLayer concept.<br>
>>> > @@ -46,25 +46,22 @@ public:<br>
>>> >    /// @brief Get a reference to the compiler functor.<br>
>>> >    CompileFtor& getCompiler() { return Compile; }<br>
>>> ><br>
>>> > -  /// @brief Compile each module in the given module set, then add the<br>
>>> resulting<br>
>>> > -  ///        set of objects to the base layer along with the memory<br>
>>> manager and<br>
>>> > -  ///        symbol resolver.<br>
>>> > +  /// @brief Compile the module, and add the resulting object to the<br>
>>> base layer<br>
>>> > +  ///        along with the given memory manager and symbol resolver.<br>
>>> >    ///<br>
>>> > -  /// @return A handle for the added modules.<br>
>>> > -  template <typename ModuleSetT, typename MemoryManagerPtrT,<br>
>>> > -            typename SymbolResolverPtrT><br>
>>> > -  ModuleSetHandleT addModuleSet(ModuleSetT Ms,<br>
>>> > -                                MemoryManagerPtrT MemMgr,<br>
>>> > -                                SymbolResolverPtrT Resolver) {<br>
>>> > -    assert(Ms.size() == 1);<br>
>>> > -    using CompileResult = decltype(Compile(*Ms.front()))<wbr>;<br>
>>> > -    auto Obj = std::make_shared<<wbr>CompileResult>(Compile(*Ms.<wbr>front()));<br>
>>> > +  /// @return A handle for the added module.<br>
>>> > +  template <typename MemoryManagerPtrT, typename SymbolResolverPtrT><br>
>>> > +  ModuleHandleT addModule(std::shared_ptr<<wbr>Module> M,<br>
>>> > +                          MemoryManagerPtrT MemMgr,<br>
>>> > +                          SymbolResolverPtrT Resolver) {<br>
>>> > +    using CompileResult = decltype(Compile(*M));<br>
>>> > +    auto Obj = std::make_shared<<wbr>CompileResult>(Compile(*M));<br>
>>> >      return BaseLayer.addObject(std::move(<wbr>Obj), std::move(MemMgr),<br>
>>> >                                 std::move(Resolver));<br>
>>> >    }<br>
>>> ><br>
>>> > -  /// @brief Remove the module set associated with the handle H.<br>
>>> > -  void removeModuleSet(<wbr>ModuleSetHandleT H) {<br>
>>> BaseLayer.removeObject(H); }<br>
>>> > +  /// @brief Remove the module associated with the handle H.<br>
>>> > +  void removeModule(ModuleHandleT H) { BaseLayer.removeObject(H); }<br>
>>> ><br>
>>> >    /// @brief Search for the given named symbol.<br>
>>> >    /// @param Name The name of the symbol to search for.<br>
>>> > @@ -74,23 +71,23 @@ public:<br>
>>> >      return BaseLayer.findSymbol(Name, ExportedSymbolsOnly);<br>
>>> >    }<br>
>>> ><br>
>>> > -  /// @brief Get the address of the given symbol in the context of the<br>
>>> set of<br>
>>> > -  ///        compiled modules represented by the handle H. This call is<br>
>>> > -  ///        forwarded to the base layer's implementation.<br>
>>> > -  /// @param H The handle for the module set to search in.<br>
>>> > +  /// @brief Get the address of the given symbol in compiled module<br>
>>> represented<br>
>>> > +  ///        by the handle H. This call is forwarded to the base<br>
>>> layer's<br>
>>> > +  ///        implementation.<br>
>>> > +  /// @param H The handle for the module to search in.<br>
>>> >    /// @param Name The name of the symbol to search for.<br>
>>> >    /// @param ExportedSymbolsOnly If true, search only for exported<br>
>>> symbols.<br>
>>> >    /// @return A handle for the given named symbol, if it is found in<br>
>>> the<br>
>>> > -  ///         given module set.<br>
>>> > -  JITSymbol findSymbolIn(ModuleSetHandleT H, const std::string &Name,<br>
>>> > +  ///         given module.<br>
>>> > +  JITSymbol findSymbolIn(ModuleHandleT H, const std::string &Name,<br>
>>> >                           bool ExportedSymbolsOnly) {<br>
>>> >      return BaseLayer.findSymbolIn(H, Name, ExportedSymbolsOnly);<br>
>>> >    }<br>
>>> ><br>
>>> > -  /// @brief Immediately emit and finalize the moduleOB set<br>
>>> represented by the<br>
>>> > -  ///        given handle.<br>
>>> > -  /// @param H Handle for module set to emit/finalize.<br>
>>> > -  void emitAndFinalize(<wbr>ModuleSetHandleT H) {<br>
>>> > +  /// @brief Immediately emit and finalize the module represented by<br>
>>> the given<br>
>>> > +  ///        handle.<br>
>>> > +  /// @param H Handle for module to emit/finalize.<br>
>>> > +  void emitAndFinalize(ModuleHandleT H) {<br>
>>> >      BaseLayer.emitAndFinalize(H);<br>
>>> >    }<br>
>>> ><br>
>>> ><br>
>>> > Modified: llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>IRTransformLayer<br>
>>> .h<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/</a><br>
>>> ExecutionEngine/Orc/<wbr>IRTransformLayer.h?rev=306166&<wbr>r1=306165&<br>
>>> r2=306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>IRTransformLayer.h<br>
>>> (original)<br>
>>> > +++ llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>IRTransformLayer.h Fri<br>
>>> Jun 23 16:45:29 2017<br>
>>> > @@ -22,39 +22,34 @@ namespace orc {<br>
>>> ><br>
>>> >  /// @brief IR mutating layer.<br>
>>> >  ///<br>
>>> > -///   This layer accepts sets of LLVM IR Modules (via addModuleSet). It<br>
>>> > -/// immediately applies the user supplied functor to each module, then<br>
>>> adds<br>
>>> > -/// the set of transformed modules to the layer below.<br>
>>> > +///   This layer applies a user supplied transform to each module that<br>
>>> is added,<br>
>>> > +/// then adds the transformed module to the layer below.<br>
>>> >  template <typename BaseLayerT, typename TransformFtor><br>
>>> >  class IRTransformLayer {<br>
>>> >  public:<br>
>>> > +<br>
>>> >    /// @brief Handle to a set of added modules.<br>
>>> > -  using ModuleSetHandleT = typename BaseLayerT::ModuleSetHandleT;<br>
>>> > +  using ModuleHandleT = typename BaseLayerT::ModuleHandleT;<br>
>>> ><br>
>>> >    /// @brief Construct an IRTransformLayer with the given BaseLayer<br>
>>> >    IRTransformLayer(BaseLayerT &BaseLayer,<br>
>>> >                     TransformFtor Transform = TransformFtor())<br>
>>> >      : BaseLayer(BaseLayer), Transform(std::move(Transform)<wbr>) {}<br>
>>> ><br>
>>> > -  /// @brief Apply the transform functor to each module in the module<br>
>>> set, then<br>
>>> > -  ///        add the resulting set of modules to the base layer, along<br>
>>> with the<br>
>>> > -  ///        memory manager and symbol resolver.<br>
>>> > +  /// @brief Apply the transform functor to the module, then add the<br>
>>> module to<br>
>>> > +  ///        the layer below, along with the memory manager and symbol<br>
>>> resolver.<br>
>>> >    ///<br>
>>> >    /// @return A handle for the added modules.<br>
>>> > -  template <typename ModuleSetT, typename MemoryManagerPtrT,<br>
>>> > -            typename SymbolResolverPtrT><br>
>>> > -  ModuleSetHandleT addModuleSet(ModuleSetT Ms,<br>
>>> > -                                MemoryManagerPtrT MemMgr,<br>
>>> > -                                SymbolResolverPtrT Resolver) {<br>
>>> > -    for (auto I = Ms.begin(), E = Ms.end(); I != E; ++I)<br>
>>> > -      *I = Transform(std::move(*I));<br>
>>> > -<br>
>>> > -    return BaseLayer.addModuleSet(std::<wbr>move(Ms), std::move(MemMgr),<br>
>>> > -                                  std::move(Resolver));<br>
>>> > +  template <typename MemoryManagerPtrT, typename SymbolResolverPtrT><br>
>>> > +  ModuleHandleT addModule(std::shared_ptr<<wbr>Module> M,<br>
>>> > +                          MemoryManagerPtrT MemMgr,<br>
>>> > +                          SymbolResolverPtrT Resolver) {<br>
>>> > +    return BaseLayer.addModule(Transform(<wbr>std::move(M)),<br>
>>> std::move(MemMgr),<br>
>>> > +                               std::move(Resolver));<br>
>>> >    }<br>
>>> ><br>
>>> > -  /// @brief Remove the module set associated with the handle H.<br>
>>> > -  void removeModuleSet(<wbr>ModuleSetHandleT H) {<br>
>>> BaseLayer.removeModuleSet(H); }<br>
>>> > +  /// @brief Remove the module associated with the handle H.<br>
>>> > +  void removeModule(ModuleHandleT H) { BaseLayer.removeModule(H); }<br>
>>> ><br>
>>> >    /// @brief Search for the given named symbol.<br>
>>> >    /// @param Name The name of the symbol to search for.<br>
>>> > @@ -64,23 +59,23 @@ public:<br>
>>> >      return BaseLayer.findSymbol(Name, ExportedSymbolsOnly);<br>
>>> >    }<br>
>>> ><br>
>>> > -  /// @brief Get the address of the given symbol in the context of the<br>
>>> set of<br>
>>> > -  ///        modules represented by the handle H. This call is<br>
>>> forwarded to the<br>
>>> > -  ///        base layer's implementation.<br>
>>> > -  /// @param H The handle for the module set to search in.<br>
>>> > +  /// @brief Get the address of the given symbol in the context of the<br>
>>> module<br>
>>> > +  ///        represented by the handle H. This call is forwarded to<br>
>>> the base<br>
>>> > +  ///        layer's implementation.<br>
>>> > +  /// @param H The handle for the module to search in.<br>
>>> >    /// @param Name The name of the symbol to search for.<br>
>>> >    /// @param ExportedSymbolsOnly If true, search only for exported<br>
>>> symbols.<br>
>>> >    /// @return A handle for the given named symbol, if it is found in<br>
>>> the<br>
>>> > -  ///         given module set.<br>
>>> > -  JITSymbol findSymbolIn(ModuleSetHandleT H, const std::string &Name,<br>
>>> > +  ///         given module.<br>
>>> > +  JITSymbol findSymbolIn(ModuleHandleT H, const std::string &Name,<br>
>>> >                           bool ExportedSymbolsOnly) {<br>
>>> >      return BaseLayer.findSymbolIn(H, Name, ExportedSymbolsOnly);<br>
>>> >    }<br>
>>> ><br>
>>> > -  /// @brief Immediately emit and finalize the module set represented<br>
>>> by the<br>
>>> > -  ///        given handle.<br>
>>> > -  /// @param H Handle for module set to emit/finalize.<br>
>>> > -  void emitAndFinalize(<wbr>ModuleSetHandleT H) {<br>
>>> > +  /// @brief Immediately emit and finalize the module represented by<br>
>>> the given<br>
>>> > +  ///        handle.<br>
>>> > +  /// @param H Handle for module to emit/finalize.<br>
>>> > +  void emitAndFinalize(ModuleHandleT H) {<br>
>>> >      BaseLayer.emitAndFinalize(H);<br>
>>> >    }<br>
>>> ><br>
>>> ><br>
>>> > Modified: llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>LazyEmittingLaye<br>
>>> r.h<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/</a><br>
>>> ExecutionEngine/Orc/<wbr>LazyEmittingLayer.h?rev=<wbr>306166&r1=<br>
>>> 306165&r2=306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>LazyEmittingLayer.h<br>
>>> (original)<br>
>>> > +++ llvm/trunk/include/llvm/<wbr>ExecutionEngine/Orc/<wbr>LazyEmittingLayer.h<br>
>>> Fri Jun 23 16:45:29 2017<br>
>>> > @@ -34,19 +34,20 @@ namespace orc {<br>
>>> ><br>
>>> >  /// @brief Lazy-emitting IR layer.<br>
>>> >  ///<br>
>>> > -///   This layer accepts sets of LLVM IR Modules (via addModuleSet),<br>
>>> but does<br>
>>> > -/// not immediately emit them the layer below. Instead, emissing to<br>
>>> the base<br>
>>> > -/// layer is deferred until the first time the client requests the<br>
>>> address<br>
>>> > -/// (via JITSymbol::getAddress) for a symbol contained in this layer.<br>
>>> > +///   This layer accepts LLVM IR Modules (via addModule), but does not<br>
>>> > +/// immediately emit them the layer below. Instead, emissing to the<br>
>>> base layer<br>
>>> > +/// is deferred until the first time the client requests the address<br>
>>> (via<br>
>>> > +/// JITSymbol::getAddress) for a symbol contained in this layer.<br>
>>> >  template <typename BaseLayerT> class LazyEmittingLayer {<br>
>>> >  public:<br>
>>> > -  using BaseLayerHandleT = typename BaseLayerT::ModuleSetHandleT;<br>
>>> > +<br>
>>> > +  using BaseLayerHandleT = typename BaseLayerT::ModuleHandleT;<br>
>>> ><br>
>>> >  private:<br>
>>> > -  class EmissionDeferredSet {<br>
>>> > +  class EmissionDeferredModule {<br>
>>> >    public:<br>
>>> > -    EmissionDeferredSet() = default;<br>
>>> > -    virtual ~EmissionDeferredSet() = default;<br>
>>> > +    EmissionDeferredModule() = default;<br>
>>> > +    virtual ~EmissionDeferredModule() = default;<br>
>>> ><br>
>>> >      JITSymbol find(StringRef Name, bool ExportedSymbolsOnly,<br>
>>> BaseLayerT &B) {<br>
>>> >        switch (EmitState) {<br>
>>> > @@ -84,9 +85,9 @@ private:<br>
>>> >        llvm_unreachable("Invalid emit-state.");<br>
>>> >      }<br>
>>> ><br>
>>> > -    void removeModulesFromBaseLayer(<wbr>BaseLayerT &BaseLayer) {<br>
>>> > +    void removeModuleFromBaseLayer(<wbr>BaseLayerT &BaseLayer) {<br>
>>> >        if (EmitState != NotEmitted)<br>
>>> > -        BaseLayer.removeModuleSet(<wbr>Handle);<br>
>>> > +        BaseLayer.removeModule(Handle)<wbr>;<br>
>>> >      }<br>
>>> ><br>
>>> >      void emitAndFinalize(BaseLayerT &BaseLayer) {<br>
>>> > @@ -100,10 +101,9 @@ private:<br>
>>> >        BaseLayer.emitAndFinalize(<wbr>Handle);<br>
>>> >      }<br>
>>> ><br>
>>> > -    template <typename ModuleSetT, typename MemoryManagerPtrT,<br>
>>> > -              typename SymbolResolverPtrT><br>
>>> > -    static std::unique_ptr<<wbr>EmissionDeferredSet><br>
>>> > -    create(BaseLayerT &B, ModuleSetT Ms, MemoryManagerPtrT MemMgr,<br>
>>> > +    template <typename MemoryManagerPtrT, typename SymbolResolverPtrT><br>
>>> > +    static std::unique_ptr<<wbr>EmissionDeferredModule><br>
>>> > +    create(BaseLayerT &B, std::shared_ptr<Module> M, MemoryManagerPtrT<br>
>>> MemMgr,<br>
>>> >             SymbolResolverPtrT Resolver);<br>
>>> ><br>
>>> >    protected:<br>
>>> > @@ -116,14 +116,13 @@ private:<br>
>>> >      BaseLayerHandleT Handle;<br>
>>> >    };<br>
>>> ><br>
>>> > -  template <typename ModuleSetT, typename MemoryManagerPtrT,<br>
>>> > -            typename SymbolResolverPtrT><br>
>>> > -  class EmissionDeferredSetImpl : public EmissionDeferredSet {<br>
>>> > +  template <typename MemoryManagerPtrT, typename SymbolResolverPtrT><br>
>>> > +  class EmissionDeferredModuleImpl : public EmissionDeferredModule {<br>
>>> >    public:<br>
>>> > -    EmissionDeferredSetImpl(<wbr>ModuleSetT Ms,<br>
>>> > -                            MemoryManagerPtrT MemMgr,<br>
>>> > -                            SymbolResolverPtrT Resolver)<br>
>>> > -        : Ms(std::move(Ms)), MemMgr(std::move(MemMgr)),<br>
>>> > +    EmissionDeferredModuleImpl(<wbr>std::shared_ptr<Module> M,<br>
>>> > +                               MemoryManagerPtrT MemMgr,<br>
>>> > +                               SymbolResolverPtrT Resolver)<br>
>>> > +        : M(std::move(M)), MemMgr(std::move(MemMgr)),<br>
>>> >            Resolver(std::move(Resolver)) {}<br>
>>> ><br>
>>> >    protected:<br>
>>> > @@ -154,8 +153,8 @@ private:<br>
>>> >        // We don't need the mangled names set any more: Once we've<br>
>>> emitted this<br>
>>> >        // to the base layer we'll just look for symbols there.<br>
>>> >        MangledSymbols.reset();<br>
>>> > -      return BaseLayer.addModuleSet(std::<wbr>move(Ms), std::move(MemMgr),<br>
>>> > -                                    std::move(Resolver));<br>
>>> > +      return BaseLayer.addModule(std::move(<wbr>M), std::move(MemMgr),<br>
>>> > +                                 std::move(Resolver));<br>
>>> >      }<br>
>>> ><br>
>>> >    private:<br>
>>> > @@ -197,56 +196,54 @@ private:<br>
>>> ><br>
>>> >        auto Symbols = llvm::make_unique<StringMap<<wbr>const<br>
>>> GlobalValue*>>();<br>
>>> ><br>
>>> > -      for (const auto &M : Ms) {<br>
>>> > -        Mangler Mang;<br>
>>> > +      Mangler Mang;<br>
>>> ><br>
>>> > -        for (const auto &GO : M->global_objects())<br>
>>> > +      for (const auto &GO : M->global_objects())<br>
>>> >            if (auto GV = addGlobalValue(*Symbols, GO, Mang, SearchName,<br>
>>> >                                         ExportedSymbolsOnly))<br>
>>> >              return GV;<br>
>>> > -      }<br>
>>> ><br>
>>> >        MangledSymbols = std::move(Symbols);<br>
>>> >        return nullptr;<br>
>>> >      }<br>
>>> ><br>
>>> > -    ModuleSetT Ms;<br>
>>> > +    std::shared_ptr<Module> M;<br>
>>> >      MemoryManagerPtrT MemMgr;<br>
>>> >      SymbolResolverPtrT Resolver;<br>
>>> >      mutable std::unique_ptr<StringMap<<wbr>const GlobalValue*>><br>
>>> MangledSymbols;<br>
>>> >    };<br>
>>> ><br>
>>> > -  using ModuleSetListT = std::list<std::unique_ptr<Emis<br>
>>> sionDeferredSet>>;<br>
>>> > +  using ModuleListT = std::list<std::unique_ptr<Emis<br>
>>> sionDeferredModule>>;<br>
>>> ><br>
>>> >    BaseLayerT &BaseLayer;<br>
>>> > -  ModuleSetListT ModuleSetList;<br>
>>> > +  ModuleListT ModuleList;<br>
>>> ><br>
>>> >  public:<br>
>>> > -  /// @brief Handle to a set of loaded modules.<br>
>>> > -  using ModuleSetHandleT = typename ModuleSetListT::iterator;<br>
>>> > +  /// @brief Handle to a loaded module.<br>
>>> > +  using ModuleHandleT = typename ModuleListT::iterator;<br>
>>> ><br>
>>> >    /// @brief Construct a lazy emitting layer.<br>
>>> >    LazyEmittingLayer(BaseLayerT &BaseLayer) : BaseLayer(BaseLayer) {}<br>
>>> ><br>
>>> > -  /// @brief Add the given set of modules to the lazy emitting layer.<br>
>>> > -  template <typename ModuleSetT, typename MemoryManagerPtrT,<br>
>>> > -            typename SymbolResolverPtrT><br>
>>> > -  ModuleSetHandleT addModuleSet(ModuleSetT Ms,<br>
>>> > -                                MemoryManagerPtrT MemMgr,<br>
>>> > -                                SymbolResolverPtrT Resolver) {<br>
>>> > -    return ModuleSetList.insert(<br>
>>> > -        ModuleSetList.end(),<br>
>>> > -        EmissionDeferredSet::create(<wbr>BaseLayer, std::move(Ms),<br>
>>> std::move(MemMgr),<br>
>>> > -                                    std::move(Resolver)));<br>
>>> > +  /// @brief Add the given module to the lazy emitting layer.<br>
>>> > +  template <typename MemoryManagerPtrT, typename SymbolResolverPtrT><br>
>>> > +  ModuleHandleT addModule(std::shared_ptr<<wbr>Module> M,<br>
>>> > +                          MemoryManagerPtrT MemMgr,<br>
>>> > +                          SymbolResolverPtrT Resolver) {<br>
>>> > +    return ModuleList.insert(<br>
>>> > +        ModuleList.end(),<br>
>>> > +        EmissionDeferredModule::<wbr>create(BaseLayer, std::move(M),<br>
>>> > +                                       std::move(MemMgr),<br>
>>> > +                                       std::move(Resolver)));<br>
>>> >    }<br>
>>> ><br>
>>> > -  /// @brief Remove the module set represented by the given handle.<br>
>>> > +  /// @brief Remove the module represented by the given handle.<br>
>>> >    ///<br>
>>> > -  ///   This method will free the memory associated with the given<br>
>>> module set,<br>
>>> > -  /// both in this layer, and the base layer.<br>
>>> > -  void removeModuleSet(<wbr>ModuleSetHandleT H) {<br>
>>> > -    (*H)-><wbr>removeModulesFromBaseLayer(<wbr>BaseLayer);<br>
>>> > -    ModuleSetList.erase(H);<br>
>>> > +  ///   This method will free the memory associated with the given<br>
>>> module, both<br>
>>> > +  /// in this layer, and the base layer.<br>
>>> > +  void removeModule(ModuleHandleT H) {<br>
>>> > +    (*H)-><wbr>removeModuleFromBaseLayer(<wbr>BaseLayer);<br>
>>> > +    ModuleList.erase(H);<br>
>>> >    }<br>
>>> ><br>
>>> >    /// @brief Search for the given named symbol.<br>
>>> > @@ -258,42 +255,40 @@ public:<br>
>>> >      if (auto Symbol = BaseLayer.findSymbol(Name, ExportedSymbolsOnly))<br>
>>> >        return Symbol;<br>
>>> ><br>
>>> > -    // If not found then search the deferred sets. If any of these<br>
>>> contain a<br>
>>> > +    // If not found then search the deferred modules. If any of these<br>
>>> contain a<br>
>>> >      // definition of 'Name' then they will return a JITSymbol that<br>
>>> will emit<br>
>>> >      // the corresponding module when the symbol address is requested.<br>
>>> > -    for (auto &DeferredSet : ModuleSetList)<br>
>>> > -      if (auto Symbol = DeferredSet->find(Name, ExportedSymbolsOnly,<br>
>>> BaseLayer))<br>
>>> > +    for (auto &DeferredMod : ModuleList)<br>
>>> > +      if (auto Symbol = DeferredMod->find(Name, ExportedSymbolsOnly,<br>
>>> BaseLayer))<br>
>>> >          return Symbol;<br>
>>> ><br>
>>> >      // If no definition found anywhere return a null symbol.<br>
>>> >      return nullptr;<br>
>>> >    }<br>
>>> ><br>
>>> > -  /// @brief Get the address of the given symbol in the context of the<br>
>>> set of<br>
>>> > +  /// @brief Get the address of the given symbol in the context of the<br>
>>> of<br>
>>> >    ///        compiled modules represented by the handle H.<br>
>>> > -  JITSymbol findSymbolIn(ModuleSetHandleT H, const std::string &Name,<br>
>>> > +  JITSymbol findSymbolIn(ModuleHandleT H, const std::string &Name,<br>
>>> >                           bool ExportedSymbolsOnly) {<br>
>>> >      return (*H)->find(Name, ExportedSymbolsOnly, BaseLayer);<br>
>>> >    }<br>
>>> ><br>
>>> > -  /// @brief Immediately emit and finalize the moduleOB set<br>
>>> represented by the<br>
>>> > -  ///        given handle.<br>
>>> > -  /// @param H Handle for module set to emit/finalize.<br>
>>> > -  void emitAndFinalize(<wbr>ModuleSetHandleT H) {<br>
>>> > +  /// @brief Immediately emit and finalize the module represented by<br>
>>> the given<br>
>>> > +  ///        handle.<br>
>>> > +  /// @param H Handle for module to emit/finalize.<br>
>>> > +  void emitAndFinalize(ModuleHandleT H) {<br>
>>> >      (*H)->emitAndFinalize(<wbr>BaseLayer);<br>
>>> >    }<br>
>>> >  };<br>
>>> ><br>
>>> >  template <typename BaseLayerT><br>
>>> > -template <typename ModuleSetT, typename MemoryManagerPtrT,<br>
>>> > -          typename SymbolResolverPtrT><br>
>>> > -std::unique_ptr<typename LazyEmittingLayer<BaseLayerT>:<br>
>>> :EmissionDeferredSet><br>
>>> > -LazyEmittingLayer<BaseLayerT><wbr>::EmissionDeferredSet::create(<br>
>>> > -    BaseLayerT &B, ModuleSetT Ms, MemoryManagerPtrT MemMgr,<br>
>>> > +template <typename MemoryManagerPtrT, typename SymbolResolverPtrT><br>
>>> > +std::unique_ptr<typename LazyEmittingLayer<BaseLayerT>:<br>
>>> :EmissionDeferredModule><br>
>>> > +LazyEmittingLayer<BaseLayerT><wbr>::EmissionDeferredModule::<wbr>create(<br>
>>> > +    BaseLayerT &B, std::shared_ptr<Module> M, MemoryManagerPtrT MemMgr,<br>
>>> >      SymbolResolverPtrT Resolver) {<br>
>>> > -  using EDS = EmissionDeferredSetImpl<<wbr>ModuleSetT, MemoryManagerPtrT,<br>
>>> > -                                      SymbolResolverPtrT>;<br>
>>> > -  return llvm::make_unique<EDS>(std::<wbr>move(Ms), std::move(MemMgr),<br>
>>> > +  using EDS = EmissionDeferredModuleImpl<<wbr>MemoryManagerPtrT,<br>
>>> SymbolResolverPtrT>;<br>
>>> > +  return llvm::make_unique<EDS>(std::<wbr>move(M), std::move(MemMgr),<br>
>>> >                                  std::move(Resolver));<br>
>>> >  }<br>
>>> ><br>
>>> ><br>
>>> > Modified: llvm/trunk/lib/<wbr>ExecutionEngine/Orc/<wbr>OrcCBindings.cpp<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Execution" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Execution</a><br>
>>> Engine/Orc/OrcCBindings.cpp?<wbr>rev=306166&r1=306165&r2=<wbr>306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/lib/<wbr>ExecutionEngine/Orc/<wbr>OrcCBindings.cpp (original)<br>
>>> > +++ llvm/trunk/lib/<wbr>ExecutionEngine/Orc/<wbr>OrcCBindings.cpp Fri Jun 23<br>
>>> 16:45:29 2017<br>
>>> > @@ -12,6 +12,24 @@<br>
>>> ><br>
>>> >  using namespace llvm;<br>
>>> ><br>
>>> > +LLVMSharedModuleRef LLVMOrcMakeSharedModule(<wbr>LLVMModuleRef Mod) {<br>
>>> > +  return wrap(new std::shared_ptr<Module>(<wbr>unwrap(Mod)));<br>
>>> > +}<br>
>>> > +<br>
>>> > +void LLVMOrcDisposeSharedModuleRef(<wbr>LLVMSharedModuleRef SharedMod) {<br>
>>> > +  delete unwrap(SharedMod);<br>
>>> > +}<br>
>>> > +<br>
>>> > +LLVMSharedObjectBufferRef<br>
>>> > +<wbr>LLVMOrcMakeSharedObjectBuffer(<wbr>LLVMMemoryBufferRef ObjBuffer) {<br>
>>> > +  return wrap(new std::shared_ptr<MemoryBuffer>(<wbr>unwrap(ObjBuffer)));<br>
>>> > +}<br>
>>> > +<br>
>>> > +void<br>
>>> > +<wbr>LLVMOrcDisposeSharedObjectBuff<wbr>erRef(<wbr>LLVMSharedObjectBufferRef<br>
>>> SharedObjBuffer) {<br>
>>> > +  delete unwrap(SharedObjBuffer);<br>
>>> > +}<br>
>>> > +<br>
>>> >  LLVMOrcJITStackRef LLVMOrcCreateInstance(<wbr>LLVMTargetMachineRef TM) {<br>
>>> >    TargetMachine *TM2(unwrap(TM));<br>
>>> ><br>
>>> > @@ -65,21 +83,23 @@ LLVMOrcErrorCode LLVMOrcSetIndirectStubP<br>
>>> >  }<br>
>>> ><br>
>>> >  LLVMOrcModuleHandle<br>
>>> > -LLVMOrcAddEagerlyCompiledIR(<wbr>LLVMOrcJITStackRef JITStack,<br>
>>> LLVMModuleRef Mod,<br>
>>> > +LLVMOrcAddEagerlyCompiledIR(<wbr>LLVMOrcJITStackRef JITStack,<br>
>>> > +                            LLVMSharedModuleRef Mod,<br>
>>> >                              LLVMOrcSymbolResolverFn SymbolResolver,<br>
>>> >                              void *SymbolResolverCtx) {<br>
>>> >    OrcCBindingsStack &J = *unwrap(JITStack);<br>
>>> > -  Module *M(unwrap(Mod));<br>
>>> > -  return J.addIRModuleEager(M, SymbolResolver, SymbolResolverCtx);<br>
>>> > +  std::shared_ptr<Module> *M(unwrap(Mod));<br>
>>> > +  return J.addIRModuleEager(*M, SymbolResolver, SymbolResolverCtx);<br>
>>> >  }<br>
>>> ><br>
>>> >  LLVMOrcModuleHandle<br>
>>> > -LLVMOrcAddLazilyCompiledIR(<wbr>LLVMOrcJITStackRef JITStack, LLVMModuleRef<br>
>>> Mod,<br>
>>> > +LLVMOrcAddLazilyCompiledIR(<wbr>LLVMOrcJITStackRef JITStack,<br>
>>> > +                           LLVMSharedModuleRef Mod,<br>
>>> >                             LLVMOrcSymbolResolverFn SymbolResolver,<br>
>>> >                             void *SymbolResolverCtx) {<br>
>>> >    OrcCBindingsStack &J = *unwrap(JITStack);<br>
>>> > -  Module *M(unwrap(Mod));<br>
>>> > -  return J.addIRModuleLazy(M, SymbolResolver, SymbolResolverCtx);<br>
>>> > +  std::shared_ptr<Module> *M(unwrap(Mod));<br>
>>> > +  return J.addIRModuleLazy(*M, SymbolResolver, SymbolResolverCtx);<br>
>>> >  }<br>
>>> ><br>
>>> >  void LLVMOrcRemoveModule(<wbr>LLVMOrcJITStackRef JITStack,<br>
>>> LLVMOrcModuleHandle H) {<br>
>>> ><br>
>>> > Modified: llvm/trunk/lib/<wbr>ExecutionEngine/Orc/<wbr>OrcCBindingsStack.h<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Execution" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Execution</a><br>
>>> Engine/Orc/OrcCBindingsStack.<wbr>h?rev=306166&r1=306165&r2=<wbr>306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/lib/<wbr>ExecutionEngine/Orc/<wbr>OrcCBindingsStack.h (original)<br>
>>> > +++ llvm/trunk/lib/<wbr>ExecutionEngine/Orc/<wbr>OrcCBindingsStack.h Fri Jun 23<br>
>>> 16:45:29 2017<br>
>>> > @@ -42,6 +42,10 @@ namespace llvm {<br>
>>> ><br>
>>> >  class OrcCBindingsStack;<br>
>>> ><br>
>>> > +DEFINE_SIMPLE_CONVERSION_<wbr>FUNCTIONS(std::shared_ptr<<wbr>Module>,<br>
>>> > +                                   LLVMSharedModuleRef);<br>
>>> > +DEFINE_SIMPLE_CONVERSION_<wbr>FUNCTIONS(std::shared_ptr<<wbr>MemoryBuffer>,<br>
>>> > +                                   LLVMSharedObjectBufferRef);<br>
>>> >  DEFINE_SIMPLE_CONVERSION_<wbr>FUNCTIONS(OrcCBindingsStack,<br>
>>> LLVMOrcJITStackRef)<br>
>>> >  DEFINE_SIMPLE_CONVERSION_<wbr>FUNCTIONS(TargetMachine,<br>
>>> LLVMTargetMachineRef)<br>
>>> ><br>
>>> > @@ -71,7 +75,7 @@ private:<br>
>>> ><br>
>>> >    template <typename LayerT> class GenericHandleImpl : public<br>
>>> GenericHandle {<br>
>>> >    public:<br>
>>> > -    GenericHandleImpl(LayerT &Layer, typename LayerT::ModuleSetHandleT<br>
>>> Handle)<br>
>>> > +    GenericHandleImpl(LayerT &Layer, typename LayerT::ModuleHandleT<br>
>>> Handle)<br>
>>> >          : Layer(Layer), Handle(std::move(Handle)) {}<br>
>>> ><br>
>>> >      JITSymbol findSymbolIn(const std::string &Name,<br>
>>> > @@ -79,24 +83,21 @@ private:<br>
>>> >        return Layer.findSymbolIn(Handle, Name, ExportedSymbolsOnly);<br>
>>> >      }<br>
>>> ><br>
>>> > -    void removeModule() override { return<br>
>>> Layer.removeModuleSet(Handle); }<br>
>>> > +    void removeModule() override { return Layer.removeModule(Handle); }<br>
>>> ><br>
>>> >    private:<br>
>>> >      LayerT &Layer;<br>
>>> > -    typename LayerT::ModuleSetHandleT Handle;<br>
>>> > +    typename LayerT::ModuleHandleT Handle;<br>
>>> >    };<br>
>>> ><br>
>>> >    template <typename LayerT><br>
>>> >    std::unique_ptr<<wbr>GenericHandleImpl<LayerT>><br>
>>> > -  createGenericHandle(LayerT &Layer, typename LayerT::ModuleSetHandleT<br>
>>> Handle) {<br>
>>> > +  createGenericHandle(LayerT &Layer, typename LayerT::ModuleHandleT<br>
>>> Handle) {<br>
>>> >      return llvm::make_unique<<wbr>GenericHandleImpl<LayerT>>(<wbr>Layer,<br>
>>> ><br>
>>> std::move(Handle));<br>
>>> >    }<br>
>>> ><br>
>>> >  public:<br>
>>> > -  // We need a 'ModuleSetHandleT' to conform to the layer concept.<br>
>>> > -  using ModuleSetHandleT = unsigned;<br>
>>> > -<br>
>>> >    using ModuleHandleT = unsigned;<br>
>>> ><br>
>>> >    OrcCBindingsStack(<wbr>TargetMachine &TM,<br>
>>> > @@ -183,7 +184,7 @@ public:<br>
>>> >    }<br>
>>> ><br>
>>> >    template <typename LayerT><br>
>>> > -  ModuleHandleT addIRModule(LayerT &Layer, Module *M,<br>
>>> > +  ModuleHandleT addIRModule(LayerT &Layer, std::shared_ptr<Module> M,<br>
>>> >                              std::unique_ptr<RuntimeDyld::<wbr>MemoryManager><br>
>>> MemMgr,<br>
>>> >                              LLVMOrcSymbolResolverFn ExternalResolver,<br>
>>> >                              void *ExternalResolverCtx) {<br>
>>> > @@ -203,11 +204,8 @@ public:<br>
>>> >      auto Resolver = createResolver(<wbr>ExternalResolver,<br>
>>> ExternalResolverCtx);<br>
>>> ><br>
>>> >      // Add the module to the JIT.<br>
>>> > -    std::vector<Module *> S;<br>
>>> > -    S.push_back(std::move(M));<br>
>>> > -<br>
>>> > -    auto LH = Layer.addModuleSet(std::move(<wbr>S), std::move(MemMgr),<br>
>>> > -                                 std::move(Resolver));<br>
>>> > +    auto LH = Layer.addModule(std::move(M), std::move(MemMgr),<br>
>>> > +                              std::move(Resolver));<br>
>>> >      ModuleHandleT H = createHandle(Layer, LH);<br>
>>> ><br>
>>> >      // Run the static constructors, and save the static destructor<br>
>>> runner for<br>
>>> > @@ -220,7 +218,7 @@ public:<br>
>>> >      return H;<br>
>>> >    }<br>
>>> ><br>
>>> > -  ModuleHandleT addIRModuleEager(Module *M,<br>
>>> > +  ModuleHandleT addIRModuleEager(std::shared_<wbr>ptr<Module> M,<br>
>>> >                                   LLVMOrcSymbolResolverFn<br>
>>> ExternalResolver,<br>
>>> >                                   void *ExternalResolverCtx) {<br>
>>> >      return addIRModule(CompileLayer, std::move(M),<br>
>>> > @@ -228,7 +226,7 @@ public:<br>
>>> >                         std::move(ExternalResolver),<br>
>>> ExternalResolverCtx);<br>
>>> >    }<br>
>>> ><br>
>>> > -  ModuleHandleT addIRModuleLazy(Module *M,<br>
>>> > +  ModuleHandleT addIRModuleLazy(std::shared_<wbr>ptr<Module> M,<br>
>>> >                                  LLVMOrcSymbolResolverFn<br>
>>> ExternalResolver,<br>
>>> >                                  void *ExternalResolverCtx) {<br>
>>> >      return addIRModule(CODLayer, std::move(M),<br>
>>> > @@ -257,8 +255,7 @@ public:<br>
>>> ><br>
>>> >  private:<br>
>>> >    template <typename LayerT><br>
>>> > -  unsigned createHandle(LayerT &Layer,<br>
>>> > -                        typename LayerT::ModuleSetHandleT Handle) {<br>
>>> > +  unsigned createHandle(LayerT &Layer, typename LayerT::ModuleHandleT<br>
>>> Handle) {<br>
>>> >      unsigned NewHandle;<br>
>>> >      if (!FreeHandleIndexes.empty()) {<br>
>>> >        NewHandle = FreeHandleIndexes.back();<br>
>>> ><br>
>>> > Modified: llvm/trunk/lib/<wbr>ExecutionEngine/Orc/<wbr>OrcMCJITReplacement.h<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Execution" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Execution</a><br>
>>> Engine/Orc/<wbr>OrcMCJITReplacement.h?rev=<wbr>306166&r1=306165&r2=306166&<wbr>view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/lib/<wbr>ExecutionEngine/Orc/<wbr>OrcMCJITReplacement.h (original)<br>
>>> > +++ llvm/trunk/lib/<wbr>ExecutionEngine/Orc/<wbr>OrcMCJITReplacement.h Fri Jun<br>
>>> 23 16:45:29 2017<br>
>>> > @@ -191,10 +191,15 @@ public:<br>
>>> >      } else {<br>
>>> >        assert(M->getDataLayout() == getDataLayout() && "DataLayout<br>
>>> Mismatch");<br>
>>> >      }<br>
>>> > -    Modules.push_back(std::move(M)<wbr>);<br>
>>> > -    std::vector<Module *> Ms;<br>
>>> > -    Ms.push_back(&*Modules.back())<wbr>;<br>
>>> > -    LazyEmitLayer.addModuleSet(<wbr>std::move(Ms), &MemMgr, &Resolver);<br>
>>> > +    auto *MPtr = M.release();<br>
>>> > +    Retain[MPtr] = false;<br>
>>> > +    auto Deleter =<br>
>>> > +      [this](Module *Mod) {<br>
>>> > +        if (!Retain[Mod])<br>
>>> > +          delete Mod;<br>
>>> > +      };<br>
>>> > +    LocalModules.push_back(std::<wbr>shared_ptr<Module>(MPtr,<br>
>>> std::move(Deleter)));<br>
>>> > +    LazyEmitLayer.addModule(<wbr>LocalModules.back(), &MemMgr, &Resolver);<br>
>>> >    }<br>
>>> ><br>
>>> >    void addObjectFile(std::unique_ptr<<wbr>object::ObjectFile> O) override {<br>
>>> > @@ -381,6 +386,8 @@ private:<br>
>>> >    std::map<ObjectLayerT::<wbr>ObjHandleT, SectionAddrSet, ObjHandleCompare><br>
>>> >        UnfinalizedSections;<br>
>>> ><br>
>>> > +  std::map<Module*, bool> Retain;<br>
>>> > +  std::vector<std::shared_ptr<<wbr>Module>> LocalModules;<br>
>>> >    std::vector<object::<wbr>OwningBinary<object::Archive>> Archives;<br>
>>> >  };<br>
>>> ><br>
>>> ><br>
>>> > Modified: llvm/trunk/tools/lli/<wbr>OrcLazyJIT.cpp<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/Orc" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/tools/lli/<wbr>Orc</a><br>
>>> LazyJIT.cpp?rev=306166&r1=<wbr>306165&r2=306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/tools/lli/<wbr>OrcLazyJIT.cpp (original)<br>
>>> > +++ llvm/trunk/tools/lli/<wbr>OrcLazyJIT.cpp Fri Jun 23 16:45:29 2017<br>
>>> > @@ -54,10 +54,10 @@ static cl::opt<bool> OrcInlineStubs("orc<br>
>>> >  OrcLazyJIT::TransformFtor OrcLazyJIT::createDebugDumper(<wbr>) {<br>
>>> >    switch (OrcDumpKind) {<br>
>>> >    case DumpKind::NoDump:<br>
>>> > -    return [](std::unique_ptr<Module> M) { return M; };<br>
>>> > +    return [](std::shared_ptr<Module> M) { return M; };<br>
>>> ><br>
>>> >    case DumpKind::DumpFuncsToStdOut:<br>
>>> > -    return [](std::unique_ptr<Module> M) {<br>
>>> > +    return [](std::shared_ptr<Module> M) {<br>
>>> >        printf("[ ");<br>
>>> ><br>
>>> >        for (const auto &F : *M) {<br>
>>> > @@ -76,7 +76,7 @@ OrcLazyJIT::TransformFtor OrcLazyJIT::cr<br>
>>> >      };<br>
>>> ><br>
>>> >    case DumpKind::DumpModsToStdOut:<br>
>>> > -    return [](std::unique_ptr<Module> M) {<br>
>>> > +    return [](std::shared_ptr<Module> M) {<br>
>>> >               outs() << "----- Module Start -----\n" << *M<br>
>>> >                      << "----- Module End -----\n";<br>
>>> ><br>
>>> > @@ -84,7 +84,7 @@ OrcLazyJIT::TransformFtor OrcLazyJIT::cr<br>
>>> >             };<br>
>>> ><br>
>>> >    case DumpKind::DumpModsToDisk:<br>
>>> > -    return [](std::unique_ptr<Module> M) {<br>
>>> > +    return [](std::shared_ptr<Module> M) {<br>
>>> >               std::error_code EC;<br>
>>> >               raw_fd_ostream Out(M->getModuleIdentifier() + ".ll", EC,<br>
>>> >                                  sys::fs::F_Text);<br>
>>> > @@ -147,7 +147,8 @@ int llvm::runOrcLazyJIT(std::<wbr>vector<std:<br>
>>> >                 OrcInlineStubs);<br>
>>> ><br>
>>> >    // Add the module, look up main and run it.<br>
>>> > -  J.addModuleSet(std::move(Ms));<br>
>>> > +  for (auto &M : Ms)<br>
>>> > +    J.addModule(std::shared_ptr<<wbr>Module>(std::move(M)));<br>
>>> >    auto MainSym = J.findSymbol("main");<br>
>>> ><br>
>>> >    if (!MainSym) {<br>
>>> ><br>
>>> > Modified: llvm/trunk/tools/lli/<wbr>OrcLazyJIT.h<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/Orc" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/tools/lli/<wbr>Orc</a><br>
>>> LazyJIT.h?rev=306166&r1=<wbr>306165&r2=306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/tools/lli/<wbr>OrcLazyJIT.h (original)<br>
>>> > +++ llvm/trunk/tools/lli/<wbr>OrcLazyJIT.h Fri Jun 23 16:45:29 2017<br>
>>> > @@ -50,11 +50,11 @@ public:<br>
>>> >    using ObjLayerT = orc::RTDyldObjectLinkingLayer;<br>
>>> >    using CompileLayerT = orc::IRCompileLayer<ObjLayerT,<br>
>>> orc::SimpleCompiler>;<br>
>>> >    using TransformFtor =<br>
>>> > -    std::function<std::unique_ptr<<wbr>Module>(std::unique_ptr<<wbr>Module>)>;<br>
>>> > +          std::function<std::shared_ptr<<wbr>Module>(std::shared_ptr<Module<br>
>>> >)>;<br>
>>> >    using IRDumpLayerT = orc::IRTransformLayer<<wbr>CompileLayerT,<br>
>>> TransformFtor>;<br>
>>> >    using CODLayerT = orc::CompileOnDemandLayer<<wbr>IRDumpLayerT,<br>
>>> CompileCallbackMgr>;<br>
>>> >    using IndirectStubsManagerBuilder = CODLayerT::IndirectStubsManage<br>
>>> rBuilderT;<br>
>>> > -  using ModuleSetHandleT = CODLayerT::ModuleSetHandleT;<br>
>>> > +  using ModuleHandleT = CODLayerT::ModuleHandleT;<br>
>>> ><br>
>>> >    OrcLazyJIT(std::unique_ptr<<wbr>TargetMachine> TM,<br>
>>> >               std::unique_ptr<<wbr>CompileCallbackMgr> CCMgr,<br>
>>> > @@ -77,11 +77,9 @@ public:<br>
>>> >        DtorRunner.runViaLayer(<wbr>CODLayer);<br>
>>> >    }<br>
>>> ><br>
>>> > -  ModuleSetHandleT addModuleSet(std::vector<std::<wbr>unique_ptr<Module>><br>
>>> Ms) {<br>
>>> > -    // Attach a data-layouts if they aren't already present.<br>
>>> > -    for (auto &M : Ms)<br>
>>> > -      if (M->getDataLayout().isDefault(<wbr>))<br>
>>> > -        M->setDataLayout(DL);<br>
>>> > +  void addModule(std::shared_ptr<<wbr>Module> M) {<br>
>>> > +    if (M->getDataLayout().isDefault(<wbr>))<br>
>>> > +      M->setDataLayout(DL);<br>
>>> ><br>
>>> >      // Rename, bump linkage and record static constructors and<br>
>>> destructors.<br>
>>> >      // We have to do this before we hand over ownership of the module<br>
>>> to the<br>
>>> > @@ -89,21 +87,19 @@ public:<br>
>>> >      std::vector<std::string> CtorNames, DtorNames;<br>
>>> >      {<br>
>>> >        unsigned CtorId = 0, DtorId = 0;<br>
>>> > -      for (auto &M : Ms) {<br>
>>> > -        for (auto Ctor : orc::getConstructors(*M)) {<br>
>>> > -          std::string NewCtorName = ("$static_ctor." +<br>
>>> Twine(CtorId++)).str();<br>
>>> > -          Ctor.Func->setName(<wbr>NewCtorName);<br>
>>> > -          Ctor.Func->setLinkage(<wbr>GlobalValue::ExternalLinkage);<br>
>>> > -          Ctor.Func->setVisibility(<wbr>GlobalValue::HiddenVisibility)<wbr>;<br>
>>> > -          CtorNames.push_back(mangle(<wbr>NewCtorName));<br>
>>> > -        }<br>
>>> > -        for (auto Dtor : orc::getDestructors(*M)) {<br>
>>> > -          std::string NewDtorName = ("$static_dtor." +<br>
>>> Twine(DtorId++)).str();<br>
>>> > -          Dtor.Func->setLinkage(<wbr>GlobalValue::ExternalLinkage);<br>
>>> > -          Dtor.Func->setVisibility(<wbr>GlobalValue::HiddenVisibility)<wbr>;<br>
>>> > -          DtorNames.push_back(mangle(<wbr>Dtor.Func->getName()));<br>
>>> > -          Dtor.Func->setName(<wbr>NewDtorName);<br>
>>> > -        }<br>
>>> > +      for (auto Ctor : orc::getConstructors(*M)) {<br>
>>> > +        std::string NewCtorName = ("$static_ctor." +<br>
>>> Twine(CtorId++)).str();<br>
>>> > +        Ctor.Func->setName(<wbr>NewCtorName);<br>
>>> > +        Ctor.Func->setLinkage(<wbr>GlobalValue::ExternalLinkage);<br>
>>> > +        Ctor.Func->setVisibility(<wbr>GlobalValue::HiddenVisibility)<wbr>;<br>
>>> > +        CtorNames.push_back(mangle(<wbr>NewCtorName));<br>
>>> > +      }<br>
>>> > +      for (auto Dtor : orc::getDestructors(*M)) {<br>
>>> > +        std::string NewDtorName = ("$static_dtor." +<br>
>>> Twine(DtorId++)).str();<br>
>>> > +        Dtor.Func->setLinkage(<wbr>GlobalValue::ExternalLinkage);<br>
>>> > +        Dtor.Func->setVisibility(<wbr>GlobalValue::HiddenVisibility)<wbr>;<br>
>>> > +        DtorNames.push_back(mangle(<wbr>Dtor.Func->getName()));<br>
>>> > +        Dtor.Func->setName(<wbr>NewDtorName);<br>
>>> >        }<br>
>>> >      }<br>
>>> ><br>
>>> > @@ -111,41 +107,45 @@ public:<br>
>>> >      //   1) Search the JIT symbols.<br>
>>> >      //   2) Check for C++ runtime overrides.<br>
>>> >      //   3) Search the host process (LLI)'s symbol table.<br>
>>> > -    auto Resolver =<br>
>>> > -      orc::createLambdaResolver(<br>
>>> > -        [this](const std::string &Name) -> JITSymbol {<br>
>>> > -          if (auto Sym = CODLayer.findSymbol(Name, true))<br>
>>> > -            return Sym;<br>
>>> > -          return CXXRuntimeOverrides.<wbr>searchOverrides(Name);<br>
>>> > -        },<br>
>>> > -        [](const std::string &Name) {<br>
>>> > -          if (auto Addr =<br>
>>> > -              RTDyldMemoryManager::<wbr>getSymbolAddressInProcess(<wbr>Name))<br>
>>> > -            return JITSymbol(Addr, JITSymbolFlags::Exported);<br>
>>> > -          return JITSymbol(nullptr);<br>
>>> > -        }<br>
>>> > -      );<br>
>>> > -<br>
>>> > -    // Add the module to the JIT.<br>
>>> > -    auto H = CODLayer.addModuleSet(std::<wbr>move(Ms),<br>
>>> > -                                llvm::make_unique<SectionMemor<br>
>>> yManager>(),<br>
>>> > -                                std::move(Resolver));<br>
>>> > +    if (ModulesHandle == CODLayerT::ModuleHandleT()) {<br>
>>> > +      auto Resolver =<br>
>>> > +        orc::createLambdaResolver(<br>
>>> > +          [this](const std::string &Name) -> JITSymbol {<br>
>>> > +            if (auto Sym = CODLayer.findSymbol(Name, true))<br>
>>> > +              return Sym;<br>
>>> > +            return CXXRuntimeOverrides.<wbr>searchOverrides(Name);<br>
>>> > +          },<br>
>>> > +          [](const std::string &Name) {<br>
>>> > +            if (auto Addr =<br>
>>> > +                RTDyldMemoryManager::<wbr>getSymbolAddressInProcess(<wbr>Name))<br>
>>> > +              return JITSymbol(Addr, JITSymbolFlags::Exported);<br>
>>> > +            return JITSymbol(nullptr);<br>
>>> > +          }<br>
>>> > +        );<br>
>>> > +<br>
>>> > +      // Add the module to the JIT.<br>
>>> > +      ModulesHandle =<br>
>>> > +        CODLayer.addModule(std::move(<wbr>M),<br>
>>> > +                           llvm::make_unique<<wbr>SectionMemoryManager>(),<br>
>>> > +                           std::move(Resolver));<br>
>>> > +    } else<br>
>>> > +      CODLayer.addExtraModule(<wbr>ModulesHandle, std::move(M));<br>
>>> ><br>
>>> >      // Run the static constructors, and save the static destructor<br>
>>> runner for<br>
>>> >      // execution when the JIT is torn down.<br>
>>> > -    orc::CtorDtorRunner<CODLayerT> CtorRunner(std::move(<wbr>CtorNames),<br>
>>> H);<br>
>>> > +    orc::CtorDtorRunner<CODLayerT> CtorRunner(std::move(<wbr>CtorNames),<br>
>>> > +                                              ModulesHandle);<br>
>>> >      CtorRunner.runViaLayer(<wbr>CODLayer);<br>
>>> ><br>
>>> > -    IRStaticDestructorRunners.<wbr>emplace_back(std::move(<wbr>DtorNames), H);<br>
>>> > -<br>
>>> > -    return H;<br>
>>> > +    IRStaticDestructorRunners.<wbr>emplace_back(std::move(<wbr>DtorNames),<br>
>>> > +                                           ModulesHandle);<br>
>>> >    }<br>
>>> ><br>
>>> >    JITSymbol findSymbol(const std::string &Name) {<br>
>>> >      return CODLayer.findSymbol(mangle(<wbr>Name), true);<br>
>>> >    }<br>
>>> ><br>
>>> > -  JITSymbol findSymbolIn(ModuleSetHandleT H, const std::string &Name) {<br>
>>> > +  JITSymbol findSymbolIn(ModuleHandleT H, const std::string &Name) {<br>
>>> >      return CODLayer.findSymbolIn(H, mangle(Name), true);<br>
>>> >    }<br>
>>> ><br>
>>> > @@ -179,6 +179,7 @@ private:<br>
>>> ><br>
>>> >    orc::LocalCXXRuntimeOverrides CXXRuntimeOverrides;<br>
>>> >    std::vector<orc::<wbr>CtorDtorRunner<CODLayerT>><br>
>>> IRStaticDestructorRunners;<br>
>>> > +  CODLayerT::ModuleHandleT ModulesHandle;<br>
>>> >  };<br>
>>> ><br>
>>> >  int runOrcLazyJIT(std::vector<std:<wbr>:unique_ptr<Module>> Ms,<br>
>>> ><br>
>>> > Modified: llvm/trunk/unittests/<wbr>ExecutionEngine/Orc/<wbr>LazyEmittingLayerTe<br>
>>> st.cpp<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Exe" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/unittests/<wbr>Exe</a><br>
>>> cutionEngine/Orc/<wbr>LazyEmittingLayerTest.cpp?rev=<wbr>306166&r1=<br>
>>> 306165&r2=306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/unittests/<wbr>ExecutionEngine/Orc/<wbr>LazyEmittingLayerTest.cpp<br>
>>> (original)<br>
>>> > +++ llvm/trunk/unittests/<wbr>ExecutionEngine/Orc/<wbr>LazyEmittingLayerTest.cpp<br>
>>> Fri Jun 23 16:45:29 2017<br>
>>> > @@ -14,9 +14,9 @@<br>
>>> >  namespace {<br>
>>> ><br>
>>> >  struct MockBaseLayer {<br>
>>> > -  typedef int ModuleSetHandleT;<br>
>>> > -  ModuleSetHandleT addModuleSet(<br>
>>> > -                  std::list<std::unique_ptr<<wbr>llvm::Module>>,<br>
>>> > +  typedef int ModuleHandleT;<br>
>>> > +  ModuleHandleT addModule(<br>
>>> > +                  std::shared_ptr<llvm::Module>,<br>
>>> >                    std::unique_ptr<llvm::<wbr>RuntimeDyld::MemoryManager><br>
>>> MemMgr,<br>
>>> >                    std::unique_ptr<llvm::<wbr>JITSymbolResolver> Resolver) {<br>
>>> >      EXPECT_FALSE(MemMgr);<br>
>>> > @@ -27,7 +27,7 @@ struct MockBaseLayer {<br>
>>> >  TEST(LazyEmittingLayerTest, Empty) {<br>
>>> >    MockBaseLayer M;<br>
>>> >    llvm::orc::LazyEmittingLayer<<wbr>MockBaseLayer> L(M);<br>
>>> > -  L.addModuleSet(std::list<std::<wbr>unique_ptr<llvm::Module>>(), nullptr,<br>
>>> nullptr);<br>
>>> > +  L.addModule(std::unique_ptr<<wbr>llvm::Module>(), nullptr, nullptr);<br>
>>> >  }<br>
>>> ><br>
>>> >  }<br>
>>> ><br>
>>> > Modified: llvm/trunk/unittests/<wbr>ExecutionEngine/Orc/<wbr>ObjectTransformLaye<br>
>>> rTest.cpp<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Exe" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/unittests/<wbr>Exe</a><br>
>>> cutionEngine/Orc/<wbr>ObjectTransformLayerTest.cpp?<wbr>rev=306166&r1=<br>
>>> 306165&r2=306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/unittests/<wbr>ExecutionEngine/Orc/<wbr>ObjectTransformLayerTest.cpp<br>
>>> (original)<br>
>>> > +++ llvm/trunk/unittests/<wbr>ExecutionEngine/Orc/<wbr>ObjectTransformLayerTest.cpp<br>
>>> Fri Jun 23 16:45:29 2017<br>
>>> > @@ -314,7 +314,7 @@ TEST(ObjectTransformLayerTest, Main) {<br>
>>> >    // compile.<br>
>>> >    NullResolver Resolver;<br>
>>> >    NullManager Manager;<br>
>>> > -  CompileLayer.addModuleSet(std:<wbr>:vector<llvm::Module *>(), &Manager,<br>
>>> &Resolver);<br>
>>> > +  CompileLayer.addModule(std::<wbr>shared_ptr<llvm::Module>(), &Manager,<br>
>>> &Resolver);<br>
>>> ><br>
>>> >    // Make sure that the calls from ObjectTransformLayer to<br>
>>> ObjectLinkingLayer<br>
>>> >    // compile.<br>
>>> ><br>
>>> > Modified: llvm/trunk/unittests/<wbr>ExecutionEngine/Orc/<wbr>OrcCAPITest.cpp<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Exe" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/unittests/<wbr>Exe</a><br>
>>> cutionEngine/Orc/OrcCAPITest.<wbr>cpp?rev=306166&r1=306165&r2=<wbr>306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/unittests/<wbr>ExecutionEngine/Orc/<wbr>OrcCAPITest.cpp (original)<br>
>>> > +++ llvm/trunk/unittests/<wbr>ExecutionEngine/Orc/<wbr>OrcCAPITest.cpp Fri Jun<br>
>>> 23 16:45:29 2017<br>
>>> > @@ -65,8 +65,9 @@ protected:<br>
>>> >      CompileContext *CCtx = static_cast<CompileContext*>(<wbr>Ctx);<br>
>>> >      auto *ET = CCtx->APIExecTest;<br>
>>> >      CCtx->M = ET->createTestModule(ET->TM-><wbr>getTargetTriple());<br>
>>> > -    CCtx->H = LLVMOrcAddEagerlyCompiledIR(<wbr>JITStack,<br>
>>> wrap(CCtx->M.get()),<br>
>>> > -                                          myResolver, nullptr);<br>
>>> > +    LLVMSharedModuleRef SM = LLVMOrcMakeSharedModule(wrap(C<br>
>>> Ctx->M.release()));<br>
>>> > +    CCtx->H = LLVMOrcAddEagerlyCompiledIR(<wbr>JITStack, SM, myResolver,<br>
>>> nullptr);<br>
>>> > +    LLVMOrcDisposeSharedModuleRef(<wbr>SM);<br>
>>> >      CCtx->Compiled = true;<br>
>>> >      LLVMOrcTargetAddress MainAddr = LLVMOrcGetSymbolAddress(<wbr>JITStack,<br>
>>> "main");<br>
>>> >      LLVMOrcSetIndirectStubPointer(<wbr>JITStack, "foo", MainAddr);<br>
>>> > @@ -87,8 +88,10 @@ TEST_F(OrcCAPIExecutionTest, TestEagerIR<br>
>>> ><br>
>>> >    LLVMOrcGetMangledSymbol(JIT, &testFuncName, "testFunc");<br>
>>> ><br>
>>> > +  LLVMSharedModuleRef SM = LLVMOrcMakeSharedModule(wrap(<wbr>M.release()));<br>
>>> >    LLVMOrcModuleHandle H =<br>
>>> > -    LLVMOrcAddEagerlyCompiledIR(<wbr>JIT, wrap(M.get()), myResolver,<br>
>>> nullptr);<br>
>>> > +    LLVMOrcAddEagerlyCompiledIR(<wbr>JIT, SM, myResolver, nullptr);<br>
>>> > +  LLVMOrcDisposeSharedModuleRef(<wbr>SM);<br>
>>> >    MainFnTy MainFn = (MainFnTy)<wbr>LLVMOrcGetSymbolAddress(JIT, "main");<br>
>>> >    int Result = MainFn();<br>
>>> >    EXPECT_EQ(Result, 42)<br>
>>> > @@ -111,8 +114,10 @@ TEST_F(OrcCAPIExecutionTest, TestLazyIRC<br>
>>> ><br>
>>> >    LLVMOrcGetMangledSymbol(JIT, &testFuncName, "testFunc");<br>
>>> ><br>
>>> > +  LLVMSharedModuleRef SM = LLVMOrcMakeSharedModule(wrap(<wbr>M.release()));<br>
>>> >    LLVMOrcModuleHandle H =<br>
>>> > -    LLVMOrcAddLazilyCompiledIR(<wbr>JIT, wrap(M.get()), myResolver,<br>
>>> nullptr);<br>
>>> > +    LLVMOrcAddLazilyCompiledIR(<wbr>JIT, SM, myResolver, nullptr);<br>
>>> > +  LLVMOrcDisposeSharedModuleRef(<wbr>SM);<br>
>>> >    MainFnTy MainFn = (MainFnTy)<wbr>LLVMOrcGetSymbolAddress(JIT, "main");<br>
>>> >    int Result = MainFn();<br>
>>> >    EXPECT_EQ(Result, 42)<br>
>>> ><br>
>>> > Modified: llvm/trunk/unittests/<wbr>ExecutionEngine/Orc/<wbr>OrcTestCommon.h<br>
>>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Exe" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/unittests/<wbr>Exe</a><br>
>>> cutionEngine/Orc/<wbr>OrcTestCommon.h?rev=306166&r1=<wbr>306165&r2=306166&view=diff<br>
>>> > ==============================<wbr>==============================<br>
>>> ==================<br>
>>> > --- llvm/trunk/unittests/<wbr>ExecutionEngine/Orc/<wbr>OrcTestCommon.h (original)<br>
>>> > +++ llvm/trunk/unittests/<wbr>ExecutionEngine/Orc/<wbr>OrcTestCommon.h Fri Jun<br>
>>> 23 16:45:29 2017<br>
>>> > @@ -106,65 +106,65 @@ public:<br>
>>> >  };<br>
>>> ><br>
>>> >  template <typename HandleT,<br>
>>> > -          typename AddModuleSetFtor,<br>
>>> > -          typename RemoveModuleSetFtor,<br>
>>> > +          typename AddModuleFtor,<br>
>>> > +          typename RemoveModuleFtor,<br>
>>> >            typename FindSymbolFtor,<br>
>>> >            typename FindSymbolInFtor><br>
>>> >  class MockBaseLayer {<br>
>>> >  public:<br>
>>> ><br>
>>> > -  typedef HandleT ModuleSetHandleT;<br>
>>> > +  typedef HandleT ModuleHandleT;<br>
>>> ><br>
>>> > -  MockBaseLayer(AddModuleSetFtor &&AddModuleSet,<br>
>>> > -                RemoveModuleSetFtor &&RemoveModuleSet,<br>
>>> > +  MockBaseLayer(AddModuleFtor &&AddModule,<br>
>>> > +                RemoveModuleFtor &&RemoveModule,<br>
>>> >                  FindSymbolFtor &&FindSymbol,<br>
>>> >                  FindSymbolInFtor &&FindSymbolIn)<br>
>>> > -      : AddModuleSet(AddModuleSet), RemoveModuleSet(<wbr>RemoveModuleSet),<br>
>>> > +      : AddModule(AddModule), RemoveModule(RemoveModule),<br>
>>> >          FindSymbol(FindSymbol), FindSymbolIn(FindSymbolIn)<br>
>>> >    {}<br>
>>> ><br>
>>> > -  template <typename ModuleSetT, typename MemoryManagerPtrT,<br>
>>> > +  template <typename ModuleT, typename MemoryManagerPtrT,<br>
>>> >              typename SymbolResolverPtrT><br>
>>> > -  ModuleSetHandleT addModuleSet(ModuleSetT Ms, MemoryManagerPtrT<br>
>>> MemMgr,<br>
>>> > -                                SymbolResolverPtrT Resolver) {<br>
>>> > -    return AddModuleSet(std::move(Ms), std::move(MemMgr),<br>
>>> std::move(Resolver));<br>
>>> > +  ModuleHandleT addModule(ModuleT Ms, MemoryManagerPtrT MemMgr,<br>
>>> > +                          SymbolResolverPtrT Resolver) {<br>
>>> > +    return AddModule(std::move(Ms), std::move(MemMgr),<br>
>>> std::move(Resolver));<br>
>>> >    }<br>
>>> ><br>
>>> > -  void removeModuleSet(<wbr>ModuleSetHandleT H) {<br>
>>> > -    RemoveModuleSet(H);<br>
>>> > +  void removeModule(ModuleHandleT H) {<br>
>>> > +    RemoveModule(H);<br>
>>> >    }<br>
>>> ><br>
>>> >    JITSymbol findSymbol(const std::string &Name, bool<br>
>>> ExportedSymbolsOnly) {<br>
>>> >      return FindSymbol(Name, ExportedSymbolsOnly);<br>
>>> >    }<br>
>>> ><br>
>>> > -  JITSymbol findSymbolIn(ModuleSetHandleT H, const std::string &Name,<br>
>>> > +  JITSymbol findSymbolIn(ModuleHandleT H, const std::string &Name,<br>
>>> >                           bool ExportedSymbolsOnly) {<br>
>>> >      return FindSymbolIn(H, Name, ExportedSymbolsOnly);<br>
>>> >    }<br>
>>> ><br>
>>> >  private:<br>
>>> > -  AddModuleSetFtor AddModuleSet;<br>
>>> > -  RemoveModuleSetFtor RemoveModuleSet;<br>
>>> > +  AddModuleFtor AddModule;<br>
>>> > +  RemoveModuleFtor RemoveModule;<br>
>>> >    FindSymbolFtor FindSymbol;<br>
>>> >    FindSymbolInFtor FindSymbolIn;<br>
>>> >  };<br>
>>> ><br>
>>> > -template <typename ModuleSetHandleT,<br>
>>> > -          typename AddModuleSetFtor,<br>
>>> > -          typename RemoveModuleSetFtor,<br>
>>> > +template <typename ModuleHandleT,<br>
>>> > +          typename AddModuleFtor,<br>
>>> > +          typename RemoveModuleFtor,<br>
>>> >            typename FindSymbolFtor,<br>
>>> >            typename FindSymbolInFtor><br>
>>> > -MockBaseLayer<<wbr>ModuleSetHandleT, AddModuleSetFtor, RemoveModuleSetFtor,<br>
>>> > +MockBaseLayer<ModuleHandleT, AddModuleFtor, RemoveModuleFtor,<br>
>>> >                FindSymbolFtor, FindSymbolInFtor><br>
>>> > -createMockBaseLayer(<wbr>AddModuleSetFtor &&AddModuleSet,<br>
>>> > -                    RemoveModuleSetFtor &&RemoveModuleSet,<br>
>>> > +createMockBaseLayer(<wbr>AddModuleFtor &&AddModule,<br>
>>> > +                    RemoveModuleFtor &&RemoveModule,<br>
>>> >                      FindSymbolFtor &&FindSymbol,<br>
>>> >                      FindSymbolInFtor &&FindSymbolIn) {<br>
>>> > -  return MockBaseLayer<<wbr>ModuleSetHandleT, AddModuleSetFtor,<br>
>>> RemoveModuleSetFtor,<br>
>>> > +  return MockBaseLayer<ModuleHandleT, AddModuleFtor, RemoveModuleFtor,<br>
>>> >                         FindSymbolFtor, FindSymbolInFtor>(<br>
>>> > -                         std::forward<AddModuleSetFtor><wbr>(AddModuleSet),<br>
>>> > -                         std::forward<RemoveModuleSetF<br>
>>> tor>(RemoveModuleSet),<br>
>>> > +                         std::forward<AddModuleFtor>(<wbr>AddModule),<br>
>>> > +                         std::forward<RemoveModuleFtor><wbr>(RemoveModule),<br>
>>> >                           std::forward<FindSymbolFtor>(<wbr>FindSymbol),<br>
>>> >                           std::forward<FindSymbolInFtor><wbr>(<br>
>>> FindSymbolIn));<br>
>>> >  }<br>
>>> ><br>
>>> ><br>
>>> > ______________________________<wbr>_________________<br>
>>> > llvm-commits mailing list<br>
>>> > <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
>>> > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
>>><br>
>><br>
>><br>
</div></div></blockquote></div><br></div>