, Object> services = new HashMap<>();
private Properties properties = new Properties();
private DebugInformationEmitter debugEmitter;
+ private RegularMethodNodeCache astCache = new EmptyRegularMethodNodeCache();
+ private boolean incremental;
TeaVM(ClassReaderSource classSource, ClassLoader classLoader) {
this.classSource = classSource;
@@ -164,6 +164,22 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
return new Properties(properties);
}
+ public RegularMethodNodeCache getAstCache() {
+ return astCache;
+ }
+
+ public void setAstCache(RegularMethodNodeCache methodAstCache) {
+ this.astCache = methodAstCache;
+ }
+
+ public boolean isIncremental() {
+ return incremental;
+ }
+
+ public void setIncremental(boolean incremental) {
+ this.incremental = incremental;
+ }
+
/**
* Adds an entry point. TeaVM guarantees, that all methods that are required by the entry point
* will be available at run-time in browser. Also you need to specify for each parameter of entry point
@@ -314,7 +330,9 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
ListableClassHolderSource classSet = linker.link(dependencyChecker);
// Optimize and allocate registers
- devirtualize(classSet, dependencyChecker);
+ if (!incremental) {
+ devirtualize(classSet, dependencyChecker);
+ }
ClassSetOptimizer optimizer = new ClassSetOptimizer();
optimizer.optimizeAll(classSet);
allocateRegisters(classSet);
@@ -328,6 +346,7 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
// Decompile
Decompiler decompiler = new Decompiler(classSet, classLoader);
+ decompiler.setRegularMethodCache(incremental ? astCache : null);
for (Map.Entry entry : methodGenerators.entrySet()) {
decompiler.addGenerator(entry.getKey(), entry.getValue());
}
diff --git a/teavm-maven-plugin/src/main/java/org/teavm/maven/BuildJavascriptTestMojo.java b/teavm-maven-plugin/src/main/java/org/teavm/maven/BuildJavascriptTestMojo.java
index 6702cc11c..bc8117e40 100644
--- a/teavm-maven-plugin/src/main/java/org/teavm/maven/BuildJavascriptTestMojo.java
+++ b/teavm-maven-plugin/src/main/java/org/teavm/maven/BuildJavascriptTestMojo.java
@@ -89,6 +89,9 @@ public class BuildJavascriptTestMojo extends AbstractMojo {
@Parameter
private Properties properties;
+ @Parameter
+ private boolean incremental;
+
private TeaVMTestTool tool = new TeaVMTestTool();
public void setProject(MavenProject project) {
@@ -135,6 +138,10 @@ public class BuildJavascriptTestMojo extends AbstractMojo {
this.properties = properties;
}
+ public void setIncremental(boolean incremental) {
+ this.incremental = incremental;
+ }
+
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (System.getProperty("maven.test.skip", "false").equals("true") ||