aboutsummaryrefslogtreecommitdiffstats
path: root/solc
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 /solc
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 'solc')
-rw-r--r--solc/CommandLineInterface.cpp13
-rw-r--r--solc/CommandLineInterface.h5
2 files changed, 9 insertions, 9 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index fd079656..d3d234c3 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -748,7 +748,6 @@ bool CommandLineInterface::processInput()
if (!parseLibraryOption(library))
return false;
- EVMVersion evmVersion;
if (m_args.count(g_strEVMVersion))
{
string versionOptionStr = m_args[g_strEVMVersion].as<string>();
@@ -758,7 +757,7 @@ bool CommandLineInterface::processInput()
cerr << "Invalid option for --evm-version: " << versionOptionStr << endl;
return false;
}
- evmVersion = *versionOption;
+ m_evmVersion = *versionOption;
}
if (m_args.count(g_argAssemble) || m_args.count(g_argStrictAssembly) || m_args.count(g_argJulia))
@@ -784,7 +783,7 @@ bool CommandLineInterface::processInput()
return false;
}
}
- return assemble(evmVersion, inputLanguage, targetMachine);
+ return assemble(inputLanguage, targetMachine);
}
if (m_args.count(g_argLink))
{
@@ -808,8 +807,7 @@ bool CommandLineInterface::processInput()
m_compiler->addSource(sourceCode.first, sourceCode.second);
if (m_args.count(g_argLibraries))
m_compiler->setLibraries(m_libraries);
- if (m_args.count(g_strEVMVersion))
- m_compiler->setEVMVersion(evmVersion);
+ m_compiler->setEVMVersion(m_evmVersion);
// TODO: Perhaps we should not compile unless requested
bool optimize = m_args.count(g_argOptimize) > 0;
unsigned runs = m_args[g_argOptimizeRuns].as<unsigned>();
@@ -968,7 +966,7 @@ void CommandLineInterface::handleAst(string const& _argStr)
// FIXME: shouldn't this be done for every contract?
if (m_compiler->runtimeAssemblyItems(m_compiler->lastContractName()))
gasCosts = GasEstimator::breakToStatementLevel(
- GasEstimator::structuralEstimation(*m_compiler->runtimeAssemblyItems(m_compiler->lastContractName()), asts),
+ GasEstimator(m_evmVersion).structuralEstimation(*m_compiler->runtimeAssemblyItems(m_compiler->lastContractName()), asts),
asts
);
@@ -1081,7 +1079,6 @@ void CommandLineInterface::writeLinkedFiles()
}
bool CommandLineInterface::assemble(
- EVMVersion _evmVersion,
AssemblyStack::Language _language,
AssemblyStack::Machine _targetMachine
)
@@ -1090,7 +1087,7 @@ bool CommandLineInterface::assemble(
map<string, AssemblyStack> assemblyStacks;
for (auto const& src: m_sourceCodes)
{
- auto& stack = assemblyStacks[src.first] = AssemblyStack(_evmVersion, _language);
+ auto& stack = assemblyStacks[src.first] = AssemblyStack(m_evmVersion, _language);
try
{
if (!stack.parseAndAnalyze(src.first, src.second))
diff --git a/solc/CommandLineInterface.h b/solc/CommandLineInterface.h
index 81117fdc..303023fc 100644
--- a/solc/CommandLineInterface.h
+++ b/solc/CommandLineInterface.h
@@ -23,6 +23,7 @@
#include <libsolidity/interface/CompilerStack.h>
#include <libsolidity/interface/AssemblyStack.h>
+#include <libsolidity/interface/EVMVersion.h>
#include <boost/program_options.hpp>
#include <boost/filesystem/path.hpp>
@@ -54,7 +55,7 @@ private:
bool link();
void writeLinkedFiles();
- bool assemble(EVMVersion _evmVersion, AssemblyStack::Language _language, AssemblyStack::Machine _targetMachine);
+ bool assemble(AssemblyStack::Language _language, AssemblyStack::Machine _targetMachine);
void outputCompilationResults();
@@ -102,6 +103,8 @@ private:
std::map<std::string, h160> m_libraries;
/// Solidity compiler stack
std::unique_ptr<dev::solidity::CompilerStack> m_compiler;
+ /// EVM version to use
+ EVMVersion m_evmVersion;
};
}