Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d911d9b

Browse files
committed
Cleanup "libraries" field in DillTarget when their invalidated
Before this CL we removed from from the builders map, but left them in the libraries list. When using the incremental compiler via kernel worker (where we continually replace dill builders) that meant that this list would just keep growing. This CL cleans it up and the builders map and the list should now be in sync An internal benchmark via kernel worker of lots of outline calculations in worker mode with reuse and the incremental compiler goes from ~215 seconds to ~185 seconds. Change-Id: I254558d517f544fe31b5673e0dc8748048f0c5ba Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103630 Reviewed-by: Kevin Millikin <[email protected]>
1 parent eb131c3 commit d911d9b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/front_end/lib/src/fasta/incremental_compiler.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,19 @@ class IncrementalCompiler implements IncrementalKernelGenerator {
220220
notReused: notReusedLibraries);
221221
Set<Uri> reusedLibraryUris =
222222
new Set<Uri>.from(reusedLibraries.map((b) => b.uri));
223+
bool removedBuilders = false;
223224
for (Uri uri in new Set<Uri>.from(dillLoadedData.loader.builders.keys)
224225
..removeAll(reusedLibraryUris)) {
225226
LibraryBuilder builder = dillLoadedData.loader.builders.remove(uri);
226227
userBuilders?.remove(uri);
227228
CompilerContext.current.uriToSource.remove(builder.fileUri);
229+
removedBuilders = true;
230+
}
231+
if (removedBuilders) {
232+
dillLoadedData.loader.libraries.clear();
233+
for (LibraryBuilder builder in dillLoadedData.loader.builders.values) {
234+
dillLoadedData.loader.libraries.add(builder.target);
235+
}
228236
}
229237

230238
if (hasToCheckPackageUris) {

0 commit comments

Comments
 (0)