mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Remove isCreation flag from OptimiserSettings.
This commit is contained in:
parent
b57e856426
commit
e0c837b33b
@ -411,14 +411,11 @@ map<u256, u256> const& Assembly::optimiseInternal(
|
|||||||
if (m_tagReplacements)
|
if (m_tagReplacements)
|
||||||
return *m_tagReplacements;
|
return *m_tagReplacements;
|
||||||
|
|
||||||
assertThrow(_settings.isCreation == m_creation, OptimizerException, "Mismatching creation settings.");
|
|
||||||
|
|
||||||
// Run optimisation for sub-assemblies.
|
// Run optimisation for sub-assemblies.
|
||||||
for (size_t subId = 0; subId < m_subs.size(); ++subId)
|
for (size_t subId = 0; subId < m_subs.size(); ++subId)
|
||||||
{
|
{
|
||||||
OptimiserSettings settings = _settings;
|
OptimiserSettings settings = _settings;
|
||||||
Assembly& sub = *m_subs[subId];
|
Assembly& sub = *m_subs[subId];
|
||||||
settings.isCreation = sub.isCreation();
|
|
||||||
map<u256, u256> const& subTagReplacements = sub.optimiseInternal(
|
map<u256, u256> const& subTagReplacements = sub.optimiseInternal(
|
||||||
settings,
|
settings,
|
||||||
JumpdestRemover::referencedTags(m_items, subId)
|
JumpdestRemover::referencedTags(m_items, subId)
|
||||||
@ -438,7 +435,7 @@ map<u256, u256> const& Assembly::optimiseInternal(
|
|||||||
m_items,
|
m_items,
|
||||||
_tagsReferencedFromOutside,
|
_tagsReferencedFromOutside,
|
||||||
_settings.expectedExecutionsPerDeployment,
|
_settings.expectedExecutionsPerDeployment,
|
||||||
_settings.isCreation,
|
isCreation(),
|
||||||
_settings.evmVersion
|
_settings.evmVersion
|
||||||
}.optimise();
|
}.optimise();
|
||||||
|
|
||||||
@ -539,8 +536,8 @@ map<u256, u256> const& Assembly::optimiseInternal(
|
|||||||
|
|
||||||
if (_settings.runConstantOptimiser)
|
if (_settings.runConstantOptimiser)
|
||||||
ConstantOptimisationMethod::optimiseConstants(
|
ConstantOptimisationMethod::optimiseConstants(
|
||||||
_settings.isCreation,
|
isCreation(),
|
||||||
_settings.isCreation ? 1 : _settings.expectedExecutionsPerDeployment,
|
isCreation() ? 1 : _settings.expectedExecutionsPerDeployment,
|
||||||
_settings.evmVersion,
|
_settings.evmVersion,
|
||||||
*this
|
*this
|
||||||
);
|
);
|
||||||
|
@ -117,7 +117,6 @@ public:
|
|||||||
|
|
||||||
struct OptimiserSettings
|
struct OptimiserSettings
|
||||||
{
|
{
|
||||||
bool isCreation = false;
|
|
||||||
bool runInliner = false;
|
bool runInliner = false;
|
||||||
bool runJumpdestRemover = false;
|
bool runJumpdestRemover = false;
|
||||||
bool runPeephole = false;
|
bool runPeephole = false;
|
||||||
|
@ -572,8 +572,7 @@ void CompilerContext::updateSourceLocation()
|
|||||||
evmasm::Assembly::OptimiserSettings CompilerContext::translateOptimiserSettings(OptimiserSettings const& _settings)
|
evmasm::Assembly::OptimiserSettings CompilerContext::translateOptimiserSettings(OptimiserSettings const& _settings)
|
||||||
{
|
{
|
||||||
// Constructing it this way so that we notice changes in the fields.
|
// Constructing it this way so that we notice changes in the fields.
|
||||||
evmasm::Assembly::OptimiserSettings asmSettings{false, false, false, false, false, false, false, m_evmVersion, 0};
|
evmasm::Assembly::OptimiserSettings asmSettings{false, false, false, false, false, false, m_evmVersion, 0};
|
||||||
asmSettings.isCreation = true;
|
|
||||||
asmSettings.runInliner = _settings.runInliner;
|
asmSettings.runInliner = _settings.runInliner;
|
||||||
asmSettings.runJumpdestRemover = _settings.runJumpdestRemover;
|
asmSettings.runJumpdestRemover = _settings.runJumpdestRemover;
|
||||||
asmSettings.runPeephole = _settings.runPeephole;
|
asmSettings.runPeephole = _settings.runPeephole;
|
||||||
|
@ -72,8 +72,7 @@ evmasm::Assembly::OptimiserSettings translateOptimiserSettings(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Constructing it this way so that we notice changes in the fields.
|
// Constructing it this way so that we notice changes in the fields.
|
||||||
evmasm::Assembly::OptimiserSettings asmSettings{false, false, false, false, false, false, false, _evmVersion, 0};
|
evmasm::Assembly::OptimiserSettings asmSettings{false, false, false, false, false, false, _evmVersion, 0};
|
||||||
asmSettings.isCreation = true;
|
|
||||||
asmSettings.runInliner = _settings.runInliner;
|
asmSettings.runInliner = _settings.runInliner;
|
||||||
asmSettings.runJumpdestRemover = _settings.runJumpdestRemover;
|
asmSettings.runJumpdestRemover = _settings.runJumpdestRemover;
|
||||||
asmSettings.runPeephole = _settings.runPeephole;
|
asmSettings.runPeephole = _settings.runPeephole;
|
||||||
|
@ -1278,7 +1278,6 @@ BOOST_AUTO_TEST_CASE(jumpdest_removal_subassemblies)
|
|||||||
main.append(u256(8));
|
main.append(u256(8));
|
||||||
|
|
||||||
Assembly::OptimiserSettings settings;
|
Assembly::OptimiserSettings settings;
|
||||||
settings.isCreation = false;
|
|
||||||
settings.runInliner = false;
|
settings.runInliner = false;
|
||||||
settings.runJumpdestRemover = true;
|
settings.runJumpdestRemover = true;
|
||||||
settings.runPeephole = true;
|
settings.runPeephole = true;
|
||||||
@ -1287,7 +1286,7 @@ BOOST_AUTO_TEST_CASE(jumpdest_removal_subassemblies)
|
|||||||
settings.runConstantOptimiser = true;
|
settings.runConstantOptimiser = true;
|
||||||
settings.evmVersion = solidity::test::CommonOptions::get().evmVersion();
|
settings.evmVersion = solidity::test::CommonOptions::get().evmVersion();
|
||||||
settings.expectedExecutionsPerDeployment = OptimiserSettings{}.expectedExecutionsPerDeployment;
|
settings.expectedExecutionsPerDeployment = OptimiserSettings{}.expectedExecutionsPerDeployment;
|
||||||
;
|
|
||||||
main.optimise(settings);
|
main.optimise(settings);
|
||||||
|
|
||||||
AssemblyItems expectationMain{
|
AssemblyItems expectationMain{
|
||||||
|
Loading…
Reference in New Issue
Block a user