From 7a109a6f484f01e4cb59d4c89d10e65ed51bcbf3 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Wed, 11 Mar 2015 11:32:49 +0400 Subject: [PATCH] See https://github.com/konsoletyper/teavm/issues/85 --- teavm-core/src/main/java/org/teavm/javascript/Decompiler.java | 2 +- teavm-core/src/main/java/org/teavm/javascript/Optimizer.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/teavm-core/src/main/java/org/teavm/javascript/Decompiler.java b/teavm-core/src/main/java/org/teavm/javascript/Decompiler.java index 33d3c3311..59845bef8 100644 --- a/teavm-core/src/main/java/org/teavm/javascript/Decompiler.java +++ b/teavm-core/src/main/java/org/teavm/javascript/Decompiler.java @@ -219,7 +219,7 @@ public class Decompiler { node.getVariables().add(program.variableAt(i).getRegister()); } Optimizer optimizer = new Optimizer(); - optimizer.optimize(node, program, splitter); + optimizer.optimize(node, splitter); node.getModifiers().addAll(mapModifiers(method.getModifiers())); int paramCount = Math.min(method.getSignature().length, program.variableCount()); for (int i = 0; i < paramCount; ++i) { diff --git a/teavm-core/src/main/java/org/teavm/javascript/Optimizer.java b/teavm-core/src/main/java/org/teavm/javascript/Optimizer.java index f69803a48..8b33e82a7 100644 --- a/teavm-core/src/main/java/org/teavm/javascript/Optimizer.java +++ b/teavm-core/src/main/java/org/teavm/javascript/Optimizer.java @@ -43,10 +43,10 @@ public class Optimizer { } } - public void optimize(AsyncMethodNode method, Program program, AsyncProgramSplitter splitter) { + public void optimize(AsyncMethodNode method, AsyncProgramSplitter splitter) { ReadWriteStatsBuilder stats = new ReadWriteStatsBuilder(method.getVariables().size()); - stats.analyze(program); for (int i = 0; i < splitter.size(); ++i) { + stats.analyze(splitter.getProgram(i)); Integer var = splitter.getInput(i); if (var != null) { stats.reads[var]++;