aboutsummaryrefslogtreecommitdiffstats
path: root/libevmasm/ExpressionClasses.h
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2017-01-06 18:25:02 +0800
committerchriseth <c@ethdev.com>2017-01-13 00:52:26 +0800
commit652d8dab191fcd50ce59b049177ae3281255f309 (patch)
tree27057dd05421c22b29b0f015686e9591d8ced883 /libevmasm/ExpressionClasses.h
parentafad40ac5a259cf60cd2f5c8b31495f3f64f3e8e (diff)
downloaddexon-solidity-652d8dab191fcd50ce59b049177ae3281255f309.tar.gz
dexon-solidity-652d8dab191fcd50ce59b049177ae3281255f309.tar.zst
dexon-solidity-652d8dab191fcd50ce59b049177ae3281255f309.zip
Optimize pattern matcher.
Diffstat (limited to 'libevmasm/ExpressionClasses.h')
-rw-r--r--libevmasm/ExpressionClasses.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/libevmasm/ExpressionClasses.h b/libevmasm/ExpressionClasses.h
index 11a698dd..c91b227f 100644
--- a/libevmasm/ExpressionClasses.h
+++ b/libevmasm/ExpressionClasses.h
@@ -135,7 +135,7 @@ public:
// Matches a specific constant value.
Pattern(unsigned _value): Pattern(u256(_value)) {}
// Matches a specific constant value.
- Pattern(u256 const& _value): m_type(Push), m_requireDataMatch(true), m_data(_value) {}
+ Pattern(u256 const& _value): m_type(Push), m_requireDataMatch(true), m_data(std::make_shared<u256>(_value)) {}
// Matches a specific assembly item type or anything if not given.
Pattern(AssemblyItemType _type = UndefinedItem): m_type(_type) {}
// Matches a given instruction with given arguments
@@ -160,10 +160,12 @@ public:
private:
bool matchesBaseItem(AssemblyItem const* _item) const;
Expression const& matchGroupValue() const;
+ u256 const& data() const;
AssemblyItemType m_type;
bool m_requireDataMatch = false;
- u256 m_data = 0;
+ Instruction m_instruction; ///< Only valid if m_type is Operation
+ std::shared_ptr<u256> m_data; ///< Only valid if m_type is not Operation
std::vector<Pattern> m_arguments;
unsigned m_matchGroup = 0;
std::map<unsigned, Expression const*>* m_matchGroups = nullptr;