Browse Source

Change the way entry function is called.

cl-refactor
Paweł Bylica 10 years ago
parent
commit
4a9d08d1b0
  1. 12
      libevmjit/ExecutionEngine.cpp

12
libevmjit/ExecutionEngine.cpp

@ -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);

Loading…
Cancel
Save