Revert "Revert "Have JIT execution take ownership of the LLVMContextRef""
This reverts commit 19adece68b.
This commit is contained in:
@@ -329,12 +329,12 @@ LLVMRustLoadCrate(void* mem, const char* crate) {
|
||||
return true;
|
||||
}
|
||||
|
||||
extern "C" void*
|
||||
LLVMRustExecuteJIT(void* mem,
|
||||
LLVMPassManagerRef PMR,
|
||||
LLVMModuleRef M,
|
||||
CodeGenOpt::Level OptLevel,
|
||||
bool EnableSegmentedStacks) {
|
||||
extern "C" LLVMExecutionEngineRef
|
||||
LLVMRustBuildJIT(void* mem,
|
||||
LLVMPassManagerRef PMR,
|
||||
LLVMModuleRef M,
|
||||
CodeGenOpt::Level OptLevel,
|
||||
bool EnableSegmentedStacks) {
|
||||
|
||||
InitializeNativeTarget();
|
||||
InitializeNativeTargetAsmPrinter();
|
||||
@@ -371,21 +371,15 @@ LLVMRustExecuteJIT(void* mem,
|
||||
|
||||
if(!EE || Err != "") {
|
||||
LLVMRustError = Err.c_str();
|
||||
return 0;
|
||||
// The EngineBuilder only takes ownership of these two structures if the
|
||||
// create() call is successful, but here it wasn't successful.
|
||||
LLVMDisposeModule(M);
|
||||
delete MM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MM->invalidateInstructionCache();
|
||||
Function* func = EE->FindFunctionNamed("_rust_main");
|
||||
|
||||
if(!func || Err != "") {
|
||||
LLVMRustError = Err.c_str();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* entry = EE->getPointerToFunction(func);
|
||||
assert(entry);
|
||||
|
||||
return entry;
|
||||
return wrap(EE);
|
||||
}
|
||||
|
||||
extern "C" bool
|
||||
|
||||
@@ -6,13 +6,14 @@ LLVMRustConstSmallInt
|
||||
LLVMRustConstInt
|
||||
LLVMRustLoadCrate
|
||||
LLVMRustPrepareJIT
|
||||
LLVMRustExecuteJIT
|
||||
LLVMRustBuildJIT
|
||||
LLVMRustParseBitcode
|
||||
LLVMRustParseAssemblyFile
|
||||
LLVMRustPrintPassTimings
|
||||
LLVMRustStartMultithreading
|
||||
LLVMCreateObjectFile
|
||||
LLVMDisposeObjectFile
|
||||
LLVMDisposeExecutionEngine
|
||||
LLVMGetSections
|
||||
LLVMDisposeSectionIterator
|
||||
LLVMIsSectionIteratorAtEnd
|
||||
@@ -356,6 +357,7 @@ LLVMGetParamParent
|
||||
LLVMGetParamTypes
|
||||
LLVMGetParams
|
||||
LLVMGetPointerAddressSpace
|
||||
LLVMGetPointerToGlobal
|
||||
LLVMGetPreviousBasicBlock
|
||||
LLVMGetPreviousFunction
|
||||
LLVMGetPreviousGlobal
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "llvm/Transforms/Vectorize.h"
|
||||
#include "llvm-c/Core.h"
|
||||
#include "llvm-c/BitReader.h"
|
||||
#include "llvm-c/ExecutionEngine.h"
|
||||
#include "llvm-c/Object.h"
|
||||
|
||||
// Used by RustMCJITMemoryManager::getPointerToNamedFunction()
|
||||
|
||||
Reference in New Issue
Block a user