aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface/CompilerStack.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/CompilerStack.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/CompilerStack.cpp')
-rw-r--r--libsolidity/interface/CompilerStack.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp
index cb1ca3aa..eacfca9c 100644
--- a/libsolidity/interface/CompilerStack.cpp
+++ b/libsolidity/interface/CompilerStack.cpp
@@ -959,11 +959,12 @@ Json::Value CompilerStack::gasEstimates(string const& _contractName) const
return Json::Value();
using Gas = GasEstimator::GasConsumption;
+ GasEstimator gasEstimator(m_evmVersion);
Json::Value output(Json::objectValue);
if (eth::AssemblyItems const* items = assemblyItems(_contractName))
{
- Gas executionGas = GasEstimator::functionalEstimation(*items);
+ Gas executionGas = gasEstimator.functionalEstimation(*items);
u256 bytecodeSize(runtimeObject(_contractName).bytecode.size());
Gas codeDepositGas = bytecodeSize * eth::GasCosts::createDataGas;
@@ -984,14 +985,14 @@ Json::Value CompilerStack::gasEstimates(string const& _contractName) const
for (auto it: contract.interfaceFunctions())
{
string sig = it.second->externalSignature();
- externalFunctions[sig] = gasToJson(GasEstimator::functionalEstimation(*items, sig));
+ externalFunctions[sig] = gasToJson(gasEstimator.functionalEstimation(*items, sig));
}
if (contract.fallbackFunction())
/// This needs to be set to an invalid signature in order to trigger the fallback,
/// without the shortcut (of CALLDATSIZE == 0), and therefore to receive the upper bound.
/// An empty string ("") would work to trigger the shortcut only.
- externalFunctions[""] = gasToJson(GasEstimator::functionalEstimation(*items, "INVALID"));
+ externalFunctions[""] = gasToJson(gasEstimator.functionalEstimation(*items, "INVALID"));
if (!externalFunctions.empty())
output["external"] = externalFunctions;
@@ -1007,7 +1008,7 @@ Json::Value CompilerStack::gasEstimates(string const& _contractName) const
size_t entry = functionEntryPoint(_contractName, *it);
GasEstimator::GasConsumption gas = GasEstimator::GasConsumption::infinite();
if (entry > 0)
- gas = GasEstimator::functionalEstimation(*items, entry, *it);
+ gas = gasEstimator.functionalEstimation(*items, entry, *it);
/// TODO: This could move into a method shared with externalSignature()
FunctionType type(*it);