Temporarily switch off expression wielding optimization in async

methods.
This commit is contained in:
Alexey Andreev 2015-02-03 11:56:17 +04:00
parent b36c10760c
commit 8a11239436
2 changed files with 8 additions and 3 deletions

View File

@ -202,17 +202,19 @@ public class Decompiler {
AsyncMethodNode node = new AsyncMethodNode(method.getReference());
AsyncProgramSplitter splitter = new AsyncProgramSplitter(asyncMethods);
splitter.split(method.getProgram());
List<Program> partPrograms = new ArrayList<>();
for (int i = 0; i < splitter.size(); ++i) {
AsyncMethodPart part = getRegularMethodStatement(splitter.getProgram(i), splitter.getBlockSuccessors(i));
part.setInputVariable(splitter.getInput(i));
node.getBody().add(part);
partPrograms.add(splitter.getProgram(i));
}
Program program = method.getProgram();
for (int i = 0; i < program.variableCount(); ++i) {
node.getVariables().add(program.variableAt(i).getRegister());
}
Optimizer optimizer = new Optimizer();
optimizer.optimize(node, method.getProgram());
optimizer.optimize(node, partPrograms);
node.getModifiers().addAll(mapModifiers(method.getModifiers()));
int paramCount = Math.min(method.getSignature().length, program.variableCount());
for (int i = 0; i < paramCount; ++i) {

View File

@ -15,6 +15,7 @@
*/
package org.teavm.javascript;
import java.util.List;
import org.teavm.javascript.ast.AsyncMethodNode;
import org.teavm.javascript.ast.AsyncMethodPart;
import org.teavm.javascript.ast.RegularMethodNode;
@ -43,9 +44,11 @@ public class Optimizer {
}
}
public void optimize(AsyncMethodNode method, Program program) {
public void optimize(AsyncMethodNode method, List<Program> programs) {
ReadWriteStatsBuilder stats = new ReadWriteStatsBuilder(method.getVariables().size());
stats.analyze(program);
for (Program program : programs) {
stats.analyze(program);
}
OptimizingVisitor optimizer = new OptimizingVisitor(stats);
for (AsyncMethodPart part : method.getBody()) {
part.getStatement().acceptVisitor(optimizer);