aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-04-27 18:29:26 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-04-27 21:06:58 +0800
commit0e91b8fb98ee942aeb668ef5ff1c6e40c52a7a2e (patch)
tree83b9f40233e3a5294b9076ebc137d49169c47ef0
parentc1e14d0119910ff7edc4fc749b1190ad910a842f (diff)
downloaddexon-solidity-0e91b8fb98ee942aeb668ef5ff1c6e40c52a7a2e.tar
dexon-solidity-0e91b8fb98ee942aeb668ef5ff1c6e40c52a7a2e.tar.gz
dexon-solidity-0e91b8fb98ee942aeb668ef5ff1c6e40c52a7a2e.tar.bz2
dexon-solidity-0e91b8fb98ee942aeb668ef5ff1c6e40c52a7a2e.tar.lz
dexon-solidity-0e91b8fb98ee942aeb668ef5ff1c6e40c52a7a2e.tar.xz
dexon-solidity-0e91b8fb98ee942aeb668ef5ff1c6e40c52a7a2e.tar.zst
dexon-solidity-0e91b8fb98ee942aeb668ef5ff1c6e40c52a7a2e.zip
Do not use the member in checkRepresentation
-rw-r--r--libevmasm/ConstantOptimiser.cpp4
-rw-r--r--libevmasm/ConstantOptimiser.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/libevmasm/ConstantOptimiser.cpp b/libevmasm/ConstantOptimiser.cpp
index c1d61b88..d2ed4faf 100644
--- a/libevmasm/ConstantOptimiser.cpp
+++ b/libevmasm/ConstantOptimiser.cpp
@@ -232,11 +232,11 @@ AssemblyItems ComputeMethod::findRepresentation(u256 const& _value)
}
}
-bool ComputeMethod::checkRepresentation(u256 const& _value)
+bool ComputeMethod::checkRepresentation(u256 const& _value, AssemblyItems const& _routine)
{
// This is a tiny EVM that can only evaluate some instructions.
vector<u256> stack;
- for (AssemblyItem const& item: m_routine)
+ for (AssemblyItem const& item: _routine)
{
switch (item.type())
{
diff --git a/libevmasm/ConstantOptimiser.h b/libevmasm/ConstantOptimiser.h
index 2c112b2b..85bdabac 100644
--- a/libevmasm/ConstantOptimiser.h
+++ b/libevmasm/ConstantOptimiser.h
@@ -135,7 +135,7 @@ public:
{
m_routine = findRepresentation(m_value);
assertThrow(
- checkRepresentation(m_value),
+ checkRepresentation(m_value, m_routine),
OptimizerException,
"Invalid constant expression created."
);
@@ -151,7 +151,7 @@ protected:
/// Tries to recursively find a way to compute @a _value.
AssemblyItems findRepresentation(u256 const& _value);
/// Recomputes the value from the calculated representation and checks for correctness.
- bool checkRepresentation(u256 const& _value);
+ bool checkRepresentation(u256 const& _value, AssemblyItems const& _routine);
bigint gasNeeded(AssemblyItems const& _routine);
/// Counter for the complexity of optimization, will stop when it reaches zero.