mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-09 00:14:10 -08:00
Fixes bug that caused TeaVM compiler to freeze when compiling a certain
bytecode sequence
This commit is contained in:
parent
99c9617834
commit
25f4ad4b45
|
@ -381,16 +381,18 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
|
||||||
cond.getConsequent().addAll(innerCond.getConsequent());
|
cond.getConsequent().addAll(innerCond.getConsequent());
|
||||||
cond.setCondition(Expr.binary(BinaryOperation.AND, cond.getCondition(),
|
cond.setCondition(Expr.binary(BinaryOperation.AND, cond.getCondition(),
|
||||||
innerCond.getCondition()));
|
innerCond.getCondition()));
|
||||||
} else {
|
--i;
|
||||||
|
} else if (cond.getAlternative().size() != 1 ||
|
||||||
|
!(cond.getAlternative().get(0) instanceof ConditionalStatement)) {
|
||||||
cond.setCondition(ExprOptimizer.invert(cond.getCondition()));
|
cond.setCondition(ExprOptimizer.invert(cond.getCondition()));
|
||||||
cond.getConsequent().clear();
|
cond.getConsequent().clear();
|
||||||
cond.getConsequent().addAll(cond.getAlternative());
|
cond.getConsequent().addAll(cond.getAlternative());
|
||||||
cond.getAlternative().clear();
|
cond.getAlternative().clear();
|
||||||
cond.getAlternative().add(innerCond);
|
cond.getAlternative().add(innerCond);
|
||||||
}
|
|
||||||
--i;
|
--i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (stmt instanceof BlockStatement) {
|
} else if (stmt instanceof BlockStatement) {
|
||||||
BlockStatement nestedBlock = (BlockStatement)stmt;
|
BlockStatement nestedBlock = (BlockStatement)stmt;
|
||||||
eliminateRedundantBreaks(nestedBlock.getBody(), nestedBlock);
|
eliminateRedundantBreaks(nestedBlock.getBody(), nestedBlock);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user