Browse Source

Merge branch 'develop-evmcc' of github.com:imapp-pl/ethereum into develop-evmcc

cl-refactor
artur-zawlocki 10 years ago
parent
commit
ae2d98838c
  1. 12
      evmcc/GasMeter.cpp

12
evmcc/GasMeter.cpp

@ -51,24 +51,20 @@ uint64_t getStepCost(dev::eth::Instruction inst) // TODO: Add this function to F
bool isCostBlockEnd(Instruction _inst) 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
switch (_inst) switch (_inst)
{ {
case Instruction::STOP:
case Instruction::CALLDATACOPY: case Instruction::CALLDATACOPY:
case Instruction::CODECOPY: case Instruction::CODECOPY:
case Instruction::MLOAD: case Instruction::MLOAD:
case Instruction::MSTORE: case Instruction::MSTORE:
case Instruction::MSTORE8: case Instruction::MSTORE8:
case Instruction::SSTORE: case Instruction::SSTORE:
case Instruction::JUMP:
case Instruction::JUMPI:
case Instruction::JUMPDEST:
case Instruction::GAS: case Instruction::GAS:
case Instruction::CREATE: case Instruction::CREATE:
case Instruction::CALL: case Instruction::CALL:
case Instruction::CALLCODE: case Instruction::CALLCODE:
case Instruction::RETURN:
case Instruction::SUICIDE:
return true; return true;
default: default:
@ -116,7 +112,11 @@ void GasMeter::commitCostBlock()
// If any uncommited block // If any uncommited block
if (m_checkCall) if (m_checkCall)
{ {
if (m_blockCost > 0) // If any cost
m_checkCall->setArgOperand(0, m_builder.getIntN(256, m_blockCost)); // Update block cost in gas check call m_checkCall->setArgOperand(0, m_builder.getIntN(256, m_blockCost)); // Update block cost in gas check call
else
m_checkCall->eraseFromParent(); // Remove the gas check call
m_checkCall = nullptr; // End cost-block m_checkCall = nullptr; // End cost-block
m_blockCost = 0; m_blockCost = 0;
} }

Loading…
Cancel
Save