mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10209 from ethereum/removeUnusedCode
Remove access to functions from inline assembly (unused code).
This commit is contained in:
commit
d9f9eb1ec5
@ -691,26 +691,7 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly)
|
|||||||
{
|
{
|
||||||
int const depositBefore = _assembly.stackHeight();
|
int const depositBefore = _assembly.stackHeight();
|
||||||
solAssert(!!decl->type(), "Type of declaration required but not yet determined.");
|
solAssert(!!decl->type(), "Type of declaration required but not yet determined.");
|
||||||
if (FunctionDefinition const* functionDef = dynamic_cast<FunctionDefinition const*>(decl))
|
if (auto variable = dynamic_cast<VariableDeclaration const*>(decl))
|
||||||
{
|
|
||||||
solAssert(!ref->second.isOffset && !ref->second.isSlot, "");
|
|
||||||
functionDef = &functionDef->resolveVirtual(m_context.mostDerivedContract());
|
|
||||||
auto functionEntryLabel = m_context.functionEntryLabel(*functionDef).pushTag();
|
|
||||||
solAssert(functionEntryLabel.data() <= std::numeric_limits<size_t>::max(), "");
|
|
||||||
_assembly.appendLabelReference(static_cast<size_t>(functionEntryLabel.data()));
|
|
||||||
// If there is a runtime context, we have to merge both labels into the same
|
|
||||||
// stack slot in case we store it in storage.
|
|
||||||
if (CompilerContext* rtc = m_context.runtimeContext())
|
|
||||||
{
|
|
||||||
_assembly.appendConstant(u256(1) << 32);
|
|
||||||
_assembly.appendInstruction(Instruction::MUL);
|
|
||||||
auto runtimeEntryLabel = rtc->functionEntryLabel(*functionDef).toSubAssemblyTag(m_context.runtimeSub());
|
|
||||||
solAssert(runtimeEntryLabel.data() <= std::numeric_limits<size_t>::max(), "");
|
|
||||||
_assembly.appendLabelReference(static_cast<size_t>(runtimeEntryLabel.data()));
|
|
||||||
_assembly.appendInstruction(Instruction::OR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (auto variable = dynamic_cast<VariableDeclaration const*>(decl))
|
|
||||||
{
|
{
|
||||||
solAssert(!variable->immutable(), "");
|
solAssert(!variable->immutable(), "");
|
||||||
if (variable->isConstant())
|
if (variable->isConstant())
|
||||||
|
Loading…
Reference in New Issue
Block a user