public class MinimalRebuildCache extends Object implements Serializable
Cached information is specific to a single permutation and it is the responsibility of the framework driving the Compiler to supply the right Cache instance for the right Module configuration and to make sure that the Compiler is only processing one permutation at a time.
All type names referenced here are assumed to be binary names.
A "typeName" here might be a root type or nested type but a "compilationUnitName" here will always be the name of just the root type in a compilation unit.
Modifier and Type | Field and Description |
---|---|
protected JTypeOracle.ImmediateTypeRelations |
immediateTypeRelations |
Constructor and Description |
---|
MinimalRebuildCache() |
Modifier and Type | Method and Description |
---|---|
void |
addGeneratedArtifacts(ArtifactSet generatedArtifacts)
Accumulates generated artifacts so that they can be output on recompiles even if no generators
are run.
|
void |
addModifiedCompilationUnitNames(TreeLogger logger,
Set<String> modifiedCompilationUnitNames) |
void |
addSourceCompilationUnitName(String sourceCompilationUnitName) |
void |
addTypeReference(String fromTypeName,
String toTypeName) |
void |
associateReboundTypeWithGeneratedCompilationUnitName(String reboundTypeName,
String generatedCompilationUnitName) |
void |
associateReboundTypeWithInputResource(String reboundTypeName,
String inputResourcePath)
Record that a Generator that was ran as a result of a GWT.create(ReboundType.class) call read a
particular resource.
|
void |
clearPerTypeJsCache() |
void |
clearRebinderTypeAssociations(String rebinderTypeName) |
void |
clearReboundTypeAssociations(String reboundTypeName) |
Set<String> |
computeAndClearStaleTypesCache(TreeLogger logger,
JTypeOracle typeOracle)
Calculates the set of stale types and clears their cached Js, StatementRanges and SourceMaps.
|
Set<String> |
computeDeletedTypeNames()
Computes and returns the set of names of deleted types.
|
Set<String> |
computeModifiedTypeNames()
Computes and returns the set of names of modified types.
|
Set<String> |
computeReachableTypeNames()
Computes and returns the names of the set of types that are transitively referenceable starting
from the set of root types.
|
void |
copyFrom(MinimalRebuildCache that)
Replaces the contents of this cache with the contents of the given cache.
|
Set<String> |
filterUnreachableTypeNames(Set<String> typeNames)
Return the set of provided typeNames with unreachable types filtered out.
|
ArtifactSet |
getGeneratedArtifacts() |
JTypeOracle.ImmediateTypeRelations |
getImmediateTypeRelations() |
String |
getJs(String typeName) |
int |
getLastLinkedJsBytes() |
Set<String> |
getModifiedCompilationUnitNames() |
JsPersistentPrettyNamer.PersistentPrettyNamerState |
getPersistentPrettyNamerState() |
Set<String> |
getPreambleTypeNames() |
Set<String> |
getProcessedStaleTypeNames()
Returns the set of the names of types that were processed as stale.
|
JsSourceMap |
getSourceMap(String typeName) |
Set<String> |
getStaleTypeNames() |
StatementRanges |
getStatementRanges(String typeName) |
ResolveRuntimeTypeReferences.IntTypeMapper |
getTypeMapper() |
boolean |
hasJs(String typeName) |
boolean |
hasPreambleTypeNames() |
boolean |
isPopulated()
Returns true if there is cached data to reuse in the next recompile.
|
boolean |
isSourceCompilationUnit(String compilationUnitName) |
boolean |
knowsLastLinkedJsBytes() |
void |
markSourceFileStale(String typeName) |
void |
recordBuildResources(ModuleDef module)
Records the resource paths and modification dates of build resources in the current compile and
builds a list of known modified resource paths by comparing the resource paths and modification
dates of build resources in the previous compile with those of the current compile.
|
void |
recordDiskSourceResources(Map<String,Long> currentModifiedByDiskSourcePath)
Records the paths and modification dates of source resources in the current compile and builds
a list of known modified paths by comparing the paths and modification dates of source
resources in the previous compile with those of the current compile.
|
void |
recordDiskSourceResources(ModuleDef module)
Records the paths and modification dates of source resources in the current compile and builds
a list of known modified paths by comparing the paths and modification dates of source
resources in the previous compile with those of the current compile.
|
void |
recordGeneratedUnits(Collection<GeneratedUnit> generatedUnits)
Records the paths and content ids of generated source resources in the current compile and
updates a list of known modified paths by comparing the paths and content ids of generated
source resources in the previous compile with those of the current compile.
|
void |
recordNestedTypeName(String compilationUnitTypeName,
String nestedTypeName) |
void |
recordNestedTypeNamesPerType(CompilationUnit compilationUnit) |
void |
recordRebinderTypeForReboundType(String reboundTypeName,
String rebinderType)
Records that rebinder type Foo contains a GWT.create(ReboundTypeBar.class) call.
|
void |
removeReferencesFrom(String fromTypeName) |
void |
setJsForType(TreeLogger logger,
String typeName,
String typeJs) |
void |
setJsoTypeNames(Set<String> jsoTypeNames,
Set<String> singleJsoImplInterfaceNames,
Set<String> dualJsoImplInterfaceNames)
Records the names of JSO subtypes, single impl interfaces and dual impl interfaces as well as
keeps track of types that entered or left one of the lists in the most recent iteration.
|
void |
setLastLinkedJsBytes(int lastLinkedJsBytes) |
void |
setPreambleTypeNames(TreeLogger logger,
Set<String> preambleTypeNames) |
void |
setProcessedStaleTypeNames(Set<String> processedStaleTypeNames) |
void |
setRootTypeNames(Collection<String> rootTypeNames) |
void |
setSourceMapForType(String typeName,
JsSourceMap sourceMap) |
void |
setStatementRangesForType(String typeName,
StatementRanges statementRanges) |
protected final JTypeOracle.ImmediateTypeRelations immediateTypeRelations
public void addGeneratedArtifacts(ArtifactSet generatedArtifacts)
public void addModifiedCompilationUnitNames(TreeLogger logger, Set<String> modifiedCompilationUnitNames)
public void addSourceCompilationUnitName(String sourceCompilationUnitName)
public void associateReboundTypeWithGeneratedCompilationUnitName(String reboundTypeName, String generatedCompilationUnitName)
public void associateReboundTypeWithInputResource(String reboundTypeName, String inputResourcePath)
public void clearPerTypeJsCache()
public void clearRebinderTypeAssociations(String rebinderTypeName)
public void clearReboundTypeAssociations(String reboundTypeName)
public Set<String> computeAndClearStaleTypesCache(TreeLogger logger, JTypeOracle typeOracle)
The calculation of stale types starts with the list of known modified types and expands that set using various patterns intended to find any types whose output JS would be affected by the changes in the modified types. For example if the parent of class Foo was changed then the castmaps in all children of Foo need to be recreated.
In some ways this process is similar to that performed by the CompilationUnitInvalidator but it differs both in what type of cached objects are being cleared (JS versus CompilationUnits) and in what invalidation rules must be applied. CompilationUnitInvalidator is concerned only with changes in interface while the invalidation here must also look at JSO promotion/demotion and cast references because of the peculiarities of output JS format.
public Set<String> computeDeletedTypeNames()
Deleted types are all those types that are nested within compilation units that are known to have been deleted.
public Set<String> computeModifiedTypeNames()
Modified types are all those types that are nested within compilation units that are known to have been modified.
public Set<String> computeReachableTypeNames()
Should only be called once per compile, so that the "lastReachableTypeNames" list accurately reflects the reachable types of the immediately previous compile.
public void copyFrom(MinimalRebuildCache that)
This operation should be kept fast as it will be called once per compile. At the moment it takes about 2.5% of the time in an incremental recompile. If wanting to recover this time in the future consider parallelizing the copy or grouping the values from hash tables with similar keys into a single data object and hashtable so that fewer references need to be replicated.
public Set<String> filterUnreachableTypeNames(Set<String> typeNames)
public ArtifactSet getGeneratedArtifacts()
public JTypeOracle.ImmediateTypeRelations getImmediateTypeRelations()
public ResolveRuntimeTypeReferences.IntTypeMapper getTypeMapper()
public int getLastLinkedJsBytes()
public JsPersistentPrettyNamer.PersistentPrettyNamerState getPersistentPrettyNamerState()
public Set<String> getProcessedStaleTypeNames()
public JsSourceMap getSourceMap(String typeName)
public StatementRanges getStatementRanges(String typeName)
public boolean hasJs(String typeName)
public boolean hasPreambleTypeNames()
public boolean isPopulated()
public boolean isSourceCompilationUnit(String compilationUnitName)
public boolean knowsLastLinkedJsBytes()
public void markSourceFileStale(String typeName)
public void recordBuildResources(ModuleDef module)
public void recordDiskSourceResources(Map<String,Long> currentModifiedByDiskSourcePath)
public void recordDiskSourceResources(ModuleDef module)
public void recordGeneratedUnits(Collection<GeneratedUnit> generatedUnits)
public void recordNestedTypeName(String compilationUnitTypeName, String nestedTypeName)
public void recordNestedTypeNamesPerType(CompilationUnit compilationUnit)
public void recordRebinderTypeForReboundType(String reboundTypeName, String rebinderType)
public void removeReferencesFrom(String fromTypeName)
public void setJsForType(TreeLogger logger, String typeName, String typeJs)
public void setJsoTypeNames(Set<String> jsoTypeNames, Set<String> singleJsoImplInterfaceNames, Set<String> dualJsoImplInterfaceNames)
public void setLastLinkedJsBytes(int lastLinkedJsBytes)
public void setPreambleTypeNames(TreeLogger logger, Set<String> preambleTypeNames)
public void setProcessedStaleTypeNames(Set<String> processedStaleTypeNames)
public void setRootTypeNames(Collection<String> rootTypeNames)
public void setSourceMapForType(String typeName, JsSourceMap sourceMap)
public void setStatementRangesForType(String typeName, StatementRanges statementRanges)
Copyright © 2018. All rights reserved.