mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Allow inserting low-level functions without calling them.
This commit is contained in:
1 parent
390bebaaf9
commit
d9fbb83861
2 files changed
+26
-5
No files matched your search
@@ -70,19 +70,30 @@ void CompilerContext::callLowLevelFunction(
|
||||
eth::AssemblyItem retTag = pushNewTag();
|
||||
CompilerUtils(*this).moveIntoStack(_inArgs);
|
||||
|
||||
*this << lowLevelFunctionTag(_name, _inArgs, _outArgs, _generator);
|
||||
|
||||
appendJump(eth::AssemblyItem::JumpType::IntoFunction);
|
||||
adjustStackOffset(int(_outArgs) - 1 - _inArgs);
|
||||
*this << retTag.tag();
|
||||
}
|
||||
|
||||
eth::AssemblyItem CompilerContext::lowLevelFunctionTag(
|
||||
string const& _name,
|
||||
unsigned _inArgs,
|
||||
unsigned _outArgs,
|
||||
function<void(CompilerContext&)> const& _generator
|
||||
)
|
||||
{
|
||||
auto it = m_lowLevelFunctions.find(_name);
|
||||
if (it == m_lowLevelFunctions.end())
|
||||
{
|
||||
eth::AssemblyItem tag = newTag().pushTag();
|
||||
m_lowLevelFunctions.insert(make_pair(_name, tag));
|
||||
m_lowLevelFunctionGenerationQueue.push(make_tuple(_name, _inArgs, _outArgs, _generator));
|
||||
*this << tag;
|
||||
return tag;
|
||||
}
|
||||
else
|
||||
*this << it->second;
|
||||
appendJump(eth::AssemblyItem::JumpType::IntoFunction);
|
||||
adjustStackOffset(int(_outArgs) - 1 - _inArgs);
|
||||
*this << retTag.tag();
|
||||
return it->second;
|
||||
}
|
||||
|
||||
void CompilerContext::appendMissingLowLevelFunctions()
|
||||
|
||||
Reference in new issue
Block a user