mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Merge branch 'master' into better-async
Conflicts: teavm-core/src/main/java/org/teavm/javascript/Decompiler.java teavm-core/src/main/java/org/teavm/javascript/Optimizer.java
This commit is contained in:
commit
4ab4035522
|
@ -212,7 +212,7 @@ public class Decompiler {
|
||||||
node.getVariables().add(program.variableAt(i).getRegister());
|
node.getVariables().add(program.variableAt(i).getRegister());
|
||||||
}
|
}
|
||||||
Optimizer optimizer = new Optimizer();
|
Optimizer optimizer = new Optimizer();
|
||||||
optimizer.optimize(node, program);
|
optimizer.optimize(node, splitter);
|
||||||
node.getModifiers().addAll(mapModifiers(method.getModifiers()));
|
node.getModifiers().addAll(mapModifiers(method.getModifiers()));
|
||||||
int paramCount = Math.min(method.getSignature().length, program.variableCount());
|
int paramCount = Math.min(method.getSignature().length, program.variableCount());
|
||||||
for (int i = 0; i < paramCount; ++i) {
|
for (int i = 0; i < paramCount; ++i) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.teavm.javascript.ast.AsyncMethodNode;
|
||||||
import org.teavm.javascript.ast.AsyncMethodPart;
|
import org.teavm.javascript.ast.AsyncMethodPart;
|
||||||
import org.teavm.javascript.ast.RegularMethodNode;
|
import org.teavm.javascript.ast.RegularMethodNode;
|
||||||
import org.teavm.model.Program;
|
import org.teavm.model.Program;
|
||||||
|
import org.teavm.model.util.AsyncProgramSplitter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -42,9 +43,11 @@ public class Optimizer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void optimize(AsyncMethodNode method, Program program) {
|
public void optimize(AsyncMethodNode method, AsyncProgramSplitter splitter) {
|
||||||
ReadWriteStatsBuilder stats = new ReadWriteStatsBuilder(method.getVariables().size());
|
ReadWriteStatsBuilder stats = new ReadWriteStatsBuilder(method.getVariables().size());
|
||||||
stats.analyze(program);
|
for (int i = 0; i < splitter.size(); ++i) {
|
||||||
|
stats.analyze(splitter.getProgram(i));
|
||||||
|
}
|
||||||
for (AsyncMethodPart part : method.getBody()) {
|
for (AsyncMethodPart part : method.getBody()) {
|
||||||
OptimizingVisitor optimizer = new OptimizingVisitor(stats.copy());
|
OptimizingVisitor optimizer = new OptimizingVisitor(stats.copy());
|
||||||
part.getStatement().acceptVisitor(optimizer);
|
part.getStatement().acceptVisitor(optimizer);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user