mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6334 from ethereum/renameDefaultOptimizerSetting
Rename default optimizer setting
This commit is contained in:
commit
867e5bc64d
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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"))
|
||||
|
@ -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;
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user