aboutsummaryrefslogtreecommitdiffstats
path: root/libjulia/optimiser/SimplificationRules.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-09-18 21:39:46 +0800
committerGitHub <noreply@github.com>2018-09-18 21:39:46 +0800
commit4b656420ac84eb5c8c752d125fcd282612476b07 (patch)
treebd440467d4d2f4d2c275b47f51057933cac2aaef /libjulia/optimiser/SimplificationRules.cpp
parent06ffcd0502c1c06788bec9b1e1e4db3f7c42ed4d (diff)
parenta1d73a7befd2f3d72c18d4cb539edab5111c681f (diff)
downloaddexon-solidity-4b656420ac84eb5c8c752d125fcd282612476b07.tar.gz
dexon-solidity-4b656420ac84eb5c8c752d125fcd282612476b07.tar.zst
dexon-solidity-4b656420ac84eb5c8c752d125fcd282612476b07.zip
Merge pull request #4983 from ethereum/optimizerEmscriptenBug
Fix weird Optimizer Emscripten Bug
Diffstat (limited to 'libjulia/optimiser/SimplificationRules.cpp')
-rw-r--r--libjulia/optimiser/SimplificationRules.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/libjulia/optimiser/SimplificationRules.cpp b/libjulia/optimiser/SimplificationRules.cpp
index a5e296c3..56cb96ac 100644
--- a/libjulia/optimiser/SimplificationRules.cpp
+++ b/libjulia/optimiser/SimplificationRules.cpp
@@ -40,6 +40,7 @@ SimplificationRule<Pattern> const* SimplificationRules::findFirstMatch(Expressio
return nullptr;
static SimplificationRules rules;
+ assertThrow(rules.isInitialized(), OptimizerException, "Rule list not properly initialized.");
FunctionalInstruction const& instruction = boost::get<FunctionalInstruction>(_expr);
for (auto const& rule: rules.m_rules[byte(instruction.instruction)])
@@ -51,6 +52,11 @@ SimplificationRule<Pattern> const* SimplificationRules::findFirstMatch(Expressio
return nullptr;
}
+bool SimplificationRules::isInitialized() const
+{
+ return !m_rules[byte(solidity::Instruction::ADD)].empty();
+}
+
void SimplificationRules::addRules(vector<SimplificationRule<Pattern>> const& _rules)
{
for (auto const& r: _rules)
@@ -79,6 +85,7 @@ SimplificationRules::SimplificationRules()
Y.setMatchGroup(5, m_matchGroups);
addRules(simplificationRuleList(A, B, C, X, Y));
+ assertThrow(isInitialized(), OptimizerException, "Rule list not properly initialized.");
}
Pattern::Pattern(solidity::Instruction _instruction, vector<Pattern> const& _arguments):