Browse Source

Do not auto-commit cost block

cl-refactor
Paweł Bylica 10 years ago
parent
commit
5d5259e4e0
  1. 6
      libevmjit/Compiler.cpp
  2. 20
      libevmjit/GasMeter.cpp

6
libevmjit/Compiler.cpp

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

20
libevmjit/GasMeter.cpp

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

Loading…
Cancel
Save