Do not auto-commit cost block

This commit is contained in:
Paweł Bylica 2014-12-29 19:22:50 +01:00
parent c5de54dbb0
commit 5d5259e4e0
2 changed files with 6 additions and 20 deletions

View file

@ -658,6 +658,12 @@ void Compiler::compileBasicBlock(BasicBlock& _basicBlock, bytes const& _bytecode
}
case Instruction::GAS:
{
_gasMeter.commitCostBlock();
stack.push(_runtimeManager.getGas());
break;
}
case Instruction::ADDRESS:
case Instruction::CALLER:
case Instruction::ORIGIN:

View file

@ -78,23 +78,6 @@ uint64_t getStepCost(Instruction inst) // TODO: Add this function to FeeSructure
}
}
bool isCostBlockEnd(Instruction _inst)
{
// Basic block terminators like STOP are not needed on the list
// as cost will be commited at the end of basic block
// CALL, CALLCODE & CREATE are commited manually
switch (_inst)
{
case Instruction::GAS:
return true;
default:
return false;
}
}
}
GasMeter::GasMeter(llvm::IRBuilder<>& _builder, RuntimeManager& _runtimeManager) :
@ -136,9 +119,6 @@ void GasMeter::count(Instruction _inst)
}
m_blockCost += getStepCost(_inst);
if (isCostBlockEnd(_inst))
commitCostBlock();
}
void GasMeter::count(llvm::Value* _cost)