diff options
author | chriseth <c@ethdev.com> | 2016-11-11 01:16:21 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-11-16 21:37:18 +0800 |
commit | e543bd34c0b4884b5a27555f698f50af6a1c0b81 (patch) | |
tree | ef2c12e4767a3d38603323212face114213ca4b4 /libevmasm/BlockDeduplicator.h | |
parent | ee3efa67a8d3eb4077786fd745c1925a916419f5 (diff) | |
download | dexon-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/BlockDeduplicator.h')
-rw-r--r-- | libevmasm/BlockDeduplicator.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libevmasm/BlockDeduplicator.h b/libevmasm/BlockDeduplicator.h index c48835fd..5ecab7f3 100644 --- a/libevmasm/BlockDeduplicator.h +++ b/libevmasm/BlockDeduplicator.h @@ -23,9 +23,12 @@ #pragma once +#include <libdevcore/Common.h> + #include <cstddef> #include <vector> #include <functional> +#include <map> namespace dev { @@ -45,6 +48,18 @@ public: BlockDeduplicator(AssemblyItems& _items): m_items(_items) {} /// @returns true if something was changed bool deduplicate(); + /// @returns the tags that were replaced. + std::map<u256, u256> const& replacedTags() const { return m_replacedTags; } + + /// Replaces all PushTag operations insied @a _items that match a key in + /// @a _replacements by the respective value. If @a _subID is not -1, only + /// apply the replacement for foreign tags from this sub id. + /// @returns true iff a replacement was performed. + static bool applyTagReplacement( + AssemblyItems& _items, + std::map<u256, u256> const& _replacements, + size_t _subID = size_t(-1) + ); private: /// Iterator that skips tags and skips to the end if (all branches of) the control @@ -70,6 +85,7 @@ private: AssemblyItem const* replaceWith; }; + std::map<u256, u256> m_replacedTags; AssemblyItems& m_items; }; |