aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface/GasEstimator.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-03-01 19:06:36 +0800
committerchriseth <chris@ethereum.org>2018-03-05 18:36:33 +0800
commit6ec4517929e8c0eca022f4771ba217db5d80beed (patch)
treeece2e275ee9bb190d33e05cef5cc549b21abf8e3 /libsolidity/interface/GasEstimator.cpp
parent5a54cd5c708227ad6982b06de7b799ece5065917 (diff)
downloaddexon-solidity-6ec4517929e8c0eca022f4771ba217db5d80beed.tar.gz
dexon-solidity-6ec4517929e8c0eca022f4771ba217db5d80beed.tar.zst
dexon-solidity-6ec4517929e8c0eca022f4771ba217db5d80beed.zip
Use EVM version in gas meter and optimizer.
Diffstat (limited to 'libsolidity/interface/GasEstimator.cpp')
-rw-r--r--libsolidity/interface/GasEstimator.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/libsolidity/interface/GasEstimator.cpp b/libsolidity/interface/GasEstimator.cpp
index 22cc0266..2139395f 100644
--- a/libsolidity/interface/GasEstimator.cpp
+++ b/libsolidity/interface/GasEstimator.cpp
@@ -40,7 +40,7 @@ using namespace dev::solidity;
GasEstimator::ASTGasConsumptionSelfAccumulated GasEstimator::structuralEstimation(
AssemblyItems const& _items,
vector<ASTNode const*> const& _ast
-)
+) const
{
solAssert(std::count(_ast.begin(), _ast.end(), nullptr) == 0, "");
map<SourceLocation, GasConsumption> particularCosts;
@@ -49,7 +49,7 @@ GasEstimator::ASTGasConsumptionSelfAccumulated GasEstimator::structuralEstimatio
for (BasicBlock const& block: cfg.optimisedBlocks())
{
solAssert(!!block.startState, "");
- GasMeter meter(block.startState->copy());
+ GasMeter meter(block.startState->copy(), m_evmVersion);
auto const end = _items.begin() + block.end;
for (auto iter = _items.begin() + block.begin; iter != end; ++iter)
particularCosts[iter->location()] += meter.estimateMax(*iter);
@@ -127,7 +127,7 @@ map<ASTNode const*, GasMeter::GasConsumption> GasEstimator::breakToStatementLeve
GasEstimator::GasConsumption GasEstimator::functionalEstimation(
AssemblyItems const& _items,
string const& _signature
-)
+) const
{
auto state = make_shared<KnownState>();
@@ -144,7 +144,7 @@ GasEstimator::GasConsumption GasEstimator::functionalEstimation(
});
}
- PathGasMeter meter(_items);
+ PathGasMeter meter(_items, m_evmVersion);
return meter.estimateMax(0, state);
}
@@ -152,7 +152,7 @@ GasEstimator::GasConsumption GasEstimator::functionalEstimation(
AssemblyItems const& _items,
size_t const& _offset,
FunctionDefinition const& _function
-)
+) const
{
auto state = make_shared<KnownState>();
@@ -167,7 +167,7 @@ GasEstimator::GasConsumption GasEstimator::functionalEstimation(
if (parametersSize > 0)
state->feedItem(swapInstruction(parametersSize));
- return PathGasMeter(_items).estimateMax(_offset, state);
+ return PathGasMeter(_items, m_evmVersion).estimateMax(_offset, state);
}
set<ASTNode const*> GasEstimator::finestNodesAtLocation(