-
Notifications
You must be signed in to change notification settings - Fork 396
Improve incremental tracking of method references and lambdas #10323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 13 commits
e38eff2
6b36fe1
d257f0b
0e03397
f68e402
078ba41
2084b4f
0caa428
c8dbe6b
3eb24f2
66b50c6
1a3f0d7
951e95a
4c65db8
036250a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
|
|
@@ -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
|
||
| // 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
|
||
| 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); | ||
| } | ||
|
niloc132 marked this conversation as resolved.
Outdated
|
||
| } | ||
| } | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. THis pair of loops could probably be more efficient if we didn't remove-all and add-all, but just looked for the actual added/removed changes. GWT UI classes tend to have lambdas, anon inner classes, so this usually isn't a very short list, but it probably isn't long enough to really matter - but its also pretty likely most of the classes that were present last time are still there. |
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.