Note function entry points.

This commit is contained in:
chriseth
2021-05-04 17:15:13 +02:00
parent faca036837
commit f9c94d7c42
33 changed files with 252 additions and 26 deletions
+12 -2
View File
@@ -35,6 +35,7 @@
#include <iostream>
#include <sstream>
#include <memory>
#include <map>
namespace solidity::evmasm
{
@@ -49,7 +50,7 @@ public:
AssemblyItem newTag() { assertThrow(m_usedTags < 0xffffffff, AssemblyException, ""); return AssemblyItem(Tag, m_usedTags++); }
AssemblyItem newPushTag() { assertThrow(m_usedTags < 0xffffffff, AssemblyException, ""); return AssemblyItem(PushTag, m_usedTags++); }
/// Returns a tag identified by the given name. Creates it if it does not yet exist.
AssemblyItem namedTag(std::string const& _name);
AssemblyItem namedTag(std::string const& _name, size_t _params, size_t _returns, std::optional<uint64_t> _sourceID);
AssemblyItem newData(bytes const& _data) { util::h256 h(util::keccak256(util::asString(_data))); m_data[h] = _data; return AssemblyItem(PushData, h); }
bytes const& data(util::h256 const& _i) const { return m_data.at(_i); }
AssemblyItem newSub(AssemblyPointer const& _sub) { m_subs.push_back(_sub); return AssemblyItem(PushSub, m_subs.size() - 1); }
@@ -184,7 +185,16 @@ private:
protected:
/// 0 is reserved for exception
unsigned m_usedTags = 1;
std::map<std::string, size_t> m_namedTags;
struct NamedTagInfo
{
size_t id;
std::optional<size_t> sourceID;
size_t params;
size_t returns;
};
std::map<std::string, NamedTagInfo> m_namedTags;
AssemblyItems m_items;
std::map<util::h256, bytes> m_data;
/// Data that is appended to the very end of the contract.