|
@ -112,11 +112,19 @@ ReturnCode ExecutionEngine::run(ExecBundle const& _exec, RuntimeData* _data, Env |
|
|
ReturnCode returnCode; |
|
|
ReturnCode returnCode; |
|
|
Runtime runtime(_data, _env); |
|
|
Runtime runtime(_data, _env); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<llvm::GenericValue> args{{}, llvm::GenericValue(&runtime)}; |
|
|
|
|
|
llvm::GenericValue result; |
|
|
|
|
|
|
|
|
|
|
|
typedef ReturnCode(*EntryFuncPtr)(int, Runtime*); |
|
|
|
|
|
|
|
|
|
|
|
auto entryFuncVoidPtr = _exec.engine->getPointerToFunction(_exec.entryFunc); |
|
|
|
|
|
auto entryFuncPtr = static_cast<EntryFuncPtr>(entryFuncVoidPtr); |
|
|
|
|
|
|
|
|
auto r = setjmp(runtime.getJmpBuf()); |
|
|
auto r = setjmp(runtime.getJmpBuf()); |
|
|
if (r == 0) |
|
|
if (r == 0) |
|
|
{ |
|
|
{ |
|
|
auto result = _exec.engine->runFunction(_exec.entryFunc, {{}, llvm::GenericValue(&runtime)}); |
|
|
returnCode = entryFuncPtr(0, &runtime); |
|
|
returnCode = static_cast<ReturnCode>(result.IntVal.getZExtValue()); |
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
returnCode = static_cast<ReturnCode>(r); |
|
|
returnCode = static_cast<ReturnCode>(r); |
|
|