-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Defer parsing syntax trees when computing frozen partial solutions #72090
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
Changes from 12 commits
e27bb84
92e8fdb
39dff43
85ba620
0d03232
e3c6c2f
ae90a86
4ec51f6
ac5b220
6c7fdb7
cbd1e58
4e98024
52a13be
6f7d2a4
9db05f5
a16da4e
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 |
|---|---|---|
|
|
@@ -55,11 +55,6 @@ protected CompilationTrackerState( | |
| CompilationWithoutGeneratedDocuments = compilationWithoutGeneratedDocuments; | ||
| GeneratorInfo = generatorInfo; | ||
|
|
||
| // When in the frozen state, all documents must be final. We never want to run generators for frozen | ||
| // states as the point is to be fast (while potentially incomplete). | ||
| if (IsFrozen) | ||
| Contract.ThrowIfFalse(generatorInfo.DocumentsAreFinal); | ||
|
|
||
| #if DEBUG | ||
| // As a sanity check, we should never see the generated trees inside of the compilation that should | ||
| // not have generated trees. | ||
|
|
@@ -96,7 +91,7 @@ private InProgressState( | |
| Compilation compilationWithoutGeneratedDocuments, | ||
| CompilationTrackerGeneratorInfo generatorInfo, | ||
| Compilation? staleCompilationWithGeneratedDocuments, | ||
| ImmutableList<(ProjectState state, CompilationAndGeneratorDriverTranslationAction action)> pendingTranslationSteps) | ||
| ImmutableList<(ProjectState oldState, CompilationAndGeneratorDriverTranslationAction action)> pendingTranslationSteps) | ||
| : base(isFrozen, | ||
| compilationWithoutGeneratedDocuments, | ||
| generatorInfo) | ||
|
|
@@ -113,15 +108,10 @@ public static InProgressState Create( | |
| Compilation compilationWithoutGeneratedDocuments, | ||
| CompilationTrackerGeneratorInfo generatorInfo, | ||
| Compilation? staleCompilationWithGeneratedDocuments, | ||
| ImmutableList<(ProjectState state, CompilationAndGeneratorDriverTranslationAction action)> pendingTranslationSteps) | ||
| ImmutableList<(ProjectState oldState, CompilationAndGeneratorDriverTranslationAction action)> pendingTranslationSteps) | ||
| { | ||
| Contract.ThrowIfTrue(pendingTranslationSteps is null); | ||
|
|
||
| // If we're not frozen, transition back to the non-final state as we def want to rerun generators | ||
| // for either of these non-final states. | ||
| if (!isFrozen) | ||
| generatorInfo = generatorInfo with { DocumentsAreFinal = false }; | ||
|
|
||
| // If we don't have any intermediate projects to process, just initialize our | ||
| // DeclarationState now. We'll pass false for generatedDocumentsAreFinal because this is being called | ||
| // if our referenced projects are changing, so we'll have to rerun to consume changes. | ||
|
|
@@ -175,9 +165,11 @@ private FinalCompilationTrackerState( | |
| UnrootedSymbolSet unrootedSymbolSet) | ||
| : base(isFrozen, compilationWithoutGeneratedDocuments, generatorInfo) | ||
| { | ||
| Contract.ThrowIfFalse(generatorInfo.DocumentsAreFinal); | ||
| Contract.ThrowIfNull(finalCompilationWithGeneratedDocuments); | ||
| HasSuccessfullyLoaded = hasSuccessfullyLoaded; | ||
|
|
||
| // As a policy, all partial-state projects are said to have incomplete references, since the | ||
| // state has no guarantees. | ||
|
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. moved from a different location here, so that we're consistent on what this bit means wrt frozen states. |
||
| HasSuccessfullyLoaded = hasSuccessfullyLoaded && !isFrozen; | ||
CyrusNajmabadi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| FinalCompilationWithGeneratedDocuments = finalCompilationWithGeneratedDocuments; | ||
| UnrootedSymbolSet = unrootedSymbolSet; | ||
|
|
||
|
|
@@ -201,8 +193,6 @@ public static FinalCompilationTrackerState Create( | |
| ProjectId projectId, | ||
| Dictionary<MetadataReference, ProjectId>? metadataReferenceToProjectId) | ||
| { | ||
| Contract.ThrowIfFalse(generatorInfo.DocumentsAreFinal); | ||
|
|
||
| // Keep track of information about symbols from this Compilation. This will help support other APIs | ||
| // the solution exposes that allows the user to map back from symbols to project information. | ||
|
|
||
|
|
@@ -218,6 +208,14 @@ public static FinalCompilationTrackerState Create( | |
| unrootedSymbolSet); | ||
| } | ||
|
|
||
| public FinalCompilationTrackerState WithIsFrozen() | ||
| => new(isFrozen: true, | ||
|
Contributor
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.
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. fair. i can do that.
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. put into: #72111 |
||
| FinalCompilationWithGeneratedDocuments, | ||
| CompilationWithoutGeneratedDocuments, | ||
| HasSuccessfullyLoaded, | ||
| GeneratorInfo, | ||
| UnrootedSymbolSet); | ||
|
|
||
| private static void RecordAssemblySymbols(ProjectId projectId, Compilation compilation, Dictionary<MetadataReference, ProjectId>? metadataReferenceToProjectId) | ||
| { | ||
| RecordSourceOfAssemblySymbol(compilation.Assembly, projectId); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming for consistency.