Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions dev/core/src/com/google/gwt/dev/MinimalRebuildCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,17 @@
import com.google.gwt.core.ext.linker.StatementRanges;
import com.google.gwt.dev.cfg.ModuleDef;
import com.google.gwt.dev.javac.CompilationUnit;
import com.google.gwt.dev.javac.CompiledClass;
import com.google.gwt.dev.javac.GeneratedUnit;
import com.google.gwt.dev.javac.Shared;
import com.google.gwt.dev.jjs.JsSourceMap;
import com.google.gwt.dev.jjs.ast.JDeclaredType;
import com.google.gwt.dev.jjs.ast.JProgram;
import com.google.gwt.dev.jjs.ast.JTypeOracle;
import com.google.gwt.dev.jjs.ast.JTypeOracle.ImmediateTypeRelations;
import com.google.gwt.dev.jjs.impl.RapidTypeAnalyzer;
import com.google.gwt.dev.jjs.impl.ResolveRuntimeTypeReferences.IntTypeMapper;
import com.google.gwt.dev.js.JsIncrementalNamer.JsIncrementalNamerState;
import com.google.gwt.dev.resource.Resource;
import com.google.gwt.dev.util.Name.InternalName;
import com.google.gwt.thirdparty.guava.common.annotations.VisibleForTesting;
import com.google.gwt.thirdparty.guava.common.base.Objects;
import com.google.gwt.thirdparty.guava.common.base.Predicates;
Expand Down Expand Up @@ -659,14 +658,23 @@
compilationUnitTypeNameByNestedTypeName.put(nestedTypeName, compilationUnitTypeName);
}

public void recordNestedTypeNamesPerType(CompilationUnit compilationUnit) {
public void recordNestedTypeNamesPerType(CompilationUnit compilationUnit, List<JDeclaredType> types) {

Check warning on line 661 in dev/core/src/com/google/gwt/dev/MinimalRebuildCache.java

View workflow job for this annotation

GitHub Actions / build (21)

[checkstyle] reported by reviewdog 🐶 Line is longer than 100 characters (found 104). Raw Output: /home/runner/work/gwt/gwt/gwt/dev/core/src/com/google/gwt/dev/MinimalRebuildCache.java:661:0: warning: Line is longer than 100 characters (found 104). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
// For the root type in the compilation unit the source name and binary name are the same.
String compilationUnitTypeName = compilationUnit.getTypeName();

// Clean up the reverse map for old nested type names, then clear all entries
Collection<String> oldNestedTypeNames = nestedTypeNamesByUnitTypeName.get(compilationUnitTypeName);

Check warning on line 666 in dev/core/src/com/google/gwt/dev/MinimalRebuildCache.java

View workflow job for this annotation

GitHub Actions / build (21)

[checkstyle] reported by reviewdog 🐶 Line is longer than 100 characters (found 103). Raw Output: /home/runner/work/gwt/gwt/gwt/dev/core/src/com/google/gwt/dev/MinimalRebuildCache.java:666:0: warning: Line is longer than 100 characters (found 103). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
for (String oldNestedTypeName : oldNestedTypeNames) {
compilationUnitTypeNameByNestedTypeName.remove(oldNestedTypeName);
}
nestedTypeNamesByUnitTypeName.removeAll(compilationUnitTypeName);
for (CompiledClass compiledClass : compilationUnit.getCompiledClasses()) {
String nestedTypeName = InternalName.toBinaryName(compiledClass.getInternalName());
recordNestedTypeName(compilationUnitTypeName, nestedTypeName);

// Record all GWT types that were derived from that compilation unit
for (JDeclaredType type : types) {
String typeName = type.getName();
if (!nestedTypeNamesByUnitTypeName.containsEntry(compilationUnitTypeName, typeName)) {
recordNestedTypeName(compilationUnitTypeName, typeName);
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion dev/core/src/com/google/gwt/dev/NullRebuildCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
import com.google.gwt.dev.javac.CompilationUnit;
import com.google.gwt.dev.javac.GeneratedUnit;
import com.google.gwt.dev.jjs.JsSourceMap;
import com.google.gwt.dev.jjs.ast.JDeclaredType;
import com.google.gwt.dev.jjs.ast.JTypeOracle;
import com.google.gwt.dev.jjs.impl.ResolveRuntimeTypeReferences.IntTypeMapper;
import com.google.gwt.dev.js.JsIncrementalNamer.JsIncrementalNamerState;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

Expand Down Expand Up @@ -176,7 +178,7 @@
}

@Override
public void recordNestedTypeNamesPerType(CompilationUnit compilationUnit) {
public void recordNestedTypeNamesPerType(CompilationUnit compilationUnit, List<JDeclaredType> types) {

Check warning on line 181 in dev/core/src/com/google/gwt/dev/NullRebuildCache.java

View workflow job for this annotation

GitHub Actions / build (21)

[checkstyle] reported by reviewdog 🐶 Line is longer than 100 characters (found 104). Raw Output: /home/runner/work/gwt/gwt/gwt/dev/core/src/com/google/gwt/dev/NullRebuildCache.java:181:0: warning: Line is longer than 100 characters (found 104). (com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck)
}

@Override
Expand Down
9 changes: 4 additions & 5 deletions dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -1943,11 +1943,10 @@ public void endVisit(ReferenceExpression x, BlockScope blockScope) {
JMethod referredMethod = typeMap.get(referredMethodBinding);
boolean hasQualifier = hasQualifier(x);

// Constructors, overloading and generics means that the safest approach is to consider
// each different member reference as a different lambda implementation.
String lambdaImplementationClassShortName =
String.valueOf(nextReferenceExpressionId++) + "methodref$"
+ (x.binding.isConstructor() ? "ctor" : String.valueOf(x.binding.selector));
// Give the methodref synthetic class a unique, consistent name. JDT names both lambdas and
// method references as "lambda$N" for the Nth lambda in the enclosing type - we add the
// string "methodref" instead to make it somewhat clearer which impl we're referencing.
String lambdaImplementationClassShortName = "methodref$" + nextReferenceExpressionId++;
List<JExpression> enclosingThisRefs = Lists.newArrayList();

// Create an inner class to hold the implementation of the interface
Expand Down
6 changes: 3 additions & 3 deletions dev/core/src/com/google/gwt/dev/jjs/impl/UnifyAst.java
Original file line number Diff line number Diff line change
Expand Up @@ -1030,11 +1030,11 @@ private void assimilateSourceUnit(CompilationUnit unit, boolean reportErrors) {
}
// Staleness calculations need to be able to trace from CompilationUnit name to the names of
// immediately nested types. So record those associations now.
if (incrementalCompile) {
compilerContext.getMinimalRebuildCache().recordNestedTypeNamesPerType(unit);
}
// TODO(zundel): ask for a recompile if deserialization fails?
List<JDeclaredType> types = unit.getTypes();
if (incrementalCompile) {
compilerContext.getMinimalRebuildCache().recordNestedTypeNamesPerType(unit, types);
}
Comment on lines +1035 to +1037

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change lets us only deserialize the set of GWT types once. This is the only call to CompilationUnit.getTypes() and also the only call to recordNestedTypeNamesPerType.

assert containsAllTypes(unit, types);
for (JDeclaredType type : types) {
program.addType(type);
Expand Down
Loading