[llvm] r322336 - [ORC] Add a stub ExecutionSession and VModuleKey type.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 11 16:22:05 PST 2018


Author: lhames
Date: Thu Jan 11 16:22:05 2018
New Revision: 322336

URL: http://llvm.org/viewvc/llvm-project?rev=322336&view=rev
Log:
[ORC] Add a stub ExecutionSession and VModuleKey type.

ExecutionSession will represent a running JIT program.

VModuleKey is a unique key assigned to each module added as part of
an ExecutionSession. The Layer concept will be updated in future to
require a VModuleKey when a module is added.

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h
    llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h?rev=322336&r1=322335&r2=322336&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h Thu Jan 11 16:22:05 2018
@@ -17,7 +17,6 @@
 #include "llvm/ExecutionEngine/JITSymbol.h"
 #include "llvm/ExecutionEngine/Orc/SymbolStringPool.h"
 
-#include <deque>
 #include <map>
 #include <memory>
 #include <set>
@@ -26,6 +25,10 @@
 namespace llvm {
 namespace orc {
 
+/// VModuleKey provides a unique identifier (allocated and managed by
+/// ExecutionSessions) for a module added to the JIT.
+using VModuleKey = uint64_t;
+
 class VSO;
 
 /// @brief A set of symbol names (represented by SymbolStringPtrs for
@@ -228,6 +231,21 @@ private:
   std::map<SymbolStringPtr, SymbolTableEntry> Symbols;
 };
 
+/// @brief An ExecutionSession represents a running JIT program.
+class ExecutionSession {
+public:
+  /// @brief Allocate a module key for a new module to add to the JIT.
+  VModuleKey allocateVModule();
+
+  /// @brief Return a module key to the ExecutionSession so that it can be
+  ///        re-used. This should only be done once all resources associated
+  ////       with the original key have been released.
+  void releaseVModule(VModuleKey Key);
+
+public:
+  VModuleKey LastKey = 0;
+};
+
 } // End namespace orc
 } // End namespace llvm
 

Modified: llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp?rev=322336&r1=322335&r2=322336&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp Thu Jan 11 16:22:05 2018
@@ -313,5 +313,11 @@ VSO::LookupResult VSO::lookup(Asynchrono
   return {std::move(MaterializationWork), std::move(Names)};
 }
 
+VModuleKey ExecutionSession::allocateVModule() { return ++LastKey; }
+
+void ExecutionSession::releaseVModule(VModuleKey VMod) {
+  // FIXME: Recycle keys.
+}
+
 } // End namespace orc.
 } // End namespace llvm.




More information about the llvm-commits mailing list