|
@ -78,7 +78,7 @@ bool isCostBlockEnd(Instruction _inst) |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
GasMeter::GasMeter(llvm::IRBuilder<>& _builder, llvm::Module* _module, llvm::Value* _jmpBuf) : |
|
|
GasMeter::GasMeter(llvm::IRBuilder<>& _builder, llvm::Module* _module) : |
|
|
m_builder(_builder) |
|
|
m_builder(_builder) |
|
|
{ |
|
|
{ |
|
|
m_gas = new llvm::GlobalVariable(*_module, Type::i256, false, llvm::GlobalVariable::ExternalLinkage, nullptr, "gas"); |
|
|
m_gas = new llvm::GlobalVariable(*_module, Type::i256, false, llvm::GlobalVariable::ExternalLinkage, nullptr, "gas"); |
|
@ -102,8 +102,11 @@ GasMeter::GasMeter(llvm::IRBuilder<>& _builder, llvm::Module* _module, llvm::Val |
|
|
|
|
|
|
|
|
m_builder.SetInsertPoint(outOfGasBB); |
|
|
m_builder.SetInsertPoint(outOfGasBB); |
|
|
|
|
|
|
|
|
auto longjmpFunc = llvm::Intrinsic::getDeclaration(_module, llvm::Intrinsic::eh_sjlj_longjmp); |
|
|
//auto longjmpFunc = llvm::Intrinsic::getDeclaration(_module, llvm::Intrinsic::eh_sjlj_longjmp);
|
|
|
m_builder.CreateCall(longjmpFunc, _jmpBuf); |
|
|
auto extJmpBuf = new llvm::GlobalVariable(*_module, Type::BytePtr, false, llvm::GlobalVariable::ExternalLinkage, nullptr, "rt_jmpBuf"); |
|
|
|
|
|
llvm::Type* args[] = {Type::BytePtr, m_builder.getInt32Ty()}; |
|
|
|
|
|
auto longjmpNative = llvm::Function::Create(llvm::FunctionType::get(Type::Void, args, false), llvm::Function::ExternalLinkage, "longjmp", _module); |
|
|
|
|
|
m_builder.CreateCall2(longjmpNative, m_builder.CreateLoad(extJmpBuf), Constant::get(ReturnCode::OutOfGas)); |
|
|
m_builder.CreateUnreachable(); |
|
|
m_builder.CreateUnreachable(); |
|
|
|
|
|
|
|
|
m_builder.SetInsertPoint(updateBB); |
|
|
m_builder.SetInsertPoint(updateBB); |
|
|