Instantiate a JITMemoryManager for MCJIT Dyld
[oota-llvm.git] / lib / ExecutionEngine / RuntimeDyld / RuntimeDyld.cpp
index c6b6a9ee884c88b97b78fab9406fea3c47af2740..c041c940de9d65d17790e8db532763a0d81c121c 100644 (file)
@@ -18,6 +18,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/ExecutionEngine/RuntimeDyld.h"
+#include "llvm/ExecutionEngine/JITMemoryManager.h"
 #include "llvm/Object/MachOObject.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -34,6 +35,9 @@ class RuntimeDyldImpl {
   unsigned CPUType;
   unsigned CPUSubtype;
 
+  // The JITMemoryManager to load objects into.
+  JITMemoryManager *JMM;
+
   // Master symbol table. As modules are loaded and external symbols are
   // resolved, their addresses are stored here.
   StringMap<void*> SymbolTable;
@@ -68,7 +72,7 @@ class RuntimeDyldImpl {
                      const InMemoryStruct<macho::SymtabLoadCommand> &SymtabLC);
 
 public:
-  RuntimeDyldImpl() : HasError(false) {}
+  RuntimeDyldImpl(JITMemoryManager *jmm) : JMM(jmm), HasError(false) {}
 
   bool loadObject(MemoryBuffer *InputBuffer);
 
@@ -526,8 +530,8 @@ bool RuntimeDyldImpl::loadObject(MemoryBuffer *InputBuffer) {
 
 //===----------------------------------------------------------------------===//
 // RuntimeDyld class implementation
-RuntimeDyld::RuntimeDyld() {
-  Dyld = new RuntimeDyldImpl;
+RuntimeDyld::RuntimeDyld(JITMemoryManager *JMM) {
+  Dyld = new RuntimeDyldImpl(JMM);
 }
 
 RuntimeDyld::~RuntimeDyld() {