class RuntimeDyldImpl;
class MemoryBuffer;
+class JITMemoryManager;
class RuntimeDyld {
RuntimeDyld(const RuntimeDyld &); // DO NOT IMPLEMENT
// interface.
RuntimeDyldImpl *Dyld;
public:
- RuntimeDyld();
+ RuntimeDyld(JITMemoryManager*);
~RuntimeDyld();
bool loadObject(MemoryBuffer *InputBuffer);
MCJIT::MCJIT(Module *m, TargetMachine *tm, TargetJITInfo &tji,
JITMemoryManager *JMM, CodeGenOpt::Level OptLevel,
bool AllocateGVsWithCode)
- : ExecutionEngine(m), TM(tm), M(m), OS(Buffer) {
+ : ExecutionEngine(m), TM(tm), M(m), OS(Buffer), Dyld(JMM) {
PM.add(new TargetData(*TM->getTargetData()));
#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"
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;
const InMemoryStruct<macho::SymtabLoadCommand> &SymtabLC);
public:
- RuntimeDyldImpl() : HasError(false) {}
+ RuntimeDyldImpl(JITMemoryManager *jmm) : JMM(jmm), HasError(false) {}
bool loadObject(MemoryBuffer *InputBuffer);
//===----------------------------------------------------------------------===//
// RuntimeDyld class implementation
-RuntimeDyld::RuntimeDyld() {
- Dyld = new RuntimeDyldImpl;
+RuntimeDyld::RuntimeDyld(JITMemoryManager *JMM) {
+ Dyld = new RuntimeDyldImpl(JMM);
}
RuntimeDyld::~RuntimeDyld() {
# early so we can set up LINK_COMPONENTS before including Makefile.rules
include $(LEVEL)/Makefile.config
-LINK_COMPONENTS := $(TARGETS_TO_BUILD) support MC object RuntimeDyld
+LINK_COMPONENTS := $(TARGETS_TO_BUILD) support MC object RuntimeDyld JIT
include $(LLVM_SRC_ROOT)/Makefile.rules
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/OwningPtr.h"
+#include "llvm/ExecutionEngine/JITMemoryManager.h"
#include "llvm/ExecutionEngine/RuntimeDyld.h"
#include "llvm/Object/MachOObject.h"
#include "llvm/Support/CommandLine.h"
return Error("unable to read input: '" + ec.message() + "'");
// Instantiate a dynamic linker.
- RuntimeDyld Dyld;
+ RuntimeDyld Dyld(JITMemoryManager::CreateDefaultMemManager());
// Load the object file into it.
if (Dyld.loadObject(InputBuffer.take())) {