Throw on too many peephole optimizer iterations.

This commit is contained in:
chriseth 2017-10-16 18:45:21 +02:00 committed by GitHub
parent 7c94e5462a
commit f5e91e4a94

View File

@ -407,8 +407,11 @@ map<u256, u256> Assembly::optimiseInternal(
if (_settings.runPeephole) if (_settings.runPeephole)
{ {
PeepholeOptimiser peepOpt(m_items); PeepholeOptimiser peepOpt(m_items);
while (peepOpt.optimise() && count < 0xffffff) while (peepOpt.optimise())
{
count++; count++;
assertThrow(count < 64000, OptimizerException, "Peephole optimizer seems to be stuck.");
}
} }
// This only modifies PushTags, we have to run again to actually remove code. // This only modifies PushTags, we have to run again to actually remove code.