mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #14133 from ethereum/codeTransformPush0
Emit PUSH0 as junk in evm code transform, if available.
This commit is contained in:
commit
9befe1d456
@ -10,6 +10,7 @@ Compiler Features:
|
|||||||
* Optimizer: Re-implement simplified version of UnusedAssignEliminator and UnusedStoreEliminator. It can correctly remove some unused assignments in deeply nested loops that were ignored by the old version.
|
* Optimizer: Re-implement simplified version of UnusedAssignEliminator and UnusedStoreEliminator. It can correctly remove some unused assignments in deeply nested loops that were ignored by the old version.
|
||||||
* SMTChecker: Properties that are proved safe are now reported explicitly at the end of the analysis. By default, only the number of safe properties is shown. The CLI option ``--model-checker-show-proved-safe`` and the JSON option ``settings.modelChecker.showProvedSafe`` can be enabled to show the full list of safe properties.
|
* SMTChecker: Properties that are proved safe are now reported explicitly at the end of the analysis. By default, only the number of safe properties is shown. The CLI option ``--model-checker-show-proved-safe`` and the JSON option ``settings.modelChecker.showProvedSafe`` can be enabled to show the full list of safe properties.
|
||||||
* SMTChecker: Group all messages about unsupported language features in a single warning. The CLI option ``--model-checker-show-unsupported`` and the JSON option ``settings.modelChecker.showUnsupported`` can be enabled to show the full list.
|
* SMTChecker: Group all messages about unsupported language features in a single warning. The CLI option ``--model-checker-show-unsupported`` and the JSON option ``settings.modelChecker.showUnsupported`` can be enabled to show the full list.
|
||||||
|
* Yul EVM Code Transform: If available, use ``push0`` instead of ``codesize`` to produce an arbitrary value on stack in order to create equal stack heights between branches.
|
||||||
|
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
@ -117,6 +117,9 @@ public:
|
|||||||
|
|
||||||
/// Mark this assembly as invalid. Any attempt to request bytecode from it should throw.
|
/// Mark this assembly as invalid. Any attempt to request bytecode from it should throw.
|
||||||
virtual void markAsInvalid() = 0;
|
virtual void markAsInvalid() = 0;
|
||||||
|
|
||||||
|
/// @returns the EVM version the assembly targets.
|
||||||
|
virtual langutil::EVMVersion evmVersion() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class IdentifierContext { LValue, RValue, VariableDeclaration, NonExternal };
|
enum class IdentifierContext { LValue, RValue, VariableDeclaration, NonExternal };
|
||||||
|
@ -181,6 +181,11 @@ void EthAssemblyAdapter::markAsInvalid()
|
|||||||
m_assembly.markAsInvalid();
|
m_assembly.markAsInvalid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
langutil::EVMVersion EthAssemblyAdapter::evmVersion() const
|
||||||
|
{
|
||||||
|
return m_assembly.evmVersion();
|
||||||
|
}
|
||||||
|
|
||||||
EthAssemblyAdapter::LabelID EthAssemblyAdapter::assemblyTagToIdentifier(evmasm::AssemblyItem const& _tag)
|
EthAssemblyAdapter::LabelID EthAssemblyAdapter::assemblyTagToIdentifier(evmasm::AssemblyItem const& _tag)
|
||||||
{
|
{
|
||||||
u256 id = _tag.data();
|
u256 id = _tag.data();
|
||||||
|
@ -67,6 +67,9 @@ public:
|
|||||||
|
|
||||||
void markAsInvalid() override;
|
void markAsInvalid() override;
|
||||||
|
|
||||||
|
langutil::EVMVersion evmVersion() const override;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static LabelID assemblyTagToIdentifier(evmasm::AssemblyItem const& _tag);
|
static LabelID assemblyTagToIdentifier(evmasm::AssemblyItem const& _tag);
|
||||||
void appendJumpInstruction(evmasm::Instruction _instruction, JumpType _jumpType);
|
void appendJumpInstruction(evmasm::Instruction _instruction, JumpType _jumpType);
|
||||||
|
@ -77,6 +77,8 @@ public:
|
|||||||
|
|
||||||
void markAsInvalid() override {}
|
void markAsInvalid() override {}
|
||||||
|
|
||||||
|
langutil::EVMVersion evmVersion() const override { return m_evmVersion; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_stackHeight = 0;
|
int m_stackHeight = 0;
|
||||||
langutil::EVMVersion m_evmVersion;
|
langutil::EVMVersion m_evmVersion;
|
||||||
|
@ -351,7 +351,10 @@ void OptimizedEVMCodeTransform::createStackLayout(std::shared_ptr<DebugData cons
|
|||||||
[&](JunkSlot const&)
|
[&](JunkSlot const&)
|
||||||
{
|
{
|
||||||
// Note: this will always be popped, so we can push anything.
|
// Note: this will always be popped, so we can push anything.
|
||||||
m_assembly.appendInstruction(evmasm::Instruction::CODESIZE);
|
if (m_assembly.evmVersion().hasPush0())
|
||||||
|
m_assembly.appendConstant(0);
|
||||||
|
else
|
||||||
|
m_assembly.appendInstruction(evmasm::Instruction::CODESIZE);
|
||||||
}
|
}
|
||||||
}, _slot);
|
}, _slot);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user