diff --git a/libevmjit/Compiler.cpp b/libevmjit/Compiler.cpp index bc65bafa8..2dc2b0c65 100644 --- a/libevmjit/Compiler.cpp +++ b/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: diff --git a/libevmjit/GasMeter.cpp b/libevmjit/GasMeter.cpp index 515eefaaa..e5acbdc1d 100644 --- a/libevmjit/GasMeter.cpp +++ b/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)