From 264098c85fa326bcc5c88cd4ccd7628980a58c14 Mon Sep 17 00:00:00 2001 From: Ivan Inozemtsev Date: Fri, 17 Apr 2026 06:10:08 -0700 Subject: [PATCH] Revert "[kernel/cfe/etc] Split outline transformation into performOutlineTransformations and performOutlineComponentOperations" This reverts commit b3d9c8a297df573596d1ac3999a06fa1ad52ed93. Reason for revert: b/503506653 Original change's description: > [kernel/cfe/etc] Split outline transformation into performOutlineTransformations and performOutlineComponentOperations > > Currently outline transformations aren't run via the incremental > compiler which causes problems in > https://dart-review.googlesource.com/c/sdk/+/491702 which fixes it by > calling the current transformation in the incremental compiler. This > calls it twice though (because it's run again in > `frontend_server/lib/compute_kernel.dart`, but removing it there doesn't > work because a filtering is done which doesn't apply through the > incremental compiler. > > This CL splits up the outline transformation stage into a call that can > actually transform the libraries and one that can do the filtering, > which should fix the issue. > > Change-Id: I5ae3477ebfe580dca372ea792924cdfb79979b35 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/495700 > Commit-Queue: Jens Johansen > Reviewed-by: Johnni Winther Change-Id: I961a7d2e09f64f4b2e4dc9e45e1f3572f3f2cdeb Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/496260 Reviewed-by: Johnni Winther Auto-Submit: Ivan Inozemtsev Reviewed-by: Jens Johansen Bot-Commit: rubber-stamper@appspot.gserviceaccount.com Commit-Queue: Jens Johansen --- .../lib/src/base/incremental_compiler.dart | 9 ------- .../lib/src/kernel_generator_impl.dart | 1 - pkg/frontend_server/lib/compute_kernel.dart | 1 + pkg/kernel/lib/target/targets.dart | 26 ++++--------------- 4 files changed, 6 insertions(+), 31 deletions(-) diff --git a/pkg/front_end/lib/src/base/incremental_compiler.dart b/pkg/front_end/lib/src/base/incremental_compiler.dart index 3588a98ad91..d995a1e4b01 100644 --- a/pkg/front_end/lib/src/base/incremental_compiler.dart +++ b/pkg/front_end/lib/src/base/incremental_compiler.dart @@ -441,10 +441,6 @@ class IncrementalCompiler implements IncrementalKernelGenerator { ); componentWithDill = buildResult.component; } - // Coverage-ignore(suite): Not run. - else if (componentWithDill != null) { - context.options.target.performOutlineTransformations(componentWithDill); - } _benchmarker // Coverage-ignore(suite): Not run. @@ -582,11 +578,6 @@ class IncrementalCompiler implements IncrementalKernelGenerator { // about other libraries. result.metadata.addAll(componentWithDill.metadata); - if (outlineOnly) { - // Coverage-ignore-block(suite): Not run. - context.options.target.performOutlineComponentOperations(result); - } - // We're now done. Allow any waiting compile to start. Completer currentlyCompilingLocal = _currentlyCompiling!; _currentlyCompiling = null; diff --git a/pkg/front_end/lib/src/kernel_generator_impl.dart b/pkg/front_end/lib/src/kernel_generator_impl.dart index 4ee685413fe..394619f7015 100644 --- a/pkg/front_end/lib/src/kernel_generator_impl.dart +++ b/pkg/front_end/lib/src/kernel_generator_impl.dart @@ -224,7 +224,6 @@ Future _buildInternal( // the only need we have for these transformations). if (!buildComponent) { options.target.performOutlineTransformations(trimmedSummaryComponent); - options.target.performOutlineComponentOperations(trimmedSummaryComponent); options.ticker.logMs("Transformed outline"); } if (serializeIfBuildingSummary) { diff --git a/pkg/frontend_server/lib/compute_kernel.dart b/pkg/frontend_server/lib/compute_kernel.dart index e0a7972dcbc..8aca0e1d9b5 100644 --- a/pkg/frontend_server/lib/compute_kernel.dart +++ b/pkg/frontend_server/lib/compute_kernel.dart @@ -483,6 +483,7 @@ Future computeKernel( incrementalComponent.uriToSource.clear(); incrementalComponent.problemsAsJson = null; incrementalComponent.setMainMethodAndMode(null, true); + target.performOutlineTransformations(incrementalComponent); makeStable(incrementalComponent); return new Future.value( fe.serializeComponent( diff --git a/pkg/kernel/lib/target/targets.dart b/pkg/kernel/lib/target/targets.dart index 62ba79613fd..ce2b72727cc 100644 --- a/pkg/kernel/lib/target/targets.dart +++ b/pkg/kernel/lib/target/targets.dart @@ -334,24 +334,13 @@ abstract class Target { /// Perform target-specific transformations on the outlines stored in /// [Component] when generating summaries. /// - /// This is used to transforming the libraries, but not for instance - /// filtering the output libraries or adding metadata. Do this in - /// [performOutlineComponentOperations] instead. - /// This transformation is not applied when compiling full kernel programs to + /// This transformation is used to add metadata on outlines and to filter + /// unnecessary information before generating program summaries. This + /// transformation is not applied when compiling full kernel programs to /// prevent affecting the internal invariants of the compiler and accidentally /// slowing down compilation. void performOutlineTransformations(Component component) {} - /// Perform target-specific operations on the [Component] storing the outlines - /// when generating summaries. - /// - /// This is not for transforming the libraries, but can be used to add - /// metadata and filter libraries. - /// This is not applied when compiling full kernel programs to prevent - /// affecting the internal invariants of the compiler and accidentally - /// slowing down compilation. - void performOutlineComponentOperations(Component component) {} - /// Perform target-specific transformations on the given libraries that must /// run before constant evaluation. void performPreConstantEvaluationTransformations( @@ -1033,11 +1022,6 @@ class TargetWrapper extends Target { _target.performOutlineTransformations(component); } - @override - void performOutlineComponentOperations(Component component) { - _target.performOutlineComponentOperations(component); - } - @override void performPreConstantEvaluationTransformations( Component component, @@ -1116,8 +1100,8 @@ mixin SummaryMixin on Target { bool get excludeNonSources; @override - void performOutlineComponentOperations(Component component) { - super.performOutlineComponentOperations(component); + void performOutlineTransformations(Component component) { + super.performOutlineTransformations(component); if (!excludeNonSources) return; List libraries = new List.of(component.libraries);