mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Avoid generation of too deeply nested expressions to fit into v8 parser stack
This commit is contained in:
parent
174ac9e725
commit
365e47882a
|
@ -64,6 +64,7 @@ import org.teavm.ast.WhileStatement;
|
||||||
import org.teavm.model.TextLocation;
|
import org.teavm.model.TextLocation;
|
||||||
|
|
||||||
class OptimizingVisitor implements StatementVisitor, ExprVisitor {
|
class OptimizingVisitor implements StatementVisitor, ExprVisitor {
|
||||||
|
private static final int MAX_DEPTH = 20;
|
||||||
private Expr resultExpr;
|
private Expr resultExpr;
|
||||||
Statement resultStmt;
|
Statement resultStmt;
|
||||||
private final boolean[] preservedVars;
|
private final boolean[] preservedVars;
|
||||||
|
@ -286,6 +287,9 @@ class OptimizingVisitor implements StatementVisitor, ExprVisitor {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (locationStack.size() > MAX_DEPTH) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (readFrequencies[index] != 1 || preservedVars[index]) {
|
if (readFrequencies[index] != 1 || preservedVars[index]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user