llvm.org GIT mirror llvm / 5acfa9f
Instantiate a JITMemoryManager for MCJIT Dyld git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128485 91177308-0d34-0410-b5e6-96231b3b80d8 Jim Grosbach 8 years ago
5 changed file(s) with 13 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
2020
2121 class RuntimeDyldImpl;
2222 class MemoryBuffer;
23 class JITMemoryManager;
2324
2425 class RuntimeDyld {
2526 RuntimeDyld(const RuntimeDyld &); // DO NOT IMPLEMENT
2930 // interface.
3031 RuntimeDyldImpl *Dyld;
3132 public:
32 RuntimeDyld();
33 RuntimeDyld(JITMemoryManager*);
3334 ~RuntimeDyld();
3435
3536 bool loadObject(MemoryBuffer *InputBuffer);
6666 MCJIT::MCJIT(Module *m, TargetMachine *tm, TargetJITInfo &tji,
6767 JITMemoryManager *JMM, CodeGenOpt::Level OptLevel,
6868 bool AllocateGVsWithCode)
69 : ExecutionEngine(m), TM(tm), M(m), OS(Buffer) {
69 : ExecutionEngine(m), TM(tm), M(m), OS(Buffer), Dyld(JMM) {
7070
7171 PM.add(new TargetData(*TM->getTargetData()));
7272
1717 #include "llvm/ADT/StringRef.h"
1818 #include "llvm/ADT/Twine.h"
1919 #include "llvm/ExecutionEngine/RuntimeDyld.h"
20 #include "llvm/ExecutionEngine/JITMemoryManager.h"
2021 #include "llvm/Object/MachOObject.h"
2122 #include "llvm/Support/Debug.h"
2223 #include "llvm/Support/ErrorHandling.h"
3334 unsigned CPUType;
3435 unsigned CPUSubtype;
3536
37 // The JITMemoryManager to load objects into.
38 JITMemoryManager *JMM;
39
3640 // Master symbol table. As modules are loaded and external symbols are
3741 // resolved, their addresses are stored here.
3842 StringMap SymbolTable;
6771 const InMemoryStruct &SymtabLC);
6872
6973 public:
70 RuntimeDyldImpl() : HasError(false) {}
74 RuntimeDyldImpl(JITMemoryManager *jmm) : JMM(jmm), HasError(false) {}
7175
7276 bool loadObject(MemoryBuffer *InputBuffer);
7377
525529
526530 //===----------------------------------------------------------------------===//
527531 // RuntimeDyld class implementation
528 RuntimeDyld::RuntimeDyld() {
529 Dyld = new RuntimeDyldImpl;
532 RuntimeDyld::RuntimeDyld(JITMemoryManager *JMM) {
533 Dyld = new RuntimeDyldImpl(JMM);
530534 }
531535
532536 RuntimeDyld::~RuntimeDyld() {
1717 # early so we can set up LINK_COMPONENTS before including Makefile.rules
1818 include $(LEVEL)/Makefile.config
1919
20 LINK_COMPONENTS := $(TARGETS_TO_BUILD) support MC object RuntimeDyld
20 LINK_COMPONENTS := $(TARGETS_TO_BUILD) support MC object RuntimeDyld JIT
2121
2222 include $(LLVM_SRC_ROOT)/Makefile.rules
1212
1313 #include "llvm/ADT/StringMap.h"
1414 #include "llvm/ADT/OwningPtr.h"
15 #include "llvm/ExecutionEngine/JITMemoryManager.h"
1516 #include "llvm/ExecutionEngine/RuntimeDyld.h"
1617 #include "llvm/Object/MachOObject.h"
1718 #include "llvm/Support/CommandLine.h"
5960 return Error("unable to read input: '" + ec.message() + "'");
6061
6162 // Instantiate a dynamic linker.
62 RuntimeDyld Dyld;
63 RuntimeDyld Dyld(JITMemoryManager::CreateDefaultMemManager());
6364
6465 // Load the object file into it.
6566 if (Dyld.loadObject(InputBuffer.take())) {