More aggresive gas counting optimization: do not commit cost before SSTORE.

This commit is contained in:
Paweł Bylica 2014-12-29 18:54:27 +01:00
parent c5ebca65d5
commit c5de54dbb0

View file

@ -87,7 +87,6 @@ bool isCostBlockEnd(Instruction _inst)
switch (_inst) switch (_inst)
{ {
case Instruction::SSTORE:
case Instruction::GAS: case Instruction::GAS:
return true; return true;
@ -164,8 +163,6 @@ void GasMeter::countExp(llvm::Value* _exponent)
void GasMeter::countSStore(Ext& _ext, llvm::Value* _index, llvm::Value* _newValue) void GasMeter::countSStore(Ext& _ext, llvm::Value* _index, llvm::Value* _newValue)
{ {
assert(!m_checkCall); // Everything should've been commited before
auto oldValue = _ext.sload(_index); auto oldValue = _ext.sload(_index);
auto oldValueIsZero = m_builder.CreateICmpEQ(oldValue, Constant::get(0), "oldValueIsZero"); auto oldValueIsZero = m_builder.CreateICmpEQ(oldValue, Constant::get(0), "oldValueIsZero");
auto newValueIsZero = m_builder.CreateICmpEQ(_newValue, Constant::get(0), "newValueIsZero"); auto newValueIsZero = m_builder.CreateICmpEQ(_newValue, Constant::get(0), "newValueIsZero");