aboutsummaryrefslogtreecommitdiffstats
path: root/libevmasm/AssemblyItem.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-11-11 01:16:21 +0800
committerchriseth <c@ethdev.com>2016-11-16 21:37:18 +0800
commite543bd34c0b4884b5a27555f698f50af6a1c0b81 (patch)
treeef2c12e4767a3d38603323212face114213ca4b4 /libevmasm/AssemblyItem.cpp
parentee3efa67a8d3eb4077786fd745c1925a916419f5 (diff)
downloaddexon-solidity-e543bd34c0b4884b5a27555f698f50af6a1c0b81.tar.gz
dexon-solidity-e543bd34c0b4884b5a27555f698f50af6a1c0b81.tar.zst
dexon-solidity-e543bd34c0b4884b5a27555f698f50af6a1c0b81.zip
Stored combined creation and runtime tags.
Includes a change to Assembly to allow tags from sub-assemblies to be used. Sorry, this get a bit bigger than I thought.
Diffstat (limited to 'libevmasm/AssemblyItem.cpp')
-rw-r--r--libevmasm/AssemblyItem.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/libevmasm/AssemblyItem.cpp b/libevmasm/AssemblyItem.cpp
index 599ded85..2eae20af 100644
--- a/libevmasm/AssemblyItem.cpp
+++ b/libevmasm/AssemblyItem.cpp
@@ -26,6 +26,29 @@ using namespace std;
using namespace dev;
using namespace dev::eth;
+AssemblyItem AssemblyItem::toSubAssemblyTag(size_t _subId) const
+{
+ assertThrow(m_data < (u256(1) << 64), Exception, "Tag already has subassembly set.");
+
+ assertThrow(m_type == PushTag || m_type == Tag, Exception, "");
+ AssemblyItem r = *this;
+ r.m_type = PushTag;
+ r.setPushTagSubIdAndTag(_subId, size_t(m_data));
+ return r;
+}
+
+pair<size_t, size_t> AssemblyItem::splitForeignPushTag() const
+{
+ assertThrow(m_type == PushTag || m_type == Tag, Exception, "");
+ return make_pair(size_t(m_data / (u256(1) << 64)) - 1, size_t(m_data));
+}
+
+void AssemblyItem::setPushTagSubIdAndTag(size_t _subId, size_t _tag)
+{
+ assertThrow(m_type == PushTag || m_type == Tag, Exception, "");
+ setData(_tag + ((u256(_subId) + 1) << 64));
+}
+
unsigned AssemblyItem::bytesRequired(unsigned _addressLength) const
{
switch (m_type)