class GlobalVariable;
class GlobalValue;
class JITEventListener;
-class JITMemoryManager;
class MachineCodeInfo;
class MutexGuard;
class ObjectCache;
/// getMemoryforGV - Allocate memory for a global variable.
virtual char *getMemoryForGV(const GlobalVariable *GV);
- static ExecutionEngine *(*MCJITCtor)(std::unique_ptr<Module> M,
- std::string *ErrorStr,
- RTDyldMemoryManager *MCJMM,
- std::unique_ptr<TargetMachine> TM);
+ static ExecutionEngine *(*MCJITCtor)(
+ std::unique_ptr<Module> M,
+ std::string *ErrorStr,
+ std::unique_ptr<RTDyldMemoryManager> MCJMM,
+ std::unique_ptr<TargetMachine> TM);
static ExecutionEngine *(*InterpCtor)(std::unique_ptr<Module> M,
std::string *ErrorStr);
/// it prints a message to stderr and aborts.
///
/// This function is deprecated for the MCJIT execution engine.
- virtual void *getPointerToNamedFunction(const std::string &Name,
+ virtual void *getPointerToNamedFunction(StringRef Name,
bool AbortOnFailure = true) = 0;
/// mapSectionAddress - map a section to its target address space value.
EngineKind::Kind WhichEngine;
std::string *ErrorStr;
CodeGenOpt::Level OptLevel;
- RTDyldMemoryManager *MCJMM;
- JITMemoryManager *JMM;
+ std::unique_ptr<RTDyldMemoryManager> MCJMM;
TargetOptions Options;
Reloc::Model RelocModel;
CodeModel::Model CMModel;
public:
/// Constructor for EngineBuilder.
- EngineBuilder(std::unique_ptr<Module> M) : M(std::move(M)) {
- InitEngine();
- }
+ EngineBuilder(std::unique_ptr<Module> M);
+
+ // Out-of-line since we don't have the def'n of RTDyldMemoryManager here.
+ ~EngineBuilder();
/// setEngineKind - Controls whether the user wants the interpreter, the JIT,
/// or whichever engine works. This option defaults to EngineKind::Either.
/// is only appropriate for the MCJIT; setting this and configuring the builder
/// to create anything other than MCJIT will cause a runtime error. If create()
/// is called and is successful, the created engine takes ownership of the
- /// memory manager. This option defaults to NULL. Using this option nullifies
- /// the setJITMemoryManager() option.
- EngineBuilder &setMCJITMemoryManager(RTDyldMemoryManager *mcjmm) {
- MCJMM = mcjmm;
- JMM = nullptr;
- return *this;
- }
-
- /// setJITMemoryManager - Sets the JIT memory manager to use. This allows
- /// clients to customize their memory allocation policies. This is only
- /// appropriate for either JIT or MCJIT; setting this and configuring the
- /// builder to create an interpreter will cause a runtime error. If create()
- /// is called and is successful, the created engine takes ownership of the
- /// memory manager. This option defaults to NULL. This option overrides
- /// setMCJITMemoryManager() as well.
- EngineBuilder &setJITMemoryManager(JITMemoryManager *jmm) {
- MCJMM = nullptr;
- JMM = jmm;
- return *this;
- }
+ /// memory manager. This option defaults to NULL.
+ EngineBuilder &setMCJITMemoryManager(std::unique_ptr<RTDyldMemoryManager> mcjmm);
/// setErrorStr - Set the error string to write to on error. This option
/// defaults to NULL.