[yul] Adding support for accessing subobjects via .

Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
This commit is contained in:
Djordje Mijovic
2020-07-21 17:56:11 +02:00
co-authored by Kamil Śliwak
parent 952101996c
commit 6f97e6153c
24 changed files with 357 additions and 76 deletions
+16 -10
View File
@@ -147,22 +147,28 @@ pair<shared_ptr<AbstractAssembly>, AbstractAssembly::SubID> EthAssemblyAdapter::
return {make_shared<EthAssemblyAdapter>(*assembly), static_cast<size_t>(sub.data())};
}
void EthAssemblyAdapter::appendDataOffset(AbstractAssembly::SubID _sub)
void EthAssemblyAdapter::appendDataOffset(vector<AbstractAssembly::SubID> const& _subPath)
{
auto it = m_dataHashBySubId.find(_sub);
if (it == m_dataHashBySubId.end())
m_assembly.pushSubroutineOffset(_sub);
else
if (auto it = m_dataHashBySubId.find(_subPath[0]); it != m_dataHashBySubId.end())
{
yulAssert(_subPath.size() == 1, "");
m_assembly << evmasm::AssemblyItem(evmasm::PushData, it->second);
return;
}
m_assembly.pushSubroutineOffset(m_assembly.encodeSubPath(_subPath));
}
void EthAssemblyAdapter::appendDataSize(AbstractAssembly::SubID _sub)
void EthAssemblyAdapter::appendDataSize(vector<AbstractAssembly::SubID> const& _subPath)
{
auto it = m_dataHashBySubId.find(_sub);
if (it == m_dataHashBySubId.end())
m_assembly.pushSubroutineSize(static_cast<size_t>(_sub));
else
if (auto it = m_dataHashBySubId.find(_subPath[0]); it != m_dataHashBySubId.end())
{
yulAssert(_subPath.size() == 1, "");
m_assembly << u256(m_assembly.data(h256(it->second)).size());
return;
}
m_assembly.pushSubroutineSize(m_assembly.encodeSubPath(_subPath));
}
AbstractAssembly::SubID EthAssemblyAdapter::appendData(bytes const& _data)