Browse Source

Throw exception if EVM program is not jitable instead of terminating to make tests going

cl-refactor
Paweł Bylica 10 years ago
parent
commit
c97ca249a0
  1. 5
      libevmjit/Compiler.cpp
  2. 13
      libevmjit/ExecutionEngine.cpp

5
libevmjit/Compiler.cpp

@ -901,10 +901,7 @@ void Compiler::linkBasicBlocks()
// TODO: In case entry block is reached - report error
auto predBB = findBasicBlock(*predIt);
if (!predBB)
{
std::cerr << "Stack too small in " << _llbb->getName().str() << std::endl;
std::exit(1);
}
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Unsupported dynamic stack"));
auto value = predBB->getStack().get(valueIdx);
phi->addIncoming(value, predBB->llvm());
}

13
libevmjit/ExecutionEngine.cpp

@ -70,13 +70,7 @@ int ExecutionEngine::run(std::unique_ptr<llvm::Module> _module, u256& _gas, ExtV
auto exec = std::unique_ptr<llvm::ExecutionEngine>(builder.create());
if (!exec)
{
if (!errorMsg.empty())
std::cerr << "error creating EE: " << errorMsg << std::endl;
else
std::cerr << "unknown error creating llvm::ExecutionEngine" << std::endl;
exit(1);
}
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment(errorMsg));
_module.release(); // Successfully created llvm::ExecutionEngine takes ownership of the module
exec->finalizeObject();
@ -106,10 +100,7 @@ int ExecutionEngine::run(std::unique_ptr<llvm::Module> _module, u256& _gas, ExtV
auto entryFunc = module->getFunction("main");
if (!entryFunc)
{
std::cerr << "main function not found\n";
exit(1);
}
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("main function not found"));
ReturnCode returnCode;
std::jmp_buf buf;

Loading…
Cancel
Save