aboutsummaryrefslogtreecommitdiffstats
path: root/libevmasm/Assembly.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-10-17 00:45:21 +0800
committerGitHub <noreply@github.com>2017-10-17 00:45:21 +0800
commitf5e91e4a94b01daf2bbde637abef1796f063c348 (patch)
tree9c987c533bc9f9dbe68ad1a13bc7cb5352cbd737 /libevmasm/Assembly.cpp
parent7c94e5462abb327016520b896178de41bea473c2 (diff)
downloaddexon-solidity-f5e91e4a94b01daf2bbde637abef1796f063c348.tar.gz
dexon-solidity-f5e91e4a94b01daf2bbde637abef1796f063c348.tar.zst
dexon-solidity-f5e91e4a94b01daf2bbde637abef1796f063c348.zip
Throw on too many peephole optimizer iterations.
Diffstat (limited to 'libevmasm/Assembly.cpp')
-rw-r--r--libevmasm/Assembly.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp
index 37c4fb22..5fab24e1 100644
--- a/libevmasm/Assembly.cpp
+++ b/libevmasm/Assembly.cpp
@@ -407,8 +407,11 @@ map<u256, u256> Assembly::optimiseInternal(
if (_settings.runPeephole)
{
PeepholeOptimiser peepOpt(m_items);
- while (peepOpt.optimise() && count < 0xffffff)
+ while (peepOpt.optimise())
+ {
count++;
+ assertThrow(count < 64000, OptimizerException, "Peephole optimizer seems to be stuck.");
+ }
}
// This only modifies PushTags, we have to run again to actually remove code.