Browse Source

Merge branch 'develop' into develop-evmcc

Conflicts:
	CMakeLists.txt
cl-refactor
Paweł Bylica 10 years ago
parent
commit
9105fb1771
  1. 18
      libevmjit/GasMeter.cpp

18
libevmjit/GasMeter.cpp

@ -30,26 +30,26 @@ uint64_t getStepCost(Instruction inst) // TODO: Add this function to FeeSructure
return 0;
case Instruction::SSTORE:
return static_cast<uint64_t>(c_sstoreGas);
return static_cast<uint64_t>(FeeStructure::c_sstoreGas);
case Instruction::SLOAD:
return static_cast<uint64_t>(c_sloadGas);
return static_cast<uint64_t>(FeeStructure::c_sloadGas);
case Instruction::SHA3:
return static_cast<uint64_t>(c_sha3Gas);
return static_cast<uint64_t>(FeeStructure::c_sha3Gas);
case Instruction::BALANCE:
return static_cast<uint64_t>(c_sha3Gas);
return static_cast<uint64_t>(FeeStructure::c_sha3Gas);
case Instruction::CALL:
case Instruction::CALLCODE:
return static_cast<uint64_t>(c_callGas);
return static_cast<uint64_t>(FeeStructure::c_callGas);
case Instruction::CREATE:
return static_cast<uint64_t>(c_createGas);
return static_cast<uint64_t>(FeeStructure::c_createGas);
default: // Assumes instruction code is valid
return static_cast<uint64_t>(c_stepGas);
return static_cast<uint64_t>(FeeStructure::c_stepGas);
}
}
@ -134,7 +134,7 @@ void GasMeter::countSStore(Ext& _ext, llvm::Value* _index, llvm::Value* _newValu
{
assert(!m_checkCall); // Everything should've been commited before
static const auto sstoreCost = static_cast<uint64_t>(c_sstoreGas);
static const auto sstoreCost = static_cast<uint64_t>(FeeStructure::c_sstoreGas);
// [ADD] if oldValue == 0 and newValue != 0 => 2*cost
// [DEL] if oldValue != 0 and newValue == 0 => 0
@ -185,7 +185,7 @@ void GasMeter::commitCostBlock(llvm::Value* _additionalCost)
void GasMeter::checkMemory(llvm::Value* _additionalMemoryInWords, llvm::IRBuilder<>& _builder)
{
// Memory uses other builder, but that can be changes later
auto cost = _builder.CreateMul(_additionalMemoryInWords, Constant::get(static_cast<uint64_t>(c_memoryGas)), "memcost");
auto cost = _builder.CreateMul(_additionalMemoryInWords, Constant::get(static_cast<uint64_t>(FeeStructure::c_memoryGas)), "memcost");
_builder.CreateCall(m_gasCheckFunc, cost);
}

Loading…
Cancel
Save