aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-09-20 00:29:43 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-09-26 18:14:40 +0800
commit535026b492bd57eff6a96a4252e5ab32f5711b54 (patch)
tree104495811fb4dd0bdbee7875e81907738e6c5006
parent608f36d77b0dc6d908d89fe3a1b8e1626df8391c (diff)
downloaddexon-solidity-535026b492bd57eff6a96a4252e5ab32f5711b54.tar.gz
dexon-solidity-535026b492bd57eff6a96a4252e5ab32f5711b54.tar.zst
dexon-solidity-535026b492bd57eff6a96a4252e5ab32f5711b54.zip
Group append() functions in libevmasm
-rw-r--r--libevmasm/Assembly.cpp30
-rw-r--r--libevmasm/Assembly.h2
2 files changed, 17 insertions, 15 deletions
diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp
index e49e675d..63452f36 100644
--- a/libevmasm/Assembly.cpp
+++ b/libevmasm/Assembly.cpp
@@ -69,6 +69,21 @@ void Assembly::append(Assembly const& _a, int _deposit)
append(Instruction::POP);
}
+AssemblyItem const& Assembly::append(AssemblyItem const& _i)
+{
+ assertThrow(m_deposit >= 0, AssemblyException, "Stack underflow.");
+ m_deposit += _i.deposit();
+ m_items.push_back(_i);
+ if (m_items.back().location().isEmpty() && !m_currentSourceLocation.isEmpty())
+ m_items.back().setLocation(m_currentSourceLocation);
+ return back();
+}
+
+void Assembly::injectStart(AssemblyItem const& _i)
+{
+ m_items.insert(m_items.begin(), _i);
+}
+
unsigned Assembly::bytesRequired(unsigned subTagSize) const
{
for (unsigned tagSize = subTagSize; true; ++tagSize)
@@ -323,16 +338,6 @@ Json::Value Assembly::assemblyJSON(StringMap const& _sourceCodes) const
return root;
}
-AssemblyItem const& Assembly::append(AssemblyItem const& _i)
-{
- assertThrow(m_deposit >= 0, AssemblyException, "Stack underflow.");
- m_deposit += _i.deposit();
- m_items.push_back(_i);
- if (m_items.back().location().isEmpty() && !m_currentSourceLocation.isEmpty())
- m_items.back().setLocation(m_currentSourceLocation);
- return back();
-}
-
AssemblyItem Assembly::namedTag(string const& _name)
{
assertThrow(!_name.empty(), AssemblyException, "Empty named tag.");
@@ -348,11 +353,6 @@ AssemblyItem Assembly::newPushLibraryAddress(string const& _identifier)
return AssemblyItem(PushLibraryAddress, h);
}
-void Assembly::injectStart(AssemblyItem const& _i)
-{
- m_items.insert(m_items.begin(), _i);
-}
-
Assembly& Assembly::optimise(bool _enable, EVMVersion _evmVersion, bool _isCreation, size_t _runs)
{
OptimiserSettings settings;
diff --git a/libevmasm/Assembly.h b/libevmasm/Assembly.h
index 1ed9b859..9278c929 100644
--- a/libevmasm/Assembly.h
+++ b/libevmasm/Assembly.h
@@ -59,8 +59,10 @@ public:
AssemblyItem newPushSubSize(u256 const& _subId) { return AssemblyItem(PushSubSize, _subId); }
AssemblyItem newPushLibraryAddress(std::string const& _identifier);
+ // These two are only used by liblll
void append(Assembly const& _a);
void append(Assembly const& _a, int _deposit);
+
AssemblyItem const& append(AssemblyItem const& _i);
AssemblyItem const& append(std::string const& _data) { return append(newPushString(_data)); }
AssemblyItem const& append(bytes const& _data) { return append(newData(_data)); }