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

This commit is contained in:
Paweł Bylica 2014-10-20 18:38:39 +02:00
parent 150162e33d
commit c97ca249a0
2 changed files with 3 additions and 15 deletions

View file

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

View file

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