mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
Do not auto-commit cost block
This commit is contained in:
parent
c5de54dbb0
commit
5d5259e4e0
2 changed files with 6 additions and 20 deletions
|
|
@ -658,6 +658,12 @@ void Compiler::compileBasicBlock(BasicBlock& _basicBlock, bytes const& _bytecode
|
||||||
}
|
}
|
||||||
|
|
||||||
case Instruction::GAS:
|
case Instruction::GAS:
|
||||||
|
{
|
||||||
|
_gasMeter.commitCostBlock();
|
||||||
|
stack.push(_runtimeManager.getGas());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case Instruction::ADDRESS:
|
case Instruction::ADDRESS:
|
||||||
case Instruction::CALLER:
|
case Instruction::CALLER:
|
||||||
case Instruction::ORIGIN:
|
case Instruction::ORIGIN:
|
||||||
|
|
|
||||||
|
|
@ -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) :
|
GasMeter::GasMeter(llvm::IRBuilder<>& _builder, RuntimeManager& _runtimeManager) :
|
||||||
|
|
@ -136,9 +119,6 @@ void GasMeter::count(Instruction _inst)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_blockCost += getStepCost(_inst);
|
m_blockCost += getStepCost(_inst);
|
||||||
|
|
||||||
if (isCostBlockEnd(_inst))
|
|
||||||
commitCostBlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GasMeter::count(llvm::Value* _cost)
|
void GasMeter::count(llvm::Value* _cost)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue