Merge pull request #6334 from ethereum/renameDefaultOptimizerSetting

Rename default optimizer setting
This commit is contained in:
chriseth 2019-03-21 12:22:52 +01:00 committed by GitHub
commit 867e5bc64d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 10 additions and 10 deletions

View File

@ -109,7 +109,7 @@ void CompilerStack::setLibraries(std::map<std::string, h160> const& _libraries)
void CompilerStack::setOptimiserSettings(bool _optimize, unsigned _runs)
{
OptimiserSettings settings = _optimize ? OptimiserSettings::enabled() : OptimiserSettings::minimal();
OptimiserSettings settings = _optimize ? OptimiserSettings::standard() : OptimiserSettings::minimal();
settings.expectedExecutionsPerDeployment = _runs;
setOptimiserSettings(std::move(settings));
}
@ -978,7 +978,7 @@ string CompilerStack::createMetadata(Contract const& _contract) const
settingsWithoutRuns.expectedExecutionsPerDeployment = OptimiserSettings::minimal().expectedExecutionsPerDeployment;
if (settingsWithoutRuns == OptimiserSettings::minimal())
meta["settings"]["optimizer"]["enabled"] = false;
else if (settingsWithoutRuns == OptimiserSettings::enabled())
else if (settingsWithoutRuns == OptimiserSettings::standard())
meta["settings"]["optimizer"]["enabled"] = true;
else
{

View File

@ -45,7 +45,7 @@ struct OptimiserSettings
return s;
}
/// Standard optimisations.
static OptimiserSettings enabled()
static OptimiserSettings standard()
{
OptimiserSettings s;
s.runOrderLiterals = true;
@ -63,7 +63,7 @@ struct OptimiserSettings
/// Standard optimisations plus yul and stack optimiser.
static OptimiserSettings full()
{
OptimiserSettings s = enabled();
OptimiserSettings s = standard();
s.optimizeStackAllocation = true;
s.runYulOptimiser = true;
return s;

View File

@ -369,7 +369,7 @@ boost::variant<OptimiserSettings, Json::Value> parseOptimizerSettings(Json::Valu
if (!_jsonInput["enabled"].isBool())
return formatFatalError("JSONError", "The \"enabled\" setting must be a Boolean.");
settings = _jsonInput["enabled"].asBool() ? OptimiserSettings::enabled() : OptimiserSettings::minimal();
settings = _jsonInput["enabled"].asBool() ? OptimiserSettings::standard() : OptimiserSettings::minimal();
}
if (_jsonInput.isMember("runs"))

View File

@ -904,7 +904,7 @@ bool CommandLineInterface::processInput()
m_compiler->setEVMVersion(m_evmVersion);
// TODO: Perhaps we should not compile unless requested
OptimiserSettings settings = m_args.count(g_argOptimize) ? OptimiserSettings::enabled() : OptimiserSettings::minimal();
OptimiserSettings settings = m_args.count(g_argOptimize) ? OptimiserSettings::standard() : OptimiserSettings::minimal();
settings.expectedExecutionsPerDeployment = m_args[g_argOptimizeRuns].as<unsigned>();
settings.runYulOptimiser = m_args.count(g_strOptimizeYul);
settings.optimizeStackAllocation = settings.runYulOptimiser;

View File

@ -57,7 +57,7 @@ ExecutionFramework::ExecutionFramework():
ExecutionFramework::ExecutionFramework(string const& _ipcPath, langutil::EVMVersion _evmVersion):
m_rpc(RPCSession::instance(_ipcPath)),
m_evmVersion(_evmVersion),
m_optimiserSettings(dev::test::Options::get().optimize ? solidity::OptimiserSettings::enabled() : solidity::OptimiserSettings::minimal()),
m_optimiserSettings(dev::test::Options::get().optimize ? solidity::OptimiserSettings::standard() : solidity::OptimiserSettings::minimal()),
m_showMessages(dev::test::Options::get().showMessages),
m_sender(m_rpc.account(0))
{

View File

@ -59,7 +59,7 @@ public:
bytes bytecode = lll::compileLLL(
_sourceCode,
dev::test::Options::get().evmVersion(),
m_optimiserSettings == solidity::OptimiserSettings::enabled(),
m_optimiserSettings == solidity::OptimiserSettings::standard(),
&errors
);
if (!errors.empty())

View File

@ -86,7 +86,7 @@ eth::AssemblyItems compileContract(std::shared_ptr<CharStream> _sourceCode)
{
Compiler compiler(
dev::test::Options::get().evmVersion(),
dev::test::Options::get().optimize ? OptimiserSettings::enabled() : OptimiserSettings::minimal()
dev::test::Options::get().optimize ? OptimiserSettings::standard() : OptimiserSettings::minimal()
);
compiler.compileContract(*contract, map<ContractDefinition const*, shared_ptr<Compiler const>>{}, bytes());

View File

@ -56,7 +56,7 @@ public:
{
OptimiserSettings previousSettings = std::move(m_optimiserSettings);
// This uses "none" / "full" while most other test frameworks use
// "minimal" / "enabled".
// "minimal" / "standard".
m_optimiserSettings = _optimize ? OptimiserSettings::full() : OptimiserSettings::none();
m_optimiserSettings.expectedExecutionsPerDeployment = _optimizeRuns;
bytes const& ret = compileAndRun(_sourceCode, _value, _contractName);